Skip to content

Commit 36e56e7

Browse files
authored
Merge pull request #20 from lemonade-sdk/update_for_tauri_change
Fix Tauri snap localhost connectivity
2 parents b6b6eac + d8cff61 commit 36e56e7

2 files changed

Lines changed: 37 additions & 15 deletions

File tree

scripts/launcher

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
11
#!/bin/bash
22

3-
if [[ ! -n "$DISABLE_WAYLAND" && -n "$WAYLAND_DISPLAY" ]]; then
4-
WAYLAND_OPTS="--enable-features=UseOzonePlatform --ozone-platform-hint=auto --enable-wayland-ime"
3+
DEBUG_FLAG_FILE="$SNAP_USER_COMMON/.debug-webkit"
4+
5+
if [ "$LEMONADE_SNAP_DEBUG" = "1" ] || [ -f "$DEBUG_FLAG_FILE" ]; then
6+
export WEBKIT_DEBUG="${WEBKIT_DEBUG:-all}"
7+
export G_MESSAGES_DEBUG="${G_MESSAGES_DEBUG:-all}"
8+
export DEBUG_INVOCATION="${DEBUG_INVOCATION:-1}"
9+
export RUST_BACKTRACE="${RUST_BACKTRACE:-1}"
10+
export RUST_LOG="${RUST_LOG:-trace}"
11+
12+
LOG_DIR="$SNAP_USER_COMMON/logs"
13+
LOG_FILE="$LOG_DIR/lemonade-desktop.$(date +%Y%m%d-%H%M%S).log"
14+
mkdir -p "$LOG_DIR"
15+
16+
exec > >(tee -a "$LOG_FILE") 2>&1
17+
echo "lemonade-desktop debug logging enabled" >&2
18+
echo " log file: $LOG_FILE" >&2
19+
echo " WEBKIT_DEBUG=$WEBKIT_DEBUG" >&2
20+
echo " G_MESSAGES_DEBUG=$G_MESSAGES_DEBUG" >&2
21+
echo " RUST_LOG=$RUST_LOG" >&2
522
fi
623

7-
exec $SNAP/dist-app/linux-unpacked/lemonade \
8-
--disable-dev-shm-usage \
9-
$WAYLAND_OPTS \
10-
--no-sandbox "$@"
24+
exec $SNAP/bin/lemonade-app "$@"

snap/snapcraft.yaml

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ description: |
2121
2222
snap services lemonade-server
2323
24-
The desktop client connects to lemonade-server on localhost port 8000.
24+
The desktop client connects to lemonade-server on localhost port 13305.
2525
Ensure the server is running before launching the desktop client.
2626
2727
**Features**
@@ -55,6 +55,7 @@ parts:
5555
- node/22/stable
5656
build-packages:
5757
- git
58+
- curl
5859
override-pull: |
5960
craftctl default
6061
VERSION=$(craftctl get version)
@@ -67,12 +68,16 @@ parts:
6768
# workaround for build.snapcraft.io builds
6869
# https://bugs.launchpad.net/bugs/1886861
6970
if [ -n "$http_proxy" ]; then
70-
export ELECTRON_GET_USE_PROXY=1
7171
export GLOBAL_AGENT_HTTP_PROXY="${http_proxy}"
7272
export GLOBAL_AGENT_HTTPS_PROXY="${http_proxy}"
7373
fi
7474
75-
export PATH="/snap/node/current/bin:$PATH"
75+
# Install Rust via rustup
76+
export RUSTUP_HOME="$CRAFT_PART_BUILD/.rustup"
77+
export CARGO_HOME="$CRAFT_PART_BUILD/.cargo"
78+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --no-modify-path
79+
export PATH="$CARGO_HOME/bin:/snap/node/current/bin:$PATH"
80+
7681
export npm_config_loglevel="error"
7782
export npm_config_progress="false"
7883
export npm_config_fund="false"
@@ -82,16 +87,15 @@ parts:
8287
8388
cd $CRAFT_PART_BUILD/src/app
8489
npm install
85-
npm run build
86-
cp -rp dist-app $CRAFT_PART_INSTALL/
90+
npx tauri build --no-bundle
91+
92+
mkdir -p $CRAFT_PART_INSTALL/bin
93+
cp src-tauri/target/release/lemonade-app $CRAFT_PART_INSTALL/bin/
8794
cp -rp assets $CRAFT_PART_INSTALL/
8895
prime:
8996
- -assets/favicon.ico
9097
- assets
91-
- dist-app
92-
- -*/chrome-sandbox
93-
- -*/resources/app.asar.unpacked/node_modules/sharp/vendor/lib
94-
- -*/resources/app.asar.unpacked/node_modules/sharp/vendor/include
98+
- bin/lemonade-app
9599

96100
scripts:
97101
plugin: dump
@@ -143,11 +147,15 @@ apps:
143147
- audio-record
144148
- home
145149
- network
150+
- network-bind
151+
- network-status
146152
- shmem
147153
- browser-support
148154
- hardware-observe
155+
- system-observe
149156
environment:
150157
GTK_USE_PORTAL: 1
151158
TMPDIR: $XDG_RUNTIME_DIR
152159
HOME: $SNAP_USER_COMMON
153160
AMDGPU_ASIC_ID_TABLE_PATH: $SNAP/gpu-2404/libdrm/amdgpu.ids
161+
WEBKIT_DISABLE_SANDBOX_THIS_IS_DANGEROUS: 1

0 commit comments

Comments
 (0)