diff --git a/changelog.txt b/changelog.txt
index 565b2b28..cc55fa43 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -10,6 +10,7 @@ Fix Foreign Affairs (js)
Fix Krautreporter.de
Fix Le Devoir (cookie)
Fix Scientific American (magazine)
+Update custom sites (import from GitLab)
* v2.7.6.0 (2022-07-17)
Add The Japan Times
diff --git a/manifest.json b/manifest.json
index 8b163e13..7b9879c8 100644
--- a/manifest.json
+++ b/manifest.json
@@ -694,5 +694,5 @@
"*://*.wsj.net/*",
"*://webcache.googleusercontent.com/*"
],
- "version": "2.7.6.7"
+ "version": "2.7.6.8"
}
diff --git a/options/options_custom.html b/options/options_custom.html
index 3bc1c681..897e5c7a 100644
--- a/options/options_custom.html
+++ b/options/options_custom.html
@@ -65,7 +65,8 @@
-
+
+
diff --git a/options/options_custom.js b/options/options_custom.js
index 4b5a2118..faff8dbe 100644
--- a/options/options_custom.js
+++ b/options/options_custom.js
@@ -1,4 +1,5 @@
var ext_api = chrome || browser;
+var url_loc = (typeof browser === 'object') ? 'firefox' : 'chrome';
var useragent_options = ['', 'googlebot', 'bingbot'];
var referer_options = ['', 'facebook', 'google', 'twitter'];
@@ -64,16 +65,16 @@ function export_options() {
});
}
-// Import custom sites from file
-function import_options(e) {
- var files = e.target.files;
- var reader = new FileReader();
- reader.onload = _imp;
- reader.readAsText(files[0]);
-}
+function import_json(result) {
+
+
+
+
+
+
-function _imp() {
- var result = this.result;
+
+
ext_api.storage.local.get({
sites_custom: {}
}, function (items) {
@@ -96,6 +97,36 @@ function _imp() {
});
}
+// Import custom sites from GitLab
+function import_gitlab_options(e) {
+ let url = 'https://gitlab.com/magnolia1234/bypass-paywalls-' + url_loc + '-clean/-/raw/master/custom/sites_custom.json';
+ try {
+ fetch(url)
+ .then(response => {
+ if (response.ok) {
+ response.text().then(result => {
+ import_json(result);
+ })
+ }
+ });
+ } catch (err) {
+ console.log(err);
+ }
+}
+
+// Import custom sites from file
+function import_options(e) {
+ var files = e.target.files;
+ var reader = new FileReader();
+ reader.onload = _imp;
+ reader.readAsText(files[0]);
+}
+
+function _imp() {
+ var result = this.result;
+ import_json(result)
+}
+
// Add custom site to ext_api.storage
function add_options() {
var inputEls = document.querySelectorAll('#add_site input, #add_site select');
@@ -374,6 +405,7 @@ document.getElementById('sort').addEventListener('click', sort_options);
document.getElementById('export').addEventListener('click', export_options);
document.getElementById('import').onclick = function () {importInput.click()}
document.getElementById('importInput').addEventListener("change", import_options, false);
+document.getElementById('import_gitlab').addEventListener('click', import_gitlab_options);
document.getElementById('add').addEventListener('click', add_options);
document.getElementById('delete').addEventListener('click', delete_options);
document.getElementById('edit').addEventListener('click', edit_options);