@bghitcode/bghitapp 1.1.6 → 1.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import { InvalidArgumentError, program as program$1, Option } from 'commander';
20
20
  import fs$1 from 'fs';
21
21
 
22
22
  var name = "@bghitcode/bghitapp";
23
- var version = "1.1.6";
23
+ var version = "1.1.8";
24
24
  var description = "🤱🏻 Turn any webpage into a desktop app with one command — by BghitCode.";
25
25
  var engines = {
26
26
  node: ">=18.0.0"
@@ -617,7 +617,9 @@ async function processSplashAsset(splash, autoSplash, targetUrl, appIcon) {
617
617
  const filename = `splash-asset${getExtension(resolved)}`;
618
618
  const dest = path.join(distDir, filename);
619
619
  try {
620
- const response = await fetch(resolved, { signal: AbortSignal.timeout(15000) });
620
+ const response = await fetch(resolved, {
621
+ signal: AbortSignal.timeout(15000),
622
+ });
621
623
  if (!response.ok)
622
624
  throw new Error(`HTTP ${response.status}`);
623
625
  const buffer = Buffer.from(await response.arrayBuffer());
@@ -647,7 +649,9 @@ async function processSplashAsset(splash, autoSplash, targetUrl, appIcon) {
647
649
  const filename = `splash-asset${ext}`;
648
650
  const dest = path.join(distDir, filename);
649
651
  try {
650
- const response = await fetch(ogUrl, { signal: AbortSignal.timeout(15000) });
652
+ const response = await fetch(ogUrl, {
653
+ signal: AbortSignal.timeout(15000),
654
+ });
651
655
  if (!response.ok)
652
656
  throw new Error(`HTTP ${response.status}`);
653
657
  const buffer = Buffer.from(await response.arrayBuffer());
@@ -671,7 +675,8 @@ function getExtension(urlOrPath) {
671
675
  const url = new URL(urlOrPath);
672
676
  const pathname = url.pathname;
673
677
  const ext = path.extname(pathname).split('?')[0];
674
- if (ext && ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'].includes(ext.toLowerCase())) {
678
+ if (ext &&
679
+ ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg'].includes(ext.toLowerCase())) {
675
680
  return ext;
676
681
  }
677
682
  }
@@ -1014,7 +1019,10 @@ async function mergeConfig(url, options, tauriConf) {
1014
1019
  const { appVersion, userAgent, showSystemTray, useLocalFile, identifier, name = 'bghitapp-app', installerLanguage, wasm, camera, microphone, splash, autoSplash, offline, } = options;
1015
1020
  const platform = asSupportedPlatform(process.platform);
1016
1021
  const tauriConfWindowOptions = buildWindowConfigOverrides(options, platform);
1017
- Object.assign(tauriConf.bghitapp.windows[0], { url, ...tauriConfWindowOptions });
1022
+ Object.assign(tauriConf.bghitapp.windows[0], {
1023
+ url,
1024
+ ...tauriConfWindowOptions,
1025
+ });
1018
1026
  tauriConf.productName = name;
1019
1027
  tauriConf.identifier = identifier;
1020
1028
  tauriConf.version = appVersion;
@@ -2771,15 +2779,15 @@ function validateUrlInput(url) {
2771
2779
  return url;
2772
2780
  }
2773
2781
 
2774
- const { green, yellow, gray } = chalk;
2775
- const logo = `${green(' ____ _ _ _ _ ')}
2776
- ${green('| __ ) __ _| |__ (_) |_ / \\ _ __ _ __ ')}
2777
- ${green('| _ \\ / _` | \'_ \\| | __| / _ \\ | \'_ \\| \'_ \\ ')}
2778
- ${green('| |_) | (_| | | | | | |_ / ___ \\| |_) | |_) |')}
2779
- ${green('|____/ \\__, |_| |_|_|\\__/_/ \\_\\ .__/| .__/ ')}
2780
- ${green(' |___/ |_| |_| ')}
2781
- ${yellow('https://bghitcode.com')}
2782
- ${gray('Turn any webpage into a desktop app — by BghitCode')}
2782
+ const { green: green$1, yellow: yellow$1, gray: gray$1 } = chalk;
2783
+ const logo = `${green$1(' ____ _ _ _ _ ')}
2784
+ ${green$1('| __ ) __ _| |__ (_) |_ / \\ _ __ _ __ ')}
2785
+ ${green$1("| _ \\ / _` | '_ \\| | __| / _ \\ | '_ \\| '_ \\ ")}
2786
+ ${green$1('| |_) | (_| | | | | | |_ / ___ \\| |_) | |_) |')}
2787
+ ${green$1('|____/ \\__, |_| |_|_|\\__/_/ \\_\\ .__/| .__/ ')}
2788
+ ${green$1(' |___/ |_| |_| ')}
2789
+ ${yellow$1('https://bghitcode.com')}
2790
+ ${gray$1('Turn any webpage into a desktop app — by BghitCode')}
2783
2791
  `;
2784
2792
  function getCliProgram() {
2785
2793
  return program$1
@@ -2788,7 +2796,7 @@ function getCliProgram() {
2788
2796
  .showHelpAfterError()
2789
2797
  .argument('[url]', 'The web URL you want to package', validateUrlInput)
2790
2798
  .option('--name <string>', 'Application name')
2791
- .addOption(new Option('--identifier <string>', 'Application identifier / bundle ID').hideHelp())
2799
+ .addOption(new Option('--identifier <string>', 'Application identifier / bundle ID'))
2792
2800
  .option('--icon <string>', 'Application icon', DEFAULT_BGHITAPP_OPTIONS.icon)
2793
2801
  .option('--width <number>', 'Window width', validateNumberInput, DEFAULT_BGHITAPP_OPTIONS.width)
2794
2802
  .option('--height <number>', 'Window height', validateNumberInput, DEFAULT_BGHITAPP_OPTIONS.height)
@@ -2808,37 +2816,17 @@ function getCliProgram() {
2808
2816
  return previous ? [...previous, ...files] : files;
2809
2817
  }, DEFAULT_BGHITAPP_OPTIONS.inject)
2810
2818
  .option('--debug', 'Debug build and more output', DEFAULT_BGHITAPP_OPTIONS.debug)
2811
- .addOption(new Option('--proxy-url <url>', 'Proxy URL for all network requests (http://, https://, socks5://)')
2812
- .default(DEFAULT_BGHITAPP_OPTIONS.proxyUrl)
2813
- .hideHelp())
2814
- .addOption(new Option('--user-agent <string>', 'Custom user agent')
2815
- .default(DEFAULT_BGHITAPP_OPTIONS.userAgent)
2816
- .hideHelp())
2819
+ .addOption(new Option('--proxy-url <url>', 'Proxy URL for all network requests (http://, https://, socks5://)').default(DEFAULT_BGHITAPP_OPTIONS.proxyUrl))
2820
+ .addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_BGHITAPP_OPTIONS.userAgent))
2817
2821
  .addOption(new Option('--targets <string>', 'Build target format for your system').default(DEFAULT_BGHITAPP_OPTIONS.targets))
2818
- .addOption(new Option('--app-version <string>', 'App version, the same as package.json version')
2819
- .default(DEFAULT_BGHITAPP_OPTIONS.appVersion)
2820
- .hideHelp())
2821
- .addOption(new Option('--always-on-top', 'Always on the top level')
2822
- .default(DEFAULT_BGHITAPP_OPTIONS.alwaysOnTop)
2823
- .hideHelp())
2824
- .addOption(new Option('--maximize', 'Start window maximized')
2825
- .default(DEFAULT_BGHITAPP_OPTIONS.maximize)
2826
- .hideHelp())
2827
- .addOption(new Option('--dark-mode', 'Force Mac app to use dark mode')
2828
- .default(DEFAULT_BGHITAPP_OPTIONS.darkMode)
2829
- .hideHelp())
2830
- .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
2831
- .default(DEFAULT_BGHITAPP_OPTIONS.disabledWebShortcuts)
2832
- .hideHelp())
2833
- .addOption(new Option('--activation-shortcut <string>', 'Shortcut key to active App')
2834
- .default(DEFAULT_BGHITAPP_OPTIONS.activationShortcut)
2835
- .hideHelp())
2836
- .addOption(new Option('--show-system-tray', 'Show system tray in app')
2837
- .default(DEFAULT_BGHITAPP_OPTIONS.showSystemTray)
2838
- .hideHelp())
2839
- .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon')
2840
- .default(DEFAULT_BGHITAPP_OPTIONS.systemTrayIcon)
2841
- .hideHelp())
2822
+ .addOption(new Option('--app-version <string>', 'App version, the same as package.json version').default(DEFAULT_BGHITAPP_OPTIONS.appVersion))
2823
+ .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_BGHITAPP_OPTIONS.alwaysOnTop))
2824
+ .addOption(new Option('--maximize', 'Start window maximized').default(DEFAULT_BGHITAPP_OPTIONS.maximize))
2825
+ .addOption(new Option('--dark-mode', 'Force Mac app to use dark mode').default(DEFAULT_BGHITAPP_OPTIONS.darkMode))
2826
+ .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_BGHITAPP_OPTIONS.disabledWebShortcuts))
2827
+ .addOption(new Option('--activation-shortcut <string>', 'Shortcut key to active App').default(DEFAULT_BGHITAPP_OPTIONS.activationShortcut))
2828
+ .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_BGHITAPP_OPTIONS.showSystemTray))
2829
+ .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_BGHITAPP_OPTIONS.systemTrayIcon))
2842
2830
  .addOption(new Option('--hide-on-close [boolean]', 'Hide window on close instead of exiting (default: true for macOS, false for others)')
2843
2831
  .default(DEFAULT_BGHITAPP_OPTIONS.hideOnClose)
2844
2832
  .argParser((value) => {
@@ -2849,42 +2837,19 @@ function getCliProgram() {
2849
2837
  if (value === 'false')
2850
2838
  return false;
2851
2839
  throw new Error('--hide-on-close must be true or false');
2852
- })
2853
- .hideHelp())
2854
- .addOption(new Option('--title <string>', 'Window title').hideHelp())
2855
- .addOption(new Option('--incognito', 'Launch app in incognito/private mode')
2856
- .default(DEFAULT_BGHITAPP_OPTIONS.incognito)
2857
- .hideHelp())
2858
- .addOption(new Option('--wasm', 'Enable WebAssembly support (Flutter Web, etc.)')
2859
- .default(DEFAULT_BGHITAPP_OPTIONS.wasm)
2860
- .hideHelp())
2861
- .addOption(new Option('--enable-drag-drop', 'Enable drag and drop functionality')
2862
- .default(DEFAULT_BGHITAPP_OPTIONS.enableDragDrop)
2863
- .hideHelp())
2864
- .addOption(new Option('--keep-binary', 'Keep raw binary file alongside installer')
2865
- .default(DEFAULT_BGHITAPP_OPTIONS.keepBinary)
2866
- .hideHelp())
2867
- .addOption(new Option('--multi-instance', 'Allow multiple app instances')
2868
- .default(DEFAULT_BGHITAPP_OPTIONS.multiInstance)
2869
- .hideHelp())
2870
- .addOption(new Option('--multi-window', 'Allow opening multiple windows within one app instance')
2871
- .default(DEFAULT_BGHITAPP_OPTIONS.multiWindow)
2872
- .hideHelp())
2873
- .addOption(new Option('--start-to-tray', 'Start app minimized to tray')
2874
- .default(DEFAULT_BGHITAPP_OPTIONS.startToTray)
2875
- .hideHelp())
2876
- .addOption(new Option('--force-internal-navigation', 'Keep every link inside the BghitApp window instead of opening external handlers')
2877
- .default(DEFAULT_BGHITAPP_OPTIONS.forceInternalNavigation)
2878
- .hideHelp())
2879
- .addOption(new Option('--internal-url-regex <string>', 'Regex pattern to match URLs that should be considered internal')
2880
- .default(DEFAULT_BGHITAPP_OPTIONS.internalUrlRegex)
2881
- .hideHelp())
2882
- .addOption(new Option('--enable-find', 'Enable in-page Find UI with Cmd/Ctrl+F/G shortcuts')
2883
- .default(DEFAULT_BGHITAPP_OPTIONS.enableFind)
2884
- .hideHelp())
2885
- .addOption(new Option('--installer-language <string>', 'Installer language')
2886
- .default(DEFAULT_BGHITAPP_OPTIONS.installerLanguage)
2887
- .hideHelp())
2840
+ }))
2841
+ .addOption(new Option('--title <string>', 'Window title'))
2842
+ .addOption(new Option('--incognito', 'Launch app in incognito/private mode').default(DEFAULT_BGHITAPP_OPTIONS.incognito))
2843
+ .addOption(new Option('--wasm', 'Enable WebAssembly support (Flutter Web, etc.)').default(DEFAULT_BGHITAPP_OPTIONS.wasm))
2844
+ .addOption(new Option('--enable-drag-drop', 'Enable drag and drop functionality').default(DEFAULT_BGHITAPP_OPTIONS.enableDragDrop))
2845
+ .addOption(new Option('--keep-binary', 'Keep raw binary file alongside installer').default(DEFAULT_BGHITAPP_OPTIONS.keepBinary))
2846
+ .addOption(new Option('--multi-instance', 'Allow multiple app instances').default(DEFAULT_BGHITAPP_OPTIONS.multiInstance))
2847
+ .addOption(new Option('--multi-window', 'Allow opening multiple windows within one app instance').default(DEFAULT_BGHITAPP_OPTIONS.multiWindow))
2848
+ .addOption(new Option('--start-to-tray', 'Start app minimized to tray').default(DEFAULT_BGHITAPP_OPTIONS.startToTray))
2849
+ .addOption(new Option('--force-internal-navigation', 'Keep every link inside the BghitApp window instead of opening external handlers').default(DEFAULT_BGHITAPP_OPTIONS.forceInternalNavigation))
2850
+ .addOption(new Option('--internal-url-regex <string>', 'Regex pattern to match URLs that should be considered internal').default(DEFAULT_BGHITAPP_OPTIONS.internalUrlRegex))
2851
+ .addOption(new Option('--enable-find', 'Enable in-page Find UI with Cmd/Ctrl+F/G shortcuts').default(DEFAULT_BGHITAPP_OPTIONS.enableFind))
2852
+ .addOption(new Option('--installer-language <string>', 'Installer language').default(DEFAULT_BGHITAPP_OPTIONS.installerLanguage))
2888
2853
  .addOption(new Option('--zoom <number>', 'Initial page zoom level (50-200)')
2889
2854
  .default(DEFAULT_BGHITAPP_OPTIONS.zoom)
2890
2855
  .argParser((value) => {
@@ -2893,44 +2858,49 @@ function getCliProgram() {
2893
2858
  throw new Error('--zoom must be a number between 50 and 200');
2894
2859
  }
2895
2860
  return zoom;
2896
- })
2897
- .hideHelp())
2861
+ }))
2898
2862
  .addOption(new Option('--min-width <number>', 'Minimum window width')
2899
2863
  .default(DEFAULT_BGHITAPP_OPTIONS.minWidth)
2900
- .argParser(validateNumberInput)
2901
- .hideHelp())
2864
+ .argParser(validateNumberInput))
2902
2865
  .addOption(new Option('--min-height <number>', 'Minimum window height')
2903
2866
  .default(DEFAULT_BGHITAPP_OPTIONS.minHeight)
2904
- .argParser(validateNumberInput)
2905
- .hideHelp())
2906
- .addOption(new Option('--ignore-certificate-errors', 'Ignore certificate errors (for self-signed certificates)')
2907
- .default(DEFAULT_BGHITAPP_OPTIONS.ignoreCertificateErrors)
2908
- .hideHelp())
2909
- .addOption(new Option('--iterative-build', 'Turn on rapid build mode (app only, no dmg/deb/msi), good for debugging')
2910
- .default(DEFAULT_BGHITAPP_OPTIONS.iterativeBuild)
2911
- .hideHelp())
2912
- .addOption(new Option('--new-window', 'Allow sites to open new windows (for auth flows, tabs, branches)')
2913
- .default(DEFAULT_BGHITAPP_OPTIONS.newWindow)
2914
- .hideHelp())
2915
- .addOption(new Option('--install', 'Auto-install app to /Applications (macOS) after build and remove local bundle')
2916
- .default(DEFAULT_BGHITAPP_OPTIONS.install)
2917
- .hideHelp())
2918
- .addOption(new Option('--camera', 'Request camera permission on macOS')
2919
- .default(DEFAULT_BGHITAPP_OPTIONS.camera)
2920
- .hideHelp())
2921
- .addOption(new Option('--microphone', 'Request microphone permission on macOS')
2922
- .default(DEFAULT_BGHITAPP_OPTIONS.microphone)
2923
- .hideHelp())
2924
- .addOption(new Option('--splash <path_or_url>', 'Splash screen image (local path or URL)')
2925
- .default(DEFAULT_BGHITAPP_OPTIONS.splash))
2926
- .addOption(new Option('--auto-splash', 'Auto-fetch og:image from target URL for splash')
2927
- .default(DEFAULT_BGHITAPP_OPTIONS.autoSplash))
2928
- .addOption(new Option('--offline', 'Enable offline fallback page')
2929
- .default(DEFAULT_BGHITAPP_OPTIONS.offline))
2867
+ .argParser(validateNumberInput))
2868
+ .addOption(new Option('--ignore-certificate-errors', 'Ignore certificate errors (for self-signed certificates)').default(DEFAULT_BGHITAPP_OPTIONS.ignoreCertificateErrors))
2869
+ .addOption(new Option('--iterative-build', 'Turn on rapid build mode (app only, no dmg/deb/msi), good for debugging').default(DEFAULT_BGHITAPP_OPTIONS.iterativeBuild))
2870
+ .addOption(new Option('--new-window', 'Allow sites to open new windows (for auth flows, tabs, branches)').default(DEFAULT_BGHITAPP_OPTIONS.newWindow))
2871
+ .addOption(new Option('--install', 'Auto-install app to /Applications (macOS) after build and remove local bundle').default(DEFAULT_BGHITAPP_OPTIONS.install))
2872
+ .addOption(new Option('--camera', 'Request camera permission on macOS').default(DEFAULT_BGHITAPP_OPTIONS.camera))
2873
+ .addOption(new Option('--microphone', 'Request microphone permission on macOS').default(DEFAULT_BGHITAPP_OPTIONS.microphone))
2874
+ .addOption(new Option('--splash <path_or_url>', 'Splash screen image (local path or URL)').default(DEFAULT_BGHITAPP_OPTIONS.splash))
2875
+ .addOption(new Option('--auto-splash', 'Auto-fetch og:image from target URL for splash').default(DEFAULT_BGHITAPP_OPTIONS.autoSplash))
2876
+ .addOption(new Option('--offline', 'Enable offline fallback page').default(DEFAULT_BGHITAPP_OPTIONS.offline))
2930
2877
  .version(packageJson.version, '-v, --version');
2931
2878
  }
2932
2879
 
2933
2880
  const program = getCliProgram();
2881
+ const { green, yellow, gray } = chalk;
2882
+ function printShortHelp() {
2883
+ console.log(logo);
2884
+ console.log(`Usage: bghitapp [url] [options]\n`);
2885
+ console.log(`Options:`);
2886
+ console.log(` --name <string> Application name`);
2887
+ console.log(` --icon <string> Application icon`);
2888
+ console.log(` --width <number> Window width (default: 1200)`);
2889
+ console.log(` --height <number> Window height (default: 780)`);
2890
+ console.log(` --use-local-file Use local file packaging`);
2891
+ console.log(` --fullscreen Start in full screen`);
2892
+ console.log(` --hide-title-bar For Mac, hide title bar`);
2893
+ console.log(` --multi-arch For Mac, both Intel and M1`);
2894
+ console.log(` --inject <files> Inject local CSS/JS files into the page`);
2895
+ console.log(` --debug Debug build and more output`);
2896
+ console.log(` --targets <string> Build target format for your system`);
2897
+ console.log(` --splash <path_or_url> Splash screen image (local path or URL)`);
2898
+ console.log(` --auto-splash Auto-fetch og:image from target URL for splash`);
2899
+ console.log(` --offline Enable offline fallback page`);
2900
+ console.log(` -v, --version output the version number`);
2901
+ console.log(` -h, --help display help for command`);
2902
+ console.log(`\nRun ${yellow('"bghitapp --help"')} to see all available options.\n`);
2903
+ }
2934
2904
  async function checkUpdateTips() {
2935
2905
  updateNotifier({ pkg: packageJson, updateCheckInterval: 1000 * 60 }).notify({
2936
2906
  isGlobal: true,
@@ -2940,9 +2910,7 @@ program.action(async (url, options) => {
2940
2910
  try {
2941
2911
  await checkUpdateTips();
2942
2912
  if (!url) {
2943
- program.help({
2944
- error: false,
2945
- });
2913
+ printShortHelp();
2946
2914
  return;
2947
2915
  }
2948
2916
  console.log(logo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bghitcode/bghitapp",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "🤱🏻 Turn any webpage into a desktop app with one command — by BghitCode.",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -82,7 +82,9 @@ pub struct NotificationParams {
82
82
 
83
83
  #[command]
84
84
  pub async fn download_file(app: AppHandle, params: DownloadFileParams) -> Result<(), String> {
85
- let window: WebviewWindow = app.get_webview_window("bghitapp").ok_or("Window not found")?;
85
+ let window: WebviewWindow = app
86
+ .get_webview_window("bghitapp")
87
+ .ok_or("Window not found")?;
86
88
 
87
89
  show_toast(
88
90
  &window,
@@ -98,7 +98,7 @@ pub fn set_system_tray(
98
98
  if let Some(icon) = resolved_icon {
99
99
  tray_builder = tray_builder.icon(icon);
100
100
  } else {
101
- eprintln!("[BghitApp] No tray icon available; tray will build without an icon.");
101
+ eprintln!("[BghitApp] No tray icon available; tray will build without an icon.");
102
102
  }
103
103
 
104
104
  let tray = tray_builder.build(app)?;
@@ -120,7 +120,7 @@ pub fn set_global_shortcut(
120
120
  let shortcut_hotkey = match Shortcut::from_str(&shortcut) {
121
121
  Ok(s) => s,
122
122
  Err(error) => {
123
- eprintln!("[BghitApp] Invalid activation shortcut '{shortcut}': {error}");
123
+ eprintln!("[BghitApp] Invalid activation shortcut '{shortcut}': {error}");
124
124
  return Ok(());
125
125
  }
126
126
  };
@@ -61,10 +61,7 @@ pub fn set_window(
61
61
  build_window_with_label(app, config, tauri_config, "bghitapp")
62
62
  }
63
63
 
64
- pub fn build_splash_window(
65
- app: &AppHandle,
66
- _splash_asset: &str,
67
- ) -> tauri::Result<WebviewWindow> {
64
+ pub fn build_splash_window(app: &AppHandle, _splash_asset: &str) -> tauri::Result<WebviewWindow> {
68
65
  let url = WebviewUrl::App(PathBuf::from("splash.html"));
69
66
  let splash_width = 800.0;
70
67
  let splash_height = 500.0;
@@ -81,7 +78,10 @@ pub fn build_splash_window(
81
78
  (x, y)
82
79
  } else {
83
80
  // Fallback: rough center assuming 1920x1080
84
- ((1920.0 - splash_width) / 2.0, (1080.0 - splash_height) / 2.0)
81
+ (
82
+ (1920.0 - splash_width) / 2.0,
83
+ (1080.0 - splash_height) / 2.0,
84
+ )
85
85
  };
86
86
 
87
87
  let window_builder = WebviewWindowBuilder::new(app, "splash", url)
@@ -342,8 +342,7 @@ fn build_window(
342
342
 
343
343
  // Conditionally inject offline detection script
344
344
  if window_config.offline {
345
- window_builder =
346
- window_builder.initialization_script(include_str!("../inject/offline.js"));
345
+ window_builder = window_builder.initialization_script(include_str!("../inject/offline.js"));
347
346
  }
348
347
 
349
348
  // Inject splash transition script if splash is configured
@@ -277,7 +277,8 @@ document.addEventListener("DOMContentLoaded", () => {
277
277
  const appWindow = tauri.window.getCurrentWindow();
278
278
  const invoke = tauri.core.invoke;
279
279
  const bghitappConfig = window["bghitappConfig"] || {};
280
- const forceInternalNavigation = bghitappConfig.force_internal_navigation === true;
280
+ const forceInternalNavigation =
281
+ bghitappConfig.force_internal_navigation === true;
281
282
  const internalUrlRegex = bghitappConfig.internal_url_regex || "";
282
283
  let internalUrlPattern = null;
283
284
  if (internalUrlRegex) {
@@ -434,7 +435,10 @@ document.addEventListener("DOMContentLoaded", () => {
434
435
 
435
436
  // Keep OAuth/authentication flows inside the app when popup support is enabled.
436
437
  if (window.isAuthLink(absoluteUrl)) {
437
- console.log("[BghitApp] Handling OAuth navigation in-app:", absoluteUrl);
438
+ console.log(
439
+ "[BghitApp] Handling OAuth navigation in-app:",
440
+ absoluteUrl,
441
+ );
438
442
 
439
443
  if (window.bghitappConfig?.new_window) {
440
444
  e.preventDefault();
@@ -1066,7 +1070,10 @@ function setDefaultZoom() {
1066
1070
  const htmlZoom = window.localStorage.getItem("htmlZoom");
1067
1071
  if (htmlZoom) {
1068
1072
  setZoom(htmlZoom);
1069
- } else if (window.bghitappConfig?.zoom && window.bghitappConfig.zoom !== 100) {
1073
+ } else if (
1074
+ window.bghitappConfig?.zoom &&
1075
+ window.bghitappConfig.zoom !== 100
1076
+ ) {
1070
1077
  setZoom(`${window.bghitappConfig.zoom}%`);
1071
1078
  }
1072
1079
  }
@@ -1,68 +1,73 @@
1
- (function() {
2
- var TARGET_URL = window.bghitappConfig?.url || window.location.href;
1
+ (function () {
2
+ var TARGET_URL = window.bghitappConfig?.url || window.location.href;
3
3
 
4
- var OFFLINE_HTML = '<!DOCTYPE html>'
5
- + '<html><head><meta charset="utf-8"><style>'
6
- + '*{margin:0;padding:0;box-sizing:border-box}'
7
- + 'body{display:flex;justify-content:center;align-items:center;height:100vh;background:#1a1a1a;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,system-ui,sans-serif}'
8
- + '.card{text-align:center;max-width:400px;padding:40px}'
9
- + '.icon{width:64px;height:64px;stroke:#636366;margin-bottom:24px}'
10
- + '.heading{font-size:24px;font-weight:700;color:#fff;margin-bottom:8px}'
11
- + '.subtext{font-size:16px;color:#AEAEB2;margin-bottom:32px}'
12
- + '.retry-btn{display:inline-flex;align-items:center;justify-content:center;min-width:120px;height:44px;padding:0 16px;background:#0A84FF;color:#fff;border:none;border-radius:8px;font-size:16px;font-weight:600;cursor:pointer;transition:background .15s}'
13
- + '.retry-btn:hover{background:#409CFF}'
14
- + '.retry-btn:disabled{background:#636366;cursor:not-allowed}'
15
- + '.spinner{display:none;width:20px;height:20px;border:2px solid #FFF;border-top-color:transparent;border-radius:50%;animation:spin .6s linear infinite}'
16
- + '.retry-btn.loading .btn-text{display:none}'
17
- + '.retry-btn.loading .spinner{display:inline-block}'
18
- + '@keyframes spin{to{transform:rotate(360deg)}}'
19
- + '</style></head><body>'
20
- + '<div class="card">'
21
- + '<svg class="icon" viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">'
22
- + '<path d="M1 1l22 22"/><path d="M16.72 11.06A10.94 10.94 0 0 1 19 12.55"/>'
23
- + '<path d="M5 12.55a10.94 10.94 0 0 1 5.17-2.39"/>'
24
- + '<path d="M10.71 5.05A16 16 0 0 1 22.56 9"/>'
25
- + '<path d="M1.42 9a15.91 15.91 0 0 1 4.7-2.88"/>'
26
- + '<path d="M8.53 16.11a6 6 0 0 1 6.95 0"/>'
27
- + '<line x1="12" y1="20" x2="12.01" y2="20"/>'
28
- + '</svg>'
29
- + '<h1 class="heading">No Internet Connection</h1>'
30
- + '<p class="subtext">Check your network and try again</p>'
31
- + '<button class="retry-btn" onclick="retry()">'
32
- + '<span class="btn-text">Retry</span><span class="spinner"></span></button>'
33
- + '</div>'
34
- + '<script>var cooldown=false;function retry(){if(cooldown)return;cooldown=true;var b=document.querySelector(".retry-btn");b.classList.add("loading");b.disabled=true;setTimeout(function(){var o=localStorage.getItem("bghitapp_original_url");if(o)window.location.href=o;else window.location.reload()},3000)}</'
35
- + 'script></body></html>';
4
+ var OFFLINE_HTML =
5
+ "<!DOCTYPE html>" +
6
+ '<html><head><meta charset="utf-8"><style>' +
7
+ "*{margin:0;padding:0;box-sizing:border-box}" +
8
+ "body{display:flex;justify-content:center;align-items:center;height:100vh;background:#1a1a1a;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,system-ui,sans-serif}" +
9
+ ".card{text-align:center;max-width:400px;padding:40px}" +
10
+ ".icon{width:64px;height:64px;stroke:#636366;margin-bottom:24px}" +
11
+ ".heading{font-size:24px;font-weight:700;color:#fff;margin-bottom:8px}" +
12
+ ".subtext{font-size:16px;color:#AEAEB2;margin-bottom:32px}" +
13
+ ".retry-btn{display:inline-flex;align-items:center;justify-content:center;min-width:120px;height:44px;padding:0 16px;background:#0A84FF;color:#fff;border:none;border-radius:8px;font-size:16px;font-weight:600;cursor:pointer;transition:background .15s}" +
14
+ ".retry-btn:hover{background:#409CFF}" +
15
+ ".retry-btn:disabled{background:#636366;cursor:not-allowed}" +
16
+ ".spinner{display:none;width:20px;height:20px;border:2px solid #FFF;border-top-color:transparent;border-radius:50%;animation:spin .6s linear infinite}" +
17
+ ".retry-btn.loading .btn-text{display:none}" +
18
+ ".retry-btn.loading .spinner{display:inline-block}" +
19
+ "@keyframes spin{to{transform:rotate(360deg)}}" +
20
+ "</style></head><body>" +
21
+ '<div class="card">' +
22
+ '<svg class="icon" viewBox="0 0 24 24" fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">' +
23
+ '<path d="M1 1l22 22"/><path d="M16.72 11.06A10.94 10.94 0 0 1 19 12.55"/>' +
24
+ '<path d="M5 12.55a10.94 10.94 0 0 1 5.17-2.39"/>' +
25
+ '<path d="M10.71 5.05A16 16 0 0 1 22.56 9"/>' +
26
+ '<path d="M1.42 9a15.91 15.91 0 0 1 4.7-2.88"/>' +
27
+ '<path d="M8.53 16.11a6 6 0 0 1 6.95 0"/>' +
28
+ '<line x1="12" y1="20" x2="12.01" y2="20"/>' +
29
+ "</svg>" +
30
+ '<h1 class="heading">No Internet Connection</h1>' +
31
+ '<p class="subtext">Check your network and try again</p>' +
32
+ '<button class="retry-btn" onclick="retry()">' +
33
+ '<span class="btn-text">Retry</span><span class="spinner"></span></button>' +
34
+ "</div>" +
35
+ '<script>var cooldown=false;function retry(){if(cooldown)return;cooldown=true;var b=document.querySelector(".retry-btn");b.classList.add("loading");b.disabled=true;setTimeout(function(){var o=localStorage.getItem("bghitapp_original_url");if(o)window.location.href=o;else window.location.reload()},3000)}</' +
36
+ "script></body></html>";
36
37
 
37
- function isOffline() {
38
- return !navigator.onLine;
39
- }
38
+ function isOffline() {
39
+ return !navigator.onLine;
40
+ }
40
41
 
41
- function goToOffline() {
42
- var href = window.location.href;
43
- if (!href.includes('offline.html') && !href.includes('data:text/html')) {
44
- localStorage.setItem('bghitapp_original_url', TARGET_URL);
45
- document.open();
46
- document.write(OFFLINE_HTML);
47
- document.close();
48
- }
42
+ function goToOffline() {
43
+ var href = window.location.href;
44
+ if (!href.includes("offline.html") && !href.includes("data:text/html")) {
45
+ localStorage.setItem("bghitapp_original_url", TARGET_URL);
46
+ document.open();
47
+ document.write(OFFLINE_HTML);
48
+ document.close();
49
49
  }
50
+ }
50
51
 
51
- function goOnline() {
52
- if (window.location.href.includes('data:text/html') || document.querySelector('.retry-btn')) {
53
- var original = localStorage.getItem('bghitapp_original_url') || TARGET_URL;
54
- window.location.replace(original);
55
- }
52
+ function goOnline() {
53
+ if (
54
+ window.location.href.includes("data:text/html") ||
55
+ document.querySelector(".retry-btn")
56
+ ) {
57
+ var original =
58
+ localStorage.getItem("bghitapp_original_url") || TARGET_URL;
59
+ window.location.replace(original);
56
60
  }
61
+ }
57
62
 
58
- if (isOffline()) {
59
- if (document.readyState === 'loading') {
60
- document.addEventListener('DOMContentLoaded', goToOffline);
61
- } else {
62
- goToOffline();
63
- }
63
+ if (isOffline()) {
64
+ if (document.readyState === "loading") {
65
+ document.addEventListener("DOMContentLoaded", goToOffline);
66
+ } else {
67
+ goToOffline();
64
68
  }
69
+ }
65
70
 
66
- window.addEventListener('offline', goToOffline);
67
- window.addEventListener('online', goOnline);
71
+ window.addEventListener("offline", goToOffline);
72
+ window.addEventListener("online", goOnline);
68
73
  })();
@@ -1,13 +1,13 @@
1
- (function() {
2
- function onReady() {
3
- if (window.__TAURI__ && window.bghitappConfig?.splash) {
4
- window.__TAURI__.core.invoke('close_splashscreen');
5
- }
1
+ (function () {
2
+ function onReady() {
3
+ if (window.__TAURI__ && window.bghitappConfig?.splash) {
4
+ window.__TAURI__.core.invoke("close_splashscreen");
6
5
  }
6
+ }
7
7
 
8
- if (document.readyState === 'complete') {
9
- onReady();
10
- } else {
11
- window.addEventListener('load', onReady);
12
- }
8
+ if (document.readyState === "complete") {
9
+ onReady();
10
+ } else {
11
+ window.addEventListener("load", onReady);
12
+ }
13
13
  })();
@@ -5,12 +5,13 @@ use tauri::{AppHandle, Config, Manager, WebviewWindow};
5
5
 
6
6
  pub fn get_bghitapp_config() -> (BghitappConfig, Config) {
7
7
  #[cfg(feature = "cli-build")]
8
- let bghitapp_config: BghitappConfig = serde_json::from_str(include_str!("../.bghitapp/bghitapp.json"))
9
- .expect("Failed to parse bghitapp config");
8
+ let bghitapp_config: BghitappConfig =
9
+ serde_json::from_str(include_str!("../.bghitapp/bghitapp.json"))
10
+ .expect("Failed to parse bghitapp config");
10
11
 
11
12
  #[cfg(not(feature = "cli-build"))]
12
- let bghitapp_config: BghitappConfig =
13
- serde_json::from_str(include_str!("../bghitapp.json")).expect("Failed to parse bghitapp config");
13
+ let bghitapp_config: BghitappConfig = serde_json::from_str(include_str!("../bghitapp.json"))
14
+ .expect("Failed to parse bghitapp config");
14
15
 
15
16
  #[cfg(feature = "cli-build")]
16
17
  let tauri_config: Config = serde_json::from_str(include_str!("../.bghitapp/tauri.conf.json"))