|
@@ -376,7 +376,12 @@ export class SttManagerAdapter extends AGEventEmitter<SttEventMap> implements IS
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
|
- Authorization: await this._genAuthorization({ uid, channel }),
|
|
|
|
|
|
|
+ Authorization: await generateAuthorization({
|
|
|
|
|
+ appId: this._appId,
|
|
|
|
|
+ appCertificate: this._certificate,
|
|
|
|
|
+ uid,
|
|
|
|
|
+ channel,
|
|
|
|
|
+ }),
|
|
|
},
|
|
},
|
|
|
body: JSON.stringify(data),
|
|
body: JSON.stringify(data),
|
|
|
})
|
|
})
|
|
@@ -436,7 +441,9 @@ export class SttManagerAdapter extends AGEventEmitter<SttEventMap> implements IS
|
|
|
method: 'POST',
|
|
method: 'POST',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
|
- Authorization: await this._genAuthorization({
|
|
|
|
|
|
|
+ Authorization: await generateAuthorization({
|
|
|
|
|
+ appId: this._appId,
|
|
|
|
|
+ appCertificate: this._certificate,
|
|
|
uid,
|
|
uid,
|
|
|
channel,
|
|
channel,
|
|
|
}),
|
|
}),
|
|
@@ -459,7 +466,9 @@ export class SttManagerAdapter extends AGEventEmitter<SttEventMap> implements IS
|
|
|
method: 'DELETE',
|
|
method: 'DELETE',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
|
- Authorization: await this._genAuthorization({
|
|
|
|
|
|
|
+ Authorization: await generateAuthorization({
|
|
|
|
|
+ appId: this._appId,
|
|
|
|
|
+ appCertificate: this._certificate,
|
|
|
uid,
|
|
uid,
|
|
|
channel,
|
|
channel,
|
|
|
}),
|
|
}),
|
|
@@ -479,7 +488,9 @@ export class SttManagerAdapter extends AGEventEmitter<SttEventMap> implements IS
|
|
|
method: 'GET',
|
|
method: 'GET',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
|
- Authorization: await this._genAuthorization({
|
|
|
|
|
|
|
+ Authorization: await generateAuthorization({
|
|
|
|
|
+ appId: this._appId,
|
|
|
|
|
+ appCertificate: this._certificate,
|
|
|
uid,
|
|
uid,
|
|
|
channel,
|
|
channel,
|
|
|
}),
|
|
}),
|
|
@@ -502,7 +513,9 @@ export class SttManagerAdapter extends AGEventEmitter<SttEventMap> implements IS
|
|
|
method: 'PATCH',
|
|
method: 'PATCH',
|
|
|
headers: {
|
|
headers: {
|
|
|
'Content-Type': 'application/json',
|
|
'Content-Type': 'application/json',
|
|
|
- Authorization: await this._genAuthorization({
|
|
|
|
|
|
|
+ Authorization: await generateAuthorization({
|
|
|
|
|
+ appId: this._appId,
|
|
|
|
|
+ appCertificate: this._certificate,
|
|
|
uid,
|
|
uid,
|
|
|
channel,
|
|
channel,
|
|
|
}),
|
|
}),
|
|
@@ -512,17 +525,4 @@ export class SttManagerAdapter extends AGEventEmitter<SttEventMap> implements IS
|
|
|
|
|
|
|
|
return await response.json()
|
|
return await response.json()
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- private async _genAuthorization(config: {
|
|
|
|
|
- uid: string | number
|
|
|
|
|
- channel: string
|
|
|
|
|
- }): Promise<string> {
|
|
|
|
|
- // 使用工具函数生成Authorization头(带缓存机制)
|
|
|
|
|
- return await generateAuthorization({
|
|
|
|
|
- appId: this._appId,
|
|
|
|
|
- appCertificate: this._certificate,
|
|
|
|
|
- uid: config.uid,
|
|
|
|
|
- channel: config.channel,
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|