Skip to content

Commit 13a087b

Browse files
committed
Upgrade packages; use audio.relisten.net; disable phishin-proxy for now
1 parent 7f873f2 commit 13a087b

File tree

6 files changed

+1315
-544
lines changed

6 files changed

+1315
-544
lines changed

.eslintrc.js

Lines changed: 0 additions & 10 deletions
This file was deleted.

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:20-alpine
1+
FROM node:22-alpine
22

33
RUN mkdir -p /usr/src/app
44
WORKDIR /usr/src/app

eslint.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import main from '@switz/eslint-config';
2+
3+
export default [...main];

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
"instrumental-agent": "alecgorge/instrumental_agent-node#master",
2121
"isomorphic-fetch": "^3.0.0",
2222
"pn": "^1.1.0",
23-
"soap": "1.0.2",
23+
"soap": "1.1.10",
2424
"svg2png": "^4.1.1",
2525
"thenby": "^1.3.4",
26-
"winston": "^3.13.0"
26+
"winston": "^3.17.0"
2727
},
2828
"devDependencies": {
29-
"@switz/eslint-config": "^11.0.0",
30-
"eslint": "^8.4.0",
31-
"eslint-plugin-prettier": "^5.1.3",
32-
"eslint_d": "^11.1.1"
29+
"@switz/eslint-config": "^12.3.2",
30+
"eslint": "^9.25.0"
3331
},
3432
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
35-
}
33+
}

src/services/getMediaURI.js

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -30,45 +30,41 @@ const getMediaURI = (type, id, callback) => {
3030

3131
let trackUrl = track[`${type}_url`] || track.mp3_url;
3232

33-
const options = {
34-
method: 'HEAD',
35-
};
36-
37-
fetch(trackUrl, options).then((res) => {
38-
if (res.url) {
39-
trackUrl = res.url;
40-
}
41-
42-
// wat.
43-
// for some reason https doesn't work with cloudflare or phish.in and sonos.
44-
// meh
45-
if (slug === 'phish') {
46-
trackUrl = trackUrl
47-
.replace('https', 'http')
48-
.replace('phish.in/audio', 'phishin-proxy.relisten.net/phishin-audio');
49-
}
50-
51-
// sonos requires a urlencode, but we can't encode the slashes
52-
// encodeURI encodes a fully formed URL and won't encode the slashes
53-
// also use relisten proxy
54-
if (slug === 'wsp') {
55-
trackUrl = trackUrl.replace(
56-
'www.panicstream.com/streams',
57-
'phishin-proxy.relisten.net/panicstream'
58-
);
59-
}
60-
61-
callback({
62-
getMediaURIResult: trackUrl, // 'http://192.168.0.101:3001/foo.mp3', //trackUrl,
63-
httpHeaders: [
64-
{
65-
httpHeader: {
66-
header: 'Referer',
67-
value: 'https://www.panicstream.com',
68-
},
69-
},
70-
],
33+
let headers = [];
34+
35+
if (/\/archive\.org/.test(trackUrl)) {
36+
trackUrl = trackUrl.replace('://archive.org/', '://audio.relisten.net/archive.org/');
37+
}
38+
39+
// wat.
40+
// for some reason https doesn't work with cloudflare or phish.in and sonos.
41+
// meh
42+
if (slug === 'phish') {
43+
// trackUrl = trackUrl
44+
// .replace('https', 'http')
45+
// .replace('phish.in/audio', 'phishin-proxy.relisten.net/phishin-audio');
46+
}
47+
48+
// sonos requires a urlencode, but we can't encode the slashes
49+
// encodeURI encodes a fully formed URL and won't encode the slashes
50+
// also use relisten proxy
51+
if (slug === 'wsp') {
52+
// trackUrl = trackUrl.replace(
53+
// 'www.panicstream.com/streams',
54+
// 'phishin-proxy.relisten.net/panicstream'
55+
// );
56+
57+
headers.push({
58+
httpHeader: {
59+
header: 'Referer',
60+
value: 'https://www.panicstream.com',
61+
},
7162
});
63+
}
64+
65+
callback({
66+
getMediaURIResult: trackUrl, // 'http://192.168.0.101:3001/foo.mp3', //trackUrl,
67+
httpHeaders: headers,
7268
});
7369
})
7470
.catch((err) => {

0 commit comments

Comments
 (0)