aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRahiel Kasim <rahielkasim@gmail.com>2016-06-26 12:56:12 +0200
committerRahiel Kasim <rahielkasim@gmail.com>2016-06-26 12:56:12 +0200
commit98210505d67aa5d408a0086b1b3262a012e2c5ae (patch)
tree3e734dbfed6f2b5cbfd4b86a9ef99dda82d0458b
parent8402760dd55549b47a78342c5cdded44505e7554 (diff)
exclude local browser pages from archiving
-rw-r--r--chromium/archiveror.js2
-rw-r--r--chromium/manifest.json2
-rw-r--r--firefox/lib/main.js5
-rw-r--r--firefox/package.json2
-rw-r--r--utils.js6
5 files changed, 14 insertions, 3 deletions
diff --git a/chromium/archiveror.js b/chromium/archiveror.js
index 83fe128..d9882dd 100644
--- a/chromium/archiveror.js
+++ b/chromium/archiveror.js
@@ -29,6 +29,8 @@ function archivePage(url, service) {
if (service === undefined)
service = items.archiveService;
link = get_archiving_url(url, service, items.email);
+ if (link === null)
+ return; // don't archive internal pages, "file://", "chrome://", etc.
chrome.tabs.create({url: link}, function (tab) {
tabId = tab.id;
diff --git a/chromium/manifest.json b/chromium/manifest.json
index a38e7ca..20cd648 100644
--- a/chromium/manifest.json
+++ b/chromium/manifest.json
@@ -2,7 +2,7 @@
"name": "Archiveror",
"author": "Rahiel Kasim",
"description": "Archive webpages on archive.is, archive.org and more or on your own computer in MHTML format. Automatically archive your bookmarks.",
- "version": "0.5.0",
+ "version": "0.5.1",
"icons": {
"16": "icon-16.png",
diff --git a/firefox/lib/main.js b/firefox/lib/main.js
index e35a0f3..3e2e9cf 100644
--- a/firefox/lib/main.js
+++ b/firefox/lib/main.js
@@ -63,9 +63,12 @@ function archivePage(service) {
if (service === undefined)
service = preferences.prefs.archiveService;
let email = preferences.prefs.email;
+ let url = get_archiving_url(tabs.activeTab.url, service, email);
+ if (url === null)
+ return; // internal page, "file://" or "about:" etc.
tabs.open({
- url: get_archiving_url(tabs.activeTab.url, service, email),
+ url: url,
onReady: function () { // triggers for all new urls opened in this tab
clipboard.set(tabs.activeTab.url);
}});
diff --git a/firefox/package.json b/firefox/package.json
index e1915a2..0ed8eb2 100644
--- a/firefox/package.json
+++ b/firefox/package.json
@@ -8,7 +8,7 @@
"homepage": "https://github.com/rahiel/archiveror",
"author": "Rahiel Kasim",
"license": "GPL-3.0+ (https://github.com/rahiel/archiveror/blob/master/LICENSE.txt)",
- "version": "0.5.0",
+ "version": "0.5.1",
"preferences": [
{
"name": "archiveService",
diff --git a/utils.js b/utils.js
index 0669bc9..5c6100f 100644
--- a/utils.js
+++ b/utils.js
@@ -2,7 +2,13 @@
export const services = ["archive.is", "archive.org", "webcitation.org"];
+const exclude = ["file://", "about:", "chrome://"];
+
export function get_archiving_url(page, service, email) {
+ for (let i = 0; i < exclude.length; i++) {
+ if (page.startsWith(exclude[i]))
+ return null;
+ }
let url = "https://archive.is/?run=1&url=" + page; // default
if (service === "archive.org")
url = "https://web.archive.org/save/" + page;