Browse Source

Pass location search parameters to worker

master
Eduard Kuzmenko 3 years ago
parent
commit
5dfe2e5a45
  1. 5
      src/lib/cacheStorage.ts
  2. 20
      src/lib/mtproto/mtproto_config.ts

5
src/lib/cacheStorage.ts

@ -1,5 +1,6 @@ @@ -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 { @@ -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();
}

20
src/lib/mtproto/mtproto_config.ts

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

Loading…
Cancel
Save