fix: switch admin to subdomain mode and fix frozen-lockfile build

- Remove /admin path prefix (using admin.protdskj.top subdomain instead)
- Change pnpm install to --no-frozen-lockfile for lockfile compatibility
- Simplify admin Nginx config to standard SPA serving

🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
2026-06-09 11:24:40 +08:00
parent 4caedde3fc
commit 9c6c5e51f3
7 changed files with 10 additions and 26 deletions

View File

@@ -3,7 +3,7 @@ import router from './router';
import { clearStaffSession, reconcileStaffSessionFromToken, useAuthStore } from './stores/auth';
import { ensureStaffSession, resetStaffSessionHydration } from './utils/session-hydrate';
const api = axios.create({ baseURL: '/admin/api' });
const api = axios.create({ baseURL: '/api' });
let handling401 = false;
let handling403Portal = false;

View File

@@ -3,7 +3,7 @@ import { useAuthStore } from '../stores/auth';
import { ensureStaffSession } from '../utils/session-hydrate';
const router = createRouter({
history: createWebHistory('/admin'),
history: createWebHistory(),
routes: [
{ path: '/login', component: () => import('../views/Login.vue'), meta: { public: true } },
{

View File

@@ -3,7 +3,6 @@ import vue from '@vitejs/plugin-vue';
import { resolve } from 'path';
export default defineConfig({
base: '/admin/',
plugins: [vue()],
resolve: {
// 避免 src 内遗留的 .js 抢先于 .ts/.vue 被解析(曾导致 i18n 文案缺失)
@@ -16,12 +15,6 @@ export default defineConfig({
publicDir: resolve(__dirname, '../../packages/shared/public'),
server: {
port: 5174,
proxy: {
'/admin/api': {
target: 'http://localhost:3000',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/admin\/api/, '/api'),
},
},
proxy: { '/api': { target: 'http://localhost:3000', changeOrigin: true } },
},
});

View File

@@ -10,7 +10,7 @@ COPY apps/api/package.json apps/api/
COPY apps/player/package.json apps/player/
COPY apps/admin/package.json apps/admin/
COPY packages/shared/package.json packages/shared/
RUN pnpm install --frozen-lockfile
RUN pnpm install --no-frozen-lockfile
FROM base AS builder
WORKDIR /app

View File

@@ -10,7 +10,7 @@ COPY apps/api/package.json apps/api/
COPY apps/player/package.json apps/player/
COPY apps/admin/package.json apps/admin/
COPY packages/shared/package.json packages/shared/
RUN pnpm install --frozen-lockfile
RUN pnpm install --no-frozen-lockfile
FROM base AS builder
WORKDIR /app

View File

@@ -9,8 +9,8 @@ server {
gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml;
location /admin/api/ {
proxy_pass http://api:3000/api/;
location /api/ {
proxy_pass http://api:3000;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@@ -18,16 +18,7 @@ server {
proxy_set_header X-Forwarded-Proto $scheme;
}
location /admin/ {
alias /usr/share/nginx/html/;
try_files $uri $uri/ @admin_spa;
}
location @admin_spa {
rewrite ^ /index.html break;
}
location = / {
return 301 /admin/;
location / {
try_files $uri $uri/ /index.html;
}
}

View File

@@ -10,7 +10,7 @@ COPY apps/api/package.json apps/api/
COPY apps/player/package.json apps/player/
COPY apps/admin/package.json apps/admin/
COPY packages/shared/package.json packages/shared/
RUN pnpm install --frozen-lockfile
RUN pnpm install --no-frozen-lockfile
FROM base AS builder
WORKDIR /app