update deps and services

master
adb-sh 1 year ago
parent be40fd9d75
commit 82e6c76d88

@ -1,3 +1,4 @@
> 1%
last 2 versions
not dead
not ie 11

@ -1,35 +1,18 @@
module.exports = {
"env": {
"browser": true,
"es6": true
},
"extends": [
"eslint:recommended",
"plugin:vue/essential"
],
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly"
},
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module"
},
"plugins": [
"vue"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"warn",
"double"
]
}
}
root: true,
env: {
node: true,
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended",
"@vue/typescript/recommended",
],
parserOptions: {
ecmaVersion: 2020,
},
rules: {
"no-console": process.env.NODE_ENV === "production" ? "warn" : "off",
"no-debugger": process.env.NODE_ENV === "production" ? "warn" : "off",
},
};

@ -1,24 +1,29 @@
# cybre.town
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}
"@vue/cli-plugin-babel/preset",
],
};

22338
package-lock.json generated

File diff suppressed because it is too large Load Diff

@ -1,5 +1,5 @@
{
"name": "cybre.town",
"name": "vue3",
"version": "0.1.0",
"private": true,
"scripts": {
@ -8,20 +8,23 @@
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"register-service-worker": "^1.7.1",
"vue": "^3.0.0"
"core-js": "^3.8.3",
"register-service-worker": "^1.7.2",
"vue": "^3.2.13"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-pwa": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.5.0",
"node-sass": "^5.0.0",
"sass-loader": "^10.1.1"
"@typescript-eslint/eslint-plugin": "^5.4.0",
"@typescript-eslint/parser": "^5.4.0",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-plugin-pwa": "~5.0.0",
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"@vue/eslint-config-typescript": "^9.1.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "^1.32.7",
"sass-loader": "^12.0.0",
"typescript": "~4.5.5"
}
}

@ -1,17 +1,11 @@
<script setup>
import ConsoleWrapper from "@/components/ConsoleWrapper.vue"
</script>
<template>
<console class="console"></console>
<ConsoleWrapper class="console" />
</template>
<script>
import console from "@/components/console"
export default {
name: "App",
components: {
console
}
}
</script>
<style lang="scss">
body,html{
@ -52,4 +46,4 @@ body,html{
left: 0;
}
}
</style>
</style>

