aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2018-04-16 16:32:15 +0200
committerRahiel Kasim <rahielkasim@gmail.com>2018-04-16 16:32:15 +0200
commitab49453a0bbc602166c746a580f82612c4e161c8 (patch)
tree548a1299f29364c5a0c6d12ddbcd44d1bfcb43ff
parent3bbe47bd062b2f071a5a98ca8c69c9cd3563308b (diff)
save HTTPS archive.is links, migrate "archiveMode" setting
-rw-r--r--src/archiveror.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/archiveror.js b/src/archiveror.js
index fa0917c..291ed35 100644
--- a/src/archiveror.js
+++ b/src/archiveror.js
@@ -11,8 +11,7 @@ function archive_is(url) {
let params = "url=" + encodeURIComponent(url);
request.onreadystatechange = function () {
if (request.readyState === 4) {
- let link = request.response.match(/(https?:\/\/archive.is\/\w+)/)[0];
- // TODO: upgrade link to https
+ let link = request.responseURL;
postArchive(url, link);
}
};
@@ -337,11 +336,19 @@ function removeBookmark(id, removeInfo) {
}
chrome.bookmarks.onRemoved.addListener(removeBookmark);
-// Remove deprecated "archiveMode" setting. TODO: remove this
+// Migrate deprecated "archiveMode" setting. TODO: remove this (from April 2018)
chrome.runtime.onInstalled.addListener(function (details) {
let key = "archiveMode";
- chrome.storage.local.get(key, function (items) {
- if (items[key]) {
+ chrome.storage.local.get({[key]: false, bookmarkServices: defaults.bookmarkServices}, function (items) {
+ const archiveMode = items[key];
+ if (archiveMode !== false) {
+ if (archiveMode === "local") {
+ let bookmarkServices = items.bookmarkServices;
+ if (!bookmarkServices.includes("mhtml")) {
+ bookmarkServices.push("mhtml");
+ chrome.storage.local.set({bookmarkServices: bookmarkServices});
+ }
+ }
chrome.storage.local.remove(key);
}
});