Bump version to 1.0.1 and improve build type detection

Build type now distinguishes Development, Release, and Custom based on
loader URL and environment, replacing previous logic.
This commit is contained in:
kmmiio99o 2025-10-11 21:21:27 +02:00
parent 454dde7c12
commit 135b0b3685
3 changed files with 48 additions and 17 deletions

View file

@ -74,7 +74,7 @@ const config = {
constModules: {
globals: {
"bunny-build-info": {
version: `"1.0.0"`,
version: `"1.0.1"`,
},
},
},

View file

@ -3,7 +3,7 @@ import { PupuIcon } from "@core/ui/settings";
import Version from "@core/ui/settings/pages/General/Version";
import { useProxy } from "@core/vendetta/storage";
import { getDebugInfo } from "@lib/api/debug";
import { settings } from "@lib/api/settings";
import { settings, loaderConfig } from "@lib/api/settings";
import { Stack, TableRowGroup, TableRow, Text } from "@metro/common/components";
import { Platform, ScrollView, View } from "react-native";
import { findAssetId } from "@lib/api/assets";
@ -11,6 +11,48 @@ import { findAssetId } from "@lib/api/assets";
export default function About() {
const debugInfo = getDebugInfo();
useProxy(settings);
useProxy(loaderConfig);
function getBuildType() {
// If running in React Native dev mode, treat as development
if (__DEV__) return "Development";
try {
// If a custom URL is enabled, inspect it
if (loaderConfig?.customLoadUrl?.enabled) {
const url = loaderConfig.customLoadUrl.url ?? "";
const u = new URL(url);
const host = u.hostname;
// Localhost / local IP -> dev server (bun run serve)
if (
host === "localhost" ||
host === "127.0.0.1" ||
host === "0.0.0.0" ||
host.startsWith("192.") ||
host.startsWith("10.") ||
host.startsWith("172.")
)
return "Development";
// If the URL points to GitHub releases/raw, treat as Release
if (
url.includes("github.com") ||
url.includes("raw.githubusercontent.com") ||
url.includes("/releases/")
)
return "Release";
// Custom remote URL (not recognized as local or GitHub)
return "Custom";
}
} catch (e) {
// If URL parsing fails, fall back below
}
// Default: when not using a custom URL the loader fetches from GitHub releases
return "Release";
}
const coreVersions = [
{
@ -139,20 +181,9 @@ export default function About() {
}
icon={<TableRow.Icon source={findAssetId("ScreenIcon")} />}
/>
<TableRow
label="Debug Mode"
trailing={
<TableRow.TrailingText text={__DEV__ ? "Enabled" : "Disabled"} />
}
icon={<TableRow.Icon source={findAssetId("WrenchIcon")} />}
/>
<TableRow
label="Build Type"
trailing={
<TableRow.TrailingText
text={settings.developerSettings ? "Development" : "Production"}
/>
}
trailing={<TableRow.TrailingText text={getBuildType()} />}
icon={<TableRow.Icon source={findAssetId("HammerIcon")} />}
/>
</TableRowGroup>

6
src/modules.d.ts vendored
View file

@ -1,8 +1,8 @@
declare module "bunny-build-info" {
const version: "1.0.0";
const version: "1.0.1";
}
declare module "*.png" {
const str: string;
export default str;
const str: string;
export default str;
}