Fix importing authorization
This commit is contained in:
parent
820885dbd9
commit
b6505aa07d
|
@ -5,9 +5,16 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export default function parseUriParams(uri: string, splitted = uri.split('?')) {
|
export default function parseUriParams(uri: string, splitted = uri.split('?')) {
|
||||||
|
return parseUriParamsLine(splitted?.[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function parseUriParamsLine(line: string) {
|
||||||
const params: any = {};
|
const params: any = {};
|
||||||
if(!splitted[1]) return params;
|
if(!line) {
|
||||||
splitted[1].split('&').forEach((item) => {
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
line.split('&').forEach((item) => {
|
||||||
params[item.split('=')[0]] = decodeURIComponent(item.split('=')[1]);
|
params[item.split('=')[0]] = decodeURIComponent(item.split('=')[1]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import getProxiedManagers from './lib/appManagers/getProxiedManagers';
|
||||||
import themeController from './helpers/themeController';
|
import themeController from './helpers/themeController';
|
||||||
import overlayCounter from './helpers/overlayCounter';
|
import overlayCounter from './helpers/overlayCounter';
|
||||||
import singleInstance from './lib/mtproto/singleInstance';
|
import singleInstance from './lib/mtproto/singleInstance';
|
||||||
import parseUriParams from './helpers/string/parseUriParams';
|
import {parseUriParamsLine} from './helpers/string/parseUriParams';
|
||||||
import Modes from './config/modes';
|
import Modes from './config/modes';
|
||||||
import {AuthState} from './types';
|
import {AuthState} from './types';
|
||||||
import {IS_BETA} from './config/debug';
|
import {IS_BETA} from './config/debug';
|
||||||
|
@ -283,7 +283,7 @@ document.addEventListener('DOMContentLoaded', async() => {
|
||||||
|
|
||||||
const hash = location.hash;
|
const hash = location.hash;
|
||||||
const splitted = hash.split('?');
|
const splitted = hash.split('?');
|
||||||
const params = parseUriParams(hash, splitted);
|
const params = parseUriParamsLine(splitted[1] ?? splitted[0]);
|
||||||
if(params.tgWebAuthToken && authState._ !== 'authStateSignedIn') {
|
if(params.tgWebAuthToken && authState._ !== 'authStateSignedIn') {
|
||||||
const data: AuthState.signImport['data'] = {
|
const data: AuthState.signImport['data'] = {
|
||||||
token: params.tgWebAuthToken,
|
token: params.tgWebAuthToken,
|
||||||
|
|
Loading…
Reference in New Issue