diff --git a/.github/workflows/build-deploy-[all].yml b/.github/workflows/build-deploy-[all].yml
index 34a4b18..920eee4 100644
--- a/.github/workflows/build-deploy-[all].yml
+++ b/.github/workflows/build-deploy-[all].yml
@@ -17,7 +17,11 @@ jobs:
name: Build & Deploy / ${{ matrix.package }}
strategy:
matrix:
- package: [home]
+ include:
+ - package: home
+ package_cap: HOME
+ - package: admin
+ package_cap: ADMIN
uses: ./.github/workflows/build-deploy.yml
with:
package: ${{ matrix.package }}
diff --git a/.github/workflows/build-deploy-admin.yml b/.github/workflows/build-deploy-admin.yml
new file mode 100644
index 0000000..baa04c9
--- /dev/null
+++ b/.github/workflows/build-deploy-admin.yml
@@ -0,0 +1,18 @@
+name: Build & Deploy / admin
+run-name: Build & Deploy (${{ github.ref_name }}/admin)
+
+on:
+ push:
+ paths:
+ - 'packages/admin/**'
+
+concurrency: build-deploy-admin-${{ github.ref }}
+
+jobs:
+ build-deploy-admin:
+ name: Build & Deploy
+ uses: ./.github/workflows/build-deploy.yml
+ with:
+ package: admin
+ package_cap: ADMIN
+ secrets: inherit
diff --git a/.github/workflows/build-deploy-home.yml b/.github/workflows/build-deploy-home.yml
index 2d84f61..3c67027 100644
--- a/.github/workflows/build-deploy-home.yml
+++ b/.github/workflows/build-deploy-home.yml
@@ -14,4 +14,5 @@ jobs:
uses: ./.github/workflows/build-deploy.yml
with:
package: home
+ package_cap: HOME
secrets: inherit
diff --git a/.github/workflows/build-deploy.yml b/.github/workflows/build-deploy.yml
index 96a9129..d4dc8cc 100644
--- a/.github/workflows/build-deploy.yml
+++ b/.github/workflows/build-deploy.yml
@@ -4,6 +4,9 @@ on:
package:
required: true
type: string
+ package_cap:
+ required: true
+ type: string
secrets:
PROD_CLOUD_SSH_URI:
required: true
@@ -15,6 +18,8 @@ on:
required: true
PROD_CLOUD_PROJECT_ROOT:
required: true
+ PROD_HOME_PM2_CONF_ENV:
+ PROD_ADMIN_PM2_CONF_ENV:
jobs:
build:
@@ -42,6 +47,19 @@ jobs:
run: pnpm -F ${{ inputs.package }} install
- name: Build standalone server
run: 'pnpm run build:${{ inputs.package }}'
+ - name: Replace environment variables
+ run: |
+ [ -z "${{ secrets[format('PROD_{0}_PM2_CONF_ENV', inputs.package_cap)] }}" ] || (
+ echo "${{ secrets[format('PROD_{0}_PM2_CONF_ENV', inputs.package_cap)] }}" |
+ awk '
+ /env: {/,/}/ {
+ if (/env: {/ || /}/) print;
+ while((getline < "/dev/stdin") > 0) print;
+ next
+ }
+ { print }
+ ' packages/${{ inputs.package }}/ecosystem.config.js
+ )
- name: Package the build
run: |
cd packages/${{ inputs.package }}
diff --git a/.gitignore b/.gitignore
index cf53a67..efabecb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,9 @@
!.idea/jsLinters/
!.idea/icon.svg
+### Dotenv
+.env
+
### Node.js
# Logs
*.log*
diff --git a/.idea/dictionaries/thrrip.xml b/.idea/dictionaries/thrrip.xml
index e2cf3d2..9cd599a 100644
--- a/.idea/dictionaries/thrrip.xml
+++ b/.idea/dictionaries/thrrip.xml
@@ -6,6 +6,7 @@
bilibili
dscreen
fortawesome
+ getline
nuxtjs
shopt
webmanifest
diff --git a/.run/build_admin.run.xml b/.run/build_admin.run.xml
new file mode 100644
index 0000000..f6ec0fd
--- /dev/null
+++ b/.run/build_admin.run.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/dev_admin.run.xml b/.run/dev_admin.run.xml
new file mode 100644
index 0000000..c18fe75
--- /dev/null
+++ b/.run/dev_admin.run.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.run/preview_admin.run.xml b/.run/preview_admin.run.xml
new file mode 100644
index 0000000..3e8c9d2
--- /dev/null
+++ b/.run/preview_admin.run.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/package.json b/package.json
index fbccb28..6318a59 100644
--- a/package.json
+++ b/package.json
@@ -16,7 +16,10 @@
"postinstall": "nuxt prepare && pnpm -r exec nuxt prepare",
"dev:home": "pnpm -F home exec nuxt dev",
"build:home": "pnpm -F home exec nuxt build",
- "preview:home": "pnpm -F home exec nuxt preview"
+ "preview:home": "pnpm -F home exec nuxt preview",
+ "dev:admin": "pnpm -F admin exec nuxt dev",
+ "build:admin": "pnpm -F admin exec nuxt build",
+ "preview:admin": "pnpm -F admin exec nuxt preview"
},
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^6.4.2",
diff --git a/packages/admin/app.config.ts b/packages/admin/app.config.ts
new file mode 100644
index 0000000..0a48132
--- /dev/null
+++ b/packages/admin/app.config.ts
@@ -0,0 +1 @@
+export { default } from '../../app.config'
diff --git a/packages/admin/ecosystem.config.js b/packages/admin/ecosystem.config.js
new file mode 100644
index 0000000..7a25f3e
--- /dev/null
+++ b/packages/admin/ecosystem.config.js
@@ -0,0 +1,15 @@
+module.exports = {
+ apps: [
+ {
+ name: 'mzg.fan-admin',
+ script: './.output/server/index.mjs',
+ interpreter: 'bun',
+ port: 22321,
+ max_memory_restart: '200M',
+ env: {
+ 'NITRO_PORT': 22321,
+ 'NUXT_BACKEND_API_KEY': ''
+ }
+ }
+ ]
+}
diff --git a/packages/admin/nuxt.config.ts b/packages/admin/nuxt.config.ts
new file mode 100644
index 0000000..49e8040
--- /dev/null
+++ b/packages/admin/nuxt.config.ts
@@ -0,0 +1,46 @@
+// https://nuxt.com/docs/api/configuration/nuxt-config
+export default defineNuxtConfig({
+ app: {
+ baseURL: '/admin/',
+ head: {
+ charset: 'utf-8',
+ viewport: 'width=device-width, initial-scale=1',
+ htmlAttrs: {
+ lang: 'zh'
+ },
+ title: '管理面板 | 洺知-故犯',
+ meta: [
+ { name: 'description', content: '' },
+ { name: 'format-detection', content: 'telephone=no' },
+ { name: 'theme-color', content: '#89c1cf', media: '(prefers-color-scheme: light)' },
+ { name: 'theme-color', content: '#89c1cf', media: '(prefers-color-scheme: dark)' }
+ ],
+ link: [
+ { rel: 'icon', href: '/favicon.ico', sizes: '48x48 32x32 16x16' },
+ { rel: 'apple-touch-icon', type: 'image/png', href: '/apple-touch-icon.png' },
+ { rel: 'manifest', href: '/site.webmanifest' }
+ ]
+ }
+ },
+
+ css: [
+ '@/../../assets/css/main.css',
+ '@fortawesome/fontawesome-svg-core/styles.css'
+ ],
+
+ devServer: {
+ host: '0.0.0.0',
+ port: 3001
+ },
+
+ postcss: {
+ plugins: {
+ 'tailwindcss': {},
+ 'autoprefixer': {}
+ }
+ },
+
+ runtimeConfig: {
+ backendApiKey: ''
+ }
+})
diff --git a/packages/admin/package.json b/packages/admin/package.json
new file mode 100644
index 0000000..8702bee
--- /dev/null
+++ b/packages/admin/package.json
@@ -0,0 +1,21 @@
+{
+ "name": "admin",
+ "dependencies": {
+ "@fortawesome/fontawesome-svg-core": "^6.4.2",
+ "@fortawesome/vue-fontawesome": "^3.0.3",
+ "appwrite": "^13.0.0",
+ "node-appwrite": "^11.0.0",
+ "pinyin-pro": "^3.17.0"
+ },
+ "devDependencies": {
+ "@fortawesome/free-brands-svg-icons": "^6.4.2",
+ "@fortawesome/free-solid-svg-icons": "^6.4.2",
+ "@nuxtjs/eslint-config-typescript": "^12.1.0",
+ "@types/node": "^18.18.8",
+ "autoprefixer": "^10.4.15",
+ "nuxt": "^3.8.0",
+ "postcss": "^8.4.31",
+ "tailwind-scrollbar": "^3.0.5",
+ "tailwindcss": "^3.3.5"
+ }
+}
diff --git a/packages/admin/tailwind.config.js b/packages/admin/tailwind.config.js
new file mode 100644
index 0000000..8cbda83
--- /dev/null
+++ b/packages/admin/tailwind.config.js
@@ -0,0 +1 @@
+module.exports = require('../../tailwind.config')
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1d014f8..faffbe8 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -58,6 +58,52 @@ importers:
specifier: ^3.3.5
version: 3.3.5
+ packages/admin:
+ dependencies:
+ '@fortawesome/fontawesome-svg-core':
+ specifier: ^6.4.2
+ version: 6.4.2
+ '@fortawesome/vue-fontawesome':
+ specifier: ^3.0.3
+ version: 3.0.3(@fortawesome/fontawesome-svg-core@6.4.2)(vue@3.3.7)
+ appwrite:
+ specifier: ^13.0.0
+ version: 13.0.0
+ node-appwrite:
+ specifier: ^11.0.0
+ version: 11.0.0
+ pinyin-pro:
+ specifier: ^3.17.0
+ version: 3.17.0
+ devDependencies:
+ '@fortawesome/free-brands-svg-icons':
+ specifier: ^6.4.2
+ version: 6.4.2
+ '@fortawesome/free-solid-svg-icons':
+ specifier: ^6.4.2
+ version: 6.4.2
+ '@nuxtjs/eslint-config-typescript':
+ specifier: ^12.1.0
+ version: 12.1.0(eslint@8.53.0)(typescript@5.2.2)
+ '@types/node':
+ specifier: ^18.18.8
+ version: 18.18.8
+ autoprefixer:
+ specifier: ^10.4.15
+ version: 10.4.16(postcss@8.4.31)
+ nuxt:
+ specifier: ^3.8.0
+ version: 3.8.0(@types/node@18.18.8)(eslint@8.53.0)(typescript@5.2.2)(vite@4.5.0)
+ postcss:
+ specifier: ^8.4.31
+ version: 8.4.31
+ tailwind-scrollbar:
+ specifier: ^3.0.5
+ version: 3.0.5(tailwindcss@3.3.5)
+ tailwindcss:
+ specifier: ^3.3.5
+ version: 3.3.5
+
packages/home:
dependencies:
'@fortawesome/fontawesome-svg-core':
@@ -1315,7 +1361,7 @@ packages:
'@nuxt/kit': 3.8.0
birpc: 0.2.14
consola: 3.2.3
- destr: 2.0.1
+ destr: 2.0.2
error-stack-parser-es: 0.1.1
execa: 7.2.0
fast-glob: 3.3.1
@@ -1461,7 +1507,7 @@ packages:
clear: 0.1.0
consola: 3.2.3
cssnano: 6.0.1(postcss@8.4.31)
- defu: 6.1.2
+ defu: 6.1.3
esbuild: 0.19.5
escape-string-regexp: 5.0.0
estree-walker: 3.0.3
@@ -2665,6 +2711,16 @@ packages:
engines: {node: '>= 0.4'}
dev: true
+ /axios@1.6.0:
+ resolution: {integrity: sha512-EZ1DYihju9pwVB+jg67ogm+Tmqc6JmhamRN6I4Zt8DfZu5lbcQGw3ozH9lFejSJgs/ibaef3A9PMXPLeefFGJg==}
+ dependencies:
+ follow-redirects: 1.15.3
+ form-data: 4.0.0
+ proxy-from-env: 1.1.0
+ transitivePeerDependencies:
+ - debug
+ dev: false
+
/b4a@1.6.4:
resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==}
dev: true
@@ -4248,6 +4304,16 @@ packages:
resolution: {integrity: sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ==}
dev: true
+ /follow-redirects@1.15.3:
+ resolution: {integrity: sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==}
+ engines: {node: '>=4.0'}
+ peerDependencies:
+ debug: '*'
+ peerDependenciesMeta:
+ debug:
+ optional: true
+ dev: false
+
/for-each@0.3.3:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
dependencies:
@@ -4271,6 +4337,15 @@ packages:
mime-types: 2.1.35
dev: false
+ /form-data@4.0.0:
+ resolution: {integrity: sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==}
+ engines: {node: '>= 6'}
+ dependencies:
+ asynckit: 0.4.0
+ combined-stream: 1.0.8
+ mime-types: 2.1.35
+ dev: false
+
/fraction.js@4.3.6:
resolution: {integrity: sha512-n2aZ9tNfYDwaHhvFTkhFErqOMIb8uyzSQ+vGJBjZyanAKZVbGUQ1sngfk9FdkBw7G26O7AgNjLcecLffD1c7eg==}
dev: true
@@ -5692,6 +5767,15 @@ packages:
resolution: {integrity: sha512-vgbBJTS4m5/KkE16t5Ly0WW9hz46swAstv0hYYwMtbG7AznRhNyfLRe8HZAiWIpcHzoO7HxhLuBQj9rJ/Ho0ZA==}
dev: true
+ /node-appwrite@11.0.0:
+ resolution: {integrity: sha512-l+O0d1kCvY56NdlmsiWw91IlUzJszNW7FZodGCyvNlJeR4+JIpy9Mica3T4M+zvZGsbRqLhpghCysQmPBwwhQA==}
+ dependencies:
+ axios: 1.6.0
+ form-data: 4.0.0
+ transitivePeerDependencies:
+ - debug
+ dev: false
+
/node-fetch-native@1.4.0:
resolution: {integrity: sha512-F5kfEj95kX8tkDhUCYdV8dg3/8Olx/94zB8+ZNthFs6Bz31UpUi8Xh40TN3thLwXgrwXry1pEg9lJ++tLWTcqA==}
dev: true
@@ -6762,6 +6846,10 @@ packages:
resolution: {integrity: sha512-/XJ368cyBJ7fzLMwLKv1e4vLxOju2MNAIokcr7meSaNcVbWz/CPcW22cP04mwxOErdA5mwjA8Q6w/cdAQxVn7Q==}
dev: true
+ /proxy-from-env@1.1.0:
+ resolution: {integrity: sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==}
+ dev: false
+
/prr@1.0.1:
resolution: {integrity: sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw==}
dev: true