Skip to content

Commit

Permalink
v8.9.0 - 2023-02-17 (#48)
Browse files Browse the repository at this point in the history
- Handle all subdomains of `safelinks.protection.outlook.com` (Fixes #47)
- 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`
  • Loading branch information
bjornstar committed Feb 17, 2023
1 parent ee7f698 commit 193098b
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 36 deletions.
3 changes: 1 addition & 2 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
jobs:
Install Dependencies:
docker:
- image: circleci/node:16
- image: "cimg/node:lts"
steps:
- checkout
- run: "npm install"
Expand All @@ -14,7 +14,7 @@ jobs:

Lint:
docker:
- image: "circleci/node:16"
- image: "cimg/node:lts"
steps:
- checkout
- restore_cache:
Expand All @@ -27,7 +27,7 @@ jobs:

Mocha:
docker:
- image: "circleci/node:16"
- image: "cimg/node:lts"
steps:
- checkout
- restore_cache:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions .travis.yml

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
5 changes: 4 additions & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}` },
Expand Down Expand Up @@ -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', () => {
Expand Down
23 changes: 7 additions & 16 deletions webextension/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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': {
Expand All @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions webextension/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -63,5 +63,5 @@
"*://workable.com/nr",
"*://www.youtube.com/redirect"
],
"version": "8.8.0"
"version": "8.9.0"
}

0 comments on commit 193098b

Please sign in to comment.