Skip to content

Commit

Permalink
feat: 调整白名单域名
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Apr 19, 2024
1 parent 793aacc commit b78095b
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ interface ICounters {
bytes: number
}

const whiteListDomain = ['localhost', 'bangbang93.com']

// eslint-disable-next-line @typescript-eslint/naming-convention
const __dirname = dirname(fileURLToPath(import.meta.url))

Expand Down Expand Up @@ -96,16 +98,16 @@ export class Cluster {
if (!url) return
if (typeof url === 'string') {
if (
url.includes('bmclapi.bangbang93.com') ||
url.includes('bmclapi2.bangbang93.com') ||
url.includes('localhost')
whiteListDomain.some((domain) => {
return url.includes(domain)
})
) {
options.headers.authorization = `Bearer ${await this.tokenManager.getToken()}`
}
} else if (
url.hostname.includes('bmclapi.bangbang93.com') ||
url.hostname.includes('bmclapi2.bangbang93.com') ||
url.hostname.includes('localhost')
whiteListDomain.some((domain) => {
return url.hostname.includes(domain)
})
) {
options.headers.authorization = `Bearer ${await this.tokenManager.getToken()}`
}
Expand Down

0 comments on commit b78095b

Please sign in to comment.