api-client/packages/hoppscotch-desktop/plugin-workspace/tauri-plugin-appload
Shreyas 93787f8389
fix(desktop): add win version checks for DWM attr api (#5010)
fix: add win version checks for DWM attr api

This adds version checking before using Windows 11-specific DWM APIs.

Closes HFE-821

The desktop app crashes on startup on older Windows versions (pre-Windows 11)
due to unsupported DWM API calls for dark mode and caption styling.

According to docs at https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute,
both `DWMWA_USE_IMMERSIVE_DARK_MODE` and `DWMWA_CAPTION_COLOR` attributes
are only supported starting with Windows 11 Build 22000.

> DWMWA_USE_IMMERSIVE_DARK_MODE: [...] This value is supported starting
> with Windows 11 Build 22000"

and

> DWMWA_CAPTION_COLOR: [...] This value is supported starting
> with Windows 11 Build 22000.

See https://github.com/hoppscotch/hoppscotch/discussions/4984 for more details,
for reports of app crashing immediately on startup with these errors:

```
Failed to set dark mode: Error { code: HRESULT(0x80070057), message: "The parameter is incorrect." }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[0417/150158.530:ERROR:window_impl.cc(122)] Failed to unregister class Chrome_WidgetWin_0. Error = 1412
```

The tests were all over the place, both attributes (sometimes!) seems to be present
on Windows 10 1809 and even earlier, only if it was installed with network access,
so perhaps this is due to Windows updates? Other times, they weren't, especially on VMs.

The issue is reproducible on Windows Server 2019 Datacenter (v10.0.17763),
which is equivalent to Windows 10 version 1809.

This version is too old to support DWMWA_USE_IMMERSIVE_DARK_MODE,
which is only **officially supported** starting with Windows 11 Build 22000
according to Microsoft's documentation.

So at the moment, relying on official docs seems to be the right call,
and themes are definitely something app shouldn't crash for regardless.
2025-04-25 16:48:43 +05:30
..
dist-js feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
examples/tauri-app feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
guest-js feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
permissions feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
src fix(desktop): add win version checks for DWM attr api (#5010) 2025-04-25 16:48:43 +05:30
.envrc feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
.gitignore feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
build.rs feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
Cargo.lock feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
Cargo.toml feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
devenv.lock feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
devenv.nix feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
devenv.yaml feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
LICENSE.md feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
package.json feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
pnpm-lock.yaml feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
README.md feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
rollup.config.js feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30
tsconfig.json feat: platform independent core and the new desktop app (#4684) 2025-02-28 00:01:25 +05:30

Tauri Plugin: AppLoad

A Tauri plugin for downloading and loading web app bundles into WebView.

GitHub License MIT Tauri 2.0 Rust

Features

  • 🦀 Blazingly fast!
  • Download and load web app bundles from remote servers
  • Secure verification using ed25519 + blake3
  • Caching with hot/cold storage strategy
  • Custom URI scheme for isolated app loading

Installation

Important

This plugin requires Tauri 2.0 or later.

Add the plugin to your project by installing directly from GitHub:

[dependencies]
tauri-plugin-appload = { git = "https://github.com/CuriousCorrelation/tauri-plugin-appload" }
"dependencies": {
  "@CuriousCorrelation/plugin-appload": "github:CuriousCorrelation/tauri-plugin-appload"
}

Quick Start

Rust

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_appload::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

JavaScript/TypeScript

import { download, load } from '@CuriousCorrelation/plugin-appload'

// Download a bundle
const { bundleName } = await download({
  serverUrl: "https://example.com"
})

// Load the bundle in a new window
await load({
  bundleName,
  window: {
    title: "My App",
    width: 800,
    height: 600
  }
})

Configuration

Note

The plugin uses sensible defaults but can be customized via configuration.

Option Description Default
api.serverUrl Bundle server URL http://localhost:3200
cache.maxSize Maximum cache size 100MB
cache.filesTtl File time-to-live 1 hour
storage.maxBundleSize Maximum bundle size 50MB

Permissions

The plugin defines the following permissions:

  • allow-download: Enable bundle downloads
  • allow-load: Enable bundle loading
  • deny-download: Disable bundle downloads
  • deny-load: Disable bundle loading

Development

Requirements:

  • Rust 1.77.2 or later
  • Node.js 18 or later
  • pnpm

License

Code: (c) 2024 - CuriousCorrelation

MIT or MIT/Apache 2.0 where applicable.