feat: iOS Tweak support

because we are basing it off RainTweak, we need to add such stuff
This commit is contained in:
kmmiio99o 2026-07-31 10:51:51 +02:00
parent fc6e5bccfd
commit cb877a2a99
No known key found for this signature in database
GPG key ID: DCC0431E10FADBF1
2 changed files with 22 additions and 3 deletions

View file

@ -141,7 +141,7 @@ export function getCurrentTheme() {
* @internal * @internal
*/ */
export function getThemeFromLoader(): VdThemeInfo | null { export function getThemeFromLoader(): VdThemeInfo | null {
return getStoredTheme(); return getStoredTheme() ?? getCurrentTheme();
} }
/** /**
@ -157,6 +157,7 @@ export async function initThemes() {
} }
await newAwaitStorage(colorsPref); await newAwaitStorage(colorsPref);
await awaitStorage(themes);
const currentTheme = getThemeFromLoader(); const currentTheme = getThemeFromLoader();
initColors(currentTheme?.data ?? null); initColors(currentTheme?.data ?? null);

View file

@ -10,6 +10,9 @@ const rainLoaderIdentity = globalThis.__RAIN_LOADER__;
// @ts-ignore // @ts-ignore
const vendettaLoaderIdentity = globalThis.__vendetta_loader; const vendettaLoaderIdentity = globalThis.__vendetta_loader;
// @ts-ignore
const shiggyLoaderIdentity = globalThis.__SHIGGY_LOADER__;
export interface VendettaLoaderIdentity { export interface VendettaLoaderIdentity {
name: string; name: string;
features: { features: {
@ -36,6 +39,10 @@ export function isRa1nLoader() {
return rainLoaderIdentity != null; return rainLoaderIdentity != null;
} }
export function isShiggyLoader() {
return shiggyLoaderIdentity != null;
}
function polyfillVendettaLoaderIdentity() { function polyfillVendettaLoaderIdentity() {
if (!isPyonLoader() || isVendettaLoader() || !isRa1nLoader()) return null; if (!isPyonLoader() || isVendettaLoader() || !isRa1nLoader()) return null;
@ -98,6 +105,8 @@ export function getLoaderIdentity() {
return getVendettaLoaderIdentity(); return getVendettaLoaderIdentity();
} else if (isRa1nLoader()) { } else if (isRa1nLoader()) {
return rainLoaderIdentity(); return rainLoaderIdentity();
} else if (isShiggyLoader()) {
return shiggyLoaderIdentity;
} }
return null; return null;
@ -116,6 +125,7 @@ export function getLoaderName() {
if (isPyonLoader()) return pyonLoaderIdentity.loaderName; if (isPyonLoader()) return pyonLoaderIdentity.loaderName;
else if (isRa1nLoader()) return rainLoaderIdentity.loadername; else if (isRa1nLoader()) return rainLoaderIdentity.loadername;
else if (isVendettaLoader()) return vendettaLoaderIdentity.name; else if (isVendettaLoader()) return vendettaLoaderIdentity.name;
else if (isShiggyLoader()) return shiggyLoaderIdentity.loaderName;
return "Unknown"; return "Unknown";
} }
@ -123,6 +133,7 @@ export function getLoaderName() {
export function getLoaderVersion(): string | null { export function getLoaderVersion(): string | null {
if (isPyonLoader()) return pyonLoaderIdentity.loaderVersion; if (isPyonLoader()) return pyonLoaderIdentity.loaderVersion;
else if (isRa1nLoader()) return rainLoaderIdentity.loaderVersion; else if (isRa1nLoader()) return rainLoaderIdentity.loaderVersion;
else if (isShiggyLoader()) return shiggyLoaderIdentity.loaderVersion;
return null; return null;
} }
@ -144,7 +155,9 @@ export function isThemeSupported() {
} else if (isVendettaLoader()) { } else if (isVendettaLoader()) {
return vendettaLoaderIdentity!!.features.themes != null; return vendettaLoaderIdentity!!.features.themes != null;
} else if (isRa1nLoader()) { } else if (isRa1nLoader()) {
return false; // Ra1n has theme support disabled, this is here just to make sure it doesnt think it does return false; // Rain has theme support disabled, this is here just to make sure it doesnt think it does
} else if (isShiggyLoader()) {
return shiggyLoaderIdentity.hasThemeSupport;
} }
return false; return false;
@ -158,6 +171,8 @@ export function getStoredTheme(): VdThemeInfo | null {
if (!themeProp) return null; if (!themeProp) return null;
// @ts-ignore // @ts-ignore
return globalThis[themeProp] || null; return globalThis[themeProp] || null;
} else if (isShiggyLoader()) {
return shiggyLoaderIdentity.storedTheme || null;
} }
return null; return null;
@ -168,6 +183,8 @@ export function getThemeFilePath() {
return "pyoncord/current-theme.json"; return "pyoncord/current-theme.json";
} else if (isVendettaLoader()) { } else if (isVendettaLoader()) {
return "vendetta_theme.json"; return "vendetta_theme.json";
} else if (isShiggyLoader()) {
return "ShiggyCord/current-theme.json";
} }
return null; return null;
@ -241,6 +258,7 @@ export function getLoaderConfigPath() {
export function isFontSupported() { export function isFontSupported() {
if (isPyonLoader()) return pyonLoaderIdentity.fontPatch === 2; if (isPyonLoader()) return pyonLoaderIdentity.fontPatch === 2;
else if (isShiggyLoader()) return shiggyLoaderIdentity.fontPatch === 2;
return false; return false;
} }
@ -248,4 +266,4 @@ export function isFontSupported() {
export async function clearBundle() { export async function clearBundle() {
// TODO: This should be not be hardcoded, maybe put in loader.json? // TODO: This should be not be hardcoded, maybe put in loader.json?
return void await removeCacheFile("bundle.js"); return void await removeCacheFile("bundle.js");
} }