From 5534b820f57ca4576aac07ba164b0bedfe11d642 Mon Sep 17 00:00:00 2001 From: Raphiiko Date: Fri, 5 Apr 2024 12:44:10 +0200 Subject: [PATCH 1/5] Small change in app initialization --- src-core/src/main.rs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src-core/src/main.rs b/src-core/src/main.rs index f851cb48..d536e48b 100644 --- a/src-core/src/main.rs +++ b/src-core/src/main.rs @@ -46,7 +46,7 @@ use tauri_plugin_log::{LogTarget, RotationStrategy}; fn main() { tauri_plugin_deep_link::prepare("co.raphii.oyasumi.deeplink"); // Construct Oyasumi Tauri application - let app = tauri::Builder::default() + tauri::Builder::default() .plugin(tauri_plugin_store::Builder::default().build()) .plugin(tauri_plugin_fs_extra::init()) .plugin(configure_tauri_plugin_log()) @@ -74,15 +74,14 @@ fn main() { .on_window_event(system_tray::handle_window_events()) .invoke_handler(configure_command_handlers()) .build(tauri::generate_context!()) - .expect("An error occurred while running the application"); - // Run OyasumiVR - app.run(|handler, event| match event { - tauri::RunEvent::Exit { .. } => { - handler.track_event("app_exited", None); - handler.flush_events_blocking(); - } - _ => {} - }) + .expect("An error occurred while running the application") + .run(|handler, event| match event { + tauri::RunEvent::Exit { .. } => { + handler.track_event("app_exited", None); + handler.flush_events_blocking(); + } + _ => {} + }) } async fn load_configs() { From dbde2ebd50080aa214cb5040e3913100e966ad4a Mon Sep 17 00:00:00 2001 From: Raphiiko Date: Fri, 5 Apr 2024 13:26:51 +0200 Subject: [PATCH 2/5] Add crash reporting for initialization errors --- src-ui/app/app.module.ts | 9 ++++++++- src-ui/app/utils/promise-utils.ts | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 src-ui/app/utils/promise-utils.ts diff --git a/src-ui/app/app.module.ts b/src-ui/app/app.module.ts index 04818f78..bf234641 100644 --- a/src-ui/app/app.module.ts +++ b/src-ui/app/app.module.ts @@ -193,6 +193,8 @@ import { BigscreenBeyondLedAutomationService } from './services/hmd-specific-aut import { BigscreenBeyondFanAutomationService } from './services/hmd-specific-automations/bigscreen-beyond-fan-automation.service'; import { BSBFanSpeedControlModalComponent } from './components/bsb-fan-speed-control-modal/bsb-fan-speed-control-modal.component'; import { DiscordService } from './services/discord.service'; +import { trackEvent } from '@aptabase/tauri'; +import { pTimeout } from './utils/promise-utils'; [ localeEN, @@ -425,10 +427,15 @@ export class AppModule { private async logInit(action: string, promise: Promise): Promise { if (FLAVOUR === 'DEV') console.log(`[Init] Running ${action}`); try { - const result = await promise; + const result = await pTimeout( + promise, + 6000, + new Error(`Initialization function ${action} timed out.`) + ); if (FLAVOUR === 'DEV') info(`[Init] '${action}' ran successfully`); return result; } catch (e) { + trackEvent('app_init_error', { action, error: `${e}` }); error(`[Init] Running '${action}' failed: ` + e); throw e; } diff --git a/src-ui/app/utils/promise-utils.ts b/src-ui/app/utils/promise-utils.ts new file mode 100644 index 00000000..ddc46a41 --- /dev/null +++ b/src-ui/app/utils/promise-utils.ts @@ -0,0 +1,12 @@ +export function pTimeout( + promise: Promise, + timeoutMs: number, + timeoutError = new Error('Promise timed out') +): Promise { + const timeout = new Promise((_, reject) => { + setTimeout(() => { + reject(timeoutError); + }, timeoutMs); + }); + return Promise.race([promise, timeout]) as Promise; +} From a7493541614f4798244cd20df8dd7d6561fd6760 Mon Sep 17 00:00:00 2001 From: Raphiiko Date: Fri, 5 Apr 2024 13:27:17 +0200 Subject: [PATCH 3/5] Updated changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 620aabc8..2ed4b89b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added + +- Crash reporting for initialization errors + ## [1.12.4] ### Fixed From 6ed7b11d4a1a34ca891da4eb0a3e0f770699fa88 Mon Sep 17 00:00:00 2001 From: Raphiiko Date: Fri, 5 Apr 2024 13:29:11 +0200 Subject: [PATCH 4/5] Bumped patch Bumped patch --- CHANGELOG.md | 2 ++ package.json | 2 +- src-core/Cargo.lock | 4 ++-- src-core/Cargo.toml | 2 +- src-core/tauri.conf.json | 6 +++--- src-elevated-sidecar/Cargo.toml | 2 +- src-overlay-ui/package.json | 2 +- src-shared-rust/Cargo.toml | 2 +- src-shared-ts/package.json | 2 +- 9 files changed, 13 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2ed4b89b..5ed4f01d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.12.5] + ### Added - Crash reporting for initialization errors diff --git a/package.json b/package.json index 0047cae7..f54dad71 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oyasumi", - "version": "1.12.4", + "version": "1.12.5", "author": "Raphiiko", "license": "MIT", "type": "module", diff --git a/src-core/Cargo.lock b/src-core/Cargo.lock index 092333cf..34c4efa9 100644 --- a/src-core/Cargo.lock +++ b/src-core/Cargo.lock @@ -3618,7 +3618,7 @@ dependencies = [ [[package]] name = "oyasumivr" -version = "1.12.4" +version = "1.12.5" dependencies = [ "async-recursion", "bluest", @@ -3687,7 +3687,7 @@ dependencies = [ [[package]] name = "oyasumivr-shared" -version = "1.12.4" +version = "1.12.5" dependencies = [ "winapi", ] diff --git a/src-core/Cargo.toml b/src-core/Cargo.toml index fcf7dc71..f341c8ac 100644 --- a/src-core/Cargo.toml +++ b/src-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oyasumivr" -version = "1.12.4" +version = "1.12.5" description = "" authors = ["Raphiiko"] license = "MIT" diff --git a/src-core/tauri.conf.json b/src-core/tauri.conf.json index 07b3055a..e26ba5d8 100644 --- a/src-core/tauri.conf.json +++ b/src-core/tauri.conf.json @@ -9,7 +9,7 @@ }, "package": { "productName": "OyasumiVR", - "version": "1.12.4" + "version": "1.12.5" }, "tauri": { "allowlist": { @@ -188,7 +188,7 @@ "center": true, "theme": "Dark", "transparent": true, - "userAgent": "OyasumiVR/1.12.4 (https://github.com/Raphiiko/OyasumiVR)" + "userAgent": "OyasumiVR/1.12.5 (https://github.com/Raphiiko/OyasumiVR)" }, { "width": 700, @@ -200,7 +200,7 @@ "center": true, "theme": "Dark", "transparent": true, - "userAgent": "OyasumiVR/1.12.4 (https://github.com/Raphiiko/OyasumiVR)" + "userAgent": "OyasumiVR/1.12.5 (https://github.com/Raphiiko/OyasumiVR)" } ] } diff --git a/src-elevated-sidecar/Cargo.toml b/src-elevated-sidecar/Cargo.toml index 6a6df0fe..4adde2d0 100644 --- a/src-elevated-sidecar/Cargo.toml +++ b/src-elevated-sidecar/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oyasumivr-elevated-sidecar" -version = "1.12.4" +version = "1.12.5" authors = ["Raphiiko"] license = "MIT" edition = "2021" diff --git a/src-overlay-ui/package.json b/src-overlay-ui/package.json index 9eab0953..ffa9972f 100644 --- a/src-overlay-ui/package.json +++ b/src-overlay-ui/package.json @@ -1,6 +1,6 @@ { "name": "oyasumivr-overlay-ui", - "version": "1.12.4", + "version": "1.12.5", "private": true, "scripts": { "dev": "vite dev", diff --git a/src-shared-rust/Cargo.toml b/src-shared-rust/Cargo.toml index e1b87064..159f484a 100644 --- a/src-shared-rust/Cargo.toml +++ b/src-shared-rust/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "oyasumivr-shared" -version = "1.12.4" +version = "1.12.5" authors = ["Raphiiko"] edition = "2021" license = "MIT" diff --git a/src-shared-ts/package.json b/src-shared-ts/package.json index cf78c1e4..dce55377 100644 --- a/src-shared-ts/package.json +++ b/src-shared-ts/package.json @@ -2,7 +2,7 @@ "name": "src-shared-ts", "description": "Shared typescript code for Oyasumi modules", "scripts": {}, - "version": "1.12.4", + "version": "1.12.5", "author": "Raphiiko", "license": "MIT", "type": "module", From 9c8a485ce2d2ac577581500dfb1876678d6b08ec Mon Sep 17 00:00:00 2001 From: Raphiiko Date: Fri, 5 Apr 2024 13:29:35 +0200 Subject: [PATCH 5/5] Updated changelog --- CHANGELOG.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ed4f01d..df665596 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased] - ## [1.12.5] ### Added