From 91b0ac5b3f3338f8b46ef5643a5d1098ba99597f Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Sun, 20 May 2018 07:45:39 -0400 Subject: [PATCH] fix https://github.com/gorhill/uBlock/commit/dd92337a4a69c01ecd085b6818e75666c259f3ab#commitcomment-29051501 --- platform/chromium/vapi-background.js | 21 ++++++++++++++++----- tools/make-chromium-meta.py | 7 +++---- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/platform/chromium/vapi-background.js b/platform/chromium/vapi-background.js index 190c0cf8e..f08205162 100644 --- a/platform/chromium/vapi-background.js +++ b/platform/chromium/vapi-background.js @@ -64,10 +64,19 @@ var noopFunc = function(){}; /******************************************************************************/ -vAPI.app = { - name: manifest.name.replace(' dev build', ''), - version: manifest.version -}; +vAPI.app = (function() { + let version = manifest.version; + let match = /(\d+\.\d+\.\d+)(?:\.(\d+))?/.exec(version); + if ( match !== null ) { + let v = parseInt(match[2], 10); + version = match[1] + (v < 100 ? 'b' + v : 'rc' + (v - 100)); + } + + return { + name: manifest.name.replace(/ dev\w+ build/, ''), + version: version + }; +})(); /******************************************************************************/ @@ -635,7 +644,9 @@ vAPI.tabs.injectScript = function(tabId, details, callback) { vAPI.setIcon = (function() { let browserAction = chrome.browserAction, - titleTemplate = chrome.runtime.getManifest().name + ' ({badge})'; + titleTemplate = + chrome.runtime.getManifest().browser_action.default_title + + ' ({badge})'; let icons = [ { tabId: 0, diff --git a/tools/make-chromium-meta.py b/tools/make-chromium-meta.py index b8e639f45..319b7a1d7 100644 --- a/tools/make-chromium-meta.py +++ b/tools/make-chromium-meta.py @@ -25,10 +25,9 @@ manifest_out['version'] = version # Development build? If so, modify name accordingly. match = re.search('^\d+\.\d+\.\d+\.\d+$', version) if match: - dev_build = ' development build' - manifest_out['name'] += dev_build - manifest_out['short_name'] += dev_build - manifest_out['browser_action']['default_title'] += dev_build + manifest_out['name'] += ' development build' + manifest_out['short_name'] += ' dev build' + manifest_out['browser_action']['default_title'] += ' dev build' with open(manifest_out_file, 'w') as f: json.dump(manifest_out, f, indent=2, separators=(',', ': '), sort_keys=True)