浏览代码

Add version to config and use it in TS files

Lennart Grahl 6 年之前
父节点
当前提交
eff44d7581
共有 4 个文件被更改,包括 12 次插入4 次删除
  1. 2 2
      src/app.ts
  2. 2 0
      src/config.ts
  3. 5 2
      src/controllers/troubleshooting.ts
  4. 3 0
      src/threema.d.ts

+ 2 - 2
src/app.ts

@@ -62,14 +62,14 @@ angular.module('3ema', [
 ])
 
 // Set versions
-.value('VERSION', '[[VERSION]]')
+.value('VERSION', config.VERSION)
 .value('PROTOCOL_VERSION', 2)
 
 // Configuration object
 .constant('CONFIG', config)
 
 // Set cache bust parameter
-.constant('CACHE_BUST', 'v=[[VERSION]]')
+.constant('CACHE_BUST', `v=${config.VERSION}`)
 
 // Constants to be used by controllers
 .constant('BROWSER_MIN_VERSIONS', {

+ 2 - 0
src/config.ts

@@ -5,6 +5,8 @@
  */
 // tslint:disable:max-line-length
 export default {
+    // Version
+    VERSION: '[[VERSION]]',
 
     // General
     SELF_HOSTED: false,

+ 5 - 2
src/controllers/troubleshooting.ts

@@ -28,12 +28,13 @@ import {DialogController} from './dialog';
 export class TroubleshootingController extends DialogController {
     public static readonly $inject = [
         '$scope', '$mdDialog', '$mdToast', '$translate',
-        'LogService', 'BrowserService', 'WebClientService',
+        'CONFIG', 'LogService', 'BrowserService', 'WebClientService',
     ];
 
     private readonly $scope: ng.IScope;
     private readonly $mdToast: ng.material.IToastService;
     private readonly $translate: ng.translate.ITranslateService;
+    private readonly config: threema.Config;
     private readonly logService: LogService;
     private readonly browserService: BrowserService;
     private readonly webClientService: WebClientService;
@@ -47,6 +48,7 @@ export class TroubleshootingController extends DialogController {
         $mdDialog: ng.material.IDialogService,
         $mdToast: ng.material.IToastService,
         $translate: ng.translate.ITranslateService,
+        config: threema.Config,
         logService: LogService,
         browserService: BrowserService,
         webClientService: WebClientService,
@@ -55,6 +57,7 @@ export class TroubleshootingController extends DialogController {
         this.$scope = $scope;
         this.$mdToast = $mdToast;
         this.$translate = $translate;
+        this.config = config;
         this.logService = logService;
         this.browserService = browserService;
         this.webClientService = webClientService;
@@ -139,7 +142,7 @@ export class TroubleshootingController extends DialogController {
             }
         }
         const message: threema.FileMessageData = {
-            name: `webclient-[[VERSION]]-${browserShortInfo}.log`,
+            name: `webclient-${this.config.VERSION}-${browserShortInfo}.log`,
             fileType: 'text/plain',
             size: log.byteLength,
             data: arrayToBuffer(log),

+ 3 - 0
src/threema.d.ts

@@ -650,6 +650,9 @@ declare namespace threema {
     }
 
     interface Config {
+        // Version
+        VERSION: string;
+
         // General
         SELF_HOSTED: boolean;
         VERSION_MOUNTAIN: string;