From 69a60d639fbfa550cfb22da75eea44a3d6d81b96 Mon Sep 17 00:00:00 2001 From: Malachi Soord Date: Sun, 8 Sep 2024 22:24:06 +0200 Subject: [PATCH] Tidy up --- index.ts | 21 +---- package-lock.json | 196 +++++++++++------------------------------ resources/hostfile.txt | 108 ----------------------- utils.ts | 4 +- 4 files changed, 53 insertions(+), 276 deletions(-) diff --git a/index.ts b/index.ts index dd871b1..513b31a 100644 --- a/index.ts +++ b/index.ts @@ -3,6 +3,7 @@ import fs from 'fs'; import util from 'util'; import fetch from 'node-fetch'; +import { connectorsToHostFile } from './utils'; const mkdir = util.promisify(fs.mkdir); const writeFile = util.promisify(fs.writeFile); @@ -73,26 +74,8 @@ async function dumpConnectors() { async function dumpHostfile() { const connectors = (await import(`./${moduleFile}`)).default as any[]; - - const result = connectors - .filter((connector) => 'matches' in connector) - .map((connector) => { - const label = connector.label; - const urls = connector.matches.map(function (match) { - match = match.replace(/\*:\/\/(\*\.)?/, ''); - match = match.replace(/\/\*.*/, ''); - match = match.replace(/\.\*/, '.tld'); - match = match.replace(/\/.+/, ''); - return match; - }); - - return `# ${label}\n${urls.join('\n')}`; - }); - - const contents = result.join('\n\n'); - + const contents = connectorsToHostFile(connectors); console.log(contents); - await writeFile(hostFile, contents); } diff --git a/package-lock.json b/package-lock.json index 9b72d72..984af1b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -664,15 +664,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.23.1.tgz", "integrity": "sha512-6VhYk1diRqrhBAqpJEdjASR/+WVRtfjpqKuNw11cLiaWpAT/Uu+nokB+UJnevzy/P9C/ty6AOe0dwueMrGh/iQ==", - "cpu": [ - "ppc64" - ], + "cpu": ["ppc64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "aix" - ], + "os": ["aix"], "engines": { "node": ">=18" } @@ -681,15 +677,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.23.1.tgz", "integrity": "sha512-uz6/tEy2IFm9RYOyvKl88zdzZfwEfKZmnX9Cj1BHjeSGNuGLuMD1kR8y5bteYmwqKm1tj8m4cb/aKEorr6fHWQ==", - "cpu": [ - "arm" - ], + "cpu": ["arm"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "android" - ], + "os": ["android"], "engines": { "node": ">=18" } @@ -698,15 +690,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.23.1.tgz", "integrity": "sha512-xw50ipykXcLstLeWH7WRdQuysJqejuAGPd30vd1i5zSyKK3WE+ijzHmLKxdiCMtH1pHz78rOg0BKSYOSB/2Khw==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "android" - ], + "os": ["android"], "engines": { "node": ">=18" } @@ -715,15 +703,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.23.1.tgz", "integrity": "sha512-nlN9B69St9BwUoB+jkyU090bru8L0NA3yFvAd7k8dNsVH8bi9a8cUAUSEcEEgTp2z3dbEDGJGfP6VUnkQnlReg==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "android" - ], + "os": ["android"], "engines": { "node": ">=18" } @@ -732,15 +716,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.23.1.tgz", "integrity": "sha512-YsS2e3Wtgnw7Wq53XXBLcV6JhRsEq8hkfg91ESVadIrzr9wO6jJDMZnCQbHm1Guc5t/CdDiFSSfWP58FNuvT3Q==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": ">=18" } @@ -749,15 +729,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.23.1.tgz", "integrity": "sha512-aClqdgTDVPSEGgoCS8QDG37Gu8yc9lTHNAQlsztQ6ENetKEO//b8y31MMu2ZaPbn4kVsIABzVLXYLhCGekGDqw==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": ">=18" } @@ -766,15 +742,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.23.1.tgz", "integrity": "sha512-h1k6yS8/pN/NHlMl5+v4XPfikhJulk4G+tKGFIOwURBSFzE8bixw1ebjluLOjfwtLqY0kewfjLSrO6tN2MgIhA==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "freebsd" - ], + "os": ["freebsd"], "engines": { "node": ">=18" } @@ -783,15 +755,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.23.1.tgz", "integrity": "sha512-lK1eJeyk1ZX8UklqFd/3A60UuZ/6UVfGT2LuGo3Wp4/z7eRTRYY+0xOu2kpClP+vMTi9wKOfXi2vjUpO1Ro76g==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "freebsd" - ], + "os": ["freebsd"], "engines": { "node": ">=18" } @@ -800,15 +768,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.23.1.tgz", "integrity": "sha512-CXXkzgn+dXAPs3WBwE+Kvnrf4WECwBdfjfeYHpMeVxWE0EceB6vhWGShs6wi0IYEqMSIzdOF1XjQ/Mkm5d7ZdQ==", - "cpu": [ - "arm" - ], + "cpu": ["arm"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -817,15 +781,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.23.1.tgz", "integrity": "sha512-/93bf2yxencYDnItMYV/v116zff6UyTjo4EtEQjUBeGiVpMmffDNUyD9UN2zV+V3LRV3/on4xdZ26NKzn6754g==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -834,15 +794,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.23.1.tgz", "integrity": "sha512-VTN4EuOHwXEkXzX5nTvVY4s7E/Krz7COC8xkftbbKRYAl96vPiUssGkeMELQMOnLOJ8k3BY1+ZY52tttZnHcXQ==", - "cpu": [ - "ia32" - ], + "cpu": ["ia32"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -851,15 +807,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.23.1.tgz", "integrity": "sha512-Vx09LzEoBa5zDnieH8LSMRToj7ir/Jeq0Gu6qJ/1GcBq9GkfoEAoXvLiW1U9J1qE/Y/Oyaq33w5p2ZWrNNHNEw==", - "cpu": [ - "loong64" - ], + "cpu": ["loong64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -868,15 +820,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.23.1.tgz", "integrity": "sha512-nrFzzMQ7W4WRLNUOU5dlWAqa6yVeI0P78WKGUo7lg2HShq/yx+UYkeNSE0SSfSure0SqgnsxPvmAUu/vu0E+3Q==", - "cpu": [ - "mips64el" - ], + "cpu": ["mips64el"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -885,15 +833,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.23.1.tgz", "integrity": "sha512-dKN8fgVqd0vUIjxuJI6P/9SSSe/mB9rvA98CSH2sJnlZ/OCZWO1DJvxj8jvKTfYUdGfcq2dDxoKaC6bHuTlgcw==", - "cpu": [ - "ppc64" - ], + "cpu": ["ppc64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -902,15 +846,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.23.1.tgz", "integrity": "sha512-5AV4Pzp80fhHL83JM6LoA6pTQVWgB1HovMBsLQ9OZWLDqVY8MVobBXNSmAJi//Csh6tcY7e7Lny2Hg1tElMjIA==", - "cpu": [ - "riscv64" - ], + "cpu": ["riscv64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -919,15 +859,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.23.1.tgz", "integrity": "sha512-9ygs73tuFCe6f6m/Tb+9LtYxWR4c9yg7zjt2cYkjDbDpV/xVn+68cQxMXCjUpYwEkze2RcU/rMnfIXNRFmSoDw==", - "cpu": [ - "s390x" - ], + "cpu": ["s390x"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -936,15 +872,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.23.1.tgz", "integrity": "sha512-EV6+ovTsEXCPAp58g2dD68LxoP/wK5pRvgy0J/HxPGB009omFPv3Yet0HiaqvrIrgPTBuC6wCH1LTOY91EO5hQ==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "linux" - ], + "os": ["linux"], "engines": { "node": ">=18" } @@ -953,15 +885,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.23.1.tgz", "integrity": "sha512-aevEkCNu7KlPRpYLjwmdcuNz6bDFiE7Z8XC4CPqExjTvrHugh28QzUXVOZtiYghciKUacNktqxdpymplil1beA==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "netbsd" - ], + "os": ["netbsd"], "engines": { "node": ">=18" } @@ -970,15 +898,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.23.1.tgz", "integrity": "sha512-3x37szhLexNA4bXhLrCC/LImN/YtWis6WXr1VESlfVtVeoFJBRINPJ3f0a/6LV8zpikqoUg4hyXw0sFBt5Cr+Q==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "openbsd" - ], + "os": ["openbsd"], "engines": { "node": ">=18" } @@ -987,15 +911,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.23.1.tgz", "integrity": "sha512-aY2gMmKmPhxfU+0EdnN+XNtGbjfQgwZj43k8G3fyrDM/UdZww6xrWxmDkuz2eCZchqVeABjV5BpildOrUbBTqA==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "openbsd" - ], + "os": ["openbsd"], "engines": { "node": ">=18" } @@ -1004,15 +924,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.23.1.tgz", "integrity": "sha512-RBRT2gqEl0IKQABT4XTj78tpk9v7ehp+mazn2HbUeZl1YMdaGAQqhapjGTCe7uw7y0frDi4gS0uHzhvpFuI1sA==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "sunos" - ], + "os": ["sunos"], "engines": { "node": ">=18" } @@ -1021,15 +937,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.23.1.tgz", "integrity": "sha512-4O+gPR5rEBe2FpKOVyiJ7wNDPA8nGzDuJ6gN4okSA1gEOYZ67N8JPk58tkWtdtPeLz7lBnY6I5L3jdsr3S+A6A==", - "cpu": [ - "arm64" - ], + "cpu": ["arm64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "win32" - ], + "os": ["win32"], "engines": { "node": ">=18" } @@ -1038,15 +950,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.23.1.tgz", "integrity": "sha512-BcaL0Vn6QwCwre3Y717nVHZbAa4UBEigzFm6VdsVdT/MbZ38xoj1X9HPkZhbmaBGUD1W8vxAfffbDe8bA6AKnQ==", - "cpu": [ - "ia32" - ], + "cpu": ["ia32"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "win32" - ], + "os": ["win32"], "engines": { "node": ">=18" } @@ -1055,15 +963,11 @@ "version": "0.23.1", "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.23.1.tgz", "integrity": "sha512-BHpFFeslkWrXWyUPnbKm+xYYVYruCinGcftSBaa8zoF9hZO4BcSCFUvHVTtzpIY6YzUnYtuEhZ+C9iEXjxnasg==", - "cpu": [ - "x64" - ], + "cpu": ["x64"], "dev": true, "license": "MIT", "optional": true, - "os": [ - "win32" - ], + "os": ["win32"], "engines": { "node": ">=18" } @@ -3913,9 +3817,7 @@ "hasInstallScript": true, "license": "MIT", "optional": true, - "os": [ - "darwin" - ], + "os": ["darwin"], "engines": { "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } diff --git a/resources/hostfile.txt b/resources/hostfile.txt index d0fc5ac..4a35170 100644 --- a/resources/hostfile.txt +++ b/resources/hostfile.txt @@ -91,9 +91,6 @@ fm.douban.fm # Focus@Will www.focusatwill.com -# Subphonic (owncloud plugin) -* - # Digitally Imported www.di.fm @@ -109,12 +106,6 @@ music.yandex.by music.yandex.kz music.yandex.ua -# Plex -*32400 -plex.tv -plex.tv -plex.tv - # TuneIn tunein.com @@ -276,10 +267,6 @@ en.noisefm.ru # WWOZ www.wwoz.org -# Sonerezh -sonerezh.tld -* - # Youradio www.youradio.cz @@ -320,11 +307,6 @@ anghami.com my.mail.ru my.mail.ru -# Emby/Jellyfin -*8096 -*8920 -app.emby.media - # Freegal Music freegalmusic.com @@ -401,9 +383,6 @@ player.rockfm.ru # Radio JAZZ player.radiojazzfm.ru -# WO Streaming -*player.wostreaming.net - # Listen Live player.listenlive.co @@ -426,13 +405,6 @@ www.webradio.de # The Breeze www.thebreeze.com -# RadioPlayer -ukradioplayer.tld -radioplayer.tld -* -* -* - # deltaradio www.deltaradio.de @@ -647,9 +619,6 @@ super45.fm/ # R/a/dio r-a-d.io -# Apple Music -*music.apple.com - # Primephonic play.primephonic.com @@ -858,10 +827,6 @@ streetvoice.com # Red Bull www.redbull.com -# Synology -*5000 -* - # Ragya www.ragya.com @@ -924,9 +889,6 @@ calm.com # Keakie keakie.com -# KKBOX -*play.kkbox.com - # Thrill Jockey thrilljockey.com @@ -951,48 +913,18 @@ www.rockandpop.cl # WYEP wyep.org -# ZENO -*zeno.fm - # Naxos Music Library naxosmusiclibrary.com -# Klassik Radio -*klassikradio.de - # RefNet listen.refnet.fm -# La Radio du bord de l'eau -*auborddeleau.radio - -# Radio Willy -*willy.radio - -# NIGHT.FM -*night.fm - # Radio Nowy Swiat nowyswiat.online -# Radiolla -*radiolla.com - -# Oxigenio.fm -*oxigenio.fm - -# Intergalactic FM -*intergalactic.fm - -# Radio Cuca -*radiocuca.es - # Irama Nusantara iramanusantara.org -# Yammat FM -*yammat.fm - # Husk Recordings huskrecordings.com @@ -1062,10 +994,6 @@ player.gotradio.com lightningstream.com lightningstream.com -# Securenet Systems -radio.securenetsystems.net -stream*.securenetsystems.net - # WBRU www.wbru.com @@ -1085,12 +1013,6 @@ amazingradio.us # DR Lyd www.dr.dk -# lulu.fm -*lulu.fm - -# ROCK ANTENNE -*rockantenne.tld - # copyparty 127.0.0.1:3923 a.ocv.me @@ -1107,19 +1029,6 @@ trackerhub.vercel.app # Gensokyo Radio gensokyoradio.net -# Stationhead -*stationhead.com - -# TECHNOBASE.FM -*technobase.fm -*housetime.fm -*hardbase.fm -*trancebase.fm -*coretime.fm -*clubtime.fm -*teatime.fm -*replay.fm - # Telegram A web.telegram.org @@ -1192,23 +1101,6 @@ jam.coop # Zing MP3 zingmp3.vn -# NTS Live -*nts.live - -# NTS Shows -*nts.live/ -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live -*nts.live - # earth.fm earth.fm diff --git a/utils.ts b/utils.ts index f903ee7..2bd5780 100644 --- a/utils.ts +++ b/utils.ts @@ -1,9 +1,9 @@ -function connectorsToHostFile(connectors: any[]) { +function connectorsToHostFile(connectors) { const results = connectors .filter((connector) => 'matches' in connector) .map((connector) => { const label = connector.label; - const urls = connector.matches.map(function (match: string) { + const urls = connector.matches.map(function (match) { match = match.replace(/\*:\/\/(\*\.)?/, ''); match = match.replace(/\/\*.*/, ''); match = match.replace(/\.\*/, '.tld');