mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
Compare commits
204
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aebe587ad3 | ||
|
|
c96ee83fa3 | ||
|
|
bf44cce580 | ||
|
|
7c88a60d94 | ||
|
|
1f55ae09d6 | ||
|
|
e2b5bb3b70 | ||
|
|
ba69685ea2 | ||
|
|
84e65c9ef6 | ||
|
|
f466a7a793 | ||
|
|
d74a549b89 | ||
|
|
33a1a110e8 | ||
|
|
d4c9d4577c | ||
|
|
27b6096633 | ||
|
|
a8a367f477 | ||
|
|
78b92ee8ce | ||
|
|
14fb870838 | ||
|
|
455fde41ab | ||
|
|
ff1cdc9a95 | ||
|
|
df140c64f8 | ||
|
|
4efd670ed6 | ||
|
|
4814626a71 | ||
|
|
1179faf176 | ||
|
|
a9acf54139 | ||
|
|
b64f49915f | ||
|
|
ef279ba00e | ||
|
|
eb106c020a | ||
|
|
432084cc66 | ||
|
|
2fb1315c5a | ||
|
|
75f5407dde | ||
|
|
ebd713200c | ||
|
|
bb2a1a145f | ||
|
|
7f33100132 | ||
|
|
59a0865157 | ||
|
|
c843a03fc8 | ||
|
|
182cc7d1bb | ||
|
|
daa3f11b2e | ||
|
|
a4c121dc94 | ||
|
|
5adaa47c5c | ||
|
|
3345fb3b3f | ||
|
|
0313671ff5 | ||
|
|
e31511fdc1 | ||
|
|
685be8c1d2 | ||
|
|
0d2e62be24 | ||
|
|
962db4e8a4 | ||
|
|
52d8e86043 | ||
|
|
51fb25aa50 | ||
|
|
d2d8374926 | ||
|
|
4570162e7b | ||
|
|
3194c03f48 | ||
|
|
c4fd92e289 | ||
|
|
ce538a049c | ||
|
|
36932e1eb1 | ||
|
|
ca3d9b4236 | ||
|
|
76e6cda0cb | ||
|
|
3dee3d0373 | ||
|
|
218a25daee | ||
|
|
94ae2d7df4 | ||
|
|
a71411d5bf | ||
|
|
807974d727 | ||
|
|
ec63bba0fe | ||
|
|
ddaefca5fb | ||
|
|
ba43b4c5e8 | ||
|
|
f52017ef9f | ||
|
|
af9b443865 | ||
|
|
4739849549 | ||
|
|
63a57aa2cf | ||
|
|
ead321cd62 | ||
|
|
516e59f855 | ||
|
|
4ddbb5aede | ||
|
|
d924ccaaa9 | ||
|
|
c324bfcfee | ||
|
|
817cf8c40e | ||
|
|
4e8a56f127 | ||
|
|
6aed5789a5 | ||
|
|
d737347d0b | ||
|
|
5041ec9dc6 | ||
|
|
c2c792f10c | ||
|
|
85b34abc7e | ||
|
|
2bfd2cc06d | ||
|
|
5dbdadbb27 | ||
|
|
1e2a43db50 | ||
|
|
ba7409b7a8 | ||
|
|
f9decee80b | ||
|
|
bef134871d | ||
|
|
46e27c7456 | ||
|
|
9146c433b3 | ||
|
|
00e421861f | ||
|
|
cdd76f7d0c | ||
|
|
a389d2752d | ||
|
|
039da53bbe | ||
|
|
622d64dd45 | ||
|
|
90e661f77b | ||
|
|
88ee8f2cc3 | ||
|
|
bb4a11b20c | ||
|
|
031d7a8ceb | ||
|
|
48dbac7907 | ||
|
|
ea33434bea | ||
|
|
923de901c4 | ||
|
|
fb69cb4e10 | ||
|
|
818e4e95e4 | ||
|
|
2aa1c84e73 | ||
|
|
1b52349f03 | ||
|
|
a9bc2cc127 | ||
|
|
7c08d21142 | ||
|
|
b059cca7b2 | ||
|
|
9e108e397b | ||
|
|
dc972173a4 | ||
|
|
56d07f14b4 | ||
|
|
b47bb62831 | ||
|
|
ece0ec7c41 | ||
|
|
004d232a84 | ||
|
|
0a730e4eef | ||
|
|
5091f8f24f | ||
|
|
87060aa3ef | ||
|
|
670a5b2e87 | ||
|
|
f540a0166d | ||
|
|
b98f4e4c07 | ||
|
|
31eb638a6e | ||
|
|
583605ef3a | ||
|
|
8c6b86ad17 | ||
|
|
8670d2b3bb | ||
|
|
07ec58e41c | ||
|
|
025553f42a | ||
|
|
bfa839f2f9 | ||
|
|
b57e7adb37 | ||
|
|
b1a9a6102c | ||
|
|
c5a7e77f04 | ||
|
|
ed142ab27b | ||
|
|
f29dcf810f | ||
|
|
48cfcb2c36 | ||
|
|
14eea84a36 | ||
|
|
c0efce69f4 | ||
|
|
37b1bead28 | ||
|
|
9f1008336d | ||
|
|
59590639ee | ||
|
|
885f1c5b27 | ||
|
|
ac8e9d1cfa | ||
|
|
fd543ed594 | ||
|
|
c0ec382510 | ||
|
|
e84ca12647 | ||
|
|
c912319967 | ||
|
|
4c421b4cb3 | ||
|
|
2d05149cea | ||
|
|
ad66191d88 | ||
|
|
5e8df7ae01 | ||
|
|
9bac360498 | ||
|
|
7c1d83ccd3 | ||
|
|
4ab3096fa5 | ||
|
|
64215d3ef1 | ||
|
|
075e21fb89 | ||
|
|
9dc0b43737 | ||
|
|
5489de2432 | ||
|
|
d6c95cea4a | ||
|
|
2cb82fdcdc | ||
|
|
2b495f7cda | ||
|
|
9509bbc355 | ||
|
|
c3d9130731 | ||
|
|
4f9b275211 | ||
|
|
db16413754 | ||
|
|
5c17f5ea3c | ||
|
|
ca2a40341c | ||
|
|
c06d6d6deb | ||
|
|
f797f4d897 | ||
|
|
640d6b58c5 | ||
|
|
79a5dac7f1 | ||
|
|
cfda174dc5 | ||
|
|
ee03b9999e | ||
|
|
253bd04588 | ||
|
|
2a542302bc | ||
|
|
e91774fe3b | ||
|
|
23f9023f8b | ||
|
|
5b0d1f92c4 | ||
|
|
ec4e97a7d6 | ||
|
|
19cd66475c | ||
|
|
c353f81b9f | ||
|
|
6e4e1cfed1 | ||
|
|
78966d351f | ||
|
|
eb231e4056 | ||
|
|
ba3b40792b | ||
|
|
7216158053 | ||
|
|
5f36f732b1 | ||
|
|
30aefb47f9 | ||
|
|
1531846482 | ||
|
|
a18e0d9b68 | ||
|
|
557af91d4b | ||
|
|
2bdb804f24 | ||
|
|
8eaec839d3 | ||
|
|
3977db87a3 | ||
|
|
e6abd08963 | ||
|
|
68e922878b | ||
|
|
e9e3bc25af | ||
|
|
d4bb5d8f73 | ||
|
|
7bb7ac3f00 | ||
|
|
42278ad51b | ||
|
|
107c153e98 | ||
|
|
d45fbee647 | ||
|
|
2ac73a06c9 | ||
|
|
91a9397c58 | ||
|
|
af088730e8 | ||
|
|
4b9c7de031 | ||
|
|
712a1ff319 | ||
|
|
21c1a4d11c | ||
|
|
d069233407 | ||
|
|
27c5794700 |
No files matched your search
+3
-2
@@ -1,3 +1,4 @@
|
|||||||
*/node_modules
|
**/node_modules
|
||||||
.git
|
.git
|
||||||
*/dist
|
**/dist
|
||||||
|
**/tsconfig.tsbuildinfo
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
TESTING=true
|
||||||
|
TESTING_USERNAME=alex
|
||||||
|
TESTING_PASSWORD=Alex1234
|
||||||
|
SECRET_KEY=b1d2e917-17b9-4fce-9055-082dee6ec5d6
|
||||||
+1
-1
@@ -2,4 +2,4 @@ vite.config.js
|
|||||||
.gitignore
|
.gitignore
|
||||||
data
|
data
|
||||||
mongo-init.js
|
mongo-init.js
|
||||||
app/dist
|
dist
|
||||||
+57
-5
@@ -4,22 +4,33 @@ module.exports = {
|
|||||||
node: true,
|
node: true,
|
||||||
jest: true,
|
jest: true,
|
||||||
},
|
},
|
||||||
plugins: ['cypress'],
|
plugins: ['@typescript-eslint', 'cypress', 'vue'],
|
||||||
extends: [
|
extends: [
|
||||||
'plugin:vue/vue3-essential',
|
'plugin:vue/vue3-essential',
|
||||||
'airbnb-base',
|
'airbnb-base',
|
||||||
'plugin:prettier/recommended', // We added this
|
'plugin:prettier/recommended', // We added this
|
||||||
'plugin:cypress/recommended',
|
'plugin:cypress/recommended',
|
||||||
],
|
],
|
||||||
|
parser: 'vue-eslint-parser',
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
// parser: 'babel-eslint',
|
parser: '@typescript-eslint/parser',
|
||||||
ecmaVersion: 13,
|
|
||||||
sourceType: 'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
settings: {
|
||||||
|
'import/resolver': {
|
||||||
|
node: {
|
||||||
|
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
||||||
|
},
|
||||||
|
typescript: {},
|
||||||
|
},
|
||||||
|
vue: {
|
||||||
|
version: '3.0', // Explicitly specify Vue 3
|
||||||
|
},
|
||||||
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'no-console': 'warn',
|
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
||||||
'import/extensions': 'off',
|
|
||||||
camelcase: ['error', { properties: 'never', ignoreDestructuring: true }],
|
camelcase: ['error', { properties: 'never', ignoreDestructuring: true }],
|
||||||
'no-param-reassign': ['error', { props: false }],
|
'no-param-reassign': ['error', { props: false }],
|
||||||
'no-underscore-dangle': ['error', { allow: ['_id'] }],
|
'no-underscore-dangle': ['error', { allow: ['_id'] }],
|
||||||
@@ -29,5 +40,46 @@ module.exports = {
|
|||||||
'prettier/prettier': ['error', { endOfLine: 'auto', semi: false }],
|
'prettier/prettier': ['error', { endOfLine: 'auto', semi: false }],
|
||||||
'import/prefer-default-export': 'off',
|
'import/prefer-default-export': 'off',
|
||||||
'no-restricted-syntax': ['off', 'ForOfStatement'],
|
'no-restricted-syntax': ['off', 'ForOfStatement'],
|
||||||
|
'lines-between-class-members': [
|
||||||
|
'error',
|
||||||
|
'always',
|
||||||
|
{ exceptAfterSingleLine: true },
|
||||||
|
],
|
||||||
|
'no-use-before-define': 'off',
|
||||||
|
|
||||||
|
'@typescript-eslint/explicit-module-boundary-types': 'off',
|
||||||
|
'@typescript-eslint/no-unused-vars': [
|
||||||
|
'error',
|
||||||
|
{
|
||||||
|
args: 'after-used',
|
||||||
|
argsIgnorePattern: '^_',
|
||||||
|
caughtErrors: 'all',
|
||||||
|
caughtErrorsIgnorePattern: '^_',
|
||||||
|
destructuredArrayIgnorePattern: '^_',
|
||||||
|
varsIgnorePattern: '^_',
|
||||||
|
ignoreRestSiblings: true,
|
||||||
},
|
},
|
||||||
|
],
|
||||||
|
|
||||||
|
// Allow missing file extensions
|
||||||
|
'import/extensions': [
|
||||||
|
'warn',
|
||||||
|
'ignorePackages',
|
||||||
|
{
|
||||||
|
js: 'off',
|
||||||
|
jsx: 'never',
|
||||||
|
ts: 'never',
|
||||||
|
tsx: 'never',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: ['**/tests/**/*.js', '**/tests/**/*.ts', '**/*.test.ts'], // Adjust the pattern to match your test files
|
||||||
|
rules: {
|
||||||
|
'import/extensions': 'off', // Turn off the rule for test files
|
||||||
|
'import/no-extraneous-dependencies': 'off',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
],
|
||||||
}
|
}
|
||||||
@@ -27,6 +27,9 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: yarn install
|
run: yarn install
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
run: yarn build
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: yarn lint
|
run: yarn lint
|
||||||
|
|
||||||
|
|||||||
@@ -12,23 +12,6 @@ jobs:
|
|||||||
uses: ./.github/workflows/ci-checks.yml
|
uses: ./.github/workflows/ci-checks.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
code_review:
|
|
||||||
permissions:
|
|
||||||
pull-requests: write
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Code Review GPT
|
|
||||||
uses: mattzcarey/code-review-gpt@v0.1.4-alpha
|
|
||||||
with:
|
|
||||||
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
|
|
||||||
MODEL: 'gpt-3.5-turbo'
|
|
||||||
GITHUB_TOKEN: ${{ github.token }}
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: ci-checks
|
|
||||||
uses: ./.github/workflows/build.yml
|
uses: ./.github/workflows/build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@@ -52,6 +52,9 @@ web_modules/
|
|||||||
# TypeScript cache
|
# TypeScript cache
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
|
|
||||||
|
# TypeScript build
|
||||||
|
built
|
||||||
|
|
||||||
# Optional npm cache directory
|
# Optional npm cache directory
|
||||||
.npm
|
.npm
|
||||||
|
|
||||||
@@ -132,3 +135,6 @@ dist
|
|||||||
.yarn/build-state.yml
|
.yarn/build-state.yml
|
||||||
.yarn/install-state.gz
|
.yarn/install-state.gz
|
||||||
.pnp.*
|
.pnp.*
|
||||||
|
|
||||||
|
#screenshots
|
||||||
|
tests/cypress/screenshots
|
||||||
+1
-1
@@ -1,2 +1,2 @@
|
|||||||
data/*
|
data/*
|
||||||
app/dist
|
dist
|
||||||
Vendored
+2
-1
@@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"editor.defaultFormatter": "esbenp.prettier-vscode"
|
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||||
|
"editor.formatOnSave": true
|
||||||
}
|
}
|
||||||
@@ -17,15 +17,22 @@
|
|||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
Run everything (frontend, backend, db, swagger, quests):
|
Run mongoDB first:
|
||||||
|
|
||||||
docker compose build
|
docker compose -f docker-compose.dev.yml up -d db
|
||||||
docker compose up -d
|
|
||||||
|
The db will automatically restarts by Docker.
|
||||||
|
|
||||||
|
Build up dependencies:
|
||||||
|
|
||||||
|
yarn build:deps
|
||||||
|
|
||||||
|
Run dev server (frontend, backend):
|
||||||
|
|
||||||
|
yarn dev
|
||||||
|
|
||||||
If you want to enable social login, you should have OAuth client token in a `.env` file:
|
If you want to enable social login, you should have OAuth client token in a `.env` file:
|
||||||
|
|
||||||
docker compose --env-file .env up -d
|
|
||||||
|
|
||||||
### Build Quest Images
|
### Build Quest Images
|
||||||
|
|
||||||
In each quest folder, there is a `game.yml` file, which is the quest definition. And a optional `Dockerfile` to overwrite the base image. If you want to include additional files, put them in a `home` folder. The files in `home` will **not** be copied to the image automatically, you have to copy them in the `Dockerfile`.
|
In each quest folder, there is a `game.yml` file, which is the quest definition. And a optional `Dockerfile` to overwrite the base image. If you want to include additional files, put them in a `home` folder. The files in `home` will **not** be copied to the image automatically, you have to copy them in the `Dockerfile`.
|
||||||
|
|||||||
+5
-2
@@ -1,10 +1,12 @@
|
|||||||
# Base stage
|
# Base stage
|
||||||
FROM node:20-alpine as base
|
FROM node:20-alpine as base
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY package.json yarn.lock ./
|
COPY package.json yarn.lock tsconfig.json ./
|
||||||
COPY packages/file-graph/package.json ./packages/file-graph/package.json
|
COPY packages/file-graph/package.json ./packages/file-graph/package.json
|
||||||
COPY packages/utils/package.json ./packages/utils/package.json
|
COPY packages/utils/package.json ./packages/utils/package.json
|
||||||
COPY packages/constants/package.json ./packages/constants/package.json
|
COPY packages/constants/package.json ./packages/constants/package.json
|
||||||
|
COPY packages/models/package.json ./packages/models/package.json
|
||||||
COPY app/package.json ./app/package.json
|
COPY app/package.json ./app/package.json
|
||||||
RUN yarn install --frozen-lockfile
|
RUN yarn install --frozen-lockfile
|
||||||
|
|
||||||
@@ -18,8 +20,9 @@ FROM base as build
|
|||||||
COPY packages/file-graph ./packages/file-graph
|
COPY packages/file-graph ./packages/file-graph
|
||||||
COPY packages/utils ./packages/utils
|
COPY packages/utils ./packages/utils
|
||||||
COPY packages/constants ./packages/constants
|
COPY packages/constants ./packages/constants
|
||||||
|
COPY packages/models ./packages/models
|
||||||
COPY app ./app
|
COPY app ./app
|
||||||
RUN yarn build
|
RUN yarn workspace app build
|
||||||
|
|
||||||
# Production stage
|
# Production stage
|
||||||
FROM nginx:stable-alpine as prod
|
FROM nginx:stable-alpine as prod
|
||||||
|
|||||||
+1
-1
@@ -8,6 +8,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="/src/main.ts"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
+10
-6
@@ -2,12 +2,10 @@
|
|||||||
"name": "app",
|
"name": "app",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"type": "module",
|
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "API_TARGET=http://homesrv.dala-banana.ts.net:3000 vite",
|
"dev": "vite",
|
||||||
"dev:local": "vite",
|
|
||||||
"dev:docker": "API_TARGET=http://backend:3000 vite",
|
"dev:docker": "API_TARGET=http://backend:3000 vite",
|
||||||
"build": "vite build",
|
"build": "vue-tsc -b && vite build",
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -19,6 +17,8 @@
|
|||||||
"@linux-odyssey/constants": "*",
|
"@linux-odyssey/constants": "*",
|
||||||
"@linux-odyssey/file-graph": "*",
|
"@linux-odyssey/file-graph": "*",
|
||||||
"@linux-odyssey/utils": "*",
|
"@linux-odyssey/utils": "*",
|
||||||
|
"@linux-odyssey/models": "*",
|
||||||
|
"@types/dompurify": "^3.0.5",
|
||||||
"axios": "^1.6.0",
|
"axios": "^1.6.0",
|
||||||
"dompurify": "^3.0.6",
|
"dompurify": "^3.0.6",
|
||||||
"echarts": "^5.4.3",
|
"echarts": "^5.4.3",
|
||||||
@@ -34,10 +34,14 @@
|
|||||||
"xterm-addon-fit": "^0.7.0"
|
"xterm-addon-fit": "^0.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@vitejs/plugin-vue": "^4.2.3",
|
"@types/validator": "^13.11.9",
|
||||||
|
"@vitejs/plugin-vue": "^4.5.2",
|
||||||
|
"@vue/compiler-sfc": "^3.3.13",
|
||||||
"autoprefixer": "^10.4.14",
|
"autoprefixer": "^10.4.14",
|
||||||
"postcss": "^8.4.31",
|
"postcss": "^8.4.31",
|
||||||
"tailwindcss": "^3.3.3",
|
"tailwindcss": "^3.3.3",
|
||||||
"vite": "^4.4.12"
|
"typescript": "^5.3.3",
|
||||||
|
"vite": "^4.5.3",
|
||||||
|
"vue-tsc": "^2.0.10"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
export default {
|
module.exports = {
|
||||||
plugins: {
|
plugins: {
|
||||||
tailwindcss: {},
|
tailwindcss: {},
|
||||||
autoprefixer: {},
|
autoprefixer: {},
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { computed, onMounted, ref } from 'vue'
|
import { computed, onMounted, ref } from 'vue'
|
||||||
import { RouterLink, useRouter } from 'vue-router'
|
import { RouterLink, useRouter } from 'vue-router'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
@@ -27,7 +27,7 @@ const password = ref('')
|
|||||||
const errorMessage = ref('')
|
const errorMessage = ref('')
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
const availableMethods = ref({})
|
const availableMethods = ref<{ [key: string]: boolean }>({})
|
||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
const res = await api.get('/auth/available-methods')
|
const res = await api.get('/auth/available-methods')
|
||||||
availableMethods.value = res.data
|
availableMethods.value = res.data
|
||||||
@@ -44,7 +44,7 @@ const success = () => {
|
|||||||
router.push({ name: 'map' })
|
router.push({ name: 'map' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const error = (err) => {
|
const error = (err: string) => {
|
||||||
errorMessage.value = err
|
errorMessage.value = err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,10 +114,7 @@ const handleChange = () => {
|
|||||||
:icon="['fab', 'google']"
|
:icon="['fab', 'google']"
|
||||||
class="text-text-secondary px-3 text-lg"
|
class="text-text-secondary px-3 text-lg"
|
||||||
/>
|
/>
|
||||||
<span class="font-medium">
|
<span class="font-medium"> 以 Google 繼續 </span>
|
||||||
<!-- Continue with Google -->
|
|
||||||
以 Google 繼續
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
<a
|
<a
|
||||||
id="GitHubLogin"
|
id="GitHubLogin"
|
||||||
@@ -129,32 +126,17 @@ const handleChange = () => {
|
|||||||
:icon="['fab', 'github']"
|
:icon="['fab', 'github']"
|
||||||
class="text-text-secondary px-3 text-lg"
|
class="text-text-secondary px-3 text-lg"
|
||||||
/>
|
/>
|
||||||
<span class="font-medium">
|
<span class="font-medium"> 以 GitHub 繼續 </span>
|
||||||
<!-- Continue with GitHub -->
|
|
||||||
以 GitHub 繼續
|
|
||||||
</span>
|
|
||||||
</a>
|
</a>
|
||||||
<p
|
<p
|
||||||
id="or"
|
id="or"
|
||||||
class="text-text-secondary flex justify-center mt-3"
|
class="text-text-secondary flex justify-center mt-3"
|
||||||
v-if="type === 'login' || type === 'register'"
|
v-if="type === 'login' || type === 'register'"
|
||||||
>
|
>
|
||||||
<!-- or -->
|
|
||||||
或
|
或
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6">
|
<div class="mb-6">
|
||||||
<!-- <input
|
|
||||||
type="text"
|
|
||||||
id="username"
|
|
||||||
ref="usernameInput"
|
|
||||||
class="my-4 bg-bg-primary text-text-primary bg- rounded-md block w-full px-3 h-10 shadow-sm focus:outline-none placeholder:text-text-line focus:ring-2 focus:ring-text-primary ring-1 ring-bg-secondary"
|
|
||||||
:placeholder="type === 'login' ? 'Email / Username' : 'Username'"
|
|
||||||
v-model="username"
|
|
||||||
required
|
|
||||||
@input="handleChange()"
|
|
||||||
autocomplete="username"
|
|
||||||
/> -->
|
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="username"
|
id="username"
|
||||||
@@ -176,17 +158,6 @@ const handleChange = () => {
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6" v-if="type === 'register'">
|
<div class="mb-6" v-if="type === 'register'">
|
||||||
<!-- <input
|
|
||||||
type="email"
|
|
||||||
id="email"
|
|
||||||
ref="emailInput"
|
|
||||||
class="my-4 bg-bg-primary text-text-primary bg- rounded-md block w-full px-3 h-10 shadow-sm focus:outline-none placeholder:text-text-line focus:ring-2 focus:ring-text-primary ring-1 ring-bg-secondary"
|
|
||||||
placeholder="Email"
|
|
||||||
v-model="email"
|
|
||||||
required
|
|
||||||
@input="handleChange()"
|
|
||||||
autocomplete="email"
|
|
||||||
/> -->
|
|
||||||
<input
|
<input
|
||||||
type="email"
|
type="email"
|
||||||
id="email"
|
id="email"
|
||||||
@@ -200,15 +171,6 @@ const handleChange = () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-6" v-if="type === 'login' || type === 'register'">
|
<div class="mb-6" v-if="type === 'login' || type === 'register'">
|
||||||
<!-- <input
|
|
||||||
type="password"
|
|
||||||
id="password"
|
|
||||||
class="my-4 bg-bg-primary text-text-primary bg- rounded-md block w-full px-3 h-10 shadow-sm focus:outline-none placeholder:text-text-line focus:ring-2 focus:ring-text-primary ring-1 ring-bg-secondary"
|
|
||||||
placeholder="Password"
|
|
||||||
v-model="password"
|
|
||||||
required
|
|
||||||
@input="handleChange()"
|
|
||||||
/> -->
|
|
||||||
<input
|
<input
|
||||||
type="password"
|
type="password"
|
||||||
id="password"
|
id="password"
|
||||||
@@ -231,43 +193,29 @@ const handleChange = () => {
|
|||||||
class="inline-flex justify-center rounded-lg font-black py-2 bg-text-primary text-bg w-full"
|
class="inline-flex justify-center rounded-lg font-black py-2 bg-text-primary text-bg w-full"
|
||||||
type="submit"
|
type="submit"
|
||||||
>
|
>
|
||||||
<span v-if="type === 'login'">
|
<span v-if="type === 'login'"> 登入 </span>
|
||||||
<!-- Log In -->
|
<span v-else> 註冊 </span>
|
||||||
登入
|
|
||||||
</span>
|
|
||||||
<span v-else>
|
|
||||||
<!-- Sign Up -->
|
|
||||||
註冊
|
|
||||||
</span>
|
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<p id="SwitchLoginRegister" class="text-text flex justify-center mt-3">
|
<p id="SwitchLoginRegister" class="text-text flex justify-center mt-3">
|
||||||
<span id="CheckRegistered" v-if="type === 'register'">
|
<span id="CheckRegistered" v-if="type === 'register'">
|
||||||
<!-- Already have an account? -->
|
|
||||||
已經有帳號了嗎?
|
已經有帳號了嗎?
|
||||||
<RouterLink
|
<RouterLink
|
||||||
id="SwitchtoLogin"
|
id="SwitchtoLogin"
|
||||||
class="text-text-primary font-bold"
|
class="text-text-primary font-bold"
|
||||||
to="/login"
|
to="/login"
|
||||||
>
|
>
|
||||||
<u>
|
<u> 登入 </u>
|
||||||
<!-- Log in -->
|
|
||||||
登入
|
|
||||||
</u>
|
|
||||||
</RouterLink></span
|
</RouterLink></span
|
||||||
>
|
>
|
||||||
<span id="CheckRegistered" v-else-if="type === 'login'">
|
<span id="CheckRegistered" v-else-if="type === 'login'">
|
||||||
<!-- Don't have an account? -->
|
|
||||||
還沒有帳號嗎?
|
還沒有帳號嗎?
|
||||||
<RouterLink
|
<RouterLink
|
||||||
id="SwitchtoRegister"
|
id="SwitchtoRegister"
|
||||||
class="text-text-primary font-bold"
|
class="text-text-primary font-bold"
|
||||||
to="/register"
|
to="/register"
|
||||||
>
|
>
|
||||||
<u>
|
<u> 註冊 </u>
|
||||||
<!-- Sign up -->
|
|
||||||
註冊
|
|
||||||
</u>
|
|
||||||
</RouterLink></span
|
</RouterLink></span
|
||||||
>
|
>
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<font-awesome-icon :icon="['fas', 'list']" class="text-text-primary p-1" />
|
<font-awesome-icon :icon="['fas', 'list']" class="text-text-primary p-1" />
|
||||||
<h1 id="CommandBook" class="inline text-text-primary font-xl">
|
<h1 id="CommandBook" class="inline text-text-primary font-xl">指令之書</h1>
|
||||||
<!-- Command Cheatsheets -->
|
|
||||||
指令之書
|
|
||||||
</h1>
|
|
||||||
<div id="cheatsheets">
|
<div id="cheatsheets">
|
||||||
<p class="text-text-secondary">
|
<p class="text-text-secondary">--指令列表--</p>
|
||||||
<!-- --Command List-- -->
|
|
||||||
-- --指令列表-- --
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import { ref } from 'vue'
|
import { ref } from 'vue'
|
||||||
@@ -47,7 +47,6 @@ setTimeout(() => {
|
|||||||
id="QuestCompleted"
|
id="QuestCompleted"
|
||||||
class="text-2xl text-text mb-5 w-full inline-flex justify-center"
|
class="text-2xl text-text mb-5 w-full inline-flex justify-center"
|
||||||
>
|
>
|
||||||
<!-- Quest Completed! -->
|
|
||||||
關卡完成!
|
關卡完成!
|
||||||
</h2>
|
</h2>
|
||||||
<div class="z-10 right-1/2 top-1/2" @animationend="defineComponent">
|
<div class="z-10 right-1/2 top-1/2" @animationend="defineComponent">
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
defineProps({
|
||||||
|
url: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
icons: {
|
||||||
|
type: Array,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
title: {
|
||||||
|
type: String,
|
||||||
|
required: true,
|
||||||
|
},
|
||||||
|
desciption: String,
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div class="flex flex-col">
|
||||||
|
<a :href="url" target="_blank" class="h-10 w-10" :title="desciption">
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="icons"
|
||||||
|
:alt="title"
|
||||||
|
class="text-text-primary h-10 delay-130 hover:-translate-y-1 hover:scale-110"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,55 +1,4 @@
|
|||||||
<template>
|
<script setup lang="ts">
|
||||||
<section class="h-[10%] p-3 grid grid-cols-4 gap-4 place-content-between">
|
|
||||||
<button id="survey" class="bg-bg-secondary rounded-lg p-2">
|
|
||||||
<a title="Survey" :href="surveyUrl" target="_blank" class="h-5 w-5">
|
|
||||||
<font-awesome-icon
|
|
||||||
:icon="['fas', 'file-invoice']"
|
|
||||||
class="text-text-primary"
|
|
||||||
/>
|
|
||||||
<p class="text-text-primary inline ml-1">
|
|
||||||
<!-- Survey -->
|
|
||||||
問卷
|
|
||||||
</p>
|
|
||||||
</a>
|
|
||||||
</button>
|
|
||||||
<button disabled id="solution" class="bg-bg-disabled rounded-lg p-2">
|
|
||||||
<font-awesome-icon
|
|
||||||
:icon="['far', 'circle-question']"
|
|
||||||
class="text-text-disabled"
|
|
||||||
/>
|
|
||||||
<p class="text-text-disabled inline ml-1">
|
|
||||||
<!-- Solution -->
|
|
||||||
解答
|
|
||||||
</p>
|
|
||||||
</button>
|
|
||||||
<button id="reset" class="bg-bg-secondary rounded-lg p-2" @click="reset">
|
|
||||||
<font-awesome-icon
|
|
||||||
:icon="['fas', 'arrow-rotate-left']"
|
|
||||||
class="text-text-primary"
|
|
||||||
/>
|
|
||||||
<p class="text-text-primary inline ml-1">
|
|
||||||
<!-- Reset -->
|
|
||||||
重來
|
|
||||||
</p>
|
|
||||||
</button>
|
|
||||||
<button
|
|
||||||
id="continue"
|
|
||||||
class="bg-bg-secondary rounded-lg p-2"
|
|
||||||
@click="continuePlay"
|
|
||||||
>
|
|
||||||
<font-awesome-icon
|
|
||||||
:icon="['far', 'circle-right']"
|
|
||||||
class="text-text-primary"
|
|
||||||
/>
|
|
||||||
<p class="text-text-primary inline ml-1">
|
|
||||||
<!-- Continue -->
|
|
||||||
繼續
|
|
||||||
</p>
|
|
||||||
</button>
|
|
||||||
</section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import { createSession } from '../store/session'
|
import { createSession } from '../store/session'
|
||||||
@@ -64,9 +13,47 @@ const continuePlay = async () => {
|
|||||||
try {
|
try {
|
||||||
router.push({ name: 'map' })
|
router.push({ name: 'map' })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// useToast().error('Failed to load map')
|
|
||||||
useToast().error('無法讀取地圖')
|
useToast().error('無法讀取地圖')
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<section class="h-[10%] p-3 grid grid-cols-4 gap-4 place-content-between">
|
||||||
|
<button id="survey" class="bg-bg-secondary rounded-lg p-2">
|
||||||
|
<a title="Survey" :href="surveyUrl" target="_blank" class="h-5 w-5">
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'file-invoice']"
|
||||||
|
class="text-text-primary"
|
||||||
|
/>
|
||||||
|
<p class="text-text-primary inline ml-1">問卷</p>
|
||||||
|
</a>
|
||||||
|
</button>
|
||||||
|
<button disabled id="solution" class="bg-bg-disabled rounded-lg p-2">
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['far', 'circle-question']"
|
||||||
|
class="text-text-disabled"
|
||||||
|
/>
|
||||||
|
<p class="text-text-disabled inline ml-1">解答</p>
|
||||||
|
</button>
|
||||||
|
<button id="reset" class="bg-bg-secondary rounded-lg p-2" @click="reset">
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'arrow-rotate-left']"
|
||||||
|
class="text-text-primary"
|
||||||
|
/>
|
||||||
|
<p class="text-text-primary inline ml-1">重來</p>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
id="continue"
|
||||||
|
class="bg-bg-secondary rounded-lg p-2"
|
||||||
|
@click="continuePlay"
|
||||||
|
>
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['far', 'circle-right']"
|
||||||
|
class="text-text-primary"
|
||||||
|
/>
|
||||||
|
<p class="text-text-primary inline ml-1">繼續</p>
|
||||||
|
</button>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
@@ -1,26 +1,34 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
|
|
||||||
const cw = ref(0)
|
const cw = ref(0)
|
||||||
const ch = ref(0)
|
const ch = ref(0)
|
||||||
const fallingCharArr = ref([])
|
const fallingCharArr = ref<
|
||||||
|
{ value: string; x: number; y: number; speed: number }[]
|
||||||
|
>([])
|
||||||
const fontSize = ref(16)
|
const fontSize = ref(16)
|
||||||
const maxColums = ref(0)
|
const maxColums = ref(0)
|
||||||
const charArr = ['0', '1', '', '', '']
|
const charArr = ['0', '1', '', '', '']
|
||||||
const ctx = ref(null)
|
const ctx = ref<CanvasRenderingContext2D | null>(null)
|
||||||
|
|
||||||
const randomInt = (min, max) => {
|
const randomInt = (min: number, max: number) => {
|
||||||
return Math.floor(Math.random() * (max - min) + min)
|
return Math.floor(Math.random() * (max - min) + min)
|
||||||
}
|
}
|
||||||
|
|
||||||
const randomFloat = (min, max) => {
|
const randomFloat = (min: number, max: number) => {
|
||||||
return Math.random() * (max - min) + min
|
return Math.random() * (max - min) + min
|
||||||
}
|
}
|
||||||
|
|
||||||
const draw = (point) => {
|
const draw = (point: {
|
||||||
|
value: string
|
||||||
|
x: number
|
||||||
|
y: number
|
||||||
|
speed: number
|
||||||
|
}) => {
|
||||||
point.value = charArr[randomInt(0, charArr.length)].toUpperCase()
|
point.value = charArr[randomInt(0, charArr.length)].toUpperCase()
|
||||||
if (point.y < 0) point.speed = randomFloat(10, 20)
|
if (point.y < 0) point.speed = randomFloat(10, 20)
|
||||||
|
|
||||||
|
if (ctx.value === null) return
|
||||||
ctx.value.fillStyle = '#0F0'
|
ctx.value.fillStyle = '#0F0'
|
||||||
ctx.value.font = `${fontSize.value}px san-serif`
|
ctx.value.font = `${fontSize.value}px san-serif`
|
||||||
ctx.value.fillText(point.value, point.x, point.y)
|
ctx.value.fillText(point.value, point.x, point.y)
|
||||||
@@ -33,6 +41,7 @@ const draw = (point) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const update = () => {
|
const update = () => {
|
||||||
|
if (ctx.value === null) return
|
||||||
ctx.value.fillStyle = 'rgba(0,0,0,0.05)'
|
ctx.value.fillStyle = 'rgba(0,0,0,0.05)'
|
||||||
ctx.value.fillRect(0, 0, cw.value, ch.value)
|
ctx.value.fillRect(0, 0, cw.value, ch.value)
|
||||||
|
|
||||||
@@ -48,7 +57,7 @@ onMounted(() => {
|
|||||||
ch.value = document.documentElement.clientHeight
|
ch.value = document.documentElement.clientHeight
|
||||||
maxColums.value = cw.value / fontSize.value
|
maxColums.value = cw.value / fontSize.value
|
||||||
|
|
||||||
const canvas = document.querySelector('canvas')
|
const canvas = document.querySelector('canvas') as HTMLCanvasElement
|
||||||
ctx.value = canvas.getContext('2d')
|
ctx.value = canvas.getContext('2d')
|
||||||
|
|
||||||
canvas.width = cw.value
|
canvas.width = cw.value
|
||||||
@@ -58,6 +67,8 @@ onMounted(() => {
|
|||||||
fallingCharArr.value.push({
|
fallingCharArr.value.push({
|
||||||
x: i * fontSize.value,
|
x: i * fontSize.value,
|
||||||
y: randomFloat(-500, 0),
|
y: randomFloat(-500, 0),
|
||||||
|
value: '',
|
||||||
|
speed: 0,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
node: {
|
node: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { defineProps, onMounted } from 'vue'
|
import { defineProps, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
@@ -21,34 +21,15 @@ const handleLogout = async () => {
|
|||||||
reset()
|
reset()
|
||||||
router.push({ name: 'login' })
|
router.push({ name: 'login' })
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// toast.error('Failed to logout')
|
|
||||||
toast.error('登出失敗')
|
toast.error('登出失敗')
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const handleMap = async () => {
|
|
||||||
try {
|
|
||||||
router.push({ name: 'map' })
|
|
||||||
} catch (err) {
|
|
||||||
// toast.error('Failed to load map')
|
|
||||||
toast.error('無法讀取地圖')
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const handleLeaderBoard = async () => {
|
|
||||||
try {
|
|
||||||
router.push({ name: 'leaderboard' })
|
|
||||||
} catch (err) {
|
|
||||||
// toast.error('Failed to load map')
|
|
||||||
toast.error('無法讀取排行榜')
|
|
||||||
console.error(err)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
defineProps({
|
defineProps({
|
||||||
title: {
|
title: {
|
||||||
type: String,
|
type: String,
|
||||||
required: true,
|
required: false,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -56,7 +37,7 @@ onMounted(async () => {
|
|||||||
try {
|
try {
|
||||||
await loadUserProfile()
|
await loadUserProfile()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// toast.error('Failed to load user profile')
|
console.error(err)
|
||||||
toast.error('無法讀取使用者資料')
|
toast.error('無法讀取使用者資料')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -126,18 +107,18 @@ onMounted(async () => {
|
|||||||
class="text-text-primary h-full w-full"
|
class="text-text-primary h-full w-full"
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<button title="LeaderBoard" @click="handleLeaderBoard" class="h-5 w-5">
|
<RouterLink title="LeaderBoard" to="/leaderboard" class="h-5 w-5">
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['fas', 'trophy']"
|
:icon="['fas', 'trophy']"
|
||||||
class="text-text-primary h-full w-full"
|
class="text-text-primary h-full w-full"
|
||||||
/>
|
/>
|
||||||
</button>
|
</RouterLink>
|
||||||
<button title="Map" @click="handleMap" class="h-5 w-5">
|
<RouterLink title="Map" to="/map" class="h-5 w-5">
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['fas', 'map']"
|
:icon="['fas', 'map']"
|
||||||
class="text-text-primary h-full w-full"
|
class="text-text-primary h-full w-full"
|
||||||
/>
|
/>
|
||||||
</button>
|
</RouterLink>
|
||||||
<a
|
<a
|
||||||
title="Bug Report"
|
title="Bug Report"
|
||||||
:href="bugReportUrl"
|
:href="bugReportUrl"
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, watch } from 'vue'
|
import { ref, watch } from 'vue'
|
||||||
import sessionStore from '../store/session'
|
import sessionStore from '../store/session'
|
||||||
import MarkdownText from './MarkdownText.vue'
|
import MarkdownText from './MarkdownText.vue'
|
||||||
@@ -26,7 +26,9 @@ const right = () => {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="w-full flex items-center p-2">
|
<div class="h-full flex flex-col">
|
||||||
|
<!-- Hint Header -->
|
||||||
|
<div class="flex items-center p-2 h-10">
|
||||||
<font-awesome-icon
|
<font-awesome-icon
|
||||||
:icon="['far', 'lightbulb']"
|
:icon="['far', 'lightbulb']"
|
||||||
class="text-yellow-200 p-2 content-center"
|
class="text-yellow-200 p-2 content-center"
|
||||||
@@ -63,16 +65,26 @@ const right = () => {
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div id="hint" class="bg-bg flex flex-wrap p-8">
|
<div id="hint" class="bg-bg p-8 overflow-y-auto">
|
||||||
<ul>
|
<ul>
|
||||||
|
<li
|
||||||
|
v-for="response in sessionStore.session.responses[current]"
|
||||||
|
:key="response.type"
|
||||||
|
class="text-text font-xl whitespace-pre-wrap"
|
||||||
|
>
|
||||||
|
<div v-for="content in response.content" :key="content">
|
||||||
|
<MarkdownText :content="content" />
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
<li
|
<li
|
||||||
v-for="hint in sessionStore.session.hints[current]"
|
v-for="hint in sessionStore.session.hints[current]"
|
||||||
:key="hint"
|
:key="hint"
|
||||||
class="text-text font-xl whitespace-pre-wrap"
|
class="text-text-primary font-xl whitespace-pre-wrap"
|
||||||
>
|
>
|
||||||
<MarkdownText :content="hint" />
|
<MarkdownText :content="hint" />
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<br />
|
<br />
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { computed, defineProps } from 'vue'
|
import { computed, defineProps } from 'vue'
|
||||||
import markdown2HTML from '../utils/markdown'
|
import markdown2HTML from '../utils/markdown'
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<!-- eslint-disable no-console -->
|
<!-- eslint-disable no-console -->
|
||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useRouter } from 'vue-router'
|
import { useRouter } from 'vue-router'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
@@ -50,7 +50,7 @@ async function getProgress() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const genOption = (nodes, edges) => ({
|
const genOption = (nodes: any, edges: any) => ({
|
||||||
renderer: 'svg',
|
renderer: 'svg',
|
||||||
tooltip: {},
|
tooltip: {},
|
||||||
animationDurationUpdate: 1500,
|
animationDurationUpdate: 1500,
|
||||||
@@ -94,7 +94,7 @@ const genOption = (nodes, edges) => ({
|
|||||||
curveness: 0.08,
|
curveness: 0.08,
|
||||||
},
|
},
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
color: (params) => {
|
color: (params: any) => {
|
||||||
const {
|
const {
|
||||||
data: { completed, unlocked },
|
data: { completed, unlocked },
|
||||||
} = params
|
} = params
|
||||||
@@ -111,7 +111,7 @@ const genOption = (nodes, edges) => ({
|
|||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
function getOption(quests, progress) {
|
function getOption(quests: any, progress: any) {
|
||||||
const dag = new DAG(quests)
|
const dag = new DAG(quests)
|
||||||
|
|
||||||
const nodes = dag.getNodes().map((node) => ({
|
const nodes = dag.getNodes().map((node) => ({
|
||||||
@@ -120,9 +120,9 @@ function getOption(quests, progress) {
|
|||||||
y: marginX * node.index - (marginX * dag.getLayer(node._id)) / 2,
|
y: marginX * node.index - (marginX * dag.getLayer(node._id)) / 2,
|
||||||
x: marginY * node.layer * 2,
|
x: marginY * node.layer * 2,
|
||||||
completed: progress[node._id]?.completed || false,
|
completed: progress[node._id]?.completed || false,
|
||||||
unlocked: node.requirements.every((req) => progress[req]?.completed),
|
unlocked: node.requirements.every((req: any) => progress[req]?.completed),
|
||||||
}))
|
}))
|
||||||
const lineAppearence = (node) => {
|
const lineAppearence = (node: any) => {
|
||||||
try {
|
try {
|
||||||
const { unlocked } = node
|
const { unlocked } = node
|
||||||
return {
|
return {
|
||||||
@@ -134,7 +134,7 @@ function getOption(quests, progress) {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const edges = dag.getEdgesArray().map((edge) => ({
|
const edges = dag.getEdgesArray().map((edge: any) => ({
|
||||||
source: edge[0],
|
source: edge[0],
|
||||||
target: edge[1],
|
target: edge[1],
|
||||||
lineStyle: lineAppearence(nodes.find((node) => node.id === edge[1])),
|
lineStyle: lineAppearence(nodes.find((node) => node.id === edge[1])),
|
||||||
@@ -145,10 +145,10 @@ function getOption(quests, progress) {
|
|||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
function initChart(option) {
|
function initChart(option: any) {
|
||||||
chartInstance = init(chartContainer.value)
|
chartInstance = init(chartContainer.value)
|
||||||
chartInstance.setOption(option)
|
chartInstance.setOption(option)
|
||||||
chartInstance.on('click', (params) => {
|
chartInstance.on('click', (params: any) => {
|
||||||
const {
|
const {
|
||||||
data: { id, unlocked },
|
data: { id, unlocked },
|
||||||
} = params
|
} = params
|
||||||
@@ -156,7 +156,6 @@ function initChart(option) {
|
|||||||
if (unlocked) {
|
if (unlocked) {
|
||||||
router.push({ name: 'game', params: { questId: id } })
|
router.push({ name: 'game', params: { questId: id } })
|
||||||
} else {
|
} else {
|
||||||
// toast.warning('You have not completed the previous quest yet!')
|
|
||||||
toast.warning('你還沒完成前一個關卡!')
|
toast.warning('你還沒完成前一個關卡!')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -181,7 +180,6 @@ onMounted(async () => {
|
|||||||
class="p-4 absolute w-fit z-2 font-mono flex flax-wrap text-xl"
|
class="p-4 absolute w-fit z-2 font-mono flex flax-wrap text-xl"
|
||||||
style="width: 30%; height: 6%; font-size: 3vh; color: #00ff00"
|
style="width: 30%; height: 6%; font-size: 3vh; color: #00ff00"
|
||||||
>
|
>
|
||||||
<!-- Get through your linux journey! -->
|
|
||||||
踏上你的Linux冒險之旅吧!
|
踏上你的Linux冒險之旅吧!
|
||||||
</h1>
|
</h1>
|
||||||
<div class="flex flex-wrap absolute w-full h-full z-1">
|
<div class="flex flex-wrap absolute w-full h-full z-1">
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { computed } from 'vue'
|
import { computed } from 'vue'
|
||||||
import MarkdownText from './MarkdownText.vue'
|
import MarkdownText from './MarkdownText.vue'
|
||||||
import sessionStore from '../store/session'
|
import sessionStore from '../store/session'
|
||||||
|
import { Task } from '../types'
|
||||||
|
|
||||||
const tasks = computed(() => {
|
const tasks = computed(() => {
|
||||||
return sessionStore.session.tasks.map((task) => {
|
return sessionStore.session.tasks.map((task: Task) => {
|
||||||
const prefix = task.completed ? '✓' : '➤'
|
const prefix = task.completed ? '✓' : '➤'
|
||||||
const color = task.completed ? 'text-text-primary' : 'text-text'
|
const color = task.completed ? 'text-text-primary' : 'text-text'
|
||||||
return {
|
return {
|
||||||
@@ -29,10 +30,7 @@ const tasks = computed(() => {
|
|||||||
:content="sessionStore.quest.instruction"
|
:content="sessionStore.quest.instruction"
|
||||||
/>
|
/>
|
||||||
<br />
|
<br />
|
||||||
<p id="tasks" class="text-text">
|
<p id="tasks" class="text-text">任務:</p>
|
||||||
<!-- Tasks: -->
|
|
||||||
任務:
|
|
||||||
</p>
|
|
||||||
<ul v-if="sessionStore.session">
|
<ul v-if="sessionStore.session">
|
||||||
<li v-for="task in tasks" :key="task.id">
|
<li v-for="task in tasks" :key="task.id">
|
||||||
<MarkdownText :class="task.class" :content="task.content" />
|
<MarkdownText :class="task.class" :content="task.content" />
|
||||||
|
|||||||
@@ -1,25 +1,23 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import { onMounted, ref } from 'vue'
|
||||||
|
import { useTerminal } from '../store/session'
|
||||||
|
|
||||||
|
const terminal = ref<HTMLElement | null>(null)
|
||||||
|
|
||||||
|
onMounted(() => {
|
||||||
|
const term = useTerminal()
|
||||||
|
if (!terminal.value) return
|
||||||
|
term.mount(terminal.value)
|
||||||
|
window.addEventListener('resize', () => term.resizeScreen())
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<font-awesome-icon :icon="['fas', 'terminal']" class="text-text p-1" />
|
<font-awesome-icon :icon="['fas', 'terminal']" class="text-text p-1" />
|
||||||
<button id="Terminal" class="text-text h-[5%]">
|
<button id="Terminal" class="text-text h-[5%]">終端機</button>
|
||||||
<!-- Terminal -->
|
|
||||||
終端機
|
|
||||||
</button>
|
|
||||||
<div
|
<div
|
||||||
id="terminal"
|
id="terminal"
|
||||||
ref="terminal"
|
ref="terminal"
|
||||||
class="bg-bg-secondary h-[calc(100%-5%)] p-0.5"
|
class="bg-bg-secondary h-[calc(100%-5%)] p-0.5"
|
||||||
></div>
|
></div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
|
||||||
import { onMounted, ref } from 'vue'
|
|
||||||
import { useTerminal } from '../store/session'
|
|
||||||
|
|
||||||
const terminal = ref(null)
|
|
||||||
|
|
||||||
onMounted(() => {
|
|
||||||
const term = useTerminal()
|
|
||||||
term.mount(terminal.value)
|
|
||||||
window.addEventListener('resize', () => term.resizeScreen())
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import FileNode from './FileNode.vue'
|
import FileNode from './FileNode.vue'
|
||||||
import sessionStore from '../store/session.js'
|
import sessionStore from '../store/session'
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
|||||||
@@ -1,19 +1,21 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted } from 'vue'
|
import { ref, onMounted, onUnmounted } from 'vue'
|
||||||
import TreeChart from './TreeChart.vue'
|
import TreeChart from './TreeChart.vue'
|
||||||
|
|
||||||
const treeRef = ref(null)
|
const treeRef = ref<HTMLElement | null>(null)
|
||||||
let pos = { top: 0, left: 0, x: 0, y: 0 }
|
let pos = { top: 0, left: 0, x: 0, y: 0 }
|
||||||
|
|
||||||
function mouseMoveHandler(e) {
|
function mouseMoveHandler(e: MouseEvent) {
|
||||||
const dx = e.clientX - pos.x
|
const dx = e.clientX - pos.x
|
||||||
const dy = e.clientY - pos.y
|
const dy = e.clientY - pos.y
|
||||||
|
|
||||||
|
if (treeRef.value === null) return
|
||||||
treeRef.value.scrollTop = pos.top - dy
|
treeRef.value.scrollTop = pos.top - dy
|
||||||
treeRef.value.scrollLeft = pos.left - dx
|
treeRef.value.scrollLeft = pos.left - dx
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseUpHandler() {
|
function mouseUpHandler() {
|
||||||
|
if (treeRef.value === null) return
|
||||||
treeRef.value.style.cursor = 'grab'
|
treeRef.value.style.cursor = 'grab'
|
||||||
treeRef.value.style.removeProperty('user-select')
|
treeRef.value.style.removeProperty('user-select')
|
||||||
|
|
||||||
@@ -21,7 +23,8 @@ function mouseUpHandler() {
|
|||||||
document.removeEventListener('mouseup', mouseUpHandler)
|
document.removeEventListener('mouseup', mouseUpHandler)
|
||||||
}
|
}
|
||||||
|
|
||||||
function mouseDownHandler(e) {
|
function mouseDownHandler(e: MouseEvent) {
|
||||||
|
if (treeRef.value === null) return
|
||||||
treeRef.value.style.cursor = 'grabbing'
|
treeRef.value.style.cursor = 'grabbing'
|
||||||
treeRef.value.style.userSelect = 'none'
|
treeRef.value.style.userSelect = 'none'
|
||||||
|
|
||||||
@@ -37,6 +40,7 @@ function mouseDownHandler(e) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
|
if (treeRef.value === null) return
|
||||||
treeRef.value.style.cursor = 'grab'
|
treeRef.value.style.cursor = 'grab'
|
||||||
treeRef.value.addEventListener('mousedown', mouseDownHandler)
|
treeRef.value.addEventListener('mousedown', mouseDownHandler)
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
export const surveyUrl = '/api/v1/survey'
|
|
||||||
export const bugReportUrl = '/api/v1/bug-report'
|
|
||||||
|
|
||||||
export default {
|
|
||||||
surveyUrl,
|
|
||||||
bugReportUrl,
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export const surveyUrl = '/api/v1/survey'
|
||||||
|
export const bugReportUrl = '/api/v1/bug-report'
|
||||||
|
export const facebookUrl = 'https://www.facebook.com/LinuxOdyssey'
|
||||||
|
export const githubUrl = 'https://github.com/linux-odyssey/linux-odyssey'
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<path d="M0 0H512V512H0V0Z" fill="url(#pattern0)"/>
|
||||||
|
<defs>
|
||||||
|
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||||
|
<use xlink:href="#image0_426_5" transform="scale(0.00195312)"/>
|
||||||
|
</pattern>
|
||||||
|
<image id="image0_426_5" width="512" height="512" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAN1wAADdcBQiibeAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N13nCV1nf3/V9UNHWcGScrqgEoWBhB13TWjCCimNdHdpnuVbhX1ortr3J+r7vpz17TqNa3gesvADMGIoChmwRzAgHFEyTTDpO6Znr73VtX3j9uX6em53X1DVX2q6p7nY/sBdKh67zjd5/Sn6n7K8n0fiadioTQIHLjwdtCif1/tfVlg58LbjiX/bPW+xR+7ueKU747k/0ERETHGUgEwr1go5YATgYcuejsOGDY00s3AdUvebqw4Zf1lERFJCRWAiBULpQzwIPYN+5OBAZNztWEHcD37loLfVpxy1ehUIiLSFRWAEBULJRs4BngYe8P+FMz9Zh+0GnADewvBVRWn/Hu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vqbbASTxtD1wk9X7ITzPPav3o4iki+nw9zyfu7ZsYdeu3SZOfw/btv3hoaFv5XLZiWOLine truncated
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 32 KiB |
@@ -0,0 +1,9 @@
|
|||||||
|
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<path d="M0 0H512V512H0V0Z" fill="url(#pattern0)"/>
|
||||||
|
<defs>
|
||||||
|
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||||
|
<use xlink:href="#image0_424_19" transform="scale(0.00195312)"/>
|
||||||
|
</pattern>
|
||||||
|
<image id="image0_424_19" width="512" height="512" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAIACAYAAAD0eNT6AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAACAASURBVHic7N15fFTlvT/wz/c558yShIQkhJCErOyg4C6I+77vqIDa6m2tu7b11i63Ld7bX2/be7svt5u1ta29rXaxLrX1Vm2rdd/ABUFEIEEgkGQme2bmPL8/QjBAlkkyM885M5/363VvIUzm+dRiPt85y3MEREREPrdtm84PBFAqEisRkVKlJN91EQbcIhHkay1hpVCotRRojbBSepLWmKQ1wiIo2P02CpCi999VFw9aohCAlUSUKIDE7l/3AdK5+716AHQDgNboFEGfCFq11t0iqhvQbVqjSwTdrqvblFLbtXa3ae2snzxZWif0D2cYko43JSIiGi+tterqQnlfX2yaZakqwJ3qulIGoBSQEkCXAigBUCKCgV8HjYZOK3kHcJ8D1J+Usv40aZI0p+RdU/EmREREyWhv12XxeKxKKVUl4k7TWqoAqQB0JYAKAFUApgKwzSb1rASAR0Tkh5MmWQ+KiDveN+IAQEREKaO1DkYivVWA1QDoBqWkAUCD1mgAM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||
|
<svg width="474" height="475" viewBox="0 0 474 475" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<path d="M0 0H474V475H0V0Z" fill="url(#pattern0)"/>
|
||||||
|
<defs>
|
||||||
|
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||||
|
<use xlink:href="#image0_426_3" transform="matrix(0.00215972 0 0 0.00215517 -0.00105485 0)"/>
|
||||||
|
</pattern>
|
||||||
|
<image id="image0_426_3" width="464" height="464" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAdAAAAHQCAYAAAARXTsAAAAgAElEQVR4nOy9CZhcVZ33/z239up9qaQ7O5uOoi+iOEKW7vSQGXyRGed1Bl7GEWV3f9VBdPzraMBlZhx13EYxpJuIgkpUVlGUEBIWwUSBgAGyp5Ne0mt679ru+T+nOgWdTnfXdpdzzv19noeHTnfVvefe7qpPne37Y7AAzrkVhyEchjFLfv2EDVy5lYcNA99iDBFfFB/YcB4bp/tMEO5y7Nix003TXM05X2UYhkEC9TgkUfm4chs/y8exGQznnGjciybDP97WxHZ7/d4QhFNwzn1dXV1vArAawCoALQDqxekNw3jU5/N1lPzuSfJUH5KoPFy7nb+Tc2wCUD2jUSMcuLatmd3l5ftDEHbR2dkZBfBm0bsU0mSMrQFQNfN0J+S5FsAHSKBEBpKou6zfyv1HDHwJwKfEr2OuxnBgw0g9Prr5bJbwyK0hCFvo7++vnJyc/EvDMNZxzkUv8zwAofnONU2e4uuzS3rXJHnqBUnUHd67hS8O+PGzE8NE+bAzbeLSTS3skMduFUEUTXt7+6JAILDqhCzFa+1c4cF8jzddngD66uvrF5BAiVcggTrP1Y/yFsZwJ4CGAk/eBxNXtLaw3+hwHwjCaqYv+AGwDsDpxZ5ihjwF98Zisb8v+h2T5KknJFGH4Jxdsz0zXPtlAL4iTypehF8dPobPbr6MpZW7BwRhEfMt+CmVWeQp+GQsFvs6CZQ4CRKo/Vy/lden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sUpAJyYA6qw4g00lCdKnf+EEwIlearFiQVCVwO4iQMLvX4/iLmJ+sx+qrCiP5rKs6gC2jOxVaAkT3VYz7lxZBv+IT2GLwM4y+v3g5gfUWHloyv6DlGFFb3RVZ4Axurq6p4p9SC2CJTEqQ5ZcR7Zji+B4TVevx+yYJomBro7Mq+luobF4kUlVfuowor+aCxPwVOMsWSpB7FcoCRPNXhFnNvwRTC81uv3QyYSkxPo6WhHKhHPtCoZn0RsyQr4/HIkb76lavxpqrCiN5rLE1bMfwoY5yUtQjr1gCRQqTkhzncAGXGe4/X7IRvDA30Y6OkCZrwuff4AFixZjlAk6mqLRYWVDy/vq6eQeH3xgDyFpy6sr69/pOTjWClQkqe8CHEefQzv4hxfAPAGr98P2UinUujvOoLx0ZE5WyZeX7WNi1FR5U74U4jx0X89/dgxv8HPcKUBhO14QZ5iUCedTtc0NDSMlXogywRK8pSTS//MgxV9uJwBnxZRpV6/HzIyOT6K3o4jSKfym5KpqK5FbcNiR19zosLKx5b3PF0XTFOFFU3xiDwFT8diMUv+ji2ZVCF5ysc/P8Urw3FcxfpwIwfFq8mI+PA61NeD4/3HgAI+x44cH0AyEUds8XLH5kWpworeeEiesGr+E1YIlOQpF9ds4cvhxwcRxwcAVFk7w01YRSqZQG9HO+IT40UdcXJ8DJ2H9mLB4hUIRezdhkkVVvTGY/KElQItaQiX5CkPVz/Gz2EcN4Djn2QqlE6cytjQIPq7OzJbVUols82lcQnKq2psudM1gXTnJ5b3hMRp6FepHx6UJw+FQrHKysp+Kw5W9BstydN9xMKg9m24iDHcABMXev1+yE52b+fo0KBlLRUfgPs6j2S2utTEGjOTlVbhY3zyw0t7jzNGc+cLine truncated
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 34 KiB |
File renamed without changes.
@@ -18,13 +18,18 @@ import {
|
|||||||
faMap,
|
faMap,
|
||||||
faTrophy,
|
faTrophy,
|
||||||
faFileInvoice,
|
faFileInvoice,
|
||||||
|
faEnvelope,
|
||||||
} from '@fortawesome/free-solid-svg-icons'
|
} from '@fortawesome/free-solid-svg-icons'
|
||||||
import {
|
import {
|
||||||
faLightbulb,
|
faLightbulb,
|
||||||
faCircleQuestion,
|
faCircleQuestion,
|
||||||
faCircleRight,
|
faCircleRight,
|
||||||
} from '@fortawesome/free-regular-svg-icons'
|
} from '@fortawesome/free-regular-svg-icons'
|
||||||
import { faGithub, faGoogle } from '@fortawesome/free-brands-svg-icons'
|
import {
|
||||||
|
faFacebook,
|
||||||
|
faGithub,
|
||||||
|
faGoogle,
|
||||||
|
} from '@fortawesome/free-brands-svg-icons'
|
||||||
|
|
||||||
/* add icons to the library */
|
/* add icons to the library */
|
||||||
library.add(
|
library.add(
|
||||||
@@ -47,5 +52,7 @@ library.add(
|
|||||||
faCircleRight,
|
faCircleRight,
|
||||||
faGithub,
|
faGithub,
|
||||||
faGoogle,
|
faGoogle,
|
||||||
faFileInvoice
|
faFileInvoice,
|
||||||
|
faFacebook,
|
||||||
|
faEnvelope
|
||||||
)
|
)
|
||||||
File renamed without changes.
@@ -5,15 +5,14 @@ import RegisterPage from './views/RegisterPage.vue'
|
|||||||
import ChooseUsernamePage from './views/ChooseUsernamePage.vue'
|
import ChooseUsernamePage from './views/ChooseUsernamePage.vue'
|
||||||
import QuestMapPage from './views/QuestMapPage.vue'
|
import QuestMapPage from './views/QuestMapPage.vue'
|
||||||
import LeaderboardPage from './views/LeaderboardPage.vue'
|
import LeaderboardPage from './views/LeaderboardPage.vue'
|
||||||
|
import LandingPage from './views/LandingPage.vue'
|
||||||
import { isLoggedIn } from './utils/auth'
|
import { isLoggedIn } from './utils/auth'
|
||||||
|
|
||||||
const routes = [
|
const routes = [
|
||||||
{
|
{
|
||||||
path: '/',
|
path: '/',
|
||||||
redirect: {
|
name: 'landing-page',
|
||||||
name: 'register',
|
component: LandingPage,
|
||||||
},
|
|
||||||
meta: { requiresGuest: true },
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
@@ -58,7 +57,7 @@ const router = createRouter({
|
|||||||
routes,
|
routes,
|
||||||
})
|
})
|
||||||
|
|
||||||
router.beforeEach(async (to, from, next) => {
|
router.beforeEach(async (to, _from, next) => {
|
||||||
const loggedIn = await isLoggedIn()
|
const loggedIn = await isLoggedIn()
|
||||||
// Check if the route requires authentication
|
// Check if the route requires authentication
|
||||||
if (to.meta.requiresAuth && !loggedIn) {
|
if (to.meta.requiresAuth && !loggedIn) {
|
||||||
@@ -1,10 +1,12 @@
|
|||||||
import { reactive } from 'vue'
|
import { reactive } from 'vue'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import { FileGraph } from '@linux-odyssey/file-graph'
|
import { FileGraph, FileObject } from '@linux-odyssey/file-graph'
|
||||||
|
import { IQuest } from '@linux-odyssey/models'
|
||||||
import api from '../utils/api'
|
import api from '../utils/api'
|
||||||
import Socket from '../utils/socket'
|
import Socket from '../utils/socket'
|
||||||
import SocketTerminal from '../utils/terminal'
|
import SocketTerminal from '../utils/terminal'
|
||||||
import { LoadQuestError, LoadSessionError } from '../utils/errors'
|
import { LoadQuestError, LoadSessionError } from '../utils/errors'
|
||||||
|
import { Session, StageResponse } from '../types'
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
|
|
||||||
@@ -15,15 +17,23 @@ function newSession() {
|
|||||||
discovered: false,
|
discovered: false,
|
||||||
})
|
})
|
||||||
return {
|
return {
|
||||||
|
_id: '',
|
||||||
status: 'inactive',
|
status: 'inactive',
|
||||||
graph,
|
graph,
|
||||||
pwd: '',
|
pwd: '',
|
||||||
hints: [],
|
hints: [],
|
||||||
tasks: [],
|
tasks: [],
|
||||||
|
responses: [],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = reactive({
|
interface Store {
|
||||||
|
session: Session
|
||||||
|
questId: string
|
||||||
|
quest: IQuest | null
|
||||||
|
}
|
||||||
|
|
||||||
|
const store = reactive<Store>({
|
||||||
session: newSession(),
|
session: newSession(),
|
||||||
questId: '',
|
questId: '',
|
||||||
quest: null,
|
quest: null,
|
||||||
@@ -32,23 +42,28 @@ const store = reactive({
|
|||||||
const socket = new Socket()
|
const socket = new Socket()
|
||||||
const term = new SocketTerminal(40, 80)
|
const term = new SocketTerminal(40, 80)
|
||||||
|
|
||||||
function setQuest(questId) {
|
function setQuest(questId: string) {
|
||||||
return api.get(`/quests/${questId}`).then((res) => {
|
return api.get(`/quests/${questId}`).then((res) => {
|
||||||
store.questId = res.data._id
|
store.questId = res.data._id
|
||||||
store.quest = res.data
|
store.quest = res.data
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function setSession(session) {
|
async function setSession(session: Session) {
|
||||||
try {
|
try {
|
||||||
|
console.log('Setting session...', session)
|
||||||
store.session = session
|
store.session = session
|
||||||
store.session.graph = new FileGraph(session.graph)
|
store.session.graph = new FileGraph(session.graph)
|
||||||
term.reset()
|
term.reset()
|
||||||
await socket.connect(session)
|
await socket.connect(session)
|
||||||
term.focus()
|
term.focus()
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
if (err instanceof Error) {
|
||||||
toast.error(err.message)
|
toast.error(err.message)
|
||||||
|
} else {
|
||||||
|
toast.error('Failed to connect to the session. Please try again later.')
|
||||||
|
}
|
||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -65,7 +80,7 @@ export async function createSession() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getActiveSession(questId) {
|
async function getActiveSession(questId: string) {
|
||||||
try {
|
try {
|
||||||
const res = await api.post('/sessions/active', { questId })
|
const res = await api.post('/sessions/active', { questId })
|
||||||
await setSession(res.data)
|
await setSession(res.data)
|
||||||
@@ -76,7 +91,7 @@ async function getActiveSession(questId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateGraph(event) {
|
function updateGraph(event: { discover: FileObject[]; pwd: string }) {
|
||||||
if (event.discover) {
|
if (event.discover) {
|
||||||
store.session.graph.discover(event.discover)
|
store.session.graph.discover(event.discover)
|
||||||
}
|
}
|
||||||
@@ -85,16 +100,12 @@ function updateGraph(event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateHints(hints) {
|
function newResponse(response: StageResponse) {
|
||||||
store.session.hints.push(hints)
|
console.log('newResponse', response, 'session', store.session)
|
||||||
}
|
store.session.responses.push(response.responses)
|
||||||
|
store.session.hints.push(response.hints)
|
||||||
function updateStatus(status) {
|
store.session.tasks = response.tasks
|
||||||
store.session.status = status
|
store.session.status = response.status
|
||||||
}
|
|
||||||
|
|
||||||
function setTasks(tasks) {
|
|
||||||
store.session.tasks = tasks
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function useTerminal() {
|
export function useTerminal() {
|
||||||
@@ -108,7 +119,7 @@ export function reset() {
|
|||||||
store.quest = null
|
store.quest = null
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function init(questId) {
|
export async function init(questId: string) {
|
||||||
if (!questId) throw new Error('No quest ID provided')
|
if (!questId) throw new Error('No quest ID provided')
|
||||||
reset()
|
reset()
|
||||||
try {
|
try {
|
||||||
@@ -126,23 +137,17 @@ export async function init(questId) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function setup() {
|
function setup() {
|
||||||
socket.on('terminal', (data) => {
|
socket.on('terminal', (data: string) => {
|
||||||
term.write(data)
|
term.write(data)
|
||||||
})
|
})
|
||||||
term.onData((data) => {
|
term.onData((data: string) => {
|
||||||
socket.emit('terminal', data)
|
socket.emit('terminal', data)
|
||||||
})
|
})
|
||||||
socket.on('graph', (event) => {
|
socket.on('graph', (event: { discover: FileObject[]; pwd: string }) => {
|
||||||
updateGraph(event)
|
updateGraph(event)
|
||||||
})
|
})
|
||||||
socket.on('hints', (event) => {
|
socket.on('response', (response: StageResponse) => {
|
||||||
updateHints(event)
|
newResponse(response)
|
||||||
})
|
|
||||||
socket.on('tasks', (tasks) => {
|
|
||||||
setTasks(tasks)
|
|
||||||
})
|
|
||||||
socket.on('status', (event) => {
|
|
||||||
updateStatus(event)
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -15,7 +15,7 @@ export async function loadUserProfile() {
|
|||||||
store.email = email
|
store.email = email
|
||||||
store.progress = progress
|
store.progress = progress
|
||||||
return store
|
return store
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
throw new Error(`Failed to load user profile: ${err.message}`)
|
throw new Error(`Failed to load user profile: ${err.message}`)
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { FileGraph } from '@linux-odyssey/file-graph'
|
||||||
|
// eslint-disable-next-line import/no-relative-packages
|
||||||
|
import { IResponse } from '@linux-odyssey/models'
|
||||||
|
|
||||||
|
export interface Task {
|
||||||
|
id: number
|
||||||
|
name: string
|
||||||
|
completed: boolean
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface StageResponse {
|
||||||
|
status: string
|
||||||
|
hints: string[]
|
||||||
|
tasks: Task[]
|
||||||
|
responses: IResponse[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface Session {
|
||||||
|
_id: string
|
||||||
|
status: string
|
||||||
|
graph: FileGraph
|
||||||
|
pwd: string
|
||||||
|
hints: string[][]
|
||||||
|
tasks: Task[]
|
||||||
|
responses: IResponse[][]
|
||||||
|
}
|
||||||
@@ -7,5 +7,4 @@ const api = axios.create({
|
|||||||
},
|
},
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
export default api
|
export default api
|
||||||
@@ -12,7 +12,12 @@ export async function isLoggedIn() {
|
|||||||
return loggedIn
|
return loggedIn
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleRequestError(err) {
|
function handleRequestError(err: {
|
||||||
|
response: {
|
||||||
|
data?: any
|
||||||
|
status?: number
|
||||||
|
}
|
||||||
|
}) {
|
||||||
if (!err.response) throw err // Not an axios error
|
if (!err.response) throw err // Not an axios error
|
||||||
const { status } = err.response
|
const { status } = err.response
|
||||||
if (status === 429) {
|
if (status === 429) {
|
||||||
@@ -41,14 +46,14 @@ function handleRequestError(err) {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
|
|
||||||
export const login = (username, password) => {
|
export const login = (username: string, password: string) => {
|
||||||
return api
|
return api
|
||||||
.post('/auth/login', { username, password })
|
.post('/auth/login', { username, password })
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
.catch(handleRequestError)
|
.catch(handleRequestError)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const register = (username, email, password) => {
|
export const register = (username: string, email: string, password: string) => {
|
||||||
return api
|
return api
|
||||||
.post('/auth/register', {
|
.post('/auth/register', {
|
||||||
username,
|
username,
|
||||||
@@ -59,7 +64,7 @@ export const register = (username, email, password) => {
|
|||||||
.catch(handleRequestError)
|
.catch(handleRequestError)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const checkUsername = async (username) => {
|
export const checkUsername = async (username: string) => {
|
||||||
return api
|
return api
|
||||||
.get('/auth/check-username', {
|
.get('/auth/check-username', {
|
||||||
params: { username },
|
params: { username },
|
||||||
@@ -68,7 +73,7 @@ export const checkUsername = async (username) => {
|
|||||||
.catch(handleRequestError)
|
.catch(handleRequestError)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const chooseUsername = async (username) => {
|
export const chooseUsername = async (username: string) => {
|
||||||
return api
|
return api
|
||||||
.post('/auth/register-from-session', { username })
|
.post('/auth/register-from-session', { username })
|
||||||
.then(() => true)
|
.then(() => true)
|
||||||
@@ -1,27 +1,28 @@
|
|||||||
/* eslint-disable max-classes-per-file */
|
/* eslint-disable max-classes-per-file */
|
||||||
export class TooManyRequestsError extends Error {
|
export class TooManyRequestsError extends Error {
|
||||||
constructor(message) {
|
constructor(message: string) {
|
||||||
super(message)
|
super(message)
|
||||||
this.name = 'TooManyRequestsError'
|
this.name = 'TooManyRequestsError'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class ValidationError extends Error {
|
export class ValidationError extends Error {
|
||||||
constructor(message) {
|
constructor(message: string) {
|
||||||
super(message)
|
super(message)
|
||||||
this.name = 'ValidationError'
|
this.name = 'ValidationError'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class UnauthorizedError extends Error {
|
export class UnauthorizedError extends Error {
|
||||||
constructor(message) {
|
constructor(message: string) {
|
||||||
super(message)
|
super(message)
|
||||||
this.name = 'UnauthorizedError'
|
this.name = 'UnauthorizedError'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class LoadQuestError extends Error {
|
export class LoadQuestError extends Error {
|
||||||
constructor(message, questId) {
|
questId: string
|
||||||
|
constructor(message: string, questId: string) {
|
||||||
super(message)
|
super(message)
|
||||||
this.name = 'LoadQuestError'
|
this.name = 'LoadQuestError'
|
||||||
this.questId = questId
|
this.questId = questId
|
||||||
@@ -29,7 +30,8 @@ export class LoadQuestError extends Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class LoadSessionError extends Error {
|
export class LoadSessionError extends Error {
|
||||||
constructor(message, questId) {
|
questId: string
|
||||||
|
constructor(message: string, questId: string) {
|
||||||
super(message)
|
super(message)
|
||||||
this.name = 'LoadSessionError'
|
this.name = 'LoadSessionError'
|
||||||
this.questId = questId
|
this.questId = questId
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { marked } from 'marked'
|
import { marked } from 'marked'
|
||||||
import DOMPurify from 'dompurify'
|
import DOMPurify from 'dompurify'
|
||||||
|
|
||||||
export default function markdown2HTML(markdown) {
|
export default function markdown2HTML(markdown: string) {
|
||||||
const html = marked.parse(markdown)
|
const html = marked.parse(markdown)
|
||||||
return DOMPurify.sanitize(html)
|
return DOMPurify.sanitize(html)
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,18 @@
|
|||||||
import io from 'socket.io-client'
|
import { io, Socket } from 'socket.io-client'
|
||||||
|
import { Session } from '../types'
|
||||||
|
|
||||||
|
type SocketCallback = (data: any) => void
|
||||||
|
|
||||||
class SocketWrapper {
|
class SocketWrapper {
|
||||||
|
socket: Socket | null
|
||||||
|
listeners: { event: string; callback: SocketCallback }[]
|
||||||
constructor() {
|
constructor() {
|
||||||
this.socket = null
|
this.socket = null
|
||||||
this.listeners = []
|
this.listeners = []
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(session) {
|
connect(session: Session) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
this.disconnect()
|
this.disconnect()
|
||||||
|
|
||||||
this.socket = io('', {
|
this.socket = io('', {
|
||||||
@@ -28,7 +33,7 @@ class SocketWrapper {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
on(event, callback) {
|
on(event: string, callback: SocketCallback) {
|
||||||
this.listeners.push({ event, callback })
|
this.listeners.push({ event, callback })
|
||||||
if (this.socket) {
|
if (this.socket) {
|
||||||
this.socket.on(event, callback)
|
this.socket.on(event, callback)
|
||||||
@@ -36,12 +41,14 @@ class SocketWrapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bindListeners() {
|
bindListeners() {
|
||||||
this.listeners.forEach(({ event, callback }) => {
|
this.listeners.forEach(
|
||||||
this.socket.on(event, callback)
|
({ event, callback }: { event: string; callback: SocketCallback }) => {
|
||||||
})
|
if (this.socket !== null) this.socket.on(event, callback)
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
emit(event, data) {
|
emit(event: string, data: any) {
|
||||||
if (!this.socket) {
|
if (!this.socket) {
|
||||||
console.warn('Socket is not connected!')
|
console.warn('Socket is not connected!')
|
||||||
return
|
return
|
||||||
@@ -3,9 +3,11 @@ import { FitAddon } from 'xterm-addon-fit'
|
|||||||
import 'xterm/css/xterm.css'
|
import 'xterm/css/xterm.css'
|
||||||
|
|
||||||
class SocketTerminal {
|
class SocketTerminal {
|
||||||
constructor(rows, cols) {
|
private term: Terminal
|
||||||
|
private fitAddon: FitAddon
|
||||||
|
|
||||||
|
constructor(rows: number, cols: number) {
|
||||||
this.term = new Terminal({
|
this.term = new Terminal({
|
||||||
rendererType: 'canvas', // 渲染类型
|
|
||||||
rows, // 行数
|
rows, // 行数
|
||||||
cols, // 不指定行数,自动回车后光标从下一行开始
|
cols, // 不指定行数,自动回车后光标从下一行开始
|
||||||
convertEol: true, // 启用时,光标将设置为下一行的开头
|
convertEol: true, // 启用时,光标将设置为下一行的开头
|
||||||
@@ -13,9 +15,11 @@ class SocketTerminal {
|
|||||||
disableStdin: false, // 是否应禁用输入
|
disableStdin: false, // 是否应禁用输入
|
||||||
// cursorStyle: "underline", //光标样式
|
// cursorStyle: "underline", //光标样式
|
||||||
cursorBlink: true, // 光标闪烁
|
cursorBlink: true, // 光标闪烁
|
||||||
|
theme: {
|
||||||
foreground: '#ECECEC', // 字体
|
foreground: '#ECECEC', // 字体
|
||||||
background: '#000000', // 背景色
|
background: '#000000', // 背景色
|
||||||
cursor: 'help', // 设置光标
|
cursor: 'help', // 设置光标
|
||||||
|
},
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: 'normal',
|
fontWeight: 'normal',
|
||||||
})
|
})
|
||||||
@@ -24,29 +28,29 @@ class SocketTerminal {
|
|||||||
this.fitAddon.fit()
|
this.fitAddon.fit()
|
||||||
}
|
}
|
||||||
|
|
||||||
write(message) {
|
write(message: string): void {
|
||||||
this.term.write(message)
|
this.term.write(message)
|
||||||
}
|
}
|
||||||
|
|
||||||
onData(callback) {
|
onData(callback: any): void {
|
||||||
this.term.onData(callback)
|
this.term.onData(callback)
|
||||||
}
|
}
|
||||||
|
|
||||||
focus() {
|
focus(): void {
|
||||||
this.term.focus()
|
this.term.focus()
|
||||||
}
|
}
|
||||||
|
|
||||||
resizeScreen() {
|
resizeScreen(): void {
|
||||||
this.fitAddon.fit()
|
this.fitAddon.fit()
|
||||||
}
|
}
|
||||||
|
|
||||||
mount(reference) {
|
mount(reference: HTMLElement): void {
|
||||||
this.term.open(reference)
|
this.term.open(reference)
|
||||||
this.term.focus()
|
this.term.focus()
|
||||||
this.resizeScreen()
|
this.resizeScreen()
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset(): void {
|
||||||
this.term.reset()
|
this.term.reset()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,14 +1,20 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { isValidUsername } from '@linux-odyssey/utils'
|
import { isValidUsername } from '@linux-odyssey/utils'
|
||||||
import AuthForm from '../components/AuthForm.vue'
|
import AuthForm from '../components/AuthForm.vue'
|
||||||
import Background from '../components/DynamicBackground.vue'
|
import Background from '../components/DynamicBackground.vue'
|
||||||
import { TooManyRequestsError, ValidationError } from '../utils/errors'
|
import { TooManyRequestsError, ValidationError } from '../utils/errors'
|
||||||
import { checkUsername, chooseUsername } from '../utils/auth'
|
import { checkUsername, chooseUsername } from '../utils/auth'
|
||||||
|
|
||||||
async function check({ username, error }) {
|
async function check({
|
||||||
|
username,
|
||||||
|
error,
|
||||||
|
}: {
|
||||||
|
username: string
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
error: (msg: string) => void
|
||||||
|
}) {
|
||||||
if (username) {
|
if (username) {
|
||||||
if (!isValidUsername(username)) {
|
if (!isValidUsername(username)) {
|
||||||
// error('Invalid username.')
|
|
||||||
error('無效的帳號名稱')
|
error('無效的帳號名稱')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -16,7 +22,6 @@ async function check({ username, error }) {
|
|||||||
await checkUsername(username)
|
await checkUsername(username)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof TooManyRequestsError) {
|
if (err instanceof TooManyRequestsError) {
|
||||||
// error('Too many requests. Try again in 2 minutes.')
|
|
||||||
error('太多請求,兩分鐘後再試一次。')
|
error('太多請求,兩分鐘後再試一次。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -24,19 +29,26 @@ async function check({ username, error }) {
|
|||||||
error(err.message)
|
error(err.message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// error('Something went wrong. Please try again later.')
|
|
||||||
error('出了點問題,請再試一次。')
|
error('出了點問題,請再試一次。')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleSubmit({ username, success, error }) {
|
async function handleSubmit({
|
||||||
|
username,
|
||||||
|
success,
|
||||||
|
error,
|
||||||
|
}: {
|
||||||
|
username: string
|
||||||
|
success: () => void
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
error: (msg: string) => void
|
||||||
|
}) {
|
||||||
try {
|
try {
|
||||||
await chooseUsername(username)
|
await chooseUsername(username)
|
||||||
success()
|
success()
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
if (err instanceof TooManyRequestsError) {
|
if (err instanceof TooManyRequestsError) {
|
||||||
// error('Too many requests. Try again in 2 minutes.')
|
|
||||||
error('太多請求,兩分鐘後再試一次。')
|
error('太多請求,兩分鐘後再試一次。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { computed, onMounted } from 'vue'
|
import { computed, onMounted } from 'vue'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import sessionStore, { init } from '../store/session'
|
import sessionStore, { init } from '../store/session'
|
||||||
@@ -28,16 +28,12 @@ const toast = useToast()
|
|||||||
onMounted(async () => {
|
onMounted(async () => {
|
||||||
try {
|
try {
|
||||||
await init(props.questId)
|
await init(props.questId)
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
if (err instanceof LoadQuestError) {
|
if (err instanceof LoadQuestError) {
|
||||||
// toast.error(`Failed to load quest: ${err.questId}. Please check the URL.`)
|
|
||||||
toast.error(`無法讀取關卡: ${err.questId},請確認網頁連結。`)
|
toast.error(`無法讀取關卡: ${err.questId},請確認網頁連結。`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (err instanceof LoadSessionError) {
|
if (err instanceof LoadSessionError) {
|
||||||
// toast.error(
|
|
||||||
// `Failed to create session for quest: ${err.questId}. Please re-login and try again.`
|
|
||||||
// )
|
|
||||||
toast.error(`無法建立工作階段: ${err.questId},請重新登入再試一次。`)
|
toast.error(`無法建立工作階段: ${err.questId},請重新登入再試一次。`)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -61,7 +57,7 @@ onMounted(async () => {
|
|||||||
<!-- main -->
|
<!-- main -->
|
||||||
<div id="main" class="h-[94vh] w-full flex p-3 space-x-3">
|
<div id="main" class="h-[94vh] w-full flex p-3 space-x-3">
|
||||||
<!-- Topic and Command List -->
|
<!-- Topic and Command List -->
|
||||||
<div class="bg-bg-secondary h-full w-1/3 rounded-lg">
|
<div class="bg-bg-secondary h-full w-1/4 rounded-lg">
|
||||||
<section id="quest" class="h-full p-3 overflow-auto">
|
<section id="quest" class="h-full p-3 overflow-auto">
|
||||||
<QuestPart />
|
<QuestPart />
|
||||||
</section>
|
</section>
|
||||||
@@ -71,17 +67,17 @@ onMounted(async () => {
|
|||||||
</section> -->
|
</section> -->
|
||||||
</div>
|
</div>
|
||||||
<!-- Terminal and Hint -->
|
<!-- Terminal and Hint -->
|
||||||
<div class="bg-bg h-full w-1/3 rounded-lg">
|
<div class="bg-bg h-full w-1/2 rounded-lg">
|
||||||
<section id="terminal" class="h-3/5 overflow-hidden">
|
<section id="hint" class="h-3/5">
|
||||||
<TerminalPart />
|
<HintPart />
|
||||||
</section>
|
</section>
|
||||||
<hr class="border-border border" />
|
<hr class="border-border border" />
|
||||||
<section id="hint" class="h-2/5">
|
<section id="terminal" class="h-2/5 overflow-hidden">
|
||||||
<HintPart />
|
<TerminalPart />
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<!-- Visualization -->
|
<!-- Visualization -->
|
||||||
<div class="h-full w-1/3">
|
<div class="h-full w-1/4">
|
||||||
<div class="bg-border rounded-xl h-[90%] p-2">
|
<div class="bg-border rounded-xl h-[90%] p-2">
|
||||||
<div class="bg-bg rounded-lg h-full p-2">
|
<div class="bg-bg rounded-lg h-full p-2">
|
||||||
<section id="visualization" class="bg-bg-primary h-full rounded-md">
|
<section id="visualization" class="bg-bg-primary h-full rounded-md">
|
||||||
|
|||||||
@@ -0,0 +1,299 @@
|
|||||||
|
<script setup lang="ts">
|
||||||
|
import ContactButton from '../components/ContactButton.vue'
|
||||||
|
import DynamicBackground from '../components/DynamicBackground.vue'
|
||||||
|
import { bugReportUrl, facebookUrl, githubUrl } from '../config'
|
||||||
|
|
||||||
|
const scrollToSection = (sectionId: string) => {
|
||||||
|
const section = document.getElementById(sectionId)
|
||||||
|
if (section) {
|
||||||
|
const container = document.querySelector('.overflow-y-auto') // Replace '.overflow-y-auto' with the appropriate class or selector for your container
|
||||||
|
if (container) {
|
||||||
|
container.scrollTo({
|
||||||
|
top: section.offsetTop,
|
||||||
|
behavior: 'smooth', // Add smooth scrolling behavior if desired
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
<template>
|
||||||
|
<div class="w-screen h-screen bg-scroll bg-bg">
|
||||||
|
<DynamicBackground class="w-full h-full" />
|
||||||
|
<div class="h-screen w-screen absolute top-0 left-0">
|
||||||
|
<!-- game header -->
|
||||||
|
<div
|
||||||
|
class="w-full h-[6vh] px-5 flex flex-row items-center justify-between bg-bg-secondary"
|
||||||
|
>
|
||||||
|
<div class="flex flex-row items-center gap-3">
|
||||||
|
<img src="../img/icon_totem.svg" class="h-8 justify-self-start" />
|
||||||
|
<button
|
||||||
|
id="GameTitle"
|
||||||
|
class="text-text-primary inline-block font-bold whitespace-nowrap pt-1"
|
||||||
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
Linux Odyssey
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="flex flex-row items-center gap-3">
|
||||||
|
<button
|
||||||
|
id="Intro"
|
||||||
|
class="text-text inline-block font-bold whitespace-nowrap pt-1"
|
||||||
|
@click="scrollToSection('intro')"
|
||||||
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
Intro
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
id="Feature"
|
||||||
|
class="text-text inline-block font-bold whitespace-nowrap pt-1"
|
||||||
|
@click="scrollToSection('feature')"
|
||||||
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
Feature</button
|
||||||
|
><button
|
||||||
|
id="Info"
|
||||||
|
class="text-text inline-block font-bold whitespace-nowrap pt-1"
|
||||||
|
@click="scrollToSection('about')"
|
||||||
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
About
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button
|
||||||
|
id="Contact"
|
||||||
|
class="text-text inline-block font-bold whitespace-nowrap pt-1"
|
||||||
|
@click="scrollToSection('contact')"
|
||||||
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
Contact Us
|
||||||
|
</button>
|
||||||
|
<RouterLink
|
||||||
|
title="Sign In"
|
||||||
|
id="SignIn"
|
||||||
|
to="/register"
|
||||||
|
class="text-text inline-block font-bold whitespace-nowrap pt-1"
|
||||||
|
style="font-size: 2vh"
|
||||||
|
>
|
||||||
|
Sign In
|
||||||
|
</RouterLink>
|
||||||
|
<a
|
||||||
|
title="Bug Report"
|
||||||
|
:href="bugReportUrl"
|
||||||
|
target="_blank"
|
||||||
|
class="h-5 w-5"
|
||||||
|
>
|
||||||
|
<font-awesome-icon
|
||||||
|
:icon="['fas', 'bug']"
|
||||||
|
class="text-text-primary h-full w-full"
|
||||||
|
/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- main content -->
|
||||||
|
<main class="w-full h-[94vh] overflow-y-auto">
|
||||||
|
<div class="w-full flex flex-col items-center">
|
||||||
|
<div
|
||||||
|
class="flex flex-col md:flex-row mt-10 justify-around gap-5 items-center my-10"
|
||||||
|
>
|
||||||
|
<h1 class="text-text-primary text-7xl font-extrabold font-mono">
|
||||||
|
Linux
|
||||||
|
</h1>
|
||||||
|
<img src="../img/icon_totem.svg" class="h-[30vh]" />
|
||||||
|
<h1 class="text-text-primary text-7xl font-extrabold font-mono">
|
||||||
|
Odyssey
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- intro -->
|
||||||
|
<div class="w-full md:w-2/3 px-5">
|
||||||
|
<section
|
||||||
|
id="intro"
|
||||||
|
class="text-text grid grid-cols-1 gap-3 justify-items-center"
|
||||||
|
>
|
||||||
|
<h1
|
||||||
|
class="text-text inline-block bg-bg-primary p-5 rounded-xl opacity-90"
|
||||||
|
style="font-size: 2.5vh"
|
||||||
|
>
|
||||||
|
程式設計不僅僅是寫程式碼,還涉及到如何有效地與你的電腦互動。
|
||||||
|
程式教育卻往往忽略背後「開發環境」的重要性,
|
||||||
|
使得許多學生在過程中充滿挫折。
|
||||||
|
「開發環境」是寫程式、執行程式過程所需要的一切工具。
|
||||||
|
而這些工具需要在終端機輸入指令來使用。
|
||||||
|
大部分的程式要用來運行的環境,並非 Windows 或 Mac OS,而是 Linux
|
||||||
|
作業系統。 Linux Odyssey 即是為此設計的線上 Linux 互動教學網站。
|
||||||
|
</h1>
|
||||||
|
</section>
|
||||||
|
<section
|
||||||
|
id="feature"
|
||||||
|
class="text-text p-15 grid grid-rows-3 gap-10 items-center pt-10"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="bg-bg-primary p-5 rounded-xl opacity-90 grid grid-cols-3 grid-rows-2 justify-items-center items-center"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="../img/icon_shuttle.svg"
|
||||||
|
class="h-[18vh] row-span-2"
|
||||||
|
/>
|
||||||
|
<h1
|
||||||
|
class="text-text-primary p-5 font-extrabold font-mono col-span-2"
|
||||||
|
style="font-size: 3.5vh"
|
||||||
|
>
|
||||||
|
初學者也能立即上手
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-2 col-span-2" style="font-size: 2.5vh">
|
||||||
|
我們明白對於初學者來說,設定和使用開發工具可能是一大障礙。
|
||||||
|
學習者無需安裝任何軟體,僅需通過瀏覽器即可連上一個真實的 Linux
|
||||||
|
環境。
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="bg-bg-primary p-5 rounded-xl opacity-90 grid grid-cols-3 grid-rows-2 justify-items-center items-center"
|
||||||
|
>
|
||||||
|
<h1
|
||||||
|
class="text-text-primary p-5 font-extrabold font-mono col-span-2"
|
||||||
|
style="font-size: 3.5vh"
|
||||||
|
>
|
||||||
|
遊戲般的學習體驗
|
||||||
|
</h1>
|
||||||
|
<img src="../img/icon_sword.svg" class="h-[18vh] row-span-2" />
|
||||||
|
<h1 class="text-text p-2 col-span-2" style="font-size: 2.5vh">
|
||||||
|
Linux Odyssey 融合了遊戲的樂趣與學習的實用性。
|
||||||
|
透過精心設計的遊戲關卡,學習者可以一邊接受挑戰、破解謎題,
|
||||||
|
一邊掌握 Linux 指令的運用。
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="bg-bg-primary p-5 rounded-xl opacity-90 grid grid-cols-3 grid-rows-2 justify-items-center items-center"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
src="../img/icon_settings.svg"
|
||||||
|
class="h-[18vh] row-span-2"
|
||||||
|
/>
|
||||||
|
<h1
|
||||||
|
class="text-text-primary p-5 font-extrabold font-mono col-span-2 pt-8"
|
||||||
|
style="font-size: 3.5vh"
|
||||||
|
>
|
||||||
|
真實的 Linux 操作之旅
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-2 col-span-2" style="font-size: 2.5vh">
|
||||||
|
Linux Odyssey 提供的不僅是理論知識,更是真實的操作體驗。
|
||||||
|
每一個指令都是在真實的 Linux 環境中執行,
|
||||||
|
讓學習者能夠真正深入軟體開發的世界。
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="w-full py-10">
|
||||||
|
<iframe
|
||||||
|
src="https://www.youtube.com/embed/XzvfmUf1QP8?si=QxnKJMNjsm27fGGF"
|
||||||
|
title="YouTube video player"
|
||||||
|
frameborder="0"
|
||||||
|
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||||
|
allowfullscreen
|
||||||
|
class="w-full aspect-video"
|
||||||
|
></iframe>
|
||||||
|
</section>
|
||||||
|
<section
|
||||||
|
id="start"
|
||||||
|
class="text-text bg-bg-secondary border-8 border-text-tertiary rounded-xl transition ease-in-out hover:scale-110 duration-300"
|
||||||
|
>
|
||||||
|
<RouterLink title="StartGame" id="StartGame" to="/register">
|
||||||
|
<div class="text-text text-xl p-2 w-full text-center">
|
||||||
|
準備好鍵盤,跟我們一起開啟你的 Linux 冒險吧!
|
||||||
|
</div>
|
||||||
|
</RouterLink>
|
||||||
|
</section>
|
||||||
|
<section
|
||||||
|
id="about"
|
||||||
|
class="text-text flex flex-col items-center mt-10 gap-10"
|
||||||
|
>
|
||||||
|
<div class="w-full flex flex-col items-center gap-2">
|
||||||
|
<h1 class="text-text-primary text-3xl font-extrabold font-mono">
|
||||||
|
團隊介紹
|
||||||
|
</h1>
|
||||||
|
<p class="text-lg">國立臺北科技大學 智慧自動化工程科 第二屆</p>
|
||||||
|
<div class="flex flex-row gap-5 justify-center">
|
||||||
|
<h1 class="font-bold">Wancat</h1>
|
||||||
|
<h1 class="font-bold">Neil</h1>
|
||||||
|
<h1 class="font-bold">A.H.</h1>
|
||||||
|
<h1 class="font-bold">Ray Gur</h1>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="w-full flex flex-col items-center gap-2">
|
||||||
|
<h1 class="text-text-primary text-3xl font-extrabold font-mono">
|
||||||
|
得獎肯定
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-xl text-center">
|
||||||
|
大專校院資訊應用服務創新競賽<br />
|
||||||
|
鈦坦敏捷開發特別獎 第二名
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <h1
|
||||||
|
class="text-text-primary p-5 font-extrabold font-mono col-span-3 gap-3"
|
||||||
|
style="font-size: 3.5vh"
|
||||||
|
>
|
||||||
|
玩家感想
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"很好玩很像益智遊戲"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"我從來不知道自由軟體的存在,謝謝你們。"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"還蠻好玩的,讓程式變好玩"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"以前不喜歡電腦課現在覺得喜歡一點點"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"程式真的對新手很友善,讓我學到了很多東西"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"感覺做得很好很簡明易懂關卡設計很用心"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"這個體驗我覺得非常有趣,可以體驗到沒辦法體驗的程式,學長也都熱心指導,非常感謝學長的用心的講解,希望以後還可以再體驗這種活動"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"以前我覺得寫程式很難不過現在覺得很有趣"
|
||||||
|
</h1>
|
||||||
|
<h1 class="text-text p-3" style="font-size: 2.5vh">
|
||||||
|
"以前覺得寫程式是我生活中碰不到而且很難的項目。但通過這堂課之後,覺得寫程式不再那麼難以親近"
|
||||||
|
</h1> -->
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<section
|
||||||
|
id="contact"
|
||||||
|
class="text-text mt-10 flex flex-col items-center"
|
||||||
|
>
|
||||||
|
<h1 class="text-text-primary font-extrabold font-mono text-3xl">
|
||||||
|
聯絡我們
|
||||||
|
</h1>
|
||||||
|
<div class="flex flex-row items-center justify-around mt-5 gap-5">
|
||||||
|
<ContactButton
|
||||||
|
:url="facebookUrl"
|
||||||
|
:icons="['fab', 'facebook']"
|
||||||
|
title="Facebook"
|
||||||
|
desciption="Linux Odyssey"
|
||||||
|
/>
|
||||||
|
<ContactButton
|
||||||
|
:url="githubUrl"
|
||||||
|
:icons="['fab', 'github']"
|
||||||
|
title="GitHub"
|
||||||
|
desciption="linux-odyssey/linux-odyssey"
|
||||||
|
/>
|
||||||
|
<ContactButton
|
||||||
|
url="mailto:team@linuxodyssey.xyz"
|
||||||
|
:icons="['fas', 'envelope']"
|
||||||
|
title="Email"
|
||||||
|
desciption="team@linuxodyssey.xyz"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
@@ -1,18 +1,24 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import { ref, onMounted } from 'vue'
|
import { ref, onMounted } from 'vue'
|
||||||
import { useToast } from 'vue-toastification'
|
import { useToast } from 'vue-toastification'
|
||||||
import DynamicBackground from '../components/DynamicBackground.vue'
|
import DynamicBackground from '../components/DynamicBackground.vue'
|
||||||
import GameHeaderPart from '../components/GameHeaderPart.vue'
|
import GameHeaderPart from '../components/GameHeaderPart.vue'
|
||||||
import api from '../utils/api'
|
import api from '../utils/api'
|
||||||
|
|
||||||
const leaderboard = ref([])
|
const leaderboard = ref<
|
||||||
|
{
|
||||||
|
username: string
|
||||||
|
score: number
|
||||||
|
completedQuests: string[]
|
||||||
|
}[]
|
||||||
|
>([])
|
||||||
|
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
async function getLeaderboard() {
|
async function getLeaderboard() {
|
||||||
try {
|
try {
|
||||||
const res = await api.get('/leaderboard')
|
const res = await api.get('/leaderboard')
|
||||||
leaderboard.value = res.data
|
leaderboard.value = res.data
|
||||||
} catch (err) {
|
} catch (err: any) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
toast.error('讀取排行榜失敗')
|
toast.error('讀取排行榜失敗')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import AuthForm from '../components/AuthForm.vue'
|
import AuthForm from '../components/AuthForm.vue'
|
||||||
import Background from '../components/DynamicBackground.vue'
|
import Background from '../components/DynamicBackground.vue'
|
||||||
|
|
||||||
@@ -9,28 +9,35 @@ import {
|
|||||||
} from '../utils/errors'
|
} from '../utils/errors'
|
||||||
import { login } from '../utils/auth'
|
import { login } from '../utils/auth'
|
||||||
|
|
||||||
const handleLogin = async ({ username, password, success, error }) => {
|
const handleLogin = async ({
|
||||||
|
username,
|
||||||
|
password,
|
||||||
|
success,
|
||||||
|
error,
|
||||||
|
}: {
|
||||||
|
username: string
|
||||||
|
password: string
|
||||||
|
success: () => void
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
error: (msg: string) => void
|
||||||
|
}) => {
|
||||||
try {
|
try {
|
||||||
const isSuccess = await login(username, password)
|
const isSuccess = await login(username, password)
|
||||||
if (isSuccess) success()
|
if (isSuccess) success()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof TooManyRequestsError) {
|
if (err instanceof TooManyRequestsError) {
|
||||||
// error('Too many requests. Try again in 2 minutes.')
|
|
||||||
error('太多請求,兩分鐘後再試一次。')
|
error('太多請求,兩分鐘後再試一次。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (err instanceof UnauthorizedError) {
|
if (err instanceof UnauthorizedError) {
|
||||||
// error('Wrong username or password.')
|
|
||||||
error('錯誤的帳號名稱或密碼。')
|
error('錯誤的帳號名稱或密碼。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (err instanceof ValidationError) {
|
if (err instanceof ValidationError) {
|
||||||
// error('Invalid username or password.')
|
|
||||||
error('無效的帳號名稱或密碼。')
|
error('無效的帳號名稱或密碼。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.error(err)
|
console.error(err)
|
||||||
// error('Something went wrong.')
|
|
||||||
error('出了點問題。')
|
error('出了點問題。')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import QuestMap from '../components/QuestMap.vue'
|
import QuestMap from '../components/QuestMap.vue'
|
||||||
import GameHeaderPart from '../components/GameHeaderPart.vue'
|
import GameHeaderPart from '../components/GameHeaderPart.vue'
|
||||||
</script>
|
</script>
|
||||||
@@ -6,13 +6,6 @@ import GameHeaderPart from '../components/GameHeaderPart.vue'
|
|||||||
<template>
|
<template>
|
||||||
<div class="h-[6vh] w-full">
|
<div class="h-[6vh] w-full">
|
||||||
<GameHeaderPart title="關卡地圖" />
|
<GameHeaderPart title="關卡地圖" />
|
||||||
<!-- <p
|
|
||||||
class="text-text-primary absolute z-1 font-bold inline-block tracking-widest"
|
|
||||||
style="left: 1.2%; top: 1.5%; height: 100%; font-size: 2vh"
|
|
||||||
>
|
|
||||||
Quest Map
|
|
||||||
Unix編年史
|
|
||||||
</p> -->
|
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col justify-center items-center w-full h-[94vh]">
|
<div class="flex flex-col justify-center items-center w-full h-[94vh]">
|
||||||
<QuestMap />
|
<QuestMap />
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
<script setup>
|
<script setup lang="ts">
|
||||||
import validator from 'validator'
|
import validator from 'validator'
|
||||||
import { isValidUsername } from '@linux-odyssey/utils'
|
import { isValidUsername } from '@linux-odyssey/utils'
|
||||||
import { passwordPolicy } from '@linux-odyssey/constants'
|
import { passwordPolicy } from '@linux-odyssey/constants'
|
||||||
@@ -12,17 +12,28 @@ import {
|
|||||||
ValidationError,
|
ValidationError,
|
||||||
} from '../utils/errors'
|
} from '../utils/errors'
|
||||||
|
|
||||||
function handleRegister({ username, email, password, success, error }) {
|
function handleRegister({
|
||||||
|
username,
|
||||||
|
email,
|
||||||
|
password,
|
||||||
|
success,
|
||||||
|
error,
|
||||||
|
}: {
|
||||||
|
username: string
|
||||||
|
email: string
|
||||||
|
password: string
|
||||||
|
success: () => void
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
error: (msg: string) => void
|
||||||
|
}) {
|
||||||
register(username, email, password)
|
register(username, email, password)
|
||||||
.then(success)
|
.then(success)
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
if (err instanceof TooManyRequestsError) {
|
if (err instanceof TooManyRequestsError) {
|
||||||
// error('Too many requests. Try again in 2 minutes.')
|
|
||||||
error('太多請求,兩分鐘後再試一次。')
|
error('太多請求,兩分鐘後再試一次。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (err instanceof UnauthorizedError) {
|
if (err instanceof UnauthorizedError) {
|
||||||
// error('Invalid username or password.')
|
|
||||||
error('無效的帳號名稱或密碼。')
|
error('無效的帳號名稱或密碼。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -31,26 +42,31 @@ function handleRegister({ username, email, password, success, error }) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.error(err)
|
console.error(err)
|
||||||
// error('Something went wrong.')
|
|
||||||
error('出了點問題。')
|
error('出了點問題。')
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
async function check({ username, email, password, error }) {
|
async function check({
|
||||||
|
username,
|
||||||
|
email,
|
||||||
|
password,
|
||||||
|
error,
|
||||||
|
}: {
|
||||||
|
username: string
|
||||||
|
email: string
|
||||||
|
password: string
|
||||||
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
error: (msg: string) => void
|
||||||
|
}) {
|
||||||
if (username && !isValidUsername(username)) {
|
if (username && !isValidUsername(username)) {
|
||||||
// error('Invalid username.')
|
|
||||||
error('無效的帳號名稱')
|
error('無效的帳號名稱')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (email && !validator.isEmail(email)) {
|
if (email && !validator.isEmail(email)) {
|
||||||
// error('Invalid email.')
|
|
||||||
error('無效的電子郵件')
|
error('無效的電子郵件')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (password && !validator.isStrongPassword(password, passwordPolicy)) {
|
if (password && !validator.isStrongPassword(password, passwordPolicy)) {
|
||||||
// error(
|
|
||||||
// 'Your password must be 8+ characters with at least one number, one upper and one lower case letter.'
|
|
||||||
// )
|
|
||||||
error('密碼必須超過8個字元,至少包含一個數字、一個大寫及一個小寫。')
|
error('密碼必須超過8個字元,至少包含一個數字、一個大寫及一個小寫。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -62,12 +78,10 @@ async function check({ username, email, password, error }) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (err instanceof TooManyRequestsError) {
|
if (err instanceof TooManyRequestsError) {
|
||||||
// error('Too many requests. Try again in 2 minutes.')
|
|
||||||
error('太多請求,兩分鐘後再試一次。')
|
error('太多請求,兩分鐘後再試一次。')
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
console.error(err)
|
console.error(err)
|
||||||
// error('Something went wrong.')
|
|
||||||
error('出了點問題。')
|
error('出了點問題。')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File renamed without changes.
@@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2020",
|
||||||
|
"useDefineForClassFields": true,
|
||||||
|
"module": "ESNext",
|
||||||
|
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||||
|
"skipLibCheck": true,
|
||||||
|
|
||||||
|
/* Bundler mode */
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"allowImportingTsExtensions": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
|
||||||
|
/* Linting */
|
||||||
|
"strict": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"noUnusedParameters": true,
|
||||||
|
"noFallthroughCasesInSwitch": true
|
||||||
|
},
|
||||||
|
"include": ["src/**/*.ts", "src/**/*.vue"],
|
||||||
|
"references": [
|
||||||
|
{ "path": "../packages/utils" },
|
||||||
|
{ "path": "../packages/constants" },
|
||||||
|
{ "path": "../packages/file-graph" },
|
||||||
|
{ "path": "../packages/models" }
|
||||||
|
]
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,6 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
['@babel/preset-env', { targets: { node: 'current' } }],
|
||||||
|
'@babel/preset-typescript',
|
||||||
|
],
|
||||||
|
}
|
||||||
@@ -30,6 +30,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./server/src:/app/server/src
|
- ./server/src:/app/server/src
|
||||||
|
- ./server/dist:/app/server/dist
|
||||||
- ./server/swagger.yaml:/app/server/swagger.yaml
|
- ./server/swagger.yaml:/app/server/swagger.yaml
|
||||||
- ./packages:/app/packages
|
- ./packages:/app/packages
|
||||||
- ./quests:/app/quests
|
- ./quests:/app/quests
|
||||||
@@ -73,6 +74,7 @@ services:
|
|||||||
|
|
||||||
db:
|
db:
|
||||||
image: mongo
|
image: mongo
|
||||||
|
restart: always
|
||||||
networks:
|
networks:
|
||||||
- internal
|
- internal
|
||||||
ports:
|
ports:
|
||||||
@@ -36,6 +36,8 @@ services:
|
|||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
- SECRET_KEY=${SECRET_KEY}
|
- SECRET_KEY=${SECRET_KEY}
|
||||||
- TRUSTED_PROXIES=${TRUSTED_PROXIES}
|
- TRUSTED_PROXIES=${TRUSTED_PROXIES}
|
||||||
|
- BACKEND_URL=http://backend:3000
|
||||||
|
- BASE_URL=${BASE_URL}
|
||||||
|
|
||||||
analytics:
|
analytics:
|
||||||
image: linuxodyssey/analytics
|
image: linuxodyssey/analytics
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ services:
|
|||||||
- BASE_URL=http://app-test
|
- BASE_URL=http://app-test
|
||||||
- TESTING_USERNAME=alex
|
- TESTING_USERNAME=alex
|
||||||
- TESTING_PASSWORD=Alex1234
|
- TESTING_PASSWORD=Alex1234
|
||||||
|
# - DEBUG=cypress:*
|
||||||
depends_on:
|
depends_on:
|
||||||
- app-test
|
- app-test
|
||||||
|
|
||||||
@@ -23,8 +24,9 @@ services:
|
|||||||
target: prod
|
target: prod
|
||||||
networks:
|
networks:
|
||||||
internal:
|
internal:
|
||||||
ports:
|
# Only open the port for debugging
|
||||||
- 5173:80
|
# ports:
|
||||||
|
# - 5173:80
|
||||||
depends_on:
|
depends_on:
|
||||||
- backend
|
- backend
|
||||||
|
|
||||||
@@ -43,7 +45,7 @@ services:
|
|||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
- ./logs:/app/logs
|
- ./logs:/app/logs
|
||||||
environment:
|
environment:
|
||||||
- BASE_URL=http://localhost:5173
|
- BASE_URL=http://app-test
|
||||||
- MONGO_URL=mongodb://user:user-password@db-test:27017/odyssey-test
|
- MONGO_URL=mongodb://user:user-password@db-test:27017/odyssey-test
|
||||||
- DOCKER_NETWORK=linux-odyssey-players
|
- DOCKER_NETWORK=linux-odyssey-players
|
||||||
- SECRET_KEY=b1d2e917-17b9-4fce-9055-082dee6ec5d6 # Only for testing
|
- SECRET_KEY=b1d2e917-17b9-4fce-9055-082dee6ec5d6 # Only for testing
|
||||||
@@ -57,6 +59,7 @@ services:
|
|||||||
- TESTING=true
|
- TESTING=true
|
||||||
- TESTING_USERNAME=alex
|
- TESTING_USERNAME=alex
|
||||||
- TESTING_PASSWORD=Alex1234
|
- TESTING_PASSWORD=Alex1234
|
||||||
|
- BACKEND_URL=http://backend:3000
|
||||||
|
|
||||||
db-test:
|
db-test:
|
||||||
image: mongo
|
image: mongo
|
||||||
@@ -70,8 +73,8 @@ services:
|
|||||||
- MONGO_USER=user
|
- MONGO_USER=user
|
||||||
- MONGO_PASS=user-password
|
- MONGO_PASS=user-password
|
||||||
- MONGO_DB=odyssey-test
|
- MONGO_DB=odyssey-test
|
||||||
ports:
|
# ports:
|
||||||
- 27017:27017
|
# - 27017:27017
|
||||||
|
|
||||||
base:
|
base:
|
||||||
image: linuxodyssey/quest-base
|
image: linuxodyssey/quest-base
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
BASE_URL=https://example.com
|
|
||||||
GOOGLE_CLIENT_ID=
|
|
||||||
GOOGLE_CLIENT_SECRET=
|
|
||||||
GITHUB_CLIENT_ID=
|
|
||||||
GITNUB_CLIENT_SECRET=
|
|
||||||
+201
@@ -0,0 +1,201 @@
|
|||||||
|
/**
|
||||||
|
* For a detailed explanation regarding each configuration property, visit:
|
||||||
|
* https://jestjs.io/docs/configuration
|
||||||
|
*/
|
||||||
|
|
||||||
|
import type { Config } from 'jest'
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
// All imported modules in your tests should be mocked automatically
|
||||||
|
// automock: false,
|
||||||
|
|
||||||
|
// Stop running tests after `n` failures
|
||||||
|
// bail: 0,
|
||||||
|
|
||||||
|
// The directory where Jest should store its cached dependency information
|
||||||
|
// cacheDirectory: "/tmp/jest_rs",
|
||||||
|
|
||||||
|
// Automatically clear mock calls, instances, contexts and results before every test
|
||||||
|
// clearMocks: false,
|
||||||
|
|
||||||
|
// Indicates whether the coverage information should be collected while executing the test
|
||||||
|
collectCoverage: true,
|
||||||
|
|
||||||
|
// An array of glob patterns indicating a set of files for which coverage information should be collected
|
||||||
|
// collectCoverageFrom: undefined,
|
||||||
|
|
||||||
|
// The directory where Jest should output its coverage files
|
||||||
|
coverageDirectory: 'coverage',
|
||||||
|
|
||||||
|
// An array of regexp pattern strings used to skip coverage collection
|
||||||
|
// coveragePathIgnorePatterns: [
|
||||||
|
// "/node_modules/"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// Indicates which provider should be used to instrument code for coverage
|
||||||
|
coverageProvider: 'v8',
|
||||||
|
|
||||||
|
// A list of reporter names that Jest uses when writing coverage reports
|
||||||
|
// coverageReporters: [
|
||||||
|
// "json",
|
||||||
|
// "text",
|
||||||
|
// "lcov",
|
||||||
|
// "clover"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An object that configures minimum threshold enforcement for coverage results
|
||||||
|
// coverageThreshold: undefined,
|
||||||
|
|
||||||
|
// A path to a custom dependency extractor
|
||||||
|
// dependencyExtractor: undefined,
|
||||||
|
|
||||||
|
// Make calling deprecated APIs throw helpful error messages
|
||||||
|
// errorOnDeprecated: false,
|
||||||
|
|
||||||
|
// The default configuration for fake timers
|
||||||
|
// fakeTimers: {
|
||||||
|
// "enableGlobally": false
|
||||||
|
// },
|
||||||
|
|
||||||
|
// Force coverage collection from ignored files using an array of glob patterns
|
||||||
|
// forceCoverageMatch: [],
|
||||||
|
|
||||||
|
// A path to a module which exports an async function that is triggered once before all test suites
|
||||||
|
// globalSetup: undefined,
|
||||||
|
|
||||||
|
// A path to a module which exports an async function that is triggered once after all test suites
|
||||||
|
// globalTeardown: undefined,
|
||||||
|
|
||||||
|
// A set of global variables that need to be available in all test environments
|
||||||
|
// globals: {},
|
||||||
|
|
||||||
|
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
|
||||||
|
// maxWorkers: "50%",
|
||||||
|
|
||||||
|
// An array of directory names to be searched recursively up from the requiring module's location
|
||||||
|
// moduleDirectories: [
|
||||||
|
// "node_modules"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An array of file extensions your modules use
|
||||||
|
// moduleFileExtensions: [
|
||||||
|
// "js",
|
||||||
|
// "mjs",
|
||||||
|
// "cjs",
|
||||||
|
// "jsx",
|
||||||
|
// "ts",
|
||||||
|
// "tsx",
|
||||||
|
// "json",
|
||||||
|
// "node"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
|
||||||
|
moduleNameMapper: {
|
||||||
|
'^(\\.{1,2}/.*)\\.js$': '$1', // Redirect .js imports to .ts files
|
||||||
|
},
|
||||||
|
|
||||||
|
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
|
||||||
|
// modulePathIgnorePatterns: [],
|
||||||
|
|
||||||
|
// Activates notifications for test results
|
||||||
|
// notify: false,
|
||||||
|
|
||||||
|
// An enum that specifies notification mode. Requires { notify: true }
|
||||||
|
// notifyMode: "failure-change",
|
||||||
|
|
||||||
|
// A preset that is used as a base for Jest's configuration
|
||||||
|
// preset: undefined,
|
||||||
|
|
||||||
|
// Run tests from one or more projects
|
||||||
|
// projects: undefined,
|
||||||
|
|
||||||
|
// Use this configuration option to add custom reporters to Jest
|
||||||
|
// reporters: undefined,
|
||||||
|
|
||||||
|
// Automatically reset mock state before every test
|
||||||
|
// resetMocks: false,
|
||||||
|
|
||||||
|
// Reset the module registry before running each individual test
|
||||||
|
// resetModules: false,
|
||||||
|
|
||||||
|
// A path to a custom resolver
|
||||||
|
// resolver: undefined,
|
||||||
|
|
||||||
|
// Automatically restore mock state and implementation before every test
|
||||||
|
// restoreMocks: false,
|
||||||
|
|
||||||
|
// The root directory that Jest should scan for tests and modules within
|
||||||
|
// rootDir: undefined,
|
||||||
|
|
||||||
|
// A list of paths to directories that Jest should use to search for files in
|
||||||
|
// roots: [
|
||||||
|
// "<rootDir>"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// Allows you to use a custom runner instead of Jest's default test runner
|
||||||
|
// runner: "jest-runner",
|
||||||
|
|
||||||
|
// The paths to modules that run some code to configure or set up the testing environment before each test
|
||||||
|
// setupFiles: [],
|
||||||
|
|
||||||
|
// A list of paths to modules that run some code to configure or set up the testing framework before each test
|
||||||
|
// setupFilesAfterEnv: [],
|
||||||
|
|
||||||
|
// The number of seconds after which a test is considered as slow and reported as such in the results.
|
||||||
|
// slowTestThreshold: 5,
|
||||||
|
|
||||||
|
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
|
||||||
|
// snapshotSerializers: [],
|
||||||
|
|
||||||
|
// The test environment that will be used for testing
|
||||||
|
// testEnvironment: "jest-environment-node",
|
||||||
|
|
||||||
|
// Options that will be passed to the testEnvironment
|
||||||
|
// testEnvironmentOptions: {},
|
||||||
|
|
||||||
|
// Adds a location field to test results
|
||||||
|
// testLocationInResults: false,
|
||||||
|
|
||||||
|
// The glob patterns Jest uses to detect test files
|
||||||
|
// testMatch: [
|
||||||
|
// "**/__tests__/**/*.[jt]s?(x)",
|
||||||
|
// "**/?(*.)+(spec|test).[tj]s?(x)"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
|
||||||
|
// testPathIgnorePatterns: [
|
||||||
|
// "/node_modules/"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// The regexp pattern or array of patterns that Jest uses to detect test files
|
||||||
|
// testRegex: [],
|
||||||
|
|
||||||
|
// This option allows the use of a custom results processor
|
||||||
|
// testResultsProcessor: undefined,
|
||||||
|
|
||||||
|
// This option allows use of a custom test runner
|
||||||
|
// testRunner: "jest-circus/runner",
|
||||||
|
|
||||||
|
// A map from regular expressions to paths to transformers
|
||||||
|
// transform: undefined,
|
||||||
|
|
||||||
|
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
|
||||||
|
// transformIgnorePatterns: [
|
||||||
|
// "/node_modules/",
|
||||||
|
// "\\.pnp\\.[^\\/]+$"
|
||||||
|
// ],
|
||||||
|
|
||||||
|
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
|
||||||
|
// unmockedModulePathPatterns: undefined,
|
||||||
|
|
||||||
|
// Indicates whether each individual test should be reported during the run
|
||||||
|
// verbose: undefined,
|
||||||
|
|
||||||
|
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
|
||||||
|
// watchPathIgnorePatterns: [],
|
||||||
|
|
||||||
|
// Whether to use watchman for file crawling
|
||||||
|
// watchman: true,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
+24
-6
@@ -13,13 +13,13 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"app": "yarn workspace app dev",
|
"app": "yarn workspace app dev",
|
||||||
"app:local": "yarn workspace app dev:local",
|
"build": "yarn workspace server build && yarn workspace app build && yarn workspace analytics build",
|
||||||
"build": "yarn workspace app build",
|
"dev": "concurrently -n \"App,Server\" -c \"bgBlue.bold,bgGreen.bold\" \"yarn workspace app dev\" \"yarn workspace server dev\"",
|
||||||
"server": "yarn workspace server dev",
|
"server": "yarn workspace server dev",
|
||||||
"cli": "yarn workspace client start",
|
"cli": "yarn workspace client start",
|
||||||
"lint": "eslint --ext .js,.vue .",
|
"lint": "eslint .",
|
||||||
"format": "prettier --ignore-path .prettierignore --write app server",
|
"format": "prettier --ignore-path .prettierignore --write app server",
|
||||||
"test": "yarn node --experimental-vm-modules $(yarn bin jest)",
|
"test": "yarn node --experimental-vm-modules --no-warnings $(yarn bin jest)",
|
||||||
"test:e2e": "yarn workspace tests test",
|
"test:e2e": "yarn workspace tests test",
|
||||||
"test:open": "yarn workspace tests test:open",
|
"test:open": "yarn workspace tests test:open",
|
||||||
"analytics": "yarn workspace analytics dev",
|
"analytics": "yarn workspace analytics dev",
|
||||||
@@ -28,14 +28,32 @@
|
|||||||
"build:quests": "yarn workspace server build:quests"
|
"build:quests": "yarn workspace server build:quests"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@babel/core": "^7.24.0",
|
||||||
|
"@babel/preset-env": "^7.24.0",
|
||||||
|
"@babel/preset-typescript": "^7.23.3",
|
||||||
|
"@jest/globals": "^29.7.0",
|
||||||
|
"@types/jest": "^29.5.12",
|
||||||
|
"@types/node": "^20.10.4",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^6.14.0",
|
||||||
|
"@typescript-eslint/parser": "^6.14.0",
|
||||||
"@vue/eslint-config-prettier": "^7.1.0",
|
"@vue/eslint-config-prettier": "^7.1.0",
|
||||||
|
"babel-jest": "^29.7.0",
|
||||||
|
"concurrently": "^8.2.2",
|
||||||
"eslint": "^8.44.0",
|
"eslint": "^8.44.0",
|
||||||
"eslint-config-airbnb-base": "^15.0.0",
|
"eslint-config-airbnb-base": "^15.0.0",
|
||||||
"eslint-config-prettier": "^8.8.0",
|
"eslint-config-prettier": "^8.8.0",
|
||||||
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
"eslint-plugin-cypress": "^2.15.1",
|
"eslint-plugin-cypress": "^2.15.1",
|
||||||
"eslint-plugin-import": "^2.27.5",
|
"eslint-plugin-import": "^2.29.0",
|
||||||
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"eslint-plugin-prettier": "^5.0.0",
|
"eslint-plugin-prettier": "^5.0.0",
|
||||||
"eslint-plugin-vue": "^9.15.1",
|
"eslint-plugin-vue": "^9.15.1",
|
||||||
"prettier": "^3.0.0"
|
"jest": "^29.7.0",
|
||||||
|
"prettier": "^3.0.0",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"typescript-eslint": "^7.4.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
ADMIN_USERNAME=alex
|
||||||
|
ADMIN_PASSWORD=Alex1234
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
FROM node:20-alpine as build
|
FROM node:20-alpine as build
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY ./package.json yarn.lock ./
|
COPY ./package.json yarn.lock tsconfig.json ./
|
||||||
COPY packages/analytics/package.json ./packages/analytics/package.json
|
COPY packages/analytics/package.json ./packages/analytics/package.json
|
||||||
COPY packages/models/package.json ./packages/models/package.json
|
COPY packages/models/package.json ./packages/models/package.json
|
||||||
RUN yarn install --frozen-lockfile --production
|
RUN yarn install --frozen-lockfile
|
||||||
ENV HOST=0.0.0.0
|
ENV HOST=0.0.0.0
|
||||||
ENV PORT=3001
|
ENV PORT=3001
|
||||||
EXPOSE 3001
|
EXPOSE 3001
|
||||||
@@ -15,11 +15,5 @@ COPY packages/analytics ./packages/analytics
|
|||||||
COPY packages/models ./packages/models
|
COPY packages/models ./packages/models
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
WORKDIR /app/packages/analytics
|
WORKDIR /app/packages/analytics
|
||||||
|
RUN yarn build
|
||||||
CMD [ "yarn", "start" ]
|
CMD [ "yarn", "start" ]
|
||||||
|
|
||||||
# Development stage
|
|
||||||
FROM build as dev
|
|
||||||
RUN yarn install --frozen-lockfile
|
|
||||||
WORKDIR /app/packages/analytics
|
|
||||||
ENV NODE_ENV=development
|
|
||||||
CMD [ "yarn", "dev" ]
|
|
||||||
@@ -1,3 +1,6 @@
|
|||||||
{
|
{
|
||||||
"ext": "js,handlebars"
|
"watch": ["src", "views"],
|
||||||
|
"ext": "ts,handlebars,js",
|
||||||
|
"ignore": ["src/**/*.spec.ts"],
|
||||||
|
"exec": "node --loader ts-node/esm src/index.ts"
|
||||||
}
|
}
|
||||||
@@ -6,17 +6,27 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"license": "GPL",
|
"license": "GPL",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node src/index.js",
|
"start": "node dist/index.js",
|
||||||
"dev": "nodemon src/index.js"
|
"build": "tsc -b -f",
|
||||||
|
"watch": "tsc -b --watch",
|
||||||
|
"dev": "nodemon"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@linux-odyssey/models": "*",
|
"@linux-odyssey/models": "*",
|
||||||
"express": "^4.18.2",
|
"dotenv": "^16.4.5",
|
||||||
|
"express": "^4.19.2",
|
||||||
"express-basic-auth": "^1.2.1",
|
"express-basic-auth": "^1.2.1",
|
||||||
"express-handlebars": "^7.1.2",
|
"express-handlebars": "^7.1.2",
|
||||||
"mongoose": "^8.0.3"
|
"mongoose": "^8.0.3"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"nodemon": "^3.0.1"
|
"@swc/core": "^1.4.2",
|
||||||
|
"@swc/helpers": "^0.5.6",
|
||||||
|
"@types/express": "^4.17.21",
|
||||||
|
"@types/node": "^20.11.20",
|
||||||
|
"nodemon": "^3.1.0",
|
||||||
|
"regenerator-runtime": "^0.14.1",
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -9,7 +9,7 @@ th {
|
|||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
border-spacing: 0;
|
border-spacing: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: 2px solid black;
|
border: 2px solid #dcdcdd;
|
||||||
}
|
}
|
||||||
|
|
||||||
th,
|
th,
|
||||||
@@ -17,3 +17,117 @@ td {
|
|||||||
width: 1px;
|
width: 1px;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
|
background-color: #000000;
|
||||||
|
color: #333;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title h1 {
|
||||||
|
color: #00ff00;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 50px;
|
||||||
|
margin-top: 50px;
|
||||||
|
font-family:
|
||||||
|
ui-monospace,
|
||||||
|
SFMono-Regular,
|
||||||
|
Menlo,
|
||||||
|
Monaco,
|
||||||
|
Consolas,
|
||||||
|
Liberation Mono,
|
||||||
|
Courier New,
|
||||||
|
monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title img {
|
||||||
|
width: 135px;
|
||||||
|
}
|
||||||
|
.title {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 30px;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
}
|
||||||
|
.heading {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
|
||||||
|
nav {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav a {
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin-top: 20px;
|
||||||
|
color: #dcdcdd;
|
||||||
|
|
||||||
|
background-color: #24262e;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table td {
|
||||||
|
padding: 10px;
|
||||||
|
text-align: left;
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table a {
|
||||||
|
color: #00dd00;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-table th {
|
||||||
|
color: #dcdcdd;
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #dcdcdd;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
background-color: #24262e;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 25px;
|
||||||
|
gap: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort a {
|
||||||
|
background-color: #24262e;
|
||||||
|
height: 50px;
|
||||||
|
padding: 0 5 0 5;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-decoration: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.sort .btn h3 {
|
||||||
|
margin: 15 3 0 3;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #dcdcdd;
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pagination {
|
||||||
|
width: 100%;
|
||||||
|
justify-content: center;
|
||||||
|
margin-top: 20px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
<svg width="638" height="732" viewBox="0 0 638 732" fill="none" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
||||||
|
<path d="M0 0H638V732H0V0Z" fill="url(#pattern0)"/>
|
||||||
|
<defs>
|
||||||
|
<pattern id="pattern0" patternContentUnits="objectBoundingBox" width="1" height="1">
|
||||||
|
<use xlink:href="#image0_379_14" transform="matrix(0.00126582 0 0 0.00110327 0 -0.000333748)"/>
|
||||||
|
</pattern>
|
||||||
|
<image id="image0_379_14" width="790" height="907" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAxYAAAOLCAYAAADNRhU6AAAAAXNSR0IArs4c6QAAAIRlWElmTU0AKgAAAAgABQEGAAMAAAABAAIAAAEaAAUAAAABAAAASgEbAAUAAAABAAAAUgEoAAMAAAABAAIAAIdpAAQAAAABAAAAWgAAAAAAAAEIAAAAAQAAAQgAAAABAAOgAQADAAAAAQABAACgAgAEAAAAAQAAAxagAwAEAAAAAQAAA4sAAAAA8/vYWgAAAAlw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c/DxSCS8010EjyZQZvgfLfGEC2/2pc5smhWASDMFC+yzjON4186YyPeSnUm3UqUIKAKKgCJQDgE1hSqHjMYrAoqAItDBCIyMXDjrOLJzYWFR0uk0ePNufJ1TqMBGeYIB623QoTscmYeUpEERUAQUAUWg2xDoxi9Rt2Gs9CoCioAi0HAEhoazx9fW1iRBZ23y510XPKGCdBv6HUyRCwkDx+l0QkLRXVbc6LqWKcGKgCKgCPQrAipY9GvPa7sVAUWgaxGY3XG+M3dyzhUqTCvIg3czH06Bwt0CQeyDWcmkEjIw/IRublTX3l9KuCKgCCLine truncated
|
||||||
|
</defs>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 630 KiB |
@@ -1,18 +0,0 @@
|
|||||||
function getOrFailed(key) {
|
|
||||||
if (!process.env[key]) {
|
|
||||||
throw new Error(`Missing required environment variable: ${key}`)
|
|
||||||
}
|
|
||||||
return process.env[key]
|
|
||||||
}
|
|
||||||
|
|
||||||
const config = {
|
|
||||||
host: process.env.HOST || 'localhost',
|
|
||||||
port: process.env.PORT || 3001,
|
|
||||||
db: process.env.MONGO_URL || 'mongodb://localhost:27017/odyssey-test',
|
|
||||||
username: getOrFailed('ADMIN_USERNAME'),
|
|
||||||
password: getOrFailed('ADMIN_PASSWORD'),
|
|
||||||
}
|
|
||||||
|
|
||||||
config.baseUrl = process.env.BASE_URL || `http://${config.host}:${config.port}`
|
|
||||||
|
|
||||||
export default config
|
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
import dotenv from 'dotenv'
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV !== 'production') {
|
||||||
|
dotenv.config({ path: '.env.dev' })
|
||||||
|
}
|
||||||
|
|
||||||
|
function getOrFailed(key: string): string {
|
||||||
|
if (!process.env[key]) {
|
||||||
|
throw new Error(`Missing required environment variable: ${key}`)
|
||||||
|
}
|
||||||
|
return process.env[key] as string
|
||||||
|
}
|
||||||
|
|
||||||
|
interface Config {
|
||||||
|
host: string
|
||||||
|
port: number
|
||||||
|
db: string
|
||||||
|
username: string
|
||||||
|
password: string
|
||||||
|
baseUrl: string
|
||||||
|
}
|
||||||
|
|
||||||
|
const config: Config = {
|
||||||
|
host: process.env.HOST || 'localhost',
|
||||||
|
port: process.env.PORT ? parseInt(process.env.PORT, 10) : 3001,
|
||||||
|
db: process.env.MONGO_URL || 'mongodb://localhost:27017/odyssey-test',
|
||||||
|
username: getOrFailed('ADMIN_USERNAME'),
|
||||||
|
password: getOrFailed('ADMIN_PASSWORD'),
|
||||||
|
baseUrl:
|
||||||
|
process.env.BASE_URL ||
|
||||||
|
`http://${process.env.HOST || 'localhost'}:${process.env.PORT ? parseInt(process.env.PORT, 10) : 3001}`,
|
||||||
|
}
|
||||||
|
|
||||||
|
export default config
|
||||||
File renamed without changes.
+6
-4
@@ -1,10 +1,12 @@
|
|||||||
/* eslint-disable object-shorthand */
|
import type { Request, Response } from 'express'
|
||||||
import Pagination from '../models/pagination.js'
|
import Pagination from '../models/pagination.js'
|
||||||
import { errorCommands } from '../models/commands.js'
|
import { errorCommands } from '../models/commands.js'
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
export async function commandListController(
|
||||||
export async function commandListController(req, res) {
|
req: Request,
|
||||||
const { nextKey, order } = req.query
|
res: Response
|
||||||
|
): Promise<void> {
|
||||||
|
const { nextKey, order } = req.query as { nextKey?: string; order: string }
|
||||||
const itemsPerPage = 100
|
const itemsPerPage = 100
|
||||||
|
|
||||||
try {
|
try {
|
||||||
+3
-4
@@ -1,8 +1,8 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
import { userCount } from '../models/users.js'
|
import { userCount } from '../models/users.js'
|
||||||
import { questList } from '../models/quests.js'
|
import { questList } from '../models/quests.js'
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
export async function homeController(req: Request, res: Response) {
|
||||||
export async function homeController(req, res) {
|
|
||||||
const quests = await questList()
|
const quests = await questList()
|
||||||
const [totalQuests, totalCompleted] = quests.reduce(
|
const [totalQuests, totalCompleted] = quests.reduce(
|
||||||
([total, completed], quest) => [
|
([total, completed], quest) => [
|
||||||
@@ -17,8 +17,7 @@ export async function homeController(req, res) {
|
|||||||
userCount: await userCount(),
|
userCount: await userCount(),
|
||||||
totalQuests,
|
totalQuests,
|
||||||
totalCompleted,
|
totalCompleted,
|
||||||
|
completedRate: Math.round((totalCompleted / totalQuests) * 10000) / 100,
|
||||||
}
|
}
|
||||||
payload.completedRate =
|
|
||||||
Math.round((payload.totalCompleted / payload.totalQuests) * 10000) / 100
|
|
||||||
res.render('home', payload)
|
res.render('home', payload)
|
||||||
}
|
}
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
import { questList } from '../models/quests.js'
|
import { questList } from '../models/quests.js'
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
export async function questListController(req: Request, res: Response) {
|
||||||
export async function questListController(req, res) {
|
|
||||||
const quests = await questList()
|
const quests = await questList()
|
||||||
quests.forEach((quest) => {
|
quests.forEach((quest) => {
|
||||||
quest.failed = quest.started - quest.completed
|
quest.failed = quest.started - quest.completed
|
||||||
+4
-3
@@ -1,8 +1,9 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
import Pagination from '../models/pagination.js'
|
import Pagination from '../models/pagination.js'
|
||||||
import { sessionList, sessionDetail } from '../models/sessions.js'
|
import { sessionList, sessionDetail } from '../models/sessions.js'
|
||||||
|
|
||||||
export async function sessionListController(req, res) {
|
export async function sessionListController(req: Request, res: Response) {
|
||||||
const { nextKey, order } = req.query
|
const { nextKey, order } = req.query as { nextKey: string; order: string }
|
||||||
const itemsPerPage = 50
|
const itemsPerPage = 50
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -21,7 +22,7 @@ export async function sessionListController(req, res) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function sessionDetailController(req, res) {
|
export async function sessionDetailController(req: Request, res: Response) {
|
||||||
const { id } = req.params
|
const { id } = req.params
|
||||||
const session = await sessionDetail(id)
|
const session = await sessionDetail(id)
|
||||||
res.render('sessionDetail', { session })
|
res.render('sessionDetail', { session })
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
import Pagination from '../models/pagination.js'
|
|
||||||
import { userList } from '../models/users.js'
|
|
||||||
|
|
||||||
export async function userListController(req, res) {
|
|
||||||
const { nextKey, order } = req.query
|
|
||||||
const itemsPerPage = 50
|
|
||||||
|
|
||||||
try {
|
|
||||||
const pagination = new Pagination(order, itemsPerPage, nextKey)
|
|
||||||
const users = await userList(pagination)
|
|
||||||
const newNextKey = users[users.length - 1]?._id
|
|
||||||
|
|
||||||
res.render('users', {
|
|
||||||
users,
|
|
||||||
nextKey: newNextKey,
|
|
||||||
order: pagination.getOrder(),
|
|
||||||
})
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
res.status(500).send('Error fetching user data')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import { Request, Response } from 'express'
|
||||||
|
import mongoose from 'mongoose'
|
||||||
|
import Pagination from '../models/pagination.js'
|
||||||
|
import { userList, userDetail, idToUser } from '../models/users.js'
|
||||||
|
|
||||||
|
export async function userListController(req: Request, res: Response) {
|
||||||
|
const { nextKey, order } = req.query as { nextKey: string; order: string }
|
||||||
|
const itemsPerPage = 50
|
||||||
|
|
||||||
|
try {
|
||||||
|
const pagination = new Pagination(order, itemsPerPage, nextKey)
|
||||||
|
const users = await userList(pagination)
|
||||||
|
const newNextKey = users[users.length - 1]?._id
|
||||||
|
|
||||||
|
res.render('users', {
|
||||||
|
users,
|
||||||
|
nextKey: newNextKey,
|
||||||
|
order: pagination.getOrder(),
|
||||||
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
res.status(500).send('Error fetching user data')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function userDetailController(req: Request, res: Response) {
|
||||||
|
const id = new mongoose.Types.ObjectId(req.params.id)
|
||||||
|
const sessions = await userDetail(id)
|
||||||
|
try {
|
||||||
|
const user = await idToUser(id)
|
||||||
|
res.render('usersDetail', { sessions, user })
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
res.status(500).send('Error fetching user data')
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -0,0 +1,61 @@
|
|||||||
|
import { Types } from 'mongoose'
|
||||||
|
|
||||||
|
export interface User {
|
||||||
|
username: string
|
||||||
|
}
|
||||||
|
export interface SessionDocument {
|
||||||
|
_id: Types.ObjectId
|
||||||
|
user: User
|
||||||
|
quest: string
|
||||||
|
status: string
|
||||||
|
createdAt: Date
|
||||||
|
finishedAt: Date
|
||||||
|
}
|
||||||
|
export interface CommandObject {
|
||||||
|
command: string
|
||||||
|
pwd: string
|
||||||
|
stage?: string | null
|
||||||
|
output: string | undefined
|
||||||
|
error: string | undefined
|
||||||
|
createdAt: string
|
||||||
|
}
|
||||||
|
export interface SessionObject {
|
||||||
|
_id: Types.ObjectId
|
||||||
|
user: string
|
||||||
|
quest: string
|
||||||
|
status: string
|
||||||
|
createdAt: string
|
||||||
|
finishedAt: string
|
||||||
|
lastActivityAt: string
|
||||||
|
usedTime: string
|
||||||
|
commandCount: number
|
||||||
|
commands: CommandObject[]
|
||||||
|
}
|
||||||
|
export interface SessionDetail {
|
||||||
|
_id: Types.ObjectId
|
||||||
|
user: string
|
||||||
|
quest: string
|
||||||
|
status: string
|
||||||
|
createdAt: string
|
||||||
|
finishedAt: string
|
||||||
|
usedTime: string
|
||||||
|
commands: CommandObject[]
|
||||||
|
}
|
||||||
|
export interface IUser extends Document {
|
||||||
|
hashedPassword?: string
|
||||||
|
socialLogins?: Record<
|
||||||
|
string,
|
||||||
|
{
|
||||||
|
id: string
|
||||||
|
provider: string
|
||||||
|
displayName?: string | null | undefined
|
||||||
|
}
|
||||||
|
>
|
||||||
|
}
|
||||||
|
export interface UserSessionDetail {
|
||||||
|
_id: Types.ObjectId
|
||||||
|
quest: string
|
||||||
|
status: string
|
||||||
|
createdAt: string
|
||||||
|
usedTime: string
|
||||||
|
}
|
||||||
+2
-1
@@ -1,7 +1,8 @@
|
|||||||
import { Command } from '@linux-odyssey/models'
|
import { Command } from '@linux-odyssey/models'
|
||||||
|
import Pagination from './pagination.js'
|
||||||
|
|
||||||
// eslint-disable-next-line import/prefer-default-export
|
// eslint-disable-next-line import/prefer-default-export
|
||||||
export async function errorCommands(pagination) {
|
export async function errorCommands(pagination: Pagination) {
|
||||||
const commands = await Command.aggregate([
|
const commands = await Command.aggregate([
|
||||||
pagination.match('_id'),
|
pagination.match('_id'),
|
||||||
{
|
{
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
/* eslint-disable lines-between-class-members */
|
|
||||||
/* eslint-disable class-methods-use-this */
|
|
||||||
// eslint-disable-next-line max-classes-per-file
|
|
||||||
import mongoose from 'mongoose'
|
|
||||||
|
|
||||||
export const DESC = 'desc'
|
|
||||||
export const ASC = 'asc'
|
|
||||||
|
|
||||||
class Asc {
|
|
||||||
getOperator() {
|
|
||||||
return '$gt'
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrder() {
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
getName() {
|
|
||||||
return ASC
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class Desc {
|
|
||||||
getOperator() {
|
|
||||||
return '$lt'
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrder() {
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
getName() {
|
|
||||||
return DESC
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class Pagination {
|
|
||||||
nextKey = null
|
|
||||||
itemsPerPage = 50
|
|
||||||
order = null
|
|
||||||
|
|
||||||
constructor(order, itemsPerPage = 50, nextKey = null) {
|
|
||||||
this.itemsPerPage = itemsPerPage
|
|
||||||
if (!order || order === DESC) {
|
|
||||||
this.order = new Desc()
|
|
||||||
} else if (order === ASC) {
|
|
||||||
this.order = new Asc()
|
|
||||||
} else {
|
|
||||||
throw new Error('order must be asc or desc')
|
|
||||||
}
|
|
||||||
if (nextKey) {
|
|
||||||
this.nextKey = new mongoose.Types.ObjectId(nextKey)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
match(field) {
|
|
||||||
const stage = this.nextKey
|
|
||||||
? { [field]: { [this.order.getOperator()]: this.nextKey } }
|
|
||||||
: {}
|
|
||||||
return { $match: stage }
|
|
||||||
}
|
|
||||||
|
|
||||||
sort(field) {
|
|
||||||
return { $sort: { [field]: this.order.getOrder() } }
|
|
||||||
}
|
|
||||||
|
|
||||||
limit() {
|
|
||||||
return { $limit: this.itemsPerPage }
|
|
||||||
}
|
|
||||||
|
|
||||||
getOrder() {
|
|
||||||
return this.order.getName()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
/* eslint-disable class-methods-use-this */
|
||||||
|
// eslint-disable-next-line max-classes-per-file
|
||||||
|
import mongoose, { Types } from 'mongoose'
|
||||||
|
|
||||||
|
export const DESC: string = 'desc'
|
||||||
|
export const ASC: string = 'asc'
|
||||||
|
|
||||||
|
interface Order {
|
||||||
|
getOperator(): string
|
||||||
|
getOrder(): number
|
||||||
|
getName(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
class Asc implements Order {
|
||||||
|
getOperator(): string {
|
||||||
|
return '$gt'
|
||||||
|
}
|
||||||
|
|
||||||
|
getOrder(): number {
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
getName(): string {
|
||||||
|
return ASC
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Desc implements Order {
|
||||||
|
getOperator(): string {
|
||||||
|
return '$lt'
|
||||||
|
}
|
||||||
|
|
||||||
|
getOrder(): 1 | -1 {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
getName(): string {
|
||||||
|
return DESC
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default class Pagination {
|
||||||
|
nextKey: Types.ObjectId | null = null
|
||||||
|
itemsPerPage: number = 50
|
||||||
|
order: Order
|
||||||
|
|
||||||
|
constructor(
|
||||||
|
order: string,
|
||||||
|
itemsPerPage: number = 50,
|
||||||
|
nextKey: string | null = null
|
||||||
|
) {
|
||||||
|
this.itemsPerPage = itemsPerPage
|
||||||
|
if (!order || order === DESC) {
|
||||||
|
this.order = new Desc()
|
||||||
|
} else if (order === ASC) {
|
||||||
|
this.order = new Asc()
|
||||||
|
} else {
|
||||||
|
throw new Error('order must be asc or desc')
|
||||||
|
}
|
||||||
|
if (nextKey) {
|
||||||
|
this.nextKey = new mongoose.Types.ObjectId(nextKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
match(field: string) {
|
||||||
|
const stage: { [key: string]: { [key: string]: Types.ObjectId } } = this
|
||||||
|
.nextKey
|
||||||
|
? {
|
||||||
|
[field]: {
|
||||||
|
[this.order ? this.order.getOperator() : '$gt']: this.nextKey,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
: {}
|
||||||
|
return { $match: stage }
|
||||||
|
}
|
||||||
|
|
||||||
|
sort(field: string): { $sort: Record<string, 1 | -1> } {
|
||||||
|
return { $sort: { [field]: this.order.getOrder() as 1 | -1 } }
|
||||||
|
}
|
||||||
|
|
||||||
|
limit() {
|
||||||
|
return { $limit: this.itemsPerPage }
|
||||||
|
}
|
||||||
|
|
||||||
|
getOrder() {
|
||||||
|
return this.order.getName()
|
||||||
|
}
|
||||||
|
}
|
||||||
File renamed without changes.
@@ -1,83 +0,0 @@
|
|||||||
import { Command, Session } from '@linux-odyssey/models'
|
|
||||||
|
|
||||||
function formatTime(time) {
|
|
||||||
const seconds = Math.floor(time / 1000)
|
|
||||||
const minutes = Math.floor(seconds / 60)
|
|
||||||
const hours = Math.floor(minutes / 60)
|
|
||||||
return `${hours}h ${minutes % 60}m ${seconds % 60}s`
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sessionList(pagination) {
|
|
||||||
const sessions = await Session.aggregate([
|
|
||||||
pagination.match('_id'),
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: 'users',
|
|
||||||
localField: 'user',
|
|
||||||
foreignField: '_id',
|
|
||||||
as: 'user',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ $unwind: '$user' },
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: 'commands',
|
|
||||||
localField: '_id',
|
|
||||||
foreignField: 'session',
|
|
||||||
as: 'commands',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
pagination.sort('_id'),
|
|
||||||
pagination.limit(),
|
|
||||||
])
|
|
||||||
|
|
||||||
return sessions.map(
|
|
||||||
({
|
|
||||||
_id,
|
|
||||||
user,
|
|
||||||
quest,
|
|
||||||
status,
|
|
||||||
createdAt,
|
|
||||||
finishedAt,
|
|
||||||
commands,
|
|
||||||
lastActivityAt,
|
|
||||||
}) => {
|
|
||||||
return {
|
|
||||||
_id,
|
|
||||||
user: user.username,
|
|
||||||
quest,
|
|
||||||
status,
|
|
||||||
createdAt: createdAt?.toLocaleString(),
|
|
||||||
finishedAt: finishedAt?.toLocaleString(),
|
|
||||||
lastActivityAt: lastActivityAt?.toLocaleString(),
|
|
||||||
usedTime: formatTime(lastActivityAt - createdAt),
|
|
||||||
commandCount: commands?.length,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function sessionDetail(id) {
|
|
||||||
const session = await Session.findById(id).populate('user').exec()
|
|
||||||
const commands = (await Command.find({ session: id })).map(
|
|
||||||
({ command, pwd, output, error, createdAt, stage }) => ({
|
|
||||||
command: command?.slice(0, 20),
|
|
||||||
pwd,
|
|
||||||
stage,
|
|
||||||
output: output?.slice(0, 50),
|
|
||||||
error: error?.slice(0, 50),
|
|
||||||
createdAt: createdAt?.toLocaleString(),
|
|
||||||
})
|
|
||||||
)
|
|
||||||
const { _id, user, quest, status, createdAt, finishedAt } = session
|
|
||||||
return {
|
|
||||||
_id,
|
|
||||||
user: user.username,
|
|
||||||
quest,
|
|
||||||
status,
|
|
||||||
createdAt: createdAt?.toLocaleString(),
|
|
||||||
finishedAt: finishedAt?.toLocaleString(),
|
|
||||||
usedTime: finishedAt ? formatTime(finishedAt - createdAt) : '',
|
|
||||||
commands,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
import { Command, Session } from '@linux-odyssey/models'
|
||||||
|
import Pagination from './pagination.js'
|
||||||
|
import {
|
||||||
|
CommandObject,
|
||||||
|
SessionDetail,
|
||||||
|
SessionDocument,
|
||||||
|
SessionObject,
|
||||||
|
} from '../interface.js'
|
||||||
|
|
||||||
|
function formatTime(time: number) {
|
||||||
|
const seconds = Math.floor(time / 1000)
|
||||||
|
const minutes = Math.floor(seconds / 60)
|
||||||
|
const hours = Math.floor(minutes / 60)
|
||||||
|
return `${hours}h ${minutes % 60}m ${seconds % 60}s`
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sessionList(
|
||||||
|
pagination: Pagination
|
||||||
|
): Promise<SessionObject[]> {
|
||||||
|
const sessions = await Session.aggregate([
|
||||||
|
pagination.match('_id'),
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: 'users',
|
||||||
|
localField: 'user',
|
||||||
|
foreignField: '_id',
|
||||||
|
as: 'user',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ $unwind: '$user' },
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: 'commands',
|
||||||
|
localField: '_id',
|
||||||
|
foreignField: 'session',
|
||||||
|
as: 'commands',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
pagination.sort('_id'),
|
||||||
|
pagination.limit(),
|
||||||
|
])
|
||||||
|
|
||||||
|
return sessions.map((session) => {
|
||||||
|
const {
|
||||||
|
_id,
|
||||||
|
user,
|
||||||
|
quest,
|
||||||
|
status,
|
||||||
|
createdAt,
|
||||||
|
finishedAt,
|
||||||
|
commands,
|
||||||
|
lastActivityAt,
|
||||||
|
} = session
|
||||||
|
return {
|
||||||
|
_id,
|
||||||
|
user: user.username, // Assuming `user` is always populated.
|
||||||
|
quest,
|
||||||
|
status,
|
||||||
|
createdAt: createdAt?.toLocaleString(),
|
||||||
|
finishedAt: finishedAt?.toLocaleString(),
|
||||||
|
lastActivityAt: lastActivityAt?.toLocaleString(),
|
||||||
|
usedTime:
|
||||||
|
lastActivityAt && createdAt
|
||||||
|
? formatTime(lastActivityAt.getTime() - createdAt.getTime())
|
||||||
|
: 'N/A', // Ensure both dates are present
|
||||||
|
commandCount: commands?.length || 0,
|
||||||
|
commands,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function sessionDetail(id: string): Promise<SessionDetail> {
|
||||||
|
const session = (await Session.findById(id)
|
||||||
|
.populate('user')
|
||||||
|
.exec()) as unknown as SessionDocument
|
||||||
|
const commands: CommandObject[] = (await Command.find({ session: id })).map(
|
||||||
|
({ command, pwd, output, error, createdAt, stage }): CommandObject => ({
|
||||||
|
command: command?.slice(0, 20),
|
||||||
|
pwd,
|
||||||
|
stage,
|
||||||
|
output: output?.slice(0, 50),
|
||||||
|
error: error?.slice(0, 50),
|
||||||
|
createdAt: createdAt?.toLocaleString(),
|
||||||
|
})
|
||||||
|
)
|
||||||
|
const { _id, user, quest, status, createdAt, finishedAt } = session
|
||||||
|
return {
|
||||||
|
_id,
|
||||||
|
user: user.username,
|
||||||
|
quest,
|
||||||
|
status,
|
||||||
|
createdAt: createdAt?.toLocaleString(),
|
||||||
|
finishedAt: finishedAt?.toLocaleString(),
|
||||||
|
usedTime: finishedAt
|
||||||
|
? formatTime(finishedAt.getTime() - createdAt.getTime())
|
||||||
|
: '',
|
||||||
|
commands,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
import { Session, User } from '@linux-odyssey/models'
|
|
||||||
|
|
||||||
function loginMethods(user) {
|
|
||||||
const methods = []
|
|
||||||
if (user.hashedPassword) methods.push('password')
|
|
||||||
if (user.socialLogins) methods.push(...Object.keys(user.socialLogins))
|
|
||||||
return methods
|
|
||||||
}
|
|
||||||
|
|
||||||
export function userCount() {
|
|
||||||
return User.find().count()
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function userList(pagination) {
|
|
||||||
const users = await Session.aggregate([
|
|
||||||
pagination.match('user'),
|
|
||||||
{
|
|
||||||
$group: {
|
|
||||||
_id: '$user',
|
|
||||||
count: { $sum: 1 },
|
|
||||||
lastActivityAt: { $max: '$lastActivityAt' },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
$lookup: {
|
|
||||||
from: 'users',
|
|
||||||
localField: '_id',
|
|
||||||
foreignField: '_id',
|
|
||||||
as: 'userData',
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{ $unwind: '$userData' },
|
|
||||||
pagination.sort('userData._id'),
|
|
||||||
pagination.limit(),
|
|
||||||
])
|
|
||||||
|
|
||||||
return users.map(({ userData, count, lastActivityAt }) => {
|
|
||||||
const { _id, username, email, createdAt } = userData
|
|
||||||
return {
|
|
||||||
_id,
|
|
||||||
username,
|
|
||||||
email,
|
|
||||||
createdAt: createdAt?.toLocaleString(),
|
|
||||||
method: loginMethods(userData),
|
|
||||||
sessionCount: count,
|
|
||||||
lastActivityAt: lastActivityAt?.toLocaleString(),
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
import { Session, User } from '@linux-odyssey/models'
|
||||||
|
import { Types } from 'mongoose'
|
||||||
|
import Pagination from './pagination.js'
|
||||||
|
import { IUser, UserSessionDetail } from '../interface.js'
|
||||||
|
|
||||||
|
function loginMethods(user: IUser): string[] {
|
||||||
|
const methods: string[] = []
|
||||||
|
if (user.hashedPassword) methods.push('password')
|
||||||
|
if (user.socialLogins && typeof user.socialLogins === 'object') {
|
||||||
|
methods.push(...Object.keys(user.socialLogins))
|
||||||
|
}
|
||||||
|
return methods
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatTime(time: number) {
|
||||||
|
const seconds = Math.floor(time / 1000)
|
||||||
|
const minutes = Math.floor(seconds / 60)
|
||||||
|
const hours = Math.floor(minutes / 60)
|
||||||
|
return `${hours}h ${minutes % 60}m ${seconds % 60}s`
|
||||||
|
}
|
||||||
|
export function userCount() {
|
||||||
|
return User.countDocuments({})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function userList(pagination: Pagination) {
|
||||||
|
const users = await Session.aggregate([
|
||||||
|
pagination.match('user'),
|
||||||
|
{
|
||||||
|
$group: {
|
||||||
|
_id: '$user',
|
||||||
|
count: { $sum: 1 },
|
||||||
|
lastActivityAt: { $max: '$lastActivityAt' },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
$lookup: {
|
||||||
|
from: 'users',
|
||||||
|
localField: '_id',
|
||||||
|
foreignField: '_id',
|
||||||
|
as: 'userData',
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{ $unwind: '$userData' },
|
||||||
|
pagination.sort('userData._id'),
|
||||||
|
pagination.limit(),
|
||||||
|
])
|
||||||
|
|
||||||
|
return users.map(({ userData, count, lastActivityAt }) => {
|
||||||
|
const { _id, username, email, createdAt } = userData
|
||||||
|
return {
|
||||||
|
_id,
|
||||||
|
username,
|
||||||
|
email,
|
||||||
|
createdAt: createdAt?.toLocaleString(),
|
||||||
|
method: loginMethods(userData),
|
||||||
|
sessionCount: count,
|
||||||
|
lastActivityAt: lastActivityAt?.toLocaleString(),
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function userDetail(
|
||||||
|
id: Types.ObjectId
|
||||||
|
): Promise<UserSessionDetail[]> {
|
||||||
|
const sessions = await Session.find({
|
||||||
|
user: id,
|
||||||
|
})
|
||||||
|
return sessions.map((session): UserSessionDetail => {
|
||||||
|
const { _id, quest, status, createdAt, lastActivityAt } = session
|
||||||
|
return {
|
||||||
|
_id,
|
||||||
|
quest,
|
||||||
|
status,
|
||||||
|
createdAt: createdAt?.toLocaleString(),
|
||||||
|
usedTime:
|
||||||
|
lastActivityAt && createdAt
|
||||||
|
? formatTime(lastActivityAt.getTime() - createdAt.getTime())
|
||||||
|
: 'N/A', // Ensure both dates are present
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export async function idToUser(id: Types.ObjectId): Promise<String> {
|
||||||
|
const user = await User.findOne({
|
||||||
|
_id: id,
|
||||||
|
})
|
||||||
|
return user?.username || 'User not found'
|
||||||
|
}
|
||||||
@@ -1,7 +1,10 @@
|
|||||||
import { Router } from 'express'
|
import { Router } from 'express'
|
||||||
|
|
||||||
import { homeController } from './controllers/index.js'
|
import { homeController } from './controllers/index.js'
|
||||||
import { userListController } from './controllers/users.js'
|
import {
|
||||||
|
userListController,
|
||||||
|
userDetailController,
|
||||||
|
} from './controllers/users.js'
|
||||||
import { questListController } from './controllers/quests.js'
|
import { questListController } from './controllers/quests.js'
|
||||||
import { commandListController } from './controllers/commands.js'
|
import { commandListController } from './controllers/commands.js'
|
||||||
import {
|
import {
|
||||||
@@ -13,6 +16,7 @@ const router = Router()
|
|||||||
|
|
||||||
router.get('/', homeController)
|
router.get('/', homeController)
|
||||||
router.get('/users', userListController)
|
router.get('/users', userListController)
|
||||||
|
router.get('/users/:id', userDetailController)
|
||||||
router.get('/quests', questListController)
|
router.get('/quests', questListController)
|
||||||
router.get('/commands', commandListController)
|
router.get('/commands', commandListController)
|
||||||
router.get('/sessions', sessionListController)
|
router.get('/sessions', sessionListController)
|
||||||
File renamed without changes.
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"extends": "../../tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"rootDir": "src",
|
||||||
|
"outDir": "./dist"
|
||||||
|
},
|
||||||
|
"include": ["src"],
|
||||||
|
"references": [{ "path": "../models" }],
|
||||||
|
"ts-node": {
|
||||||
|
"swc": true
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
<h1>Commands</h1>
|
<h1 class='heading'>Commands</h1>
|
||||||
<div>
|
<div>
|
||||||
<h2>Error commands</h2>
|
<h2 class='heading'>Error commands</h2>
|
||||||
<div class='pagination'>
|
<div class='sort'>
|
||||||
<a href='/commands?order=asc'>Ascending</a>
|
<a href='/commands?order=asc'><div class='btn'>
|
||||||
<a href='/commands?order=desc'>Descending</a>
|
<h3>Ascending</h3>
|
||||||
|
</div></a>
|
||||||
|
<a href='/commands?order=desc'><div class='btn'>
|
||||||
|
<h3>Descending</h3>
|
||||||
|
</div></a>
|
||||||
</div>
|
</div>
|
||||||
<table>
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Command</th>
|
<th>Command</th>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
@@ -25,7 +29,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
<div class='pagination'>
|
<div class='pagination sort'>
|
||||||
<a href='/commands?nextKey={{nextKey}}&order={{order}}'>Next</a>
|
<a href='/commands?nextKey={{nextKey}}&order={{order}}'><div class='btn'>
|
||||||
|
<h3>Next</h3>
|
||||||
|
</div></a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
<h1>Welcome to {{title}}</h1>
|
<body>
|
||||||
<div>
|
<div class='title'>
|
||||||
<h2>Overview</h2>
|
<img src='icon_totem.svg' class='styled-image' />
|
||||||
<table>
|
<h1>Welcome to {{title}}</h1>
|
||||||
|
</div>
|
||||||
|
<div class='container'>
|
||||||
|
<h2 class='heading'>Overview</h2>
|
||||||
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Registered Users</th>
|
<th>Registered Users</th>
|
||||||
<td>{{userCount}}</td>
|
<td>{{userCount}}</td>
|
||||||
@@ -19,4 +23,5 @@
|
|||||||
<td>{{completedRate}}%</td>
|
<td>{{completedRate}}%</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
</body>
|
||||||
@@ -4,14 +4,12 @@
|
|||||||
<link rel='stylesheet' href='/css/style.css' />
|
<link rel='stylesheet' href='/css/style.css' />
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<nav>
|
<nav class='nav'>
|
||||||
<ul>
|
<div><a href='/'>Home</a></div>
|
||||||
<li><a href='/'>Home</a></li>
|
<div><a href='/users'>Users</a></div>
|
||||||
<li><a href='/users'>Users</a></li>
|
<div><a href='/quests'>Quests</a></div>
|
||||||
<li><a href='/quests'>Quests</a></li>
|
<div><a href='/commands'>Commands</a></div>
|
||||||
<li><a href='/commands'>Commands</a></li>
|
<div><a href='/sessions'>Sessions</a></div>
|
||||||
<li><a href='/sessions'>Sessions</a></li>
|
|
||||||
</ul>
|
|
||||||
</nav>
|
</nav>
|
||||||
{{{body}}}
|
{{{body}}}
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<h1>Quests</h1>
|
<h1 class='heading'>Quests</h1>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Id</th>
|
<th>Id</th>
|
||||||
<th>Started</th>
|
<th>Started</th>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<h1>{{title}}</h1>
|
{{#with session}}<h1 class='heading'>Session {{_id}}</h1>
|
||||||
<div>
|
<div>
|
||||||
{{#with session}}
|
|
||||||
<table>
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Quest</th>
|
<th>Quest</th>
|
||||||
<td>{{quest}}</td>
|
<td>{{quest}}</td>
|
||||||
@@ -32,9 +32,9 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h2>Commands</h2>
|
<h2 class='heading'>Commands</h2>
|
||||||
|
|
||||||
<table>
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Stage</th>
|
<th>Stage</th>
|
||||||
<th>PWD</th>
|
<th>PWD</th>
|
||||||
@@ -54,5 +54,5 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
{{/with}}
|
|
||||||
</div>
|
</div>{{/with}}
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
<h1>Sessions</h1>
|
<h1 class='heading'>Sessions</h1>
|
||||||
<div class='pagination'>
|
<div class='sort'>
|
||||||
<a href='/sessions?order=asc'>Ascending</a>
|
<a href='/sessions?order=asc'><div class='btn'>
|
||||||
<a href='/sessions?order=desc'>Descending</a>
|
<h3>Ascending</h3>
|
||||||
|
</div></a>
|
||||||
|
<a href='/sessions?order=desc'><div class='btn'>
|
||||||
|
<h3>Descending</h3>
|
||||||
|
</div></a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>User</th>
|
<th>User</th>
|
||||||
<th>Quest</th>
|
<th>Quest</th>
|
||||||
@@ -29,6 +33,8 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class='pagination'>
|
<div class='pagination sort'>
|
||||||
<a href='/sessions?nextKey={{nextKey}}&order={{order}}'>Next</a>
|
<a href='/sessions?nextKey={{nextKey}}&order={{order}}'><div class='btn'>
|
||||||
|
<h3>Next</h3>
|
||||||
|
</div></a>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
<h1>Users List</h1>
|
<h1 class='heading'>Users List</h1>
|
||||||
<div class='pagination'>
|
<div class='sort'>
|
||||||
<a href='/users?order=asc'>Ascending</a>
|
<a href='/users?order=asc'><div class='btn'>
|
||||||
<a href='/users?order=desc'>Descending</a>
|
<h3>Ascending</h3>
|
||||||
|
</div></a>
|
||||||
|
<a href='/users?order=desc'><div class='btn'>
|
||||||
|
<h3>Descending</h3>
|
||||||
|
</div></a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<table>
|
<table class='data-table'>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Username</th>
|
<th>Username</th>
|
||||||
<th>Last Activity</th>
|
<th>Last Activity</th>
|
||||||
@@ -15,7 +19,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
{{#each users}}
|
{{#each users}}
|
||||||
<tr>
|
<tr>
|
||||||
<td href='/users/{{_id}}'>{{username}}</td>
|
<td><a href='/users/{{_id}}'>{{username}}</a></td>
|
||||||
<td>{{lastActivityAt}}</td>
|
<td>{{lastActivityAt}}</td>
|
||||||
<td>{{sessionCount}}</td>
|
<td>{{sessionCount}}</td>
|
||||||
<td>{{email}}</td>
|
<td>{{email}}</td>
|
||||||
@@ -25,6 +29,8 @@
|
|||||||
{{/each}}
|
{{/each}}
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<div class='pagination'>
|
<div class='pagination sort'>
|
||||||
<a href='/users?nextKey={{nextKey}}&order={{order}}'>Next</a>
|
<a href='/users?nextKey={{nextKey}}&order={{order}}'><div class='btn'>
|
||||||
|
<h3>Next</h3>
|
||||||
|
</div></a>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<h1 class='heading'>{{user}}'s Sessions History</h1>
|
||||||
|
<div>
|
||||||
|
<table class='data-table'>
|
||||||
|
<tr>
|
||||||
|
<th>Quest</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Created At</th>
|
||||||
|
<th>Used Time</th>
|
||||||
|
<th>Session</th>
|
||||||
|
</tr>
|
||||||
|
{{#each sessions}}
|
||||||
|
<tr>
|
||||||
|
<td>{{quest}}</td>
|
||||||
|
<td>{{status}}</td>
|
||||||
|
<td>{{createdAt}}</td>
|
||||||
|
<td>{{usedTime}}</td>
|
||||||
|
<td><a href='/sessions/{{_id}}'>Detail</a></td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
Loaded 100 of 234 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user