mirror of
https://github.com/whyour/qinglong.git
synced 2026-08-10 11:24:33 +08:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d1360342eb | |||
| 39ef449c10 |
@@ -64,19 +64,6 @@ if (!process.env.QL_DIR) {
|
|||||||
|
|
||||||
const lastVersionFile = `https://qn.whyour.cn/version.yaml`;
|
const lastVersionFile = `https://qn.whyour.cn/version.yaml`;
|
||||||
|
|
||||||
// Get and normalize QlBaseUrl
|
|
||||||
let baseUrl = process.env.QlBaseUrl || '';
|
|
||||||
if (baseUrl) {
|
|
||||||
// Ensure it starts with /
|
|
||||||
if (!baseUrl.startsWith('/')) {
|
|
||||||
baseUrl = `/${baseUrl}`;
|
|
||||||
}
|
|
||||||
// Remove trailing slash for consistency in route definitions
|
|
||||||
if (baseUrl.endsWith('/')) {
|
|
||||||
baseUrl = baseUrl.slice(0, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const rootPath = process.env.QL_DIR as string;
|
const rootPath = process.env.QL_DIR as string;
|
||||||
const envFound = dotenv.config({ path: path.join(rootPath, '.env') });
|
const envFound = dotenv.config({ path: path.join(rootPath, '.env') });
|
||||||
|
|
||||||
@@ -129,7 +116,6 @@ if (envFound.error) {
|
|||||||
export default {
|
export default {
|
||||||
...config,
|
...config,
|
||||||
jwt: config.jwt,
|
jwt: config.jwt,
|
||||||
baseUrl,
|
|
||||||
rootPath,
|
rootPath,
|
||||||
tmpPath,
|
tmpPath,
|
||||||
dataPath,
|
dataPath,
|
||||||
|
|||||||
@@ -15,13 +15,6 @@ import path from 'path';
|
|||||||
export default ({ app }: { app: Application }) => {
|
export default ({ app }: { app: Application }) => {
|
||||||
app.set('trust proxy', 'loopback');
|
app.set('trust proxy', 'loopback');
|
||||||
app.use(cors());
|
app.use(cors());
|
||||||
|
|
||||||
// Rewrite URLs to strip baseUrl prefix if configured
|
|
||||||
// This allows the rest of the app to work without baseUrl awareness
|
|
||||||
if (config.baseUrl) {
|
|
||||||
app.use(rewrite(`${config.baseUrl}/*`, '/$1'));
|
|
||||||
}
|
|
||||||
|
|
||||||
app.get(`${config.api.prefix}/env.js`, serveEnv);
|
app.get(`${config.api.prefix}/env.js`, serveEnv);
|
||||||
app.use(`${config.api.prefix}/static`, express.static(config.uploadPath));
|
app.use(`${config.api.prefix}/static`, express.static(config.uploadPath));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user