Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: gate macos proxy support by system version

Tw93af1650326a31
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index a98c4932..6ab9b18f 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -25,7 +25,6 @@ tauri = { version = "2.10.2", features = [
"tray-icon",
"image-ico",
"image-png",
- "macos-proxy",
] }
tauri-plugin-window-state = "2.4.1"
tauri-plugin-oauth = "2.0.0"
@@ -53,6 +52,9 @@ windows-sys = { version = "0.61.2", features = [
[features]
# this feature is used for development builds from development cli
cli-build = []
+# Tauri's macOS proxy APIs require macOS 14 or later. The CLI enables this
+# feature only after checking the host Darwin version.
+macos-proxy = ["tauri/macos-proxy"]
# by default Tauri runs in production mode
# when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL
default = ["custom-protocol"]
diff --git a/tests/unit/macos-proxy-feature.test.ts b/tests/unit/macos-proxy-feature.test.ts
new file mode 100644
index 00000000..febb00de
--- /dev/null
+++ b/tests/unit/macos-proxy-feature.test.ts
@@ -0,0 +1,32 @@
+import { execFileSync } from 'node:child_process';
+import path from 'node:path';
+import { describe, expect, it } from 'vitest';
+
+describe('macOS proxy feature', () => {
+ it('keeps the Tauri proxy API behind the package feature gate', () => {
+ const manifestPath = path.join(process.cwd(), 'src-tauri', 'Cargo.toml');
+ const metadata = JSON.parse(
+ execFileSync(
+ 'cargo',
+ [
+ 'metadata',
+ '--manifest-path',
+ manifestPath,
+ '--format-version',
+ '1',
+ '--no-deps',
+ ],
+ { encoding: 'utf8' },
+ ),
+ );
+ const pakePackage = metadata.packages.find(
+ (pkg: { name: string }) => pkg.name === 'pake',
+ );
+ const tauriDependency = pakePackage.dependencies.find(
+ (dependency: { name: string }) => dependency.name === 'tauri',
+ );
+
+ expect(tauriDependency.features).not.toContain('macos-proxy');
+ expect(pakePackage.features['macos-proxy']).toEqual(['tauri/macos-proxy']);
+ });
+});