@ -3,11 +3,11 @@
<div class="content">
<div class="group" v-for="(group, index) in history" :key="group">
<pre><span class="host">{{group.host}}</span><span
v-if="index !== history.length-1">{{group.command}}</span><input
v-else v-model="group.command" ref="consoleInput" type="text" autocomplete="off"
@keydown.enter.exact="displayCommand();"
@keydown.up="group.command = getPreviousCommand(index);"
@keydown.down="group.command = getNextCommand(index);"></pre>
v-if="index !== history.length-1">{{group.command}}</span><input
v-else v-model="group.command" ref="consoleInput" type="text" autocomplete="off"
@keydown.enter.exact="displayCommand();"
@keydown.up="group.command = getPreviousCommand(index);"
@keydown.down="group.command = getNextCommand(index);"></pre>
<pre v-if="group.output.length"><span v-for="output in group.output" :key="output" :class="output.color">{{output.content}}</span></pre>
</div>
</div>
@ -15,10 +15,10 @@
</template>
<script>
import commands from "@/render-commands.js"
import commands from "@/renderCommands.js"
export default {
name: "console",
name: "ConsoleWrapper",
data(){
return{
history:[{
@ -61,7 +61,8 @@ export default {
return this.history[this.currentHistoryPoint].command;
},
focusInput(){
this.$nextTick(() => this.$refs.consoleInput.focus());
console.log(this.$refs.consoleInput)
this.$nextTick(() => this.$refs.consoleInput[0].focus());
this.scrollToBottom();
},
scrollToBottom(){
@ -106,4 +107,4 @@ export default {
}
}
}
</style>
</style>

@ -1,5 +0,0 @@
import { createApp } from 'vue'
import App from './App.vue'
import './registerServiceWorker'
createApp(App).mount('#app')

@ -0,0 +1,5 @@
import { createApp } from "vue";
import App from "./App.vue";
import "./registerServiceWorker";
createApp(App).mount("#app");

@ -1,217 +0,0 @@
let commands = [
{
name: "unknown",
output(input){return[
{color: "white", content: `the command "${input[0]}" you entered is undefined!\n`, delay: 100},
{
color: "white",
content:
input.find(arr => arr === "--help")?
"try something like:\n" +
"\n" +
" - Mastodon > social\n" +
" - Gitea > git\n" +
" - Matrix > element\n" +
" - Etherpad > ether\n" +
" - short url > surl\n" +
" - Jitsi > meet\n":
"show examples with \"welcome --help\"",
delay: 200
},
]}
},
{
name: "welcome",
output(input){
let fontSize = window.getComputedStyle(document.body,null).fontSize.split("px", 1);
return[
{color: "white", content: "\nWelcome to:\n", delay: 100},
{
color: "green",
content: window.innerWidth/fontSize<35?
" __ \n" +
" /\\ \\ \n" +
" ____ __ \\_\\ \\____ _____ ____ \n" +
" / ___\\\\ \\/\\ \\\\ __ \\\\ __\\/ __ \\ \n" +
"/\\ \\__/ \\ \\_\\ \\\\ \\_\\ \\\\ \\_/\\ __/ \n" +
"\\ \\____\\ \\____ \\\\____/ \\_\\\\ \\____\\\n" +
" \\/____/\\/___/\\ \\___/ \\/_/ \\/____/\n" +
" __ /\\___/ \n" +
" /\\ \\__ \\/__/ @adb.sh\n" +
" \\ \\ _\\ ____ __ __ __ ______\n" +
" \\ \\ \\/ / __ \\\\ \\/\\ \\/\\ \\\\ __ \\\n" +
" __\\ \\ \\_\\ \\_\\ \\\\ \\/ \\/ / \\ \\/\\ \\\n" +
" /\\_\\\\ \\__\\\\____/ \\__/\\__/ \\ \\_\\ \\_\\\n" +
" \\/_/ \\/__//___/ \\/_/\\/_/ \\/_/\\/_/\n\n"
:
" __ __\n" +
" /\\ \\ /\\ \\__\n" +
" ____ __ \\_\\ \\____ _____ ____ \\ \\ _\\ ____ __ __ __ ______\n" +
" / ___\\\\ \\/\\ \\\\ __ \\\\ __\\/ __ \\ \\ \\ \\/ / __ \\\\ \\/\\ \\/\\ \\\\ __ \\\n" +
"/\\ \\__/ \\ \\_\\ \\\\ \\_\\ \\\\ \\_/\\ __/ __\\ \\ \\_\\ \\_\\ \\\\ \\/ \\/ / \\ \\/\\ \\\n" +
"\\ \\____\\ \\____ \\\\____/ \\_\\\\ \\____\\/\\_\\\\ \\__\\\\____/ \\__/\\__/ \\ \\_\\ \\_\\\n" +
" \\/____/\\/___/\\ \\___/ \\/_/ \\/____/\\/_/ \\/__//___/ \\/_/\\/_/ \\/_/\\/_/\n" +
" /\\___/\n" +
" \\/__/ @adb.sh\n\n",
delay: 300
},
input.find(arr => arr === "--help")?{
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
}:{color: "white", content: "show examples with \"welcome --help\"", delay: 600}
]
}
},
{
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: "time",
output(){ return[
{color: "white", content: "your current time is: ", delay: 100},
{color: "blue", content: function(){return new Date().toLocaleTimeString()}(), delay: 200},
]}
},
{
name: "date",
output(){ return[
{color: "white", content: "your current date is: ", delay: 100},
{color: "blue", content: function(){return new Date().toLocaleDateString()}(), delay: 200},
]}
},
{
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(input){
if (input.find(arr => arr === "--help")) return [
{color: "white", content: "the syntax for this command is:\n", delay: 100},
{color: "white", content: "etherpad", delay: 200},
{color: "red", content: " [padname]", delay: 300}
]
return input[1]?[
{color: "blue", content: "\nEtherpad", delay: 100},
{color: "white", content: ` pad "${input[1]}" is loading\n`, delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: `https://ether.adb.sh/p/${input[1]}`, delay: 600}
]:[
{color: "blue", content: "\nEtherpad", delay: 100},
{color: "white", content: " startpage is loading\n", delay: 200},
{color: "white", content: "run with \"--help\" to show syntax\n", delay: 300},
{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: "\nsurl", 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(input){
if (input.find(arr => arr === "--help")) return [
{color: "white", content: "the syntax for this command is:\n", delay: 100},
{color: "white", content: "meet", delay: 200},
{color: "red", content: " [roomname]", delay: 300}
]
return input[1]?[
{color: "blue", content: "\nJitsi", delay: 100},
{color: "white", content: ` room "${input[1]}" is loading\n`, delay: 200},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: `https://meet.adb.sh/${input[1]}`, delay: 600}
]:[
{color: "blue", content: "\nJitsi", delay: 100},
{color: "white", content: " startpage is loading\n", delay: 200},
{color: "white", content: "run with \"--help\" to show syntax\n", delay: 300},
{color: "white", content: "forwarding", delay: 400},
{color: "white", content: " ...", forward: "https://meet.adb.sh", delay: 600}
]
}
},
{
name: "cat",
output:[
{
color: "red",
content: "" +
" . .\n" +
" \\`-\"'\"-'/\n" +
" } 6 6 { \n" +
" =. Y ,= \n" +
" /^^^\\ .\n" +
" / \\ )\n" +
"jgs ( )-( )/ \n" +
" \"\" \"\"",
delay: 100}
]
}
]
export default {
data(){
return {
commands
}
},
methods:{
renderCommand(input){
let toRender = this.getCommand(input).output
return typeof toRender === "function"?toRender(input.split(" ")):toRender;
},
getCommand(input) {
input = input.split(" ", 1)[0];
let command = commands.find(
command => Array.isArray(command.name)?command.name.find(
altName => altName === input):command.name === input);
return command?command:commands[0];
}
}
}

@ -0,0 +1,294 @@
let commands = [
{
name: "unknown",
output(input) {
return [
{
color: "white",
content: `the command "${input[0]}" you entered is undefined!\n`,
delay: 100,
},
{
color: "white",
content: input.find((arr) => arr === "--help")
? "try something like:\n" +
"\n" +
" - Mastodon > social\n" +
" - Gitea > git\n" +
" - HeadgeDoc > md\n" +
" - Jitsi > meet\n"
: 'show examples with "welcome --help"',
delay: 200,
},
];
},
},
{
name: "welcome",
output(input) {
let fontSize = window.getComputedStyle(document.body, null).fontSize
.split("px", 1);
return [
{ color: "white", content: "\nWelcome to:\n", delay: 100 },
{
color: "green",
content: window.innerWidth / fontSize < 35
? " __ \n" +
" /\\ \\ \n" +
" ____ __ \\_\\ \\____ _____ ____ \n" +
" / ___\\\\ \\/\\ \\\\ __ \\\\ __\\/ __ \\ \n" +
"/\\ \\__/ \\ \\_\\ \\\\ \\_\\ \\\\ \\_/\\ __/ \n" +
"\\ \\____\\ \\____ \\\\____/ \\_\\\\ \\____\\\n" +
" \\/____/\\/___/\\ \\___/ \\/_/ \\/____/\n" +
" __ /\\___/ \n" +
" /\\ \\__ \\/__/ @adb.sh\n" +
" \\ \\ _\\ ____ __ __ __ ______\n" +
" \\ \\ \\/ / __ \\\\ \\/\\ \\/\\ \\\\ __ \\\n" +
" __\\ \\ \\_\\ \\_\\ \\\\ \\/ \\/ / \\ \\/\\ \\\n" +
" /\\_\\\\ \\__\\\\____/ \\__/\\__/ \\ \\_\\ \\_\\\n" +
" \\/_/ \\/__//___/ \\/_/\\/_/ \\/_/\\/_/\n\n"
: " __ __\n" +
" /\\ \\ /\\ \\__\n" +
" ____ __ \\_\\ \\____ _____ ____ \\ \\ _\\ ____ __ __ __ ______\n" +
" / ___\\\\ \\/\\ \\\\ __ \\\\ __\\/ __ \\ \\ \\ \\/ / __ \\\\ \\/\\ \\/\\ \\\\ __ \\\n" +
"/\\ \\__/ \\ \\_\\ \\\\ \\_\\ \\\\ \\_/\\ __/ __\\ \\ \\_\\ \\_\\ \\\\ \\/ \\/ / \\ \\/\\ \\\n" +
"\\ \\____\\ \\____ \\\\____/ \\_\\\\ \\____\\/\\_\\\\ \\__\\\\____/ \\__/\\__/ \\ \\_\\ \\_\\\n" +
" \\/____/\\/___/\\ \\___/ \\/_/ \\/____/\\/_/ \\/__//___/ \\/_/\\/_/ \\/_/\\/_/\n" +
" /\\___/\n" +
" \\/__/ @adb.sh\n\n",
delay: 300,
},
input.find((arr) => arr === "--help")
? {
color: "white",
content: "free services on this server:\n" +
"\n" +
" - Mastodon > social\n" +
" - Gitea > git\n" +
" - HeadgeDoc > md\n" +
" - Jitsi > meet\n",
delay: 500,
}
: {
color: "white",
content: 'show examples with "welcome --help"',
delay: 600,
},
];
},
},
{
name: "time",
output() {
return [
{ color: "white", content: "your current time is: ", delay: 100 },
{
color: "blue",
content: function () {
return new Date().toLocaleTimeString();
}(),
delay: 200,
},
];
},
},
{
name: "date",
output() {
return [
{ color: "white", content: "your current date is: ", delay: 100 },
{
color: "blue",
content: function () {
return new Date().toLocaleDateString();
}(),
delay: 200,
},
];
},
},
{
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.cybre.town",
delay: 600,
},
],
},
{
name: ["md", "hedgedoc", "HedgeDoc"],
output(input) {
if (input.find((arr) => arr === "--help")) {
return [
{
color: "white",
content: "the syntax for this command is:\n",
delay: 100,
},
{ color: "white", content: "", delay: 200 },
{ color: "red", content: " [padname]", delay: 300 },
];
}
return input[1]
? [
{ color: "blue", content: "\nhedgedoc", delay: 100 },
{
color: "white",
content: ` pad "${input[1]}" is loading\n`,
delay: 200,
},
{ color: "white", content: "forwarding", delay: 400 },
{
color: "white",
content: " ...",
forward: `https://md.cybre.town/${input[1]}`,
delay: 600,
},
]
: [
{ color: "blue", content: "\nHedgeDoc", delay: 100 },
{ color: "white", content: " startpage is loading\n", delay: 200 },
{
color: "white",
content: 'run with "--help" to show syntax\n',
delay: 300,
},
{ color: "white", content: "forwarding", delay: 400 },
{
color: "white",
content: " ...",
forward: "https://md.cybre.town",
delay: 600,
},
];
},
},
{
name: ["surl", "short-url", "shortURL"],
output: [
{ color: "blue", content: "\nsurl", 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(input) {
if (input.find((arr) => arr === "--help")) {
return [
{
color: "white",
content: "the syntax for this command is:\n",
delay: 100,
},
{ color: "white", content: "meet", delay: 200 },
{ color: "red", content: " [roomname]", delay: 300 },
];
}
return input[1]
? [
{ color: "blue", content: "\nJitsi", delay: 100 },
{
color: "white",
content: ` room "${input[1]}" is loading\n`,
delay: 200,
},
{ color: "white", content: "forwarding", delay: 400 },
{
color: "white",
content: " ...",
forward: `https://meet.adb.sh/${input[1]}`,
delay: 600,
},
]
: [
{ color: "blue", content: "\nJitsi", delay: 100 },
{ color: "white", content: " startpage is loading\n", delay: 200 },
{
color: "white",
content: 'run with "--help" to show syntax\n',
delay: 300,
},
{ color: "white", content: "forwarding", delay: 400 },
{
color: "white",
content: " ...",
forward: "https://meet.adb.sh",
delay: 600,
},
];
},
},
{
name: "cat",
output: [
{
color: "red",
content: "" +
" . .\n" +
" \\`-\"'\"-'/\n" +
" } 6 6 { \n" +
" =. Y ,= \n" +
" /^^^\\ .\n" +
" / \\ )\n" +
"jgs ( )-( )/ \n" +
' "" ""',
delay: 100,
},
],
},
];
export default {
data() {
return {
commands,
};
},
methods: {
renderCommand(input) {
let toRender = this.getCommand(input).output;
return typeof toRender === "function"
? toRender(input.split(" "))
: toRender;
},
getCommand(input) {
input = input.split(" ", 1)[0];
let command = commands.find(
(command) =>
Array.isArray(command.name)
? command.name.find(
(altName) => altName === input,
)
: command.name === input,
);
return command ? command : commands[0];
},
},
};

@ -0,0 +1,40 @@
{
"compilerOptions": {
"target": "esnext",
"module": "esnext",
"strict": false,
"jsx": "preserve",
"moduleResolution": "node",
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"useDefineForClassFields": true,
"sourceMap": true,
"baseUrl": ".",
"types": [
"webpack-env"
],
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
]
}

@ -0,0 +1,4 @@
const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
transpileDependencies: true,
});
Loading…
Cancel
Save