From 162b9e7d16d2ce0c8c05dcb5c7fa2a7749528349 Mon Sep 17 00:00:00 2001 From: Bjorn Stromberg Date: Tue, 3 Mar 2020 17:17:16 +0900 Subject: [PATCH] v4.3.0 - 2020-03-03 --- CHANGELOG.md | 5 +++++ README.md | 1 + package.json | 2 +- test/index.js | 17 ++++++++++++++++- webextension/index.js | 15 +++++++++++---- webextension/manifest.json | 3 ++- 6 files changed, 36 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0dd6fe7..4b04ddb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Intercept Redirect +## v4.3.0 - 2020-03-03 +- Add `www.javlibrary.com` +- Use arrow functions in `index.js` +- Ensure `README` lists all sites + ## v4.2.3 - 2020-03-02 - Update `mocha` from `v7.0.1` to `v7.1.0` - Add `eslint` diff --git a/README.md b/README.md index 0f7b118..d8bf11f 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ Skip tracking redirects that serve no purpose other than to waste your valuable - plus.url.google.com - www.google.com - l.instagram.com +- www.javlibrary.com - l.messenger.com - slack-redir.net - steamcommunity.com diff --git a/package.json b/package.json index 63793d9..4ea4479 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@bjornstar/intercept-redirect", - "version": "4.2.3", + "version": "4.3.0", "description": "Skip tracking redirects that serve no purpose other than to waste your valuable time.", "main": "webextension/index.js", "dependencies": {}, diff --git a/test/index.js b/test/index.js index b0c25e0..261d814 100644 --- a/test/index.js +++ b/test/index.js @@ -29,6 +29,7 @@ const urls = [ 'https://www.google.com/url?q=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', 'https://www.google.com/url?url=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', 'https://l.instagram.com/?u=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', + 'https://www.javlibrary.com/en/redirect.php?url=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', 'https://l.messenger.com/l.php?u=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', 'https://slack-redir.net/link?url=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', 'https://steamcommunity.com/linkfilter/?url=https%3A%2F%2Fbjornstar.com%2Fintercept-redirect', @@ -100,7 +101,7 @@ describe('Packaging', () => { describe('Every site implemented in the webExtension has a test', () => { manifestSites.forEach(site => { it(`site: ${site}`, () => { - assert.ok(testSites.indexOf(site) !== -1, `Missing tests: ${site}`); + assert.ok(testSites.includes(site), `Missing tests: ${site}`); }); }); }); @@ -130,6 +131,20 @@ describe('Packaging', () => { }); }); + it('The README has an entry for every supported domain', done => { + fs.readFile(path.resolve('./README.md'), 'utf8', (error, readme) => { + if (error) return done(error); + + const lines = readme.split('\n'); + + manifestSites.forEach(site => { + assert.ok(lines.includes(`- ${site}`), `Missing site: ${site}`); + }); + + done(); + }); + }); + it('The manifest does not use tabs', done => { fs.readFile(path.resolve('./webextension/manifest.json'), 'utf8', (error, manifest) => { if (error) return done(error); diff --git a/webextension/index.js b/webextension/index.js index 61dc152..8b684ba 100644 --- a/webextension/index.js +++ b/webextension/index.js @@ -12,7 +12,7 @@ const sites = { pathnames: { '/linkout': ['remoteUrl'] }, - extra: function (s = '') { + extra: (s = '') => { return decodeURIComponent(s); } }, @@ -25,7 +25,7 @@ const sites = { pathnames: { '/url': ['url'] }, - extra: function (s = '') { + extra: (s = '') => { return s.substring(0, s.lastIndexOf(':')); } }, @@ -47,7 +47,9 @@ const sites = { }, // 2019-08-06 - https://gate.sc/?url=http%3A%2F%2Ffanlink.to%2FPartial7&token=10fd54-1-1565068249069 'gate.sc': { - pathnames: { '/': ['url'] } + pathnames: { + '/': ['url'] + } }, 'www.google.co.jp': { pathnames: googlePathnames @@ -70,6 +72,11 @@ const sites = { '/': ['u'] } }, + 'www.javlibrary.com': { + pathnames: { + '/en/redirect.php': ['url'] + } + }, 'l.messenger.com': { pathnames: { '/l.php': ['u'] @@ -168,7 +175,7 @@ function analyzeURL(request) { } function reduceSites(urls, host) { - return urls.concat(Object.keys(sites[host].pathnames).map(function (pathname) { + return urls.concat(Object.keys(sites[host].pathnames).map(pathname => { return `*://${host}${pathname}*`; })); } diff --git a/webextension/manifest.json b/webextension/manifest.json index 0cfa586..2ed2cc7 100644 --- a/webextension/manifest.json +++ b/webextension/manifest.json @@ -26,6 +26,7 @@ "*://plus.url.google.com/", "*://www.google.com/", "*://l.instagram.com/", + "*://www.javlibrary.com/", "*://l.messenger.com/", "*://slack-redir.net/", "*://steamcommunity.com/", @@ -35,5 +36,5 @@ "*://workable.com/", "*://www.youtube.com/" ], - "version": "4.2.3" + "version": "4.3.0" }