diff --git a/README.md b/README.md
index 03b66d3a..3299d16e 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Smart RSS extension
-## Now officially unmaintained, I _may_ fix some critical issue if any is found within few following weeks, but then I'll archive this repo. Feel free to fork and continue development as you wish
+## This is a fork of Smart-RSS. There’s no guarantee of active development, but anyone is welcome to use it if they find it helpful.
Originally developed for Opera 15+ by BS-Harou (Martin Kadlec)
@@ -8,17 +8,6 @@ Translations are in scripts/nls/\*.js
For technical bug reports use issues here on GitHub
-## For users
-
-Extension is available in following repositories:
-
-#### AMO: https://addons.mozilla.org/firefox/addon/smart-rss-reader/
-
-~#### Chrome Web Store: https://chrome.google.com/webstore/detail/eggggihfcaabljfpjiiaohloefmgejic/~
-
-If you encounter issue with a specific feed for best results please back up and include current state of that feed in your report, this will be helpful in case the feed changes before I get to check it, thanks in advance
-
-
## For developers
If you are interested in improving Smart RSS then there are few tips to get started.
@@ -31,7 +20,7 @@ First of all you will need several command line tools:
To setup your Smart RSS project open your console, go to your projects folders and type:
```
-git clone git@github.com:zakius/Smart-RSS.git smartrss
+git clone git@github.com:cybercode3/Smart-RSS.git smartrss
cd smartrss
npm install
```
diff --git a/src/manifest.json b/src/manifest.json
index 11c4f199..8a80469b 100644
--- a/src/manifest.json
+++ b/src/manifest.json
@@ -1,11 +1,11 @@
{
"name": "Smart RSS",
"developer": {
- "name": "zakius"
+ "name": "cybercode3"
},
"description": "RSS Reader",
"manifest_version": 2,
- "version": "2.26.0",
+ "version": "2.27.0",
"background": {
"page": "index.html"
},
@@ -63,7 +63,7 @@
},
"browser_specific_settings": {
"gecko": {
- "id": "smart-rss@mozilla.firefox"
+ "id": "smart-rss-fork7123@mozilla.firefox"
}
}
-}
\ No newline at end of file
+}
diff --git a/src/options.html b/src/options.html
index a97c04a6..a78d1297 100644
--- a/src/options.html
+++ b/src/options.html
@@ -415,6 +415,11 @@
Smart RSS
+
+ Empty trash when closing Smart RSS:
+
+
+
Auto pin articles matching:
diff --git a/src/scripts/app/app.js b/src/scripts/app/app.js
index 06e9d896..539183e2 100644
--- a/src/scripts/app/app.js
+++ b/src/scripts/app/app.js
@@ -31,6 +31,20 @@ define([
browser.runtime.onMessage.addListener(onMessage);
+ window.addEventListener("beforeunload", () => {
+ if (!bg || !bg.items) {
+ return;
+ }
+ if (!bg.getBoolean("emptyTrashOnClose")) {
+ return;
+ }
+ bg.items
+ .where({ trashed: true, deleted: false })
+ .forEach((item) => {
+ item.markAsDeleted();
+ });
+ });
+
function changeUserStyle() {
const userStyle = bg.settings.get("userStyle");
document.querySelector("[data-custom-style]").textContent = userStyle;
diff --git a/src/scripts/app/options.js b/src/scripts/app/options.js
index 2f50b23f..d492688e 100644
--- a/src/scripts/app/options.js
+++ b/src/scripts/app/options.js
@@ -38,6 +38,15 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
);
}
+ function getXmlUrl(outline) {
+ return (
+ outline.getAttribute("xmlUrl") ||
+ outline.getAttribute("xmlurl") ||
+ outline.getAttribute("url") ||
+ ""
+ );
+ }
+
JSON.safeParse = function (str) {
try {
return JSON.parse(str);
@@ -572,6 +581,22 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
}, 20);
}
+ function normalizeLegacySettings(data) {
+ if (!data) {
+ return data;
+ }
+
+ if (!data.settings && data.preferences) {
+ data.settings = data.preferences;
+ }
+
+ if (!data.settings && data.options) {
+ data.settings = data.options;
+ }
+
+ return data;
+ }
+
function handleImportSettings(event) {
const settingsImportStatus =
document.querySelector("#settings-imported");
@@ -584,7 +609,7 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
const reader = new FileReader();
reader.onload = function () {
- const data = JSON.safeParse(this.result);
+ const data = normalizeLegacySettings(JSON.safeParse(this.result));
if (!data || !data.settings) {
settingsImportStatus.textContent = "Wrong file";
@@ -634,6 +659,24 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
}
}
+ function normalizeLegacySmart(data) {
+ if (!data) {
+ return data;
+ }
+
+ if (!data.items && data.articles) {
+ data.items = data.articles;
+ }
+ if (!data.sources && data.feeds) {
+ data.sources = data.feeds;
+ }
+ if (!data.folders && data.groups) {
+ data.folders = data.groups;
+ }
+
+ return data;
+ }
+
function handleImportSmart(event) {
const smartImportStatus = document.querySelector("#smart-imported");
const file = event.target.files[0];
@@ -645,7 +688,7 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
const reader = new FileReader();
reader.onload = function () {
- const data = JSON.safeParse(this.result);
+ const data = normalizeLegacySmart(JSON.safeParse(this.result));
if (!data || !data.items || !data.sources) {
smartImportStatus.textContent = "Wrong file";
@@ -720,7 +763,7 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
[...feeds].forEach((feed) => {
if (!feed.hasAttribute("xmlUrl")) {
- const subFeeds = feed.querySelectorAll("outline[xmlUrl]");
+ const subFeeds = feed.querySelectorAll("outline[xmlUrl], outline[xmlurl], outline[url]");
const folderTitle = decodeHTML(
feed.getAttribute("title") || feed.getAttribute("text")
);
@@ -740,11 +783,13 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
const folderId = folder.get("id");
[...subFeeds].forEach((subFeed) => {
- if (
- bg.sources.findWhere({
- url: decodeHTML(subFeed.getAttribute("xmlUrl")),
- })
- ) {
+ const xmlUrl = decodeHTML(getXmlUrl(subFeed));
+
+ if (!xmlUrl) {
+ return;
+ }
+
+ if (bg.sources.findWhere({ url: xmlUrl })) {
return;
}
bg.sources.create(
@@ -753,7 +798,7 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
subFeed.getAttribute("title") ||
subFeed.getAttribute("text")
),
- url: decodeHTML(subFeed.getAttribute("xmlUrl")),
+ url: xmlUrl,
updateEvery: -1,
folderID: folderId,
},
@@ -761,11 +806,13 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
);
});
} else {
- if (
- bg.sources.findWhere({
- url: decodeHTML(feed.getAttribute("xmlUrl")),
- })
- ) {
+ const xmlUrl = decodeHTML(getXmlUrl(feed));
+
+ if (!xmlUrl) {
+ return;
+ }
+
+ if (bg.sources.findWhere({ url: xmlUrl })) {
return;
}
bg.sources.create(
@@ -774,7 +821,7 @@ define(["../app/staticdb/actions", "staticdb/shortcuts"], function (
feed.getAttribute("title") ||
feed.getAttribute("text")
),
- url: decodeHTML(feed.getAttribute("xmlUrl")),
+ url: xmlUrl,
updateEvery: -1,
},
{ wait: true }
diff --git a/src/scripts/bgprocess/models/Settings.js b/src/scripts/bgprocess/models/Settings.js
index 4aa2b96f..b782a6d5 100644
--- a/src/scripts/bgprocess/models/Settings.js
+++ b/src/scripts/bgprocess/models/Settings.js
@@ -66,6 +66,7 @@ define(['backbone', 'preps/indexeddb'], function (BB) {
autoremove: false,
autoremovesetting: 'KEEP_UNREAD',
autoremovetrash: 0,
+ emptyTrashOnClose: false,
openNewTab: 'background',
userStyle: '',
defaultStyle: ':root {\n' +
diff --git a/src/scripts/options/worker.js b/src/scripts/options/worker.js
index c9a789b7..26d4da6b 100644
--- a/src/scripts/options/worker.js
+++ b/src/scripts/options/worker.js
@@ -2,6 +2,7 @@ const request = indexedDB.open("backbone-indexeddb", 4);
let db;
let content;
+let importAction;
request.addEventListener("error", function () {
throw "Error code: " + this.errorCode;
@@ -10,19 +11,25 @@ request.addEventListener("error", function () {
request.addEventListener("success", function () {
db = this.result;
if (content) {
- startImport();
+ if (importAction === "settings") {
+ startSettingsImport();
+ } else {
+ startImport();
+ }
}
});
onmessage = function (e) {
if (e.data.action === "file-content") {
content = e.data.value;
+ importAction = "file-content";
if (db) {
startImport();
}
}
if (e.data.action === "settings") {
content = e.data.value;
+ importAction = "settings";
if (db) {
startSettingsImport();
}
@@ -31,17 +38,19 @@ onmessage = function (e) {
let writes = 0;
-function handleReq(req) {
+function handleReq(req, finishedAction = "finished") {
writes++;
req.onsuccess = req.onerror = function () {
writes--;
if (writes <= 0) {
- postMessage({ action: "finished" });
+ postMessage({ action: finishedAction });
}
};
}
function startSettingsImport() {
+ writes = 0;
+
const transaction = db.transaction(["settings-backbone"], "readwrite");
const settings = transaction.objectStore("settings-backbone");
@@ -49,7 +58,7 @@ function startSettingsImport() {
if (importedSettings) {
settings.clear();
for (let i = 0, j = importedSettings.length; i < j; i++) {
- handleReq(settings.add(importedSettings[i]));
+ handleReq(settings.add(importedSettings[i]), "finished-settings");
if (i % 10 === 0) {
postMessage({
action: "message-settings",