From 4438638c6e7eee040b52dba9b7c7d4113236dd64 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Tue, 24 Feb 2026 12:33:12 +0100 Subject: [PATCH] chore: replace uri-js with fast-uri --- deno.jsonc | 1 - src/components/configurator/input/worker.js | 2 +- src/components/input/opensubsonic/common.js | 14 +++++++------- src/components/input/opensubsonic/worker.js | 4 ++-- src/components/input/s3/common.js | 4 ++-- src/components/processor/metadata/common.js | 2 +- 6 files changed, 13 insertions(+), 14 deletions(-) diff --git a/deno.jsonc b/deno.jsonc index fda8984f..710f6508 100644 --- a/deno.jsonc +++ b/deno.jsonc @@ -40,7 +40,6 @@ "query-string": "npm:query-string@^9.3.1", "subsonic-api": "npm:subsonic-api@^3.2.0", "throttle-debounce": "npm:throttle-debounce@^5.0.2", - "uri-js": "npm:uri-js@^4.4.1", "xxh32": "npm:xxh32@^2.0.5", // music-metadata diff --git a/src/components/configurator/input/worker.js b/src/components/configurator/input/worker.js index 952dcfdd..8bde1b9f 100644 --- a/src/components/configurator/input/worker.js +++ b/src/components/configurator/input/worker.js @@ -1,4 +1,4 @@ -import * as URI from "uri-js"; +import * as URI from "fast-uri"; import { groupTracksPerScheme, groupUrisPerScheme } from "@common/utils.js"; import { ostiary, rpc, workerProxy } from "@common/worker.js"; diff --git a/src/components/input/opensubsonic/common.js b/src/components/input/opensubsonic/common.js index 8480277d..76653f5f 100644 --- a/src/components/input/opensubsonic/common.js +++ b/src/components/input/opensubsonic/common.js @@ -1,4 +1,4 @@ -import * as URI from "uri-js"; +import * as URI from "fast-uri"; import QS from "query-string"; import { SCHEME } from "./constants.js"; @@ -39,9 +39,9 @@ export function buildURI(server, args) { return URI.serialize({ scheme: SCHEME, userinfo: server.apiKey - ? URI.escapeComponent(server.apiKey) - : `${URI.escapeComponent(server.username || "")}:${ - URI.escapeComponent(server.password || "") + ? encodeURIComponent(server.apiKey) + : `${encodeURIComponent(server.username || "")}:${ + encodeURIComponent(server.password || "") }`, host: server.host.replace(/^https?:\/\//, ""), path: args?.path, @@ -69,9 +69,9 @@ export const consultServerCached = cachedConsult(consultServer, serverId); export function createClient(server) { return new SubsonicAPIWithoutFetch({ url: `http${server.tls ? "s" : ""}://${server.host}`, - auth: server.apiKey ? { apiKey: URI.unescapeComponent(server.apiKey) } : { - username: URI.unescapeComponent(server.username || ""), - password: URI.unescapeComponent(server.password || ""), + auth: server.apiKey ? { apiKey: decodeURIComponent(server.apiKey) } : { + username: decodeURIComponent(server.username || ""), + password: decodeURIComponent(server.password || ""), }, }); } diff --git a/src/components/input/opensubsonic/worker.js b/src/components/input/opensubsonic/worker.js index fb6ae17d..7a61c051 100644 --- a/src/components/input/opensubsonic/worker.js +++ b/src/components/input/opensubsonic/worker.js @@ -1,4 +1,4 @@ -import * as URI from "uri-js"; +import * as URI from "fast-uri"; import { ostiary, rpc } from "@common/worker.js"; import { SCHEME } from "./constants.js"; @@ -110,7 +110,7 @@ export async function list(cachedTracks = []) { servers[sid] = parsed.server; cache[sid] ??= {}; - cache[sid][URI.unescapeComponent(parsed.path)] = t; + cache[sid][decodeURIComponent(parsed.path)] = t; }); /** diff --git a/src/components/input/s3/common.js b/src/components/input/s3/common.js index e89c35f0..0edceb51 100644 --- a/src/components/input/s3/common.js +++ b/src/components/input/s3/common.js @@ -1,6 +1,6 @@ import { S3Client } from "@bradenmacdonald/s3-lite-client"; import * as IDB from "idb-keyval"; -import * as URI from "uri-js"; +import * as URI from "fast-uri"; import QS from "query-string"; import { cachedConsult } from "@components/input/common.js"; @@ -174,7 +174,7 @@ export function parseURI(uriString) { }; const path = - (bucket.path.replace(/\/$/, "") + URI.unescapeComponent(uri.path || "")) + (bucket.path.replace(/\/$/, "") + decodeURIComponent(uri.path || "")) .replace( /^\//, "", diff --git a/src/components/processor/metadata/common.js b/src/components/processor/metadata/common.js index 7cc0abef..bce7014a 100644 --- a/src/components/processor/metadata/common.js +++ b/src/components/processor/metadata/common.js @@ -1,5 +1,5 @@ import { parseBlob, parseFromTokenizer, parseWebStream } from "music-metadata"; -import * as URI from "uri-js"; +import * as URI from "fast-uri"; import { HttpClient } from "@tokenizer/http"; import { tokenizer as rangeTokenizer } from "@tokenizer/range"; -- knotmirror 0.0.1