Set referer header for cloud shell (#866)
This commit is contained in:
Родитель
1eeb2a484c
Коммит
d62d0f60f1
|
@ -805,6 +805,7 @@ export async function connectTerminal(accessTokens: AccessTokens, consoleUri: st
|
||||||
}
|
}
|
||||||
|
|
||||||
async function initializeTerminal(accessTokens: AccessTokens, consoleUri: string, shellType: string, initialSize: Size) {
|
async function initializeTerminal(accessTokens: AccessTokens, consoleUri: string, shellType: string, initialSize: Size) {
|
||||||
|
const consoleUrl = new URL(consoleUri);
|
||||||
return requestWithLogging({
|
return requestWithLogging({
|
||||||
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
// eslint-disable-next-line @typescript-eslint/restrict-plus-operands
|
||||||
uri: consoleUri + '/terminals?cols=' + initialSize.cols + '&rows=' + initialSize.rows + '&shell=' + shellType,
|
uri: consoleUri + '/terminals?cols=' + initialSize.cols + '&rows=' + initialSize.rows + '&shell=' + shellType,
|
||||||
|
@ -812,7 +813,8 @@ async function initializeTerminal(accessTokens: AccessTokens, consoleUri: string
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Authorization': `Bearer ${accessTokens.resource}`
|
'Authorization': `Bearer ${accessTokens.resource}`,
|
||||||
|
'Referer': consoleUrl.protocol + "//" + consoleUrl.hostname + '/$hc' + consoleUrl.pathname + '/terminals',
|
||||||
},
|
},
|
||||||
simple: false,
|
simple: false,
|
||||||
resolveWithFullResponse: true,
|
resolveWithFullResponse: true,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче