mirror of
https://github.com/tauri-apps/tauri.git
synced 2024-12-14 05:06:19 +03:00
fix(bundler): bundle /usr/bin/xdg-open
in appimage if open API enabled (#4265)
This commit is contained in:
parent
b369069c5a
commit
2322ac11cf
6
.changes/cli-shell-open-api-env-var.md
Normal file
6
.changes/cli-shell-open-api-env-var.md
Normal file
@ -0,0 +1,6 @@
|
||||
---
|
||||
"cli.rs": patch
|
||||
"cli.js": patch
|
||||
---
|
||||
|
||||
Configure the AppImage bundler to copy the `/usr/bin/xdg-open` binary if it exists and the shell `open` API is enabled.
|
5
.changes/fix-appimage-shell-api.md
Normal file
5
.changes/fix-appimage-shell-api.md
Normal file
@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-bundler": patch
|
||||
---
|
||||
|
||||
Copy the `/usr/bin/xdg-open` binary if it exists and the `APPIMAGE_BUNDLE_XDG_OPEN` environment variable is set.
|
8
examples/api/dist/assets/vendor.js
vendored
8
examples/api/dist/assets/vendor.js
vendored
File diff suppressed because one or more lines are too long
@ -92,6 +92,7 @@
|
||||
}
|
||||
},
|
||||
"shell": {
|
||||
"open": true,
|
||||
"scope": [
|
||||
{
|
||||
"name": "sh",
|
||||
|
@ -6,12 +6,18 @@
|
||||
set -euxo pipefail
|
||||
|
||||
export ARCH={{arch}}
|
||||
APPIMAGE_BUNDLE_XDG_OPEN=${APPIMAGE_BUNDLE_XDG_OPEN-0}
|
||||
|
||||
mkdir -p "{{app_name}}.AppDir"
|
||||
cp -r ../appimage_deb/data/usr "{{app_name}}.AppDir"
|
||||
|
||||
cd "{{app_name}}.AppDir"
|
||||
|
||||
if [[ "$APPIMAGE_BUNDLE_XDG_OPEN" != "0" ]] && [[ -f "/usr/bin/xdg-open" ]]; then
|
||||
echo "Copying /usr/bin/xdg-open"
|
||||
cp /usr/bin/xdg-open usr/bin
|
||||
fi
|
||||
|
||||
# Copy WebKit files.
|
||||
find /usr/lib* -name WebKitNetworkProcess -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true
|
||||
find /usr/lib* -name WebKitWebProcess -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true
|
||||
|
@ -5,7 +5,7 @@
|
||||
use crate::helpers::{
|
||||
app_paths::{app_dir, tauri_dir},
|
||||
command_env,
|
||||
config::{get as get_config, AppUrl, WindowUrl},
|
||||
config::{get as get_config, AppUrl, ShellAllowlistOpen, WindowUrl},
|
||||
manifest::rewrite_manifest,
|
||||
updater_signature::sign_file_from_env_variables,
|
||||
};
|
||||
@ -302,6 +302,14 @@ pub fn command(options: Options) -> Result<()> {
|
||||
)
|
||||
.with_context(|| "failed to build bundler settings")?;
|
||||
|
||||
// set env vars used by the bundler
|
||||
if matches!(
|
||||
config_.tauri.allowlist.shell.open,
|
||||
ShellAllowlistOpen::Flag(true) | ShellAllowlistOpen::Validate(_)
|
||||
) {
|
||||
std::env::set_var("APPIMAGE_BUNDLE_XDG_OPEN", "1");
|
||||
}
|
||||
|
||||
let bundles = bundle_project(settings).with_context(|| "failed to bundle project")?;
|
||||
|
||||
// If updater is active
|
||||
|
Loading…
Reference in New Issue
Block a user