bump
All checks were successful
Build and Release / build-and-release (push) Successful in 13m51s

This commit is contained in:
Bryan1029384756
2026-02-19 18:41:26 -06:00
parent bcd93291f8
commit 4e1a6225e1
3 changed files with 31 additions and 12 deletions

View File

@@ -42,7 +42,8 @@
"WebFetch(domain:medium.com)", "WebFetch(domain:medium.com)",
"Bash(keytool:*)", "Bash(keytool:*)",
"Bash(echo:*)", "Bash(echo:*)",
"Bash(python -c \"import base64; print\\(base64.b64encode\\(open\\(r''C:\\\\Users\\\\bryan\\\\Desktop\\\\Discord Clone\\\\discord-clone-release.keystore'',''rb''\\).read\\(\\)\\).decode\\(\\)\\)\")" "Bash(python -c \"import base64; print\\(base64.b64encode\\(open\\(r''C:\\\\Users\\\\bryan\\\\Desktop\\\\Discord Clone\\\\discord-clone-release.keystore'',''rb''\\).read\\(\\)\\).decode\\(\\)\\)\")",
"WebFetch(domain:gitea.moyettes.com)"
] ]
} }
} }

View File

@@ -47,21 +47,32 @@ const webPlatform = {
// Detect Android/Capacitor and enable native APK updates // Detect Android/Capacitor and enable native APK updates
if (window.Capacitor?.isNativePlatform?.()) { if (window.Capacitor?.isNativePlatform?.()) {
const YAML_URL = 'https://gitea.moyettes.com/Moyettes/DiscordClone/releases/download/latest/latest-android.yml'; const YAML_URL = 'https://gitea.moyettes.com/Moyettes/DiscordClone/releases/download/latest/latest-android.yml';
const APK_URL = 'https://gitea.moyettes.com/Moyettes/DiscordClone/releases/download/latest/app-release.apk';
const AppUpdater = window.Capacitor.Plugins.AppUpdater; const AppUpdater = window.Capacitor.Plugins.AppUpdater;
let apkUrl;
webPlatform.updates = { webPlatform.updates = {
async checkUpdate() { async checkUpdate() {
try { try {
const response = await fetch(YAML_URL); const response = await fetch(YAML_URL);
if (!response.ok) return { updateAvailable: false }; if (!response.ok) {
console.log('[UpdateCheck] Fetch failed:', response.status);
return { updateAvailable: false };
}
const yaml = await response.text(); const yaml = await response.text();
const versionMatch = yaml.match(/^version:\s*(.+)$/m); const versionMatch = yaml.match(/^version:\s*(.+)$/m);
if (!versionMatch) return { updateAvailable: false }; if (!versionMatch) {
console.log('[UpdateCheck] No version found in YAML');
return { updateAvailable: false };
}
const latestVersion = versionMatch[1].trim(); const latestVersion = versionMatch[1].trim();
const pathMatch = yaml.match(/^path:\s*(.+)$/m);
const apkFilename = pathMatch ? pathMatch[1].trim() : `DiscordClone-v${latestVersion}.apk`;
apkUrl = `https://gitea.moyettes.com/Moyettes/DiscordClone/releases/download/latest/${apkFilename}`;
const { version: currentVersion } = await AppUpdater.getVersion(); const { version: currentVersion } = await AppUpdater.getVersion();
console.log('[UpdateCheck] Latest:', latestVersion, '| Current:', currentVersion);
const latest = latestVersion.split('.').map(Number); const latest = latestVersion.split('.').map(Number);
const current = currentVersion.split('.').map(Number); const current = currentVersion.split('.').map(Number);
@@ -78,13 +89,15 @@ if (window.Capacitor?.isNativePlatform?.()) {
if (l < c) break; if (l < c) break;
} }
return { updateAvailable, updateType, latestVersion, currentVersion, apkUrl: APK_URL }; console.log('[UpdateCheck] Result:', updateAvailable ? updateType + ' update available' : 'up to date');
} catch { return { updateAvailable, updateType, latestVersion, currentVersion, apkUrl };
} catch (e) {
console.log('[UpdateCheck] Error:', e.message);
return { updateAvailable: false }; return { updateAvailable: false };
} }
}, },
async installUpdate() { async installUpdate() {
await AppUpdater.downloadAndInstall({ url: APK_URL }); await AppUpdater.downloadAndInstall({ url: apkUrl });
}, },
onDownloadProgress(callback) { onDownloadProgress(callback) {
AppUpdater.addListener('downloadProgress', callback); AppUpdater.addListener('downloadProgress', callback);

View File

@@ -27,14 +27,14 @@ export function UpdateProvider({ children }) {
return ( return (
<UpdateContext.Provider value={state}> <UpdateContext.Provider value={state}>
{children} {children}
{state && (state.updateType === 'major' || state.updateType === 'minor') && ( {state && (state.updateType === 'major' || state.updateType === 'minor' || !features.hasWindowControls) && (
<ForcedUpdateModal latestVersion={state.latestVersion} /> <ForcedUpdateModal updateType={state.updateType} latestVersion={state.latestVersion} />
)} )}
</UpdateContext.Provider> </UpdateContext.Provider>
); );
} }
function ForcedUpdateModal({ latestVersion }) { function ForcedUpdateModal({ updateType, latestVersion }) {
const { links, updates } = usePlatform(); const { links, updates } = usePlatform();
const [downloading, setDownloading] = useState(false); const [downloading, setDownloading] = useState(false);
const [progress, setProgress] = useState(0); const [progress, setProgress] = useState(0);
@@ -62,12 +62,17 @@ function ForcedUpdateModal({ latestVersion }) {
} }
}; };
const isPatch = updateType === 'patch';
return ( return (
<div className="forced-update-overlay"> <div className="forced-update-overlay">
<div className="forced-update-modal"> <div className="forced-update-modal">
<h2>Update Required</h2> <h2>{isPatch ? 'Update Available' : 'Update Required'}</h2>
<p> <p>
A new version (v{latestVersion}) is available. This update is required to continue using the app. {isPatch
? `A new version (v${latestVersion}) is available.`
: `A new version (v${latestVersion}) is available. This update is required to continue using the app.`
}
</p> </p>
{downloading ? ( {downloading ? (
<div className="update-progress"> <div className="update-progress">