You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

151 lines
4.9 KiB
JavaScript

let commands = [
{
name: "unknown",
output:[
{color: "white", content: "\nthe command you entered is undefined!\n\n", delay: 100},
{
color: "white",
content:
"try something like:\n" +
"\n" +
" - Mastodon > social\n" +
" - Gitea > git\n" +
" - Matrix > element\n" +
" - Etherpad > ether\n" +
" - short url > surl\n" +
" - Jitsi > meet\n",
delay: 200
},
]
},
{
name: "welcome",
output:[
{color: "white", content: "\nWelcome to:\n", delay: 100},
{
color: "green",
content:
" __ __\n" +
" /\\ \\ /\\ \\__\n" +
" ____ __ \\_\\ \\____ _____ ____ \\ \\ _\\ ____ __ __ __ ______\n" +
" / ___\\\\ \\/\\ \\\\ __ \\\\ __\\/ __ \\ \\ \\ \\/ / __ \\\\ \\/\\ \\/\\ \\\\ __ \\\n" +
"/\\ \\__/ \\ \\_\\ \\\\ \\_\\ \\\\ \\_/\\ __/ __\\ \\ \\_\\ \\_\\ \\\\ \\/ \\/ / \\ \\/\\ \\\n" +
"\\ \\____\\ \\____ \\\\____/ \\_\\\\ \\____\\/\\_\\\\ \\__\\\\____/ \\__/\\__/ \\ \\_\\ \\_\\\n" +
" \\/____/\\/___/\\ \\___/ \\/_/ \\/____/\\/_/ \\/__//___/ \\/_/\\/_/ \\/_/\\/_/\n" +
" /\\___/\n" +
" \\/__/ @adb.sh\n\n",
delay: 300
},
{
color: "white",
content:
"free services on this server:\n" +
"\n" +
" - Mastodon > social\n" +
" - Gitea > git\n" +
" - Matrix > element\n" +
" - Etherpad > ether\n" +
" - short url > surl\n" +
" - Jitsi > meet\n",
delay: 500
}
]
},
{
name: ["ls", "la", "list"],
output:[
{color: "white", content: "social ", delay: 100},
{color: "white", content: "git ", delay: 200},
{color: "white", content: "element ", delay: 300},
{color: "white", content: "ether ", delay: 350},
{color: "white", content: "surl ", delay: 400},
{color: "white", content: "meet", delay: 500},
]
},
{
name: ["social", "mastodon", "Mastodon", "mstdn"],
output:[
{color: "blue", content: "\nMastodon", delay: 100},
{color: "white", content: " is loading\n", delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://social.cybre.town", delay: 600}
]
},
{
name: ["git", "gitea", "Gitea"],
output:[
{color: "blue", content: "\nGitea", delay: 100},
{color: "white", content: " is loading\n", delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://git.adb.sh", delay: 600}
]
},
{
name: ["matrix", "Matrix", "element", "Element"],
output:[
{color: "blue", content: "\nmatrix", delay: 100},
{color: "white", content: " is loading\n", delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://element.adb.sh", delay: 600}
]
},
{
name: ["ether", "etherpad", "Etherpad"],
output:[
{color: "blue", content: "\nEtherpad", delay: 100},
{color: "white", content: " is loading\n", delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://ether.adb.sh", delay: 600}
]
},
{
name: ["surl", "short-url", "shortURL"],
output:[
{color: "blue", content: "\ngit", delay: 100},
{color: "white", content: " is loading\n", delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://s.adb.sh", delay: 600}
]
},
{
name: ["meet", "jitsi", "Jitsi"],
output:[
{color: "blue", content: "\nJitsi", delay: 100},
{color: "white", content: " is loading\n", delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://meet.adb.sh", delay: 600}
]
}
]
let history = [{
host: "[cybre.town]$ ",
command: "welcome --help",
output: []
}]
export default {
data(){
return {
commands,
history
}
},
methods:{
renderCommand(input){
history[history.length-1].output = this.getCommand(input).output;
history.push({
host: "[cybre.town]$ ",
command: "",
output: []
})
},
getCommand(input) {
input = (input?input:history[history.length-1].command).split(" ")[0];
let command = commands.find(
command => Array.isArray(command.name)?command.name.find(
altName => altName === input):command.name === input);
return command?command:commands[0];
}
}
}