Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 68 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
fakeroot dpkg rpm libarchive-tools
fakeroot dpkg rpm libarchive-tools zsync squashfs-tools p7zip-full

# Packaging consumes dist/, so it must exist before electron-builder runs.
- name: Build app bundle
Expand Down Expand Up @@ -150,6 +150,72 @@ jobs:
# certificate never silently changes the output.
CSC_IDENTITY_AUTO_DISCOVERY: 'false'

# electron-builder's AppImage writer does not embed update info and does
# not emit a zsync file, which AppImageHub/AppImageUpdate require. Rebuild
# the AppImage with appimagetool so both are present next to the asset.
- name: Add AppImage update information
if: matrix.platform == 'linux'
run: |
set -euo pipefail
APPIMAGE="$(find release -maxdepth 1 -name '*.AppImage' -print -quit)"
if [ -z "$APPIMAGE" ]; then
echo "::error::electron-builder produced no AppImage"
exit 1
fi
NAME="$(basename "$APPIMAGE")"
case "${{ matrix.arch }}" in
x64) TARGET_ARCH=x86_64 ;;
arm64) TARGET_ARCH=aarch64 ;;
*) echo "::error::unsupported AppImage architecture"; exit 1 ;;
esac
# appimagetool is itself an AppImage, so run the build for the runner's
# architecture; ARCH selects the target runtime it embeds.
case "$(uname -m)" in
x86_64) TOOL_ARCH=x86_64 ;;
aarch64) TOOL_ARCH=aarch64 ;;
*) echo "::error::unsupported runner architecture"; exit 1 ;;
esac
# This is the suffix electron-builder put in the filename (x86_64 /
# arm64), not the runtime architecture appimagetool wants (x86_64 /
# aarch64); the update-information pattern must match the asset name.
BASE="${NAME%.AppImage}"
FILE_ARCH="${BASE##*-}"

TOOL="/tmp/appimagetool-${TOOL_ARCH}.AppImage"
curl -fsSL -o "$TOOL" \
"https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${TOOL_ARCH}.AppImage"
chmod +x "$TOOL"

# Extract without executing the payload: the arm64 job runs on an x64
# runner, so running the arm64 AppImage would fail with Exec format.
# `grep hsqs` also matches strings inside the runtime; use 7z, which
# reports the real SquashFS superblock offset.
OFFSET="$(7z l "$APPIMAGE" 2>/dev/null | sed -n 's/^Offset = //p' | head -n1)" || true
if [ -z "$OFFSET" ]; then
echo "::error::could not locate the SquashFS payload in $APPIMAGE"
exit 1
fi
rm -rf release/squashfs-root
unsquashfs -o "$OFFSET" -d release/squashfs-root "$APPIMAGE" > /dev/null
# electron-builder's stage directory is 0700; appimagetool (rightly)
# refuses to ship an AppImage that other users cannot read.
chmod -R a+rX release/squashfs-root
chmod a+rx release/squashfs-root/AppRun
rm -f "$APPIMAGE"
REPO="${GITHUB_REPOSITORY}"
APPIMAGE_EXTRACT_AND_RUN=1 ARCH="$TARGET_ARCH" "$TOOL" --no-appstream \
-u "gh-releases-zsync|${REPO%%/*}|${REPO##*/}|latest|ipatool-gui-*-${FILE_ARCH}.AppImage.zsync" \
release/squashfs-root "$APPIMAGE"
rm -rf release/squashfs-root

# appimagetool generates this when zsyncmake is installed; fall back
# to zsyncmake directly so a missing helper cannot silently drop it.
if [ ! -f "${APPIMAGE}.zsync" ]; then
zsyncmake -u "https://github.com/${GITHUB_REPOSITORY}/releases/download/${GITHUB_REF_NAME}/${NAME}.zsync" \
-o "${APPIMAGE}.zsync" "$APPIMAGE"
fi
ls -lh "$APPIMAGE" "${APPIMAGE}.zsync"

