部署生产环境调整配置

This commit is contained in:
celebrateyang 2025-06-06 23:32:42 +08:00
parent 9b2783ec16
commit 5f028072a7
3 changed files with 22 additions and 8 deletions

View File

@ -49,7 +49,19 @@ spec:
- name: API_PORT
value: '80'
- name: API_NAME
value: cobalt
value: freesavevideo-api
- name: CORS_WILDCARD
value: '1'
- name: CORS_URL
value: https://freesavevideo.online
- name: RATELIMIT_WINDOW
value: '60'
- name: RATELIMIT_MAX
value: '30'
- name: TUNNEL_RATELIMIT_WINDOW
value: '60'
- name: TUNNEL_RATELIMIT_MAX
value: '50'
- name: TURNSTILE_SITEKEY
value: 0x4AAAAAAAw8jRb9G7cWXnbd
- name: COOKIE_PATH

View File

@ -105,17 +105,19 @@ export class ClipboardManager {
peerConnected: peerConnected
}));
}, 1000);
}
// WebSocket management
} // WebSocket management
private getWebSocketURL(): string {
if (typeof window === 'undefined') return 'ws://localhost:9000/ws';
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
let host = window.location.host;
// For mobile access, use the actual IP instead of localhost
if (host.includes('localhost') || host.includes('127.0.0.1')) {
// 生产环境使用API域名进行WebSocket连接
if (window.location.hostname === 'freesavevideo.online') {
host = 'api.freesavevideo.online';
}
// 开发环境处理
else if (host.includes('localhost') || host.includes('127.0.0.1')) {
host = '192.168.1.12:5173';
}

View File

@ -55,8 +55,8 @@ const docs = {
apiLicense: "https://github.com/imputnet/cobalt/blob/main/api/LICENSE",
};
//const apiURL = "https://api.freesavevideo.online/";
const apiURL = "http://localhost:9000";
// 生产环境使用环境变量或默认值
const apiURL = variables.DEFAULT_API || "https://api.freesavevideo.online/";
export { donate, apiURL, contacts, partners, siriShortcuts, docs };
export default variables;