diff --git a/public/locales/id.json b/public/locales/id.json index a464841..150abd5 100644 --- a/public/locales/id.json +++ b/public/locales/id.json @@ -40,7 +40,7 @@ "YouPlayedFor": "Kamu sudah bermain selama", "hours": "jam", "minutes": "menit", - "YourLauncherLevel": "Your launcher's level", + "YourLauncherLevel": "Level peluncur kamu", "Downloading": "Mengunduh", "Unpacking": "Membuka paket", "GameDownloaded": "Game berhasil dipasang", @@ -60,8 +60,8 @@ "LauncherUpdateTitle": "Pembaruan Peluncur tersedia: ", "LauncherUpdateBody": "Kamu dapat mengunduh versi baru peluncur dari repositori di {uri.launcher}", "TelemetryNotDisabled": "Peladen telemetri {placeholders.uppercase.company} tidak dimatikan!", - "PatchRepoUnavailableTitle": "Patch's repository is not available", - "PatchRepoUnavailableBody": "Most likely notabug is under attack and is not responding", + "PatchRepoUnavailableTitle": "Repositori patch tidak tersedia", + "PatchRepoUnavailableBody": "Sepertinya notabug sedang dalam serangan dan tidak merespon", "DefPrefix": "Reset to Default", "ChangePrefix": "Change Prefix" } \ No newline at end of file diff --git a/src/ts/lib/LauncherLib.ts b/src/ts/lib/LauncherLib.ts index c653cff..0488a69 100644 --- a/src/ts/lib/LauncherLib.ts +++ b/src/ts/lib/LauncherLib.ts @@ -212,24 +212,24 @@ export default class LauncherLib * Get patch's state and version from the repository * @returns information about the patch, or null if repository is not available */ - public static async getPatchInfo(): Promise<{ version: string, state: 'testing' | 'stable' }|null> + public static async getPatchInfo(source: 'origin' | 'additional' = 'origin'): Promise<{ version: string, state: 'testing' | 'stable' }|null> { return new Promise(resolve => { this.getData().then(async (data) => { let gameLatest: string = data.game.latest.version; - got(`${constants.uri.patch}/raw/master/${gameLatest.replaceAll('.', '')}/patch.sh`, { + got(`${constants.uri.patch[source]}/raw/master/${gameLatest.replaceAll('.', '')}/patch.sh`, { timeout: { - request: 4000 + request: 3000 } }).then((patch: any) => { /** * [game version]/patch.sh file exists * so it's testing or stable version */ - got(`${constants.uri.patch}/raw/master/${gameLatest.replaceAll('.', '')}/patch_files/unityplayer_patch.vcdiff`, { + got(`${constants.uri.patch[source]}/raw/master/${gameLatest.replaceAll('.', '')}/patch_files/unityplayer_patch.vcdiff`, { timeout: { - request: 4000 + request: 3000 } }).then(() => { /** @@ -246,10 +246,17 @@ export default class LauncherLib console.error(error); /** - * Notabug is not responding + * Source is not responding */ if (error.message.includes('Timeout awaiting')) - resolve(null); + { + // If it was a notabug - then we can try to use + // Maroxy's patch's repo mirror + if (source === 'origin') + this.getPatchInfo('additional').then(resolve); + + else resolve(null); + } /** * [game version]/patch_files/unityplayer_patch @@ -270,10 +277,17 @@ export default class LauncherLib console.error(error); /** - * Notabug is not responding + * Source is not responding */ if (error.message.includes('Timeout awaiting')) - resolve(null); + { + // If it was a notabug - then we can try to use + // Maroxy's patch's repo mirror + if (source === 'origin') + this.getPatchInfo('additional').then(resolve); + + else resolve(null); + } /** * Otherwise it's definitely preparation diff --git a/src/ts/lib/constants.ts b/src/ts/lib/constants.ts index 99b12be..65e7567 100644 --- a/src/ts/lib/constants.ts +++ b/src/ts/lib/constants.ts @@ -24,7 +24,10 @@ export default class constants public static readonly uri = { api: `https://sdk-os-static.${this.placeholders.lowercase.company}.com/hk4e_global/mdk/launcher/api`, - patch: 'https://notabug.org/Krock/dawn', + patch: { + origin: 'https://notabug.org/Krock/dawn', + additional: 'https://dev.kaifa.ch/Maroxy/dawn' + }, launcher: 'https://gitlab.com/KRypt0n_/an-anime-game-launcher', telemetry: [ `log-upload-os.${this.placeholders.lowercase.company}.com`,