Browse Source

Pass navigator.userAgent to MTProto worker

Update langPackVersion
master
Eduard Kuzmenko 4 years ago
parent
commit
0944509fec
  1. 2
      src/config/app.ts
  2. 4
      src/lib/mtproto/mtproto.worker.ts
  3. 1
      src/lib/mtproto/mtprotoworker.ts
  4. 2
      src/lib/mtproto/networker.ts
  5. 1
      src/lib/mtproto/networkerFactory.ts

2
src/config/app.ts

@ -13,7 +13,7 @@ const App = { @@ -13,7 +13,7 @@ const App = {
id: 1025907,
hash: '452b0359b988148995f22ff0f4229750',
version: '0.5.6',
langPackVersion: '0.2.2',
langPackVersion: '0.2.3',
langPack: 'macos',
langPackCode: 'en',
domains: [] as string[],

4
src/lib/mtproto/mtproto.worker.ts

@ -82,6 +82,10 @@ const taskListeners = { @@ -82,6 +82,10 @@ const taskListeners = {
localStorageProxy: (task: LocalStorageProxyTask) => {
sessionStorage.finishTask(task.id, task.payload);
},
userAgent: (task: any) => {
networkerFactory.userAgent = task.payload;
}
};

1
src/lib/mtproto/mtprotoworker.ts

@ -265,6 +265,7 @@ export class ApiManagerProxy extends CryptoWorkerMethods { @@ -265,6 +265,7 @@ export class ApiManagerProxy extends CryptoWorkerMethods {
const isWebpSupported = webpWorkerController.isWebpSupported();
this.log('WebP supported:', isWebpSupported);
this.postMessage({type: 'webpSupport', payload: isWebpSupported});
this.postMessage({type: 'userAgent', payload: navigator.userAgent});
this.releasePending();
}

2
src/lib/mtproto/networker.ts

@ -302,7 +302,7 @@ export default class MTPNetworker { @@ -302,7 +302,7 @@ export default class MTPNetworker {
serializer.storeInt(+initConnection.id >>> 0, 'initConnection');
serializer.storeInt(0x0, 'flags');
serializer.storeInt(App.id, 'api_id');
serializer.storeString(navigator.userAgent || 'Unknown UserAgent', 'device_model');
serializer.storeString(networkerFactory.userAgent || 'Unknown UserAgent', 'device_model');
serializer.storeString(navigator.platform || 'Unknown Platform', 'system_version');
serializer.storeString(App.version + (App.isMainDomain ? ' ' + App.suffix : ''), 'app_version');
serializer.storeString(navigator.language || 'en', 'system_lang_code');

1
src/lib/mtproto/networkerFactory.ts

@ -21,6 +21,7 @@ export class NetworkerFactory { @@ -21,6 +21,7 @@ export class NetworkerFactory {
public updatesProcessor: (obj: any) => void = null;
public onConnectionStatusChange: (info: ConnectionStatusChange) => void = null;
public akStopped = false;
public userAgent = navigator.userAgent;
public setUpdatesProcessor(callback: (obj: any) => void) {
this.updatesProcessor = callback;

Loading…
Cancel
Save