mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-10 18:26:55 +08:00
perf: Assistant dynamic certificate
This commit is contained in:
@@ -245,7 +245,7 @@ class HttpService {
|
||||
return this.request({ ...config, method: 'POST', url, data })
|
||||
}
|
||||
|
||||
public fetchStream(url: string, data?: any, controller?: AbortController): Promise<any> {
|
||||
public async fetchStream(url: string, data?: any, controller?: AbortController): Promise<any> {
|
||||
const token = wsCache.get('user.token')
|
||||
const heads: any = {
|
||||
'Content-Type': 'application/json',
|
||||
@@ -257,6 +257,7 @@ class HttpService {
|
||||
heads['X-SQLBOT-ASSISTANT-TOKEN'] = `Assistant ${assistantStore.getToken}`
|
||||
if (heads['X-SQLBOT-TOKEN']) delete heads['X-SQLBOT-TOKEN']
|
||||
if (assistantStore.getType && assistantStore.getCertificate) {
|
||||
await assistantStore.refreshCertificate()
|
||||
heads['X-SQLBOT-ASSISTANT-CERTIFICATE'] = btoa(
|
||||
encodeURIComponent(assistantStore.getCertificate)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user