# macOS: turn the unpacked .app into a single runnable archive.
- name: Package the .app as a runnable tar.gz
if: matrix.platform == 'mac'
Expand Down Expand Up @@ -259,6 +325,7 @@ jobs:
release/*.dmg
release/*.app.tar.gz
release/*.AppImage
release/*.zsync
release/*.deb
release/SHA256SUMS.txt
if-no-files-found: error
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ SmartScreen may warn about an unknown publisher — choose **Run anyway**.

### Linux

AppImage and deb packages for x64 / arm64.
AppImage (with a `.zsync` sidecar for AppImageUpdate) and deb packages for x64 / arm64.

---

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ SmartScreen 提示「未知发布者」属正常现象,选择「仍要运行

### Linux

提供 AppImage 与 deb(x64 / arm64)。
提供 AppImage(附带用于 AppImageUpdate 的 `.zsync`)与 deb(x64 / arm64)。

---

Expand Down
4 changes: 2 additions & 2 deletions docs/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@

- 全栈 TypeScript,主进程 / preload / 渲染进程共享类型与纯逻辑层,编译期即可发现 IPC 不一致;
- 渲染层与其它方案同样是 webview,UI 流畅度没有差别;
- 打包产物覆盖 Windows(NSIS + 便携版)、macOS(dmg)、Linux(AppImage + deb)。
- 打包产物覆盖 Windows(NSIS + 便携版)、macOS(dmg)、Linux(AppImage + `.zsync` + deb)。

> 若你更想要 Tauri/Wails 的体积,`src/shared/` 与 `src/main/` 的命令构建、输出解析、
> 队列与引擎逻辑均为平台无关的纯逻辑,可以较直接地移植到 Rust/Go 壳中。
Expand Down Expand Up @@ -270,7 +270,7 @@ Windows 产物未签名。
> macOS 在 CI 上产 **`.app.tar.gz` 运行包**(GitHub 的 macOS runner 无法运行 dmg 所需的
> `hdiutil attach`,会报 `Device not configured`,故用 `dir` target + tar);
> 在真实 Mac 上 `npm run dist:mac` 仍会产 dmg 安装包。
> 各平台产物:Windows = NSIS 安装包 + portable 运行包 + portable zip(均 x64);Linux = deb 安装包 + AppImage 运行包(x64 与 arm64 分开打包)。
> 各平台产物:Windows = NSIS 安装包 + portable 运行包 + portable zip(均 x64);Linux = deb 安装包 + AppImage 运行包 + AppImage 的 `.zsync` 更新元数据(x64 与 arm64 分开打包)。
>
> Draft 不是公开状态,仍需到 Releases 页手动点 Publish 才对外可见。
> 地下开发阶段只要不勾 `publish`,仓库对外不会留下任何 Release 痕迹。
Expand Down
2 changes: 1 addition & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ linux:
category: Utility
synopsis: Desktop front-end for ipatool
maintainer: ipatool-gui contributors <noreply@example.com>
artifactName: ${name}-${version}-linux-${arch}.${ext}
artifactName: ${name}-${version}-${arch}.${ext}
# mksquashfs then defaults to zlib, which the catalog's mount helper supports.
compression: normal
# ⚠️ Deliberately NO `arch:` here. Once a target declares its own arch list,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ipatool-gui",
"productName": "IPATool GUI",
"version": "0.3.1",
"version": "0.3.2",
"engines": {
"node": ">=20.19"
},
Expand Down
2 changes: 1 addition & 1 deletion scripts/sha256sums.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import path from 'node:path'
import { pathToFileURL } from 'node:url'

/** Artifact extensions that ship to users. Intermediate build output is skipped. */
const ARTIFACT_SUFFIXES = ['.exe', '.dmg', '.app.tar.gz', '.AppImage', '.deb', '.zip']
const ARTIFACT_SUFFIXES = ['.exe', '.dmg', '.app.tar.gz', '.AppImage', '.deb', '.zip', '.zsync']

