Pass location search parameters to worker

This commit is contained in:
Eduard Kuzmenko 2021-02-04 00:38:19 +02:00
parent 57ea1b02de
commit 83f10e61da
2 changed files with 18 additions and 13 deletions

View File

@ -1,5 +1,6 @@
import { blobConstruct } from '../helpers/blob';
import FileManager from './filemanager';
import { Modes } from './mtproto/mtproto_config';
//import { MOUNT_CLASS_TO } from './mtproto/mtproto_config';
//import { logger } from './polyfill';
@ -10,6 +11,10 @@ export default class CacheStorageController {
//private log: ReturnType<typeof logger> = logger('CS');
constructor(public dbName: string) {
if(Modes.test) {
this.dbName += '_test';
}
this.openDatabase();
}

View File

@ -12,18 +12,6 @@ export const App = {
baseDcId: 2
};
export type DatabaseStoreName = 'session' | 'stickerSets';
export type DatabaseStore = Omit<IDBStore, 'name'> & {name: DatabaseStoreName};
export const Database = {
name: 'tweb',
version: 5,
stores: [{
name: 'session'
}, {
name: 'stickerSets'
}] as DatabaseStore[],
};
export const Modes = {
test: location.search.indexOf('test=1') > 0/* || true */,
debug: location.search.indexOf('debug=1') > 0,
@ -32,5 +20,17 @@ export const Modes = {
multipleConnections: true
};
export const DEBUG = process.env.NODE_ENV != 'production';
export type DatabaseStoreName = 'session' | 'stickerSets';
export type DatabaseStore = Omit<IDBStore, 'name'> & {name: DatabaseStoreName};
export const Database = {
name: 'tweb' + (Modes.test ? '_test' : ''),
version: 5,
stores: [{
name: 'session'
}, {
name: 'stickerSets'
}] as DatabaseStore[],
};
export const DEBUG = process.env.NODE_ENV !== 'production' || Modes.debug;
export const MOUNT_CLASS_TO: any = DEBUG ? (typeof(window) !== 'undefined' ? window : self) : null;