Use invidious instance as base for manifest

This commit is contained in:
WardPearce
2026-04-30 02:37:09 +12:00
parent b211619b83
commit 314ab969e5
7 changed files with 28 additions and 27 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2026-04-29T13:30:29.789814037Z">
<DropdownSelection timestamp="2026-04-29T14:13:42.770873710Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/wpearce/.android/avd/Pixel_9.avd" />
+12 -2
View File
@@ -1,17 +1,18 @@
{
"name": "Materialious",
"version": "1.16.25",
"version": "1.16.26",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "Materialious",
"version": "1.16.25",
"version": "1.16.26",
"license": "MIT",
"dependencies": {
"@capacitor-community/electron": "^5.0.0",
"@types/jsdom": "^28.0.1",
"bgutils-js": "^3.2.0",
"capacitor-nodejs": "https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.9/capacitor-nodejs.tgz",
"chokidar": "~5.0.0",
"electron-is-dev": "~2.0.0",
"electron-serve": "~3.0.0",
@@ -2515,6 +2516,15 @@
"node": ">= 0.4"
}
},
"node_modules/capacitor-nodejs": {
"version": "1.0.0-beta.9",
"resolved": "https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.9/capacitor-nodejs.tgz",
"integrity": "sha512-4EU/QBolfuyHiMtwd1nxZ4wsK243tGE4VttKvVBG+x1yQuK9EIlEf3lbRjFXfjrJMTZNCqaP6glmdfj9Zo7KVg==",
"license": "MIT",
"peerDependencies": {
"@capacitor/core": ">=7.0.0"
}
},
"node_modules/chalk": {
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz",
+2 -1
View File
@@ -25,6 +25,7 @@
"@capacitor-community/electron": "^5.0.0",
"@types/jsdom": "^28.0.1",
"bgutils-js": "^3.2.0",
"capacitor-nodejs": "https://github.com/hampoelz/capacitor-nodejs/releases/download/v1.0.0-beta.9/capacitor-nodejs.tgz",
"chokidar": "~5.0.0",
"electron-is-dev": "~2.0.0",
"electron-serve": "~3.0.0",
@@ -45,4 +46,4 @@
"capacitor",
"electron"
]
}
}
@@ -1,4 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const CapacitorNodejs = require('../../../node_modules/capacitor-nodejs/electron/dist/plugin.js');
module.exports = {
CapacitorNodejs,
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "materialious",
"version": "1.16.25",
"version": "1.16.26",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "materialious",
"version": "1.16.25",
"version": "1.16.26",
"hasInstallScript": true,
"dependencies": {
"@capacitor-community/electron": "^5.0.1",
+4
View File
@@ -42,9 +42,13 @@ export const fetchProxied = async (
const nonProxiedUrl =
requestInput instanceof Request ? requestInput.url : requestInput.toString();
console.log('nonProxiedUrl', nonProxiedUrl);
if (needsProxying(nonProxiedUrl)) {
const proxiedUrl = corsProxyUrl + encodeUrl(nonProxiedUrl);
console.log('proxiedUrl', proxiedUrl);
if (requestInput instanceof Request) {
requestInput = new Request(proxiedUrl, {
method: requestInput.method,
+5 -21
View File
@@ -1,21 +1,8 @@
import { invidiousInstanceStore } from '$lib/store';
import { get } from 'svelte/store';
export async function manifestDomainInclusion(manifestUrl: string): Promise<string> {
const respIvg = await fetch(manifestUrl, {
method: 'GET',
headers: {
// Required for our custom android backend.
__redirect: 'manual'
},
referrerPolicy: 'no-referrer'
});
if (!respIvg.ok) {
throw Error('Unable to make request to Invidious');
}
// If location isn't present, then use base manifest URL.
const companionUrl = respIvg.headers.get('location') ?? manifestUrl;
const respCompanion = await fetch(companionUrl, {
const respCompanion = await fetch(manifestUrl, {
method: 'GET'
});
@@ -35,10 +22,7 @@ export async function manifestDomainInclusion(manifestUrl: string): Promise<stri
const baseUrlValue = baseUrlElement.textContent;
if (baseUrlValue && (baseUrlValue.startsWith('/') || !baseUrlValue.includes('://'))) {
const companionUrlObj = new URL(companionUrl);
const baseDomain = `${companionUrlObj.protocol}//${companionUrlObj.host}`;
const resolvedUrl = new URL(baseUrlValue, baseDomain).href;
baseUrlElement.textContent = resolvedUrl;
baseUrlElement.textContent = new URL(baseUrlValue, get(invidiousInstanceStore) ?? '').href;
}
}