export const MANIFEST_NAME = 'SHA256SUMS.txt'

Expand Down
2 changes: 1 addition & 1 deletion src/main/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const REPO_WEB = `https://github.com/${IPATOOL_REPO}`
* trick can answer (offline API, blocked mirror, ...). Installing a slightly old
* ipatool beats failing to install any.
*/
const FALLBACK_VERSION = '2.6.0'
const FALLBACK_VERSION = '2.8.1'

interface GhAsset {
name: string
Expand Down
17 changes: 16 additions & 1 deletion src/main/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export function defaultSettings(): Settings {
notifyOnComplete: true,
autoCheckUpdates: true,
confirmCloseWhileDownloading: false,
lastEmail: ''
emailHistory: []
}
}

Expand Down Expand Up @@ -147,6 +147,21 @@ export function normalizeSettings(input: unknown): Settings {
out.activeAccountId = accounts[0]?.id ?? ''
}

// `lastEmail` was the pre-history field. Seed it first, then merge the saved
// list; dedupe case-insensitively so a legacy entry cannot appear twice.
const emails: string[] = []
const seenEmails = new Set<string>()
const addEmail = (value: unknown): void => {
if (typeof value !== 'string') return
const email = value.trim()
if (email === '' || seenEmails.has(email.toLowerCase())) return
seenEmails.add(email.toLowerCase())
emails.push(email)
}
addEmail(raw.lastEmail)
for (const value of Array.isArray(raw.emailHistory) ? raw.emailHistory : []) addEmail(value)
out.emailHistory = emails.slice(0, 50)

return out
}

Expand Down
20 changes: 17 additions & 3 deletions src/main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function titleBarOptions(): Electron.BrowserWindowConstructorOptions {

export function createMainWindow(options: WindowOptions = {}): BrowserWindow {
const dark = nativeTheme.shouldUseDarkColors
chromeModal = false

const win = new BrowserWindow({
width: options.width ?? 1240,
Expand Down Expand Up @@ -100,6 +101,10 @@ export function createMainWindow(options: WindowOptions = {}): BrowserWindow {

win.on('maximize', () => win.webContents.send('window:maximized', true))
win.on('unmaximize', () => win.webContents.send('window:maximized', false))
// Windows may repaint the caption strip while the window loses focus (a
// login request, a native dialog, ...). Re-apply the last known state when
// focus comes back instead of leaving a solid strip over an open modal.
win.on('focus', () => syncTitleBarOverlay(win))

if (DEV_URL) {
void win.loadURL(DEV_URL)
Expand All @@ -110,17 +115,26 @@ export function createMainWindow(options: WindowOptions = {}): BrowserWindow {
return win
}

/**
* Last modal state reported by the renderer. Theme/settings events call
* syncTitleBarOverlay() without an explicit state; they must not paint the
* caption strip back to opaque while a dialog is still open.
*/
let chromeModal = false

/** Keeps the Windows caption buttons in sync with the app theme. */
export function syncTitleBarOverlay(win: BrowserWindow | null, modal = false): void {
export function syncTitleBarOverlay(win: BrowserWindow | null, modal?: boolean): void {
if (!win || process.platform !== 'win32') return
if (typeof modal === 'boolean') chromeModal = modal
const dimmed = modal ?? chromeModal
try {
const dark = nativeTheme.shouldUseDarkColors
// Modal scrim is a dark blur over the whole page, including the strip the
// OS caption buttons sit on. A painted overlay color cannot show that blur,
// so the strip stays transparent while a modal is open and lets the scrim
// through; glyphs stay bright because the scrim is dark on both themes.
const color = modal ? 'rgba(0, 0, 0, 0)' : dark ? '#101014' : '#ffffff'
const symbolColor = modal
const color = dimmed ? 'rgba(0, 0, 0, 0)' : dark ? '#101014' : '#ffffff'
const symbolColor = dimmed
? dark
? '#e8e8ef'
: '#ffffff'
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export const en = {
'auth.passwordPlaceholder': 'Your Apple ID password',
'auth.submit': 'Sign in',
'auth.signingIn': 'Signing in…',
'auth.remember': 'Remember this e-mail',
'auth.emailHistoryDelete': 'Remove this e-mail',
'auth.2fa.title': 'Two-factor code required',
'auth.2fa.body': 'Apple sent a verification code to your trusted devices. Enter it below.',
'auth.2fa.placeholder': '6-digit code',
Expand Down Expand Up @@ -296,6 +296,8 @@ export const en = {
'downloads.progress.remaining': '{eta} left',
'downloads.progress.done': 'Complete',
'downloads.resumeHint': 'Paused downloads keep their partial file and resume where they stopped.',
'downloads.reloginRequired': 'Sign in again before downloading',
'downloads.reloginHint': 'Use the same Apple ID; your queue and purchases are kept.',
'downloads.deletePartial.title': 'Discard the partial file?',
'downloads.deletePartial.body':
'The next attempt will start from zero bytes. Use this when Apple rejects the resume range (HTTP 416) after a long pause.',
Expand Down Expand Up @@ -470,6 +472,9 @@ export const en = {
'toast.downloadStarted': 'Download started',
'toast.downloadDone': '{name} downloaded',
'toast.downloadFailed': '{name} failed',
'toast.reloginRequired': 'Sign in again to enable downloads',
'toast.reloginRequiredDetail':
'ipatool 2.8.1 needs to provision this session for Store downloads. Sign in with the same Apple ID; your purchases and queue are kept.',
'toast.copied': 'Copied to clipboard',
'toast.saved': 'Saved',
'toast.settingsReset': 'Settings reset to defaults',
Expand Down
7 changes: 6 additions & 1 deletion src/renderer/src/i18n/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export const zh: Dict = {
'auth.passwordPlaceholder': '你的 Apple ID 密码',
'auth.submit': '登录',
'auth.signingIn': '登录中…',
'auth.remember': '记住这个邮箱',
'auth.emailHistoryDelete': '删除这个邮箱',
'auth.2fa.title': '需要双重认证验证码',
'auth.2fa.body': 'Apple 已向你的受信任设备发送验证码,请输入。',
'auth.2fa.placeholder': '6 位验证码',
Expand Down Expand Up @@ -287,6 +287,8 @@ export const zh: Dict = {
'downloads.progress.remaining': '剩余 {eta}',
'downloads.progress.done': '完成',
'downloads.resumeHint': '暂停会保留未完成文件,继续时从断点接着下。',
'downloads.reloginRequired': '需要重新登录一次才能下载',
'downloads.reloginHint': '用同一个 Apple ID 登录即可,队列和已购记录都会保留。',
'downloads.deletePartial.title': '丢弃未完成文件?',
'downloads.deletePartial.body': '下次将从 0 字节重新开始。当长时间暂停后 Apple 拒绝续传范围(HTTP 416)时使用。',
'downloads.deletePartial.confirm': '丢弃并重新下载',
Expand Down Expand Up @@ -455,6 +457,9 @@ export const zh: Dict = {
'toast.downloadStarted': '开始下载',
'toast.downloadDone': '{name} 下载完成',
'toast.downloadFailed': '{name} 下载失败',
'toast.reloginRequired': '需要重新登录一次才能下载',
'toast.reloginRequiredDetail':
'ipatool 2.8.1 需要为当前会话完成 Store AMD 初始化;用同一个 Apple ID 重新登录即可,已购记录和队列都会保留。',
'toast.copied': '已复制到剪贴板',
'toast.saved': '已保存',
'toast.settingsReset': '设置已恢复默认',
Expand Down
Loading
Loading