diff --git a/.appveyor.yml b/.appveyor.yml index ff57854..5d078ad 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,8 +2,7 @@ build: off environment: matrix: - # We can't update to node v16 yet -- https://github.com/appveyor/ci/issues/3684 - - nodejs_version: '14' + - nodejs_version: '18' install: - ps: Install-Product node $env:nodejs_version diff --git a/.circleci/config.yml b/.circleci/config.yml index c101057..fd04dd1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,7 +3,7 @@ version: 2 jobs: Install Dependencies: docker: - - image: circleci/node:16 + - image: "cimg/node:lts" steps: - checkout - run: "npm install" @@ -14,7 +14,7 @@ jobs: Lint: docker: - - image: "circleci/node:16" + - image: "cimg/node:lts" steps: - checkout - restore_cache: @@ -27,7 +27,7 @@ jobs: Mocha: docker: - - image: "circleci/node:16" + - image: "cimg/node:lts" steps: - checkout - restore_cache: diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index bb3657c..c56172f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -16,12 +16,12 @@ jobs: strategy: matrix: - node-version: [16.x] + node-version: [18.x] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - run: npm i diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d62a814..0000000 --- a/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: - - node_js -node_js: - - "16" diff --git a/CHANGELOG.md b/CHANGELOG.md index 18c5cd8..89f1354 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,15 @@ # Intercept Redirect +## v8.9.0 - 2023-02-17 +- Handle all subdomains of `safelinks.protection.outlook.com` +- Improve logic for handling subdomains +- [.appveyor] Use node v18 +- [.circleci] Use node `lts` on "next-gen" Docker image +- [.github/workflows] Use node v18 +- [.github/workflows] Update actions versions +- [.travis] Remove travis-ci config +- [devDependencies] Update `addons-linter`, `eslint`, and `mocha` + ## v8.8.0 - 2022-06-01 - Add `linkedin.com` diff --git a/README.md b/README.md index 3bac398..3d17221 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ This extension does not modify any of the pages that you visit. Its sole purpose - l.messenger.com - outgoing.prod.mozaws.net - onlyfans.com -- gcc01.safelinks.protection.outlook.com +- *.safelinks.protection.outlook.com - slack-redir.net - steamcommunity.com - twitter.com diff --git a/package.json b/package.json index ab93045..d7fb968 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,12 @@ { "name": "@bjornstar/intercept-redirect", - "version": "8.8.0", + "version": "8.9.0", "description": "Skip tracking redirects that serve no purpose other than to waste your valuable time.", "main": "webextension/index.js", "devDependencies": { - "addons-linter": "^4.1.0", - "eslint": "^8.2.0", - "mocha": "^9.1.3" + "addons-linter": "^5.28.0", + "eslint": "^8.34.0", + "mocha": "^10.2.0" }, "scripts": { "addons-linter": "addons-linter webextension", diff --git a/test/index.js b/test/index.js index d88d335..c923348 100644 --- a/test/index.js +++ b/test/index.js @@ -62,6 +62,7 @@ const urls = [ // https://github.com/bjornstar/intercept-redirect/issues/22 { url: 'https://outgoing.prod.mozaws.net/v1/08aa3089688d4b6ec460e6c402e78eba305c36fb81287197e4ae3f5a5c60f22d/https%3A//bjornstar.com/intercept-redirect' }, { url: `https://onlyfans.com/away?url=${encodedURL}` }, + { url: `https://eur03.safelinks.protection.outlook.com/?url=${encodedURL}` }, { url: `https://gcc01.safelinks.protection.outlook.com/?url=${encodedURL}` }, { url: `https://slack-redir.net/link?url=${encodedURL}` }, { url: `https://steamcommunity.com/linkfilter/?url=${encodedURL}` }, @@ -195,14 +196,16 @@ describe('Packaging', () => { describe('Subdomain', () => { it('For supported domains returns *.domain', () => { + assert.strictEqual(subdomain('wow.curseforge.com'), '*.curseforge.com'); assert.strictEqual(subdomain('foobar.digidip.net'), '*.digidip.net'); assert.strictEqual(subdomain('foo.bar.digidip.net'), '*.digidip.net'); - assert.strictEqual(subdomain('wow.curseforge.com'), '*.curseforge.com'); + assert.strictEqual(subdomain('bjo01.safelinks.protection.outlook.com'), '*.safelinks.protection.outlook.com'); }); it('Does not apply to domain host', () => { assert.strictEqual(subdomain('digidip.net'), 'digidip.net'); assert.strictEqual(subdomain('curseforge.com'), 'curseforge.com'); + assert.strictEqual(subdomain('safelinks.protection.outlook.com'), 'safelinks.protection.outlook.com'); }); it('Returns host when not supported', () => { diff --git a/webextension/index.js b/webextension/index.js index 9fb70fb..6c455ec 100644 --- a/webextension/index.js +++ b/webextension/index.js @@ -138,7 +138,8 @@ const sites = { '/away': searchParam('url') }, // 2020-04-13 - https://gcc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.metro.tokyo.lg.jp%2Fenglish%2Findex.html - 'gcc01.safelinks.protection.outlook.com': { + // 2022-07-25 - https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbjornstar.com&sdata=abcdefg&reserved=0 + '*.safelinks.protection.outlook.com': { '/': searchParam('url') }, 'slack-redir.net': { @@ -164,23 +165,13 @@ const sites = { } }; -const domains = [ - 'curseforge.com', - 'digidip.net' -]; +const subdomains = Object.keys(sites) + .filter(site => site.startsWith('*')) + .map(site => site.replace(/^\*\./, '')); function subdomain(host) { - const hostLength = host.length; - - for (let i = 0; i < domains.length; i += 1) { - const domain = domains[i]; - const expectedIndex = hostLength - domain.length; - - if (expectedIndex > 0 && host.lastIndexOf(domain) === expectedIndex) { - return `*.${domain}`; - } - } - return host; + const [domain] = subdomains.filter(s => host.endsWith(s)); + return (domain && domain !== host) ? `*.${domain}` : host; } function reduceSites(urls, host) { diff --git a/webextension/manifest.json b/webextension/manifest.json index ce4db16..638cb7b 100644 --- a/webextension/manifest.json +++ b/webextension/manifest.json @@ -54,7 +54,7 @@ "*://l.messenger.com/l.php", "*://outgoing.prod.mozaws.net/v1/*", "*://onlyfans.com/away", - "*://gcc01.safelinks.protection.outlook.com/", + "*://*.safelinks.protection.outlook.com/", "*://slack-redir.net/link", "*://steamcommunity.com/linkfilter/", "*://twitter.com/i/redirect", @@ -63,5 +63,5 @@ "*://workable.com/nr", "*://www.youtube.com/redirect" ], - "version": "8.8.0" + "version": "8.9.0" }