Minor fixes

This commit is contained in:
WardPearce
2026-02-14 05:40:35 +13:00
parent c8cd692b78
commit a1efe412ee
9 changed files with 67 additions and 23 deletions
+1 -2
View File
@@ -85,8 +85,7 @@ ipcMain.handle(
{
url: youtubeUrl,
referrer: youtubeUrl,
origin: youtubeUrl,
USER_AGENT
userAgent: USER_AGENT
}
);
+46
View File
@@ -62,6 +62,7 @@
"@types/event-source-polyfill": "^1.0.5",
"@types/he": "^1.2.3",
"@types/human-number": "^1.0.2",
"@types/jsdom": "^27.0.0",
"@types/mousetrap": "^1.6.15",
"@vite-pwa/sveltekit": "^1.0.0",
"altcha-lib": "^1.4.1",
@@ -4633,6 +4634,44 @@
"dev": true,
"license": "MIT"
},
"node_modules/@types/jsdom": {
"version": "27.0.0",
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-27.0.0.tgz",
"integrity": "sha512-NZyFl/PViwKzdEkQg96gtnB8wm+1ljhdDay9ahn4hgb+SfVtPCbm3TlmDUFXTA+MGN3CijicnMhG18SI5H3rFw==",
"dev": true,
"license": "MIT",
"dependencies": {
"@types/node": "*",
"@types/tough-cookie": "*",
"parse5": "^7.0.0"
}
},
"node_modules/@types/jsdom/node_modules/entities": {
"version": "6.0.1",
"resolved": "https://registry.npmjs.org/entities/-/entities-6.0.1.tgz",
"integrity": "sha512-aN97NXWF6AWBTahfVOIrB/NShkzi5H7F9r1s9mD3cDj4Ko5f2qhhVoYMibXF7GlLveb/D2ioWay8lxI97Ven3g==",
"dev": true,
"license": "BSD-2-Clause",
"engines": {
"node": ">=0.12"
},
"funding": {
"url": "https://github.com/fb55/entities?sponsor=1"
}
},
"node_modules/@types/jsdom/node_modules/parse5": {
"version": "7.3.0",
"resolved": "https://registry.npmjs.org/parse5/-/parse5-7.3.0.tgz",
"integrity": "sha512-IInvU7fabl34qmi9gY8XOVxhYyMyuH2xUNpb2q8/Y+7552KlejkRvqvD19nMoUW/uQGGbqNpA6Tufu5FL5BZgw==",
"dev": true,
"license": "MIT",
"dependencies": {
"entities": "^6.0.0"
},
"funding": {
"url": "https://github.com/inikulin/parse5?sponsor=1"
}
},
"node_modules/@types/json-schema": {
"version": "7.0.15",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz",
@@ -4691,6 +4730,13 @@
"integrity": "sha512-+OpjSaq85gvlZAYINyzKpLeiFkSC4EsC6IIiT6v6TLSU5k5U83fHGj9Lel8oKEXM0HqgrMVCjXPDPVICtxF7EQ==",
"license": "MIT"
},
"node_modules/@types/tough-cookie": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz",
"integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
"dev": true,
"license": "MIT"
},
"node_modules/@types/trusted-types": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz",
+1
View File
@@ -27,6 +27,7 @@
"@types/event-source-polyfill": "^1.0.5",
"@types/he": "^1.2.3",
"@types/human-number": "^1.0.2",
"@types/jsdom": "^27.0.0",
"@types/mousetrap": "^1.6.15",
"@vite-pwa/sveltekit": "^1.0.0",
"altcha-lib": "^1.4.1",
@@ -576,10 +576,10 @@
if (data.video.captions) {
for (const caption of data.video.captions) {
let captionUrl: string;
if (!import.meta.env.VITE_DEFAULT_COMPANION_INSTANCE) {
if (!import.meta.env.VITE_DEFAULT_COMPANION_INSTANCE && $instanceStore) {
captionUrl = caption.url.startsWith('http')
? caption.url
: `${new URL(get(instanceStore)).origin}${caption.url}`;
: `${new URL($instanceStore).origin}${caption.url}`;
} else {
captionUrl = `${import.meta.env.VITE_DEFAULT_COMPANION_INSTANCE}${caption.url}`;
}
@@ -46,11 +46,19 @@
return;
}
let urlConstructed = '';
if (video.fallbackPatch === 'youtubejs') {
urlConstructed = url;
} else if ($instanceStore) {
urlConstructed = new URL($instanceStore).origin + url;
} else {
return;
}
isLoading = true;
transcript = null;
const resp = await fetch(
`${!video.fallbackPatch ? new URL(get(instanceStore)).origin : ''}${url}`
);
const resp = await fetch(urlConstructed);
transcript = await parseText(await resp.text(), { strict: false });
transcriptCues = transcript.cues;
+1
View File
@@ -1 +1,2 @@
declare module 'virtual:pwa-info';
declare module 'psl';
@@ -32,8 +32,7 @@ export async function POST({ request, locals }) {
{
url: youtubeUrl,
referrer: youtubeUrl,
origin: youtubeUrl,
USER_AGENT
userAgent: USER_AGENT
}
);
@@ -2,7 +2,6 @@ import { isOwnBackend } from '$lib/shared';
import psl from 'psl';
import { env } from '$env/dynamic/private';
import { error } from '@sveltejs/kit';
import { verifyCaptcha } from '$lib/server/captcha.js';
const allowedDomains: string[] = [
'youtube.com',
+4 -13
View File
@@ -10,21 +10,12 @@
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler",
"types": [
"shaka-player"
]
"types": ["shaka-player"]
},
"include": [
"src/**/*.d.ts",
"src/**/*.ts",
"src/**/*.svelte"
],
"exclude": [
"node_modules",
"dist"
]
"include": ["src/**/*.d.ts", "src/**/*.ts", "src/**/*.svelte", ".svelte-kit/ambient.d.ts"],
"exclude": ["node_modules", "dist"]
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}
}