PasteFerry (隔空贴): clipboard and file sync across macOS, Windows and Linux. Direct-first, end-to-end encrypted. Optional official access: no server to host. Independent self-hosting remains available.
Dart airdrop-alternativeclipboardclipboard-sharingclipboard-synccopy-pastecross-platformend-to-end-encryptionfile-syncfile-transferfluttergolanglinuxmacosnat-traversalp2pself-hostedtailscaleuniversal-clipboardwebrtcwindows
build: bundle the quick paste helper and its dependencies
baiyuzed422505802cc
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex f19a9c4..8555195 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -132,7 +132,7 @@ jobs:- name: 安装构建依赖run: |sudo apt-get update -q- sudo apt-get install -y -q clang cmake ninja-build pkg-config libgtk-3-dev xvfb xclip dbus-x11+ sudo apt-get install -y -q clang cmake ninja-build pkg-config libgtk-3-dev libx11-dev libxtst-dev xvfb xclip dbus-x11# flutter-action 不提供 Linux ARM64 的 Flutter,两种架构都直接取 stable 分支- name: 安装 Flutterrun: |diff --git a/scripts/build.sh b/scripts/build.shindex 51c603f..d1344f6 100755--- a/scripts/build.sh+++ b/scripts/build.sh@@ -109,11 +109,57 @@ mkdir -p "$UI/Contents/Helpers"cp -R "$APP" "$UI/Contents/Helpers/"cp "$DIST/pasteferry-cli" "$UI/Contents/Helpers/pasteferry-cli"+# 快捷粘贴窗口:单独的辅助程序,由界面登记成第二个 LaunchAgent(见 ui/lib/quick_paste_service.dart)。+# 只有一个很小的 Swift 可执行文件,Flutter 引擎与 Dart 代码用主 App 的 Contents/Frameworks/+# (rpath 指过去),所以不进 Xcode 工程,在这里用 swiftc 编译。见 ui/macos/Picker/main.swift+echo "▶ 构建快捷粘贴窗口"+PICKER="$UI/Contents/Helpers/PasteFerryPicker.app"+FLUTTER_ROOT=$(dirname "$(dirname "$(readlink -f "$(command -v flutter)")")")+FLUTTER_FW="$FLUTTER_ROOT/bin/cache/artifacts/engine/darwin-x64-release/FlutterMacOS.xcframework/macos-arm64_x86_64"+mkdir -p "$PICKER/Contents/MacOS" "$PICKER/Contents/Resources"+PICKER_TMP=$(mktemp -d)+for arch in x86_64 arm64; do+ swiftc -O -target "$arch-apple-macos$MACOS_MIN" -F "$FLUTTER_FW" -framework FlutterMacOS \+ -Xlinker -rpath -Xlinker @executable_path/../../../../Frameworks \+ ui/macos/Picker/main.swift -o "$PICKER_TMP/$arch"+done+lipo -create -output "$PICKER/Contents/MacOS/PasteFerryPicker" "$PICKER_TMP/x86_64" "$PICKER_TMP/arm64"+rm -rf "$PICKER_TMP"+cat > "$PICKER/Contents/Info.plist" <<PLIST+<?xml version="1.0" encoding="UTF-8"?>+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">+<plist version="1.0">+<dict>+ <key>CFBundleExecutable</key> <string>PasteFerryPicker</string>+ <key>CFBundleIdentifier</key> <string>com.pasteferry.picker</string>+ <key>CFBundleName</key> <string>PasteFerry</string>+ <key>CFBundleDisplayName</key> <string>PasteFerry</string>+ <key>CFBundleDevelopmentRegion</key> <string>en</string>+ <key>CFBundleIconFile</key> <string>AppIcon</string>+ <key>CFBundlePackageType</key> <string>APPL</string>+ <key>CFBundleShortVersionString</key> <string>$VERSION</string>+ <key>CFBundleVersion</key> <string>$VERSION</string>+ <key>LSMinimumSystemVersion</key> <string>$MACOS_MIN</string>+ <key>LSUIElement</key> <true/>+ <key>NSHighResolutionCapable</key> <true/>+</dict>+</plist>+PLIST+cp assets/brand/AppIcon.icns "$PICKER/Contents/Resources/AppIcon.icns"+# 「辅助功能」授权列表里显示的名字,按系统语言:中文系统上叫隔空贴+for loc in zh-Hans zh-Hant zh-HK; do+ mkdir -p "$PICKER/Contents/Resources/$loc.lproj"+ name=$([[ $loc == zh-Hans ]] && echo 隔空贴 || echo 隔空貼)+ printf '"CFBundleDisplayName" = "%s";\n"CFBundleName" = "%s";\n' "$name" "$name" \+ > "$PICKER/Contents/Resources/$loc.lproj/InfoPlist.strings"+done+# 签名由内向外:先签内置的组件,最后签外层 App。# Flutter 增量构建在 Dart 代码变化后会重新生成 App.framework 却不重签,# 留下失效签名,Apple Silicon 上会直接拒绝运行,这里一并重签。codesign --force --sign - "$UI/Contents/Helpers/pasteferry-cli"codesign --force --sign - "$UI/Contents/Helpers/PasteFerryDaemon.app"+codesign --force --sign - "$UI/Contents/Helpers/PasteFerryPicker.app"codesign --force --sign - "$UI/Contents/Frameworks/App.framework"codesign --force --sign - --preserve-metadata=entitlements,requirements,flags "$UI"codesign --verify --deep --strict "$UI" "$APP"diff --git a/scripts/package-linux.sh b/scripts/package-linux.shindex 4c36298..d542bbe 100755--- a/scripts/package-linux.sh+++ b/scripts/package-linux.sh@@ -11,7 +11,7 @@# 所以 CI 在两种架构的机器上各跑一次。## 需要 Go、Flutter,以及 Flutter 的 Linux 构建依赖:-# sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev+# sudo apt install clang cmake ninja-build pkg-config libgtk-3-dev libx11-dev libxtst-dev# 文件名不带版本号,网站上的 releases/latest/download/<文件名> 链接才不会随发版失效。set -euo pipefailcd "$(dirname "$0")/.."@@ -65,14 +65,15 @@ doneln -s /opt/PasteFerry/pasteferry "$DEB/usr/bin/pasteferry"ln -s /opt/PasteFerry/pasteferry-cli "$DEB/usr/bin/pasteferry-cli"-# libgtk-3-0:Ubuntu 24.04 起改名为 libgtk-3-0t64,新包也提供旧名字,写旧名字两边都能装+# libgtk-3-0:Ubuntu 24.04 起改名为 libgtk-3-0t64,新包也提供旧名字,写旧名字两边都能装。+# libxtst6:快捷粘贴窗口在 X11 上模拟粘贴键cat > "$DEB/DEBIAN/control" <<EOFPackage: pasteferryVersion: $VERSIONArchitecture: $ARCHMaintainer: baiyuze <[email protected]>Installed-Size: $(du -sk "$DEB" | cut -f1)-Depends: libgtk-3-0 (>= 3.22)+Depends: libgtk-3-0 (>= 3.22), libxtst6Recommends: fonts-noto-cjkConflicts: copysyncReplaces: copysync@@ -87,12 +88,14 @@ EOF# 2.0.0 之前的包叫 copysync:上面的 Conflicts/Replaces 让 apt 装这个包时自动卸掉旧的,# 旧的后台服务与开机自启项由界面第一次启动时清理(ui/lib/background_service_linux.dart 的 removeLegacy)#-# 卸载时结束正在运行的后台服务:程序文件已经没了。升级时不结束,界面打开时会按新版本重启它+# 卸载时结束正在运行的后台服务与快捷粘贴窗口(pasteferry --picker):程序文件已经没了。+# 升级时不结束,界面打开时会按新版本重启后台服务,快捷窗口随之由新的后台服务拉起cat > "$DEB/DEBIAN/prerm" <<'EOF'#!/bin/shset -eif [ "$1" = remove ]; thenpkill -x pasteferryd || true+ pkill -f '^/opt/PasteFerry/pasteferry --picker' || truefiEOFchmod 755 "$DEB/DEBIAN/prerm"diff --git a/scripts/package.sh b/scripts/package.shindex f5a767a..3167dff 100755--- a/scripts/package.sh+++ b/scripts/package.sh@@ -82,6 +82,7 @@ thin_app() { # <通用 App> <输出 App> <arm64 | x86_64>done < <(find "$dst" -type f -print0)codesign --force --sign - "$dst/Contents/Helpers/pasteferry-cli"codesign --force --sign - "$dst/Contents/Helpers/PasteFerryDaemon.app"+ codesign --force --sign - "$dst/Contents/Helpers/PasteFerryPicker.app"codesign --force --sign - "$dst/Contents/Frameworks/App.framework"codesign --force --sign - "$dst/Contents/Frameworks/FlutterMacOS.framework"codesign --force --sign - --preserve-metadata=entitlements,requirements,flags "$dst"diff --git a/tools/installer/pasteferry.iss b/tools/installer/pasteferry.issindex af8c80e..579e166 100644--- a/tools/installer/pasteferry.iss+++ b/tools/installer/pasteferry.iss@@ -90,6 +90,7 @@ beginend;// 后台服务(含守护进程)没有可见窗口,重启管理器关不掉它,安装前直接结束。+// /T 连同它拉起的快捷粘贴窗口(PasteFerry.exe --picker)一起结束。// 2.0.0 之前叫 CopySync:旧的界面与后台服务也结束掉,旧的开机自启项换成新的,// 数据目录由新的后台服务第一次启动时挪过来function PrepareToInstall(var NeedsRestart: Boolean): String;