Link: Fix autologin (#3281)
This commit is contained in:
parent
eccf73cbdd
commit
e880d83377
@ -50,9 +50,7 @@ function buildEmojiSounds(appConfig: GramJsAppConfig) {
|
|||||||
accessHash: BigInt(l.access_hash),
|
accessHash: BigInt(l.access_hash),
|
||||||
dcId: 1,
|
dcId: 1,
|
||||||
mimeType: 'audio/ogg',
|
mimeType: 'audio/ogg',
|
||||||
fileReference: Buffer.from(atob(l.file_reference_base64
|
fileReference: Buffer.alloc(0),
|
||||||
.replace(/-/g, '+')
|
|
||||||
.replace(/_/g, '/'))),
|
|
||||||
size: BigInt(0),
|
size: BigInt(0),
|
||||||
} as GramJs.Document);
|
} as GramJs.Document);
|
||||||
|
|
||||||
@ -75,7 +73,6 @@ export function buildAppConfig(json: GramJs.TypeJSONValue, hash: number): ApiApp
|
|||||||
seenByMaxChatMembers: appConfig.chat_read_mark_size_threshold,
|
seenByMaxChatMembers: appConfig.chat_read_mark_size_threshold,
|
||||||
seenByExpiresAt: appConfig.chat_read_mark_expire_period,
|
seenByExpiresAt: appConfig.chat_read_mark_expire_period,
|
||||||
autologinDomains: appConfig.autologin_domains || [],
|
autologinDomains: appConfig.autologin_domains || [],
|
||||||
autologinToken: appConfig.autologin_token || '',
|
|
||||||
urlAuthDomains: appConfig.url_auth_domains || [],
|
urlAuthDomains: appConfig.url_auth_domains || [],
|
||||||
maxUniqueReactions: appConfig.reactions_uniq_max,
|
maxUniqueReactions: appConfig.reactions_uniq_max,
|
||||||
premiumBotUsername: appConfig.premium_bot_username,
|
premiumBotUsername: appConfig.premium_bot_username,
|
||||||
|
|||||||
@ -250,5 +250,6 @@ export function buildApiConfig(config: GramJs.Config): ApiConfig {
|
|||||||
gifSearchUsername: config.gifSearchUsername,
|
gifSearchUsername: config.gifSearchUsername,
|
||||||
defaultReaction,
|
defaultReaction,
|
||||||
maxGroupSize: config.chatSizeMax,
|
maxGroupSize: config.chatSizeMax,
|
||||||
|
autologinToken: config.autologinToken,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -175,7 +175,6 @@ export interface ApiAppConfig {
|
|||||||
seenByMaxChatMembers: number;
|
seenByMaxChatMembers: number;
|
||||||
seenByExpiresAt: number;
|
seenByExpiresAt: number;
|
||||||
autologinDomains: string[];
|
autologinDomains: string[];
|
||||||
autologinToken: string;
|
|
||||||
urlAuthDomains: string[];
|
urlAuthDomains: string[];
|
||||||
premiumInvoiceSlug: string;
|
premiumInvoiceSlug: string;
|
||||||
premiumBotUsername: string;
|
premiumBotUsername: string;
|
||||||
@ -196,6 +195,7 @@ export interface ApiConfig {
|
|||||||
defaultReaction?: ApiReaction;
|
defaultReaction?: ApiReaction;
|
||||||
gifSearchUsername?: string;
|
gifSearchUsername?: string;
|
||||||
maxGroupSize: number;
|
maxGroupSize: number;
|
||||||
|
autologinToken?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GramJsEmojiInteraction {
|
export interface GramJsEmojiInteraction {
|
||||||
|
|||||||
@ -1380,12 +1380,12 @@ addActionHandler('openUrl', (global, actions, payload): ActionReturnType => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const { appConfig } = global;
|
const { appConfig, config } = global;
|
||||||
if (appConfig) {
|
if (appConfig) {
|
||||||
const parsedUrl = new URL(urlWithProtocol);
|
const parsedUrl = new URL(urlWithProtocol);
|
||||||
|
|
||||||
if (appConfig.autologinDomains.includes(parsedUrl.hostname)) {
|
if (config?.autologinToken && appConfig.autologinDomains.includes(parsedUrl.hostname)) {
|
||||||
parsedUrl.searchParams.set(AUTOLOGIN_TOKEN_KEY, appConfig.autologinToken);
|
parsedUrl.searchParams.set(AUTOLOGIN_TOKEN_KEY, config.autologinToken);
|
||||||
window.open(parsedUrl.href, '_blank', 'noopener');
|
window.open(parsedUrl.href, '_blank', 'noopener');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user