Set Accept-Language at the connection level for chat connections
This commit is contained in:
parent
3063262730
commit
b440aec88c
7 changed files with 41 additions and 54 deletions
|
@ -29,7 +29,6 @@ import type { ExplodePromiseResultType } from '../util/explodePromise';
|
|||
import { explodePromise } from '../util/explodePromise';
|
||||
import { getUserAgent } from '../util/getUserAgent';
|
||||
import { getTimeoutStream } from '../util/getStreamWithTimeout';
|
||||
import { formatAcceptLanguageHeader } from '../util/userLanguages';
|
||||
import { toWebSafeBase64, fromWebSafeBase64 } from '../util/webSafeBase64';
|
||||
import { getBasicAuth } from '../util/getBasicAuth';
|
||||
import { createHTTPSAgent } from '../util/createHTTPSAgent';
|
||||
|
@ -1630,9 +1629,7 @@ export type WebAPIType = {
|
|||
options: ProfileFetchUnauthRequestOptions
|
||||
) => Promise<ProfileType>;
|
||||
getBadgeImageFile: (imageUrl: string) => Promise<Uint8Array>;
|
||||
getSubscriptionConfiguration: (
|
||||
userLanguages: ReadonlyArray<string>
|
||||
) => Promise<unknown>;
|
||||
getSubscriptionConfiguration: () => Promise<unknown>;
|
||||
getSubscription: (
|
||||
subscriberId: Uint8Array
|
||||
) => Promise<SubscriptionResponseType>;
|
||||
|
@ -2743,17 +2740,13 @@ export function initialize({
|
|||
serviceId: ServiceIdString,
|
||||
options: ProfileFetchAuthRequestOptions
|
||||
) {
|
||||
const { profileKeyVersion, profileKeyCredentialRequest, userLanguages } =
|
||||
options;
|
||||
const { profileKeyVersion, profileKeyCredentialRequest } = options;
|
||||
|
||||
return (await _ajax({
|
||||
host: 'chatService',
|
||||
call: 'profile',
|
||||
httpType: 'GET',
|
||||
urlParameters: getProfileUrl(serviceId, options),
|
||||
headers: {
|
||||
'Accept-Language': formatAcceptLanguageHeader(userLanguages),
|
||||
},
|
||||
responseType: 'json',
|
||||
redactUrl: _createRedactor(
|
||||
serviceId,
|
||||
|
@ -2855,7 +2848,6 @@ export function initialize({
|
|||
groupSendToken,
|
||||
profileKeyVersion,
|
||||
profileKeyCredentialRequest,
|
||||
userLanguages,
|
||||
} = options;
|
||||
|
||||
if (profileKeyVersion != null || profileKeyCredentialRequest != null) {
|
||||
|
@ -2872,9 +2864,6 @@ export function initialize({
|
|||
call: 'profile',
|
||||
httpType: 'GET',
|
||||
urlParameters: getProfileUrl(serviceId, options),
|
||||
headers: {
|
||||
'Accept-Language': formatAcceptLanguageHeader(userLanguages),
|
||||
},
|
||||
responseType: 'json',
|
||||
unauthenticated: true,
|
||||
accessKey: accessKey ?? undefined,
|
||||
|
@ -2939,16 +2928,11 @@ export function initialize({
|
|||
);
|
||||
}
|
||||
|
||||
async function getSubscriptionConfiguration(
|
||||
userLanguages: ReadonlyArray<string>
|
||||
): Promise<unknown> {
|
||||
async function getSubscriptionConfiguration(): Promise<unknown> {
|
||||
return _ajax({
|
||||
host: 'chatService',
|
||||
call: 'subscriptionConfiguration',
|
||||
httpType: 'GET',
|
||||
headers: {
|
||||
'Accept-Language': formatAcceptLanguageHeader(userLanguages),
|
||||
},
|
||||
responseType: 'json',
|
||||
// TODO DESKTOP-8719
|
||||
zodSchema: z.unknown(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue