Skip to content

Commit

Permalink
修改馒头请求域名
Browse files Browse the repository at this point in the history
  • Loading branch information
SHL-COOL committed Jun 22, 2024
1 parent 23e07b3 commit ca7f094
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions resource/sites/xp.m-team.cc/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"https://xp.m-team.cc/",
"https://ap.m-team.cc/"
],
"apiHost":"https://api.m-team.io/",
"tokenRequired": true,
"formerHosts": [
"xp.m-team.io",
Expand Down
3 changes: 1 addition & 2 deletions resource/sites/xp.m-team.cc/getUserSeedingTorrents.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@
}
return resolvedUrl.toString();
}

let activeURL = options.site.activeURL
let activeURL = this.getSiteActiveUrl(site);
console.log(`[mt] getUserSeedingTorrents`, options, User);

let dataURL = resolveURL(activeURL, options.rule.page);
Expand Down
4 changes: 4 additions & 0 deletions src/background/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ export class User {
}

private getSiteURL(site: Site) {
if (site.apiHost) {
return site.apiHost;
}

if (site.cdn && site.cdn.length > 0) {
return site.cdn[0];
}
Expand Down
3 changes: 2 additions & 1 deletion src/interface/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,8 @@ export interface Site {
// 使用站点标签进行分组
// siteGroups?: string[];
// token in headers
authToken?: string
authToken?: string;
apiHost?: string;
}

/**
Expand Down
1 change: 1 addition & 0 deletions src/service/public.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,7 @@ class HelpFunctions {
* 比如右键种子发送到 PTPP, 按正常逻辑筛选一遍
*/
public getSiteActiveUrl(site: Site) {
if (site.apiHost) return site.apiHost
if (site.activeURL) return site.activeURL
if (site.cdn && site.cdn.length > 0) return site.cdn[0]
return site.url
Expand Down

0 comments on commit ca7f094

Please sign in to comment.