Skip to content
This repository has been archived by the owner on May 27, 2019. It is now read-only.

Commit

Permalink
Show notification on update with major changes (#221)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz authored Mar 19, 2018
1 parent 49bbfd5 commit d76a85e
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
33 changes: 31 additions & 2 deletions chrome/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ var tabInfos = {};

chrome.runtime.onMessage.addListener(onMessage);
chrome.tabs.onUpdated.addListener(onTabUpdated);
chrome.runtime.onInstalled.addListener(onExtensionInstalled);

// fill login form & submit
function fillLoginForm(login, tab) {
Expand Down Expand Up @@ -90,8 +91,9 @@ function onMessage(request, sender, sendResponse) {
// object that has current settings. Update this as new settings
// are added (or old ones removed)
if (request.action == "getSettings") {
const use_fuzzy_search = localStorage.getItem("use_fuzzy_search") != "false";
sendResponse({ use_fuzzy_search: use_fuzzy_search})
const use_fuzzy_search =
localStorage.getItem("use_fuzzy_search") != "false";
sendResponse({ use_fuzzy_search: use_fuzzy_search });
}
}

Expand All @@ -113,3 +115,30 @@ function getHostname(url) {
a.href = url;
return a.hostname;
}

function onExtensionInstalled(details) {
// No permissions
if (!chrome.notifications) {
return;
}

if (details.reason != "update") {
return;
}

var changelog = {
"2.0.13": "Breaking change: please update the host app to at least v2.0.12"
};

var version = chrome.runtime.getManifest().version;
if (!(version in changelog)) {
return;
}

chrome.notifications.create(version, {
title: "browserpass: Important changes",
message: changelog[version],
iconUrl: "icon-lock.png",
type: "basic"
});
}
3 changes: 2 additions & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"manifest_version": 2,
"name": "browserpass-ce",
"description": "Chrome extension for zx2c4's pass (password manager) - Community Edition.",
"version": "2.0.12",
"version": "2.0.13",
"author": "Danny van Kooten",
"homepage_url": "https://github.com/dannyvankooten/browserpass",
"background": {
Expand All @@ -26,6 +26,7 @@
"tabs",
"activeTab",
"nativeMessaging",
"notifications",
"storage",
"http://*/*",
"https://*/*"
Expand Down
3 changes: 2 additions & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"manifest_version": 2,
"name": "browserpass-ce",
"description": "Firefox extension for zx2c4's pass (password manager) - Community Edition.",
"version": "2.0.12",
"version": "2.0.13",
"author": "Danny van Kooten",
"homepage_url": "https://github.com/dannyvankooten/browserpass",
"options_ui": {
Expand All @@ -24,6 +24,7 @@
"tabs",
"activeTab",
"nativeMessaging",
"notifications",
"storage",
"http://*/*",
"https://*/*"
Expand Down

0 comments on commit d76a85e

Please sign in to comment.