Improved checks for if nodejs loaded

This commit is contained in:
WardPearce
2026-01-03 14:24:23 +13:00
parent 0b3ae7cb4d
commit 1c21aa352c
9 changed files with 33 additions and 9 deletions
+2 -2
View File
@@ -4,10 +4,10 @@
<selectionStates>
<SelectionState runConfigName="app">
<option name="selectionMode" value="DROPDOWN" />
<DropdownSelection timestamp="2025-10-14T13:17:54.830930475Z">
<DropdownSelection timestamp="2026-01-03T00:57:14.623944251Z">
<Target type="DEFAULT_BOOT">
<handle>
<DeviceId pluginId="LocalEmulator" identifier="path=/home/ward/.android/avd/Pixel_9.avd" />
<DeviceId pluginId="LocalEmulator" identifier="path=/home/ward/.android/avd/Television_4K.avd" />
</handle>
</Target>
</DropdownSelection>
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "us.materialio.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 183
versionName "1.12.11"
versionCode 184
versionName "1.13.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
@@ -80,7 +80,11 @@
<release version="1.12.11" date="2026-1-02">
<release version="1.13.0" date="2026-1-03">
<url>https://github.com/Materialious/Materialious/releases/tag/1.13.0</url>
</release>
<release version="1.12.11" date="2026-1-02">
<url>https://github.com/Materialious/Materialious/releases/tag/1.12.11</url>
</release>
<release version="1.12.10" date="2025-12-28">
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "Materialious",
"version": "1.12.11",
"version": "1.13.0",
"description": "Modern material design for Invidious.",
"author": {
"name": "Ward Pearce",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "materialious",
"version": "1.12.11",
"version": "1.13.0",
"private": true,
"scripts": {
"dev": "npm run patch:github && vite dev",
@@ -1,7 +1,9 @@
import { timeout } from '$lib/misc';
import { Capacitor } from '@capacitor/core';
const originalFetch = window.fetch;
const corsProxyUrl: string = 'http://localhost:3000/';
let mobileNodeLoaded = false;
function needsProxying(target: string): boolean {
if (!target.startsWith('http')) return false;
@@ -12,6 +14,21 @@ export const androidFetch = async (
requestInput: string | URL | Request,
requestOptions?: RequestInit
): Promise<Response> => {
if (!mobileNodeLoaded) {
let mobileNodeResp: Response | undefined;
while (!mobileNodeResp || !mobileNodeResp.ok) {
try {
mobileNodeResp = await originalFetch(corsProxyUrl + 'check-nodejs');
} catch {
// Continue regardless of error
}
await timeout(100);
}
mobileNodeLoaded = true;
}
const uri = requestInput instanceof Request ? requestInput.url : requestInput.toString();
if (needsProxying(uri)) {
File diff suppressed because one or more lines are too long
@@ -177,6 +177,9 @@ const server = http.createServer((req, res) => {
rejectUnauthorized = true;
res.writeHead(200);
return res.end();
} else if (targetUrl === 'check-nodejs') {
res.writeHead(200);
return res.end();
}
if (!targetUrl.startsWith('http')) {
+1 -1
View File
@@ -3,7 +3,7 @@ import os
import re
from datetime import datetime
LATEST_VERSION = "1.12.11"
LATEST_VERSION = "1.13.0"
RELEASE_DATE = datetime.now().strftime("%Y-%-m-%d") # Format: YYYY-M-D
WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "materialious")