diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index 63e2f67d..6c15b051 100644 --- a/materialious/android/app/build.gradle +++ b/materialious/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "us.materialio.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 82 - versionName "1.7.0" + versionCode 83 + versionName "1.7.1" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/materialious/electron/package.json b/materialious/electron/package.json index 6840beff..8a65ccb1 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.7.0", + "version": "1.7.1", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", diff --git a/materialious/package.json b/materialious/package.json index 582dbe11..c3831ac7 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.7.0", + "version": "1.7.1", "private": true, "scripts": { "dev": "vite dev", diff --git a/materialious/static/nodejs-android/index.js b/materialious/static/nodejs-android/index.js index 41465795..d4e20363 100644 --- a/materialious/static/nodejs-android/index.js +++ b/materialious/static/nodejs-android/index.js @@ -23,36 +23,22 @@ function fetchWithRedirects(targetUrl, options, redirectCount = 0) { return reject(new Error('Too many redirects')); } - let redirectHeaderLocation = res.headers.location; - - // Handle relative URLs - if (redirectHeaderLocation.startsWith('/')) { - redirectHeaderLocation = targetUrl.host + redirectHeaderLocation; - } - - // Add http:// if missing from the Location header - if (!redirectHeaderLocation.startsWith('http')) { - redirectHeaderLocation = 'http://' + redirectHeaderLocation; - } - try { // Attempt to create the redirect URL - let redirectUrl = new URL(redirectHeaderLocation); + const redirectUrl = new URL(res.headers.location, targetUrl); return resolve(fetchWithRedirects(redirectUrl, options, redirectCount + 1)); } catch (error) { - // Catch invalid URL errors return reject(new Error(`Invalid URL in redirect: ${error.message}`)); } } resolve(res); // Resolve with the final response if not a redirect }); - req.on('error', reject); + req.on('error', (error) => reject(error)); // Better error handling for request req.end(); }); } - const server = http.createServer(async (req, res) => { setCorsHeaders(res); @@ -66,10 +52,11 @@ const server = http.createServer(async (req, res) => { return res.end('No URL provided to fetch.'); } - const targetUrl = req.url.slice(1); // Remove leading '/' + let targetUrl = req.url.slice(1); // Remove leading '/' let parsedTarget; try { - if (!targetUrl.startsWith('http')) { + // Ensure protocol (http) is added if missing + if (!targetUrl.startsWith('http://') && !targetUrl.startsWith('https://')) { targetUrl = 'http://' + targetUrl; } parsedTarget = new URL(targetUrl); diff --git a/update_versions.py b/update_versions.py index a68d8ac8..59b811d1 100644 --- a/update_versions.py +++ b/update_versions.py @@ -5,7 +5,7 @@ import json import os import re -LATEST_VERSION = "1.7.0" +LATEST_VERSION = "1.7.1" WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "materialious") ROOT_PACKAGE = os.path.join(WORKING_DIR, "package.json")