Prechádzať zdrojové kódy

Link version number to changelog

Danilo Bargen 7 rokov pred
rodič
commit
6414d2906d

+ 5 - 2
index.html

@@ -83,9 +83,12 @@
             </div>
             <div id="main-content" ui-view></div>
         </div>
-        <footer>
+        <footer ng-controller="FooterController as ctrl">
             <ul>
-                <li>Version [[VERSION]]</li>
+                <li><a
+                        href="{{ ctrl.changelogUrl }}"
+                        target="_blank"
+                        rel="noopener noreferrer">Version [[VERSION]]</a></li>
                 <li><a
                         href="https://threema.ch/threema-web"
                         target="_blank"

+ 1 - 0
src/config.ts

@@ -8,6 +8,7 @@ export default {
     // General
     SELF_HOSTED: false,
     PREV_PROTOCOL_LAST_VERSION: '1.8.2',
+    GIT_BRANCH: 'ios',
 
     // SaltyRTC
     SALTYRTC_HOST: 'saltyrtc-beta.threema.ch',

+ 2 - 0
src/controllers.ts

@@ -15,10 +15,12 @@
  * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
  */
 
+import {FooterController} from './controllers/footer';
 import {StatusController} from './controllers/status';
 
 angular.module('3ema.controllers', ['3ema.services'])
 
 .controller('StatusController', StatusController)
+.controller('FooterController', FooterController)
 
 ;

+ 35 - 0
src/controllers/footer.ts

@@ -0,0 +1,35 @@
+/**
+ * This file is part of Threema Web.
+ *
+ * Threema Web is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Threema Web. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/**
+ * Handle footer information.
+ */
+export class FooterController {
+    private config: threema.Config;
+
+    public static $inject = ['CONFIG'];
+    constructor(CONFIG: threema.Config) {
+        this.config = CONFIG;
+    }
+
+    /**
+     * Return the changelog URL.
+     */
+    public get changelogUrl(): string {
+        return 'https://github.com/threema-ch/threema-web/blob/' + this.config.GIT_BRANCH + '/CHANGELOG.md';
+    }
+}

+ 2 - 2
src/partials/dialog.about.html

@@ -29,7 +29,7 @@
                 <h2 translate>about.CHANGELOG</h2>
                 <p>
                     <span translate>about.CHANGELOG_LINK_BEFORE</span>
-                    <a href="https://github.com/threema-ch/threema-web/blob/master/CHANGELOG.md"
+                    <a href="https://github.com/threema-ch/threema-web/blob/{{ ctrl.config.GIT_BRANCH }}/CHANGELOG.md"
                        target="_blank" rel="noopener noreferrer" translate>about.CHANGELOG_LINK_TEXT</a><span translate>about.CHANGELOG_LINK_AFTER</span>
                 </p>
 
@@ -38,7 +38,7 @@
                     <li translate>about.EMOJI_ART</li>
                     <li>
                         <span translate>about.LICENSE_LINK_BEFORE</span>
-                        <a href="https://github.com/threema-ch/threema-web/blob/master/LICENSE-3RD-PARTY.txt"
+                        <a href="https://github.com/threema-ch/threema-web/blob/{{ ctrl.config.GIT_BRANCH }}/LICENSE-3RD-PARTY.txt"
                            target="_blank" rel="noopener noreferrer" translate>about.LICENSE_LINK_TEXT</a>
                         <span translate>about.LICENSE_LINK_AFTER</span>
                     </li>

+ 9 - 6
src/partials/messenger.ts

@@ -36,14 +36,15 @@ import {isContactReceiver} from '../typeguards';
 import ControllerModelMode = threema.ControllerModelMode;
 
 class DialogController {
-    public static $inject = ['$mdDialog'];
-
     public $mdDialog: ng.material.IDialogService;
     public activeElement: HTMLElement | null;
+    public config: threema.Config;
 
-    constructor($mdDialog: ng.material.IDialogService) {
+    public static $inject = ['$mdDialog', 'CONFIG'];
+    constructor($mdDialog: ng.material.IDialogService, CONFIG: threema.Config) {
         this.$mdDialog = $mdDialog;
         this.activeElement = document.activeElement as HTMLElement;
+        this.config = CONFIG;
     }
 
     public cancel(): void {
@@ -76,14 +77,16 @@ class DialogController {
  * Handle sending of files.
  */
 class SendFileController extends DialogController {
-    public static $inject = ['$mdDialog', 'preview'];
+    public static $inject = ['$mdDialog', 'CONFIG', 'preview'];
 
     public caption: string;
     public sendAsFile: boolean = false;
     public preview: threema.FileMessageData | null = null;
 
-    constructor($mdDialog: ng.material.IDialogService, preview: threema.FileMessageData) {
-        super($mdDialog);
+    constructor($mdDialog: ng.material.IDialogService,
+                CONFIG: threema.Config,
+                preview: threema.FileMessageData) {
+        super($mdDialog, CONFIG);
         this.preview = preview;
     }
 

+ 8 - 4
src/services/version.ts

@@ -16,8 +16,6 @@
  */
 
 export class VersionService {
-    public static $inject = ['$log', '$http', '$mdDialog', '$translate', '$window'];
-
     private logTag: string = '[VersionService]';
 
     private $log: ng.ILogService;
@@ -27,18 +25,22 @@ export class VersionService {
     private $window: ng.IWindowService;
 
     private version: string;
+    private config: threema.Config;
     private dialogShowing = false;
 
+    public static $inject = ['$log', '$http', '$mdDialog', '$translate', '$window', 'CONFIG'];
     constructor($log: ng.ILogService,
                 $http: ng.IHttpService,
                 $mdDialog: ng.material.IDialogService,
                 $translate: ng.translate.ITranslateService,
-                $window: ng.IWindowService) {
+                $window: ng.IWindowService,
+                CONFIG: threema.Config) {
         this.$log = $log;
         this.$http = $http;
         this.$mdDialog = $mdDialog;
         this.$translate = $translate;
         this.$window = $window;
+        this.config = CONFIG;
     }
 
     /**
@@ -119,7 +121,9 @@ export class VersionService {
             // Don't show again if dialog is already showing.
             return;
         }
-        const changelogUrl = 'https://github.com/threema-ch/threema-web/blob/master/CHANGELOG.md';
+        const changelogUrl = 'https://github.com/threema-ch/threema-web/blob/'
+                + this.config.GIT_BRANCH
+                + '/CHANGELOG.md';
         const changelogLink = '<a href="' + changelogUrl + '" target="_blank" rel="noopener noreferrer">Changelog</a>';
         const confirm = this.$mdDialog.alert()
             .title(this.$translate.instant('version.NEW_VERSION'))

+ 1 - 0
src/threema.d.ts

@@ -628,6 +628,7 @@ declare namespace threema {
     interface Config {
         SELF_HOSTED: boolean;
         PREV_PROTOCOL_LAST_VERSION: string | null;
+        GIT_BRANCH: string;
         SALTYRTC_PORT: number;
         SALTYRTC_SERVER_KEY: string | null;
         SALTYRTC_HOST: string | null;