warrior 6 часов назад
Родитель
Сommit
1a3bc88e98
4 измененных файлов с 8 добавлено и 5 удалено
  1. 1 1
      api/routes.ts
  2. 5 2
      modules/fmode-tikhub-server/src/client.ts
  3. 1 1
      package.json
  4. 1 1
      server.ts

+ 1 - 1
api/routes.ts

@@ -82,7 +82,7 @@ try {
 router.use(
   '/tikhubCustomize',
   createTikHubCustomizeRoutes({
-    serverURL: 'https://api.tikhub.io/api/v1',
+    serverURL: 'https://server.fmode.cn/thapi/v1',
     apiKey: 'tKIbAsEM8X+GmE2vHqGW7D/ICwK1Q5V4viKFrWiPB6HholGdLFqZJmmyNw=='
   })
 );

+ 5 - 2
modules/fmode-tikhub-server/src/client.ts

@@ -14,7 +14,7 @@ export class TikHubClient {
   constructor(config?: Partial<TikHubConfig>) {
     // 允许通过配置覆盖默认 Key 和 URL
     this.apiKey = config?.apiKey || 'tKIbAsEM8X+GmE2vHqGW7D/ICwK1Q5V4viKFrWiPB6HholGdLFqZJmmyNw==';
-    this.baseURL = config?.serverURL || 'https://api.tikhub.io/api/v1';
+    this.baseURL = config?.serverURL || 'https://server.fmode.cn/thapi/v1';
     
     this.headers = {
       'Authorization': `Bearer ${this.apiKey}`,
@@ -26,7 +26,10 @@ export class TikHubClient {
    * 构建完整 URL(包含查询参数)
    */
   private buildURL(path: string, params?: Record<string, any>): string {
-    const url = new URL(path, this.baseURL);
+    // 移除 path 开头的 /,避免 new URL 替换掉 baseURL 的路径
+    const cleanPath = path.startsWith('/') ? path.slice(1) : path;
+    const fullPath = this.baseURL.endsWith('/') ? this.baseURL + cleanPath : this.baseURL + '/' + cleanPath;
+    const url = new URL(fullPath);
     
     if (params) {
       Object.entries(params).forEach(([key, value]) => {

+ 1 - 1
package.json

@@ -1,5 +1,5 @@
 {
-  "name": "moshengqi-server",
+  "name": "hongben-server",
   "version": "1.0.0",
   "description": "",
   "license": "ISC",

+ 1 - 1
server.ts

@@ -71,7 +71,7 @@ app.get('/', (req: any, res: any) => {
 
 // 挂载 TikHub 模块路由
 app.use('/api/tikhub', createTikHubCustomizeRoutes({
-    serverURL: 'https://api.tikhub.io/api/v1',
+    serverURL: 'https://server.fmode.cn/thapi/v1',
     apiKey: 'tKIbAsEM8X+GmE2vHqGW7D/ICwK1Q5V4viKFrWiPB6HholGdLFqZJmmyNw=='
   }));