Compare commits
4
Commits
b7c7c5cd76
...
Dev_202609
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f026400676 | ||
|
|
dd08f8054a | ||
|
|
dba2b14c33 | ||
|
|
680254cad6 |
No files matched your search
@@ -28,18 +28,18 @@ Electron + electron-vite + React 终端工具(本地终端 / SSH / SFTP)。
|
|||||||
1. `package.json` 版本号 +1,写 `RELEASE_NOTES.md`(仓库根,已 gitignore;可选 `.zh-TW/.en/.ja` 译文,缺译文回退简体)
|
1. `package.json` 版本号 +1,写 `RELEASE_NOTES.md`(仓库根,已 gitignore;可选 `.zh-TW/.en/.ja` 译文,缺译文回退简体)
|
||||||
2. `node scripts/sync-changelog.cjs` 把发布说明并入 `CHANGELOG*.md` —— **必须在 `npm run dist` 之前**:更新日志以 `?raw` 打进安装包(「关于」页离线读),`release.cjs` 也校验 `CHANGELOG.md` 已含该版本号
|
2. `node scripts/sync-changelog.cjs` 把发布说明并入 `CHANGELOG*.md` —— **必须在 `npm run dist` 之前**:更新日志以 `?raw` 打进安装包(「关于」页离线读),`release.cjs` 也校验 `CHANGELOG.md` 已含该版本号
|
||||||
3. `npm run dist` 构建
|
3. `npm run dist` 构建
|
||||||
4. `node scripts/release.cjs <版本号> --skip-github`,例如 `node scripts/release.cjs 1.0.14 --skip-github`
|
4. `node scripts/release.cjs <版本号>`,例如 `node scripts/release.cjs 1.0.14`(**不带 skip 参数**,Gitea 与 GitHub 一起发)
|
||||||
- **只发国内**(2026-09-15 起的产品决定):Gitea release(msi + exe 资产)→ Gitea 更新通道(`api/packages/admin/generic/openterminal-update/stable`:exe.blockmap → exe → release-notes.md → **latest.yml 最后**)
|
- Gitea:release(msi + exe 资产)→ Gitea 更新通道(`api/packages/admin/generic/openterminal-update/stable`:exe.blockmap → exe → release-notes.md → **latest.yml 最后**)
|
||||||
|
- GitHub:release 资产再次随版本同步发布(exe + exe.blockmap + latest.yml),electron-updater 标准 GitHub provider 直接吃 release 资产
|
||||||
- 通道不再先删旧版:新版本文件全部传完、latest.yml 生效后才清掉上一版 exe/blockmap,中途失败不会把通道打空;同一版本可重复运行(release 复用、已传资产跳过)
|
- 通道不再先删旧版:新版本文件全部传完、latest.yml 生效后才清掉上一版 exe/blockmap,中途失败不会把通道打空;同一版本可重复运行(release 复用、已传资产跳过)
|
||||||
- 只补通道:`node scripts/release.cjs <版本号> --channel-only`(不建 release、不发 GitHub)
|
- 只补通道:`node scripts/release.cjs <版本号> --channel-only`(不建 release、不发 GitHub)
|
||||||
- 国内通道全程直连,**不需要设代理**;代理只在显式补发 GitHub 时才用(`HTTPS_PROXY=http://127.0.0.1:7897`,脚本只把它用于 GitHub 请求)
|
- 国内通道全程直连,**不需要设代理**;GitHub 请求走 `HTTPS_PROXY=http://127.0.0.1:7897`(脚本只把它用于 GitHub 请求)
|
||||||
- GitHub 那一步的状态:`README` 与更新机制里仍保留 GitHub 作为更新回退源,但**release 资产不再随版本发布同步**;若某天需要补,跑一次 `node scripts/release.cjs <版本号> --skip-gitea` 即可
|
|
||||||
5. 验证更新通道:`curl https://git.codingplan.site/api/packages/admin/generic/openterminal-update/stable/latest.yml` 应返回新版本号
|
5. 验证更新通道:`curl https://git.codingplan.site/api/packages/admin/generic/openterminal-update/stable/latest.yml` 应返回新版本号
|
||||||
6. `git tag v<版本号>` 并推送两个远程(代码/tag 的镜像保持同步,仅 release 资产不发 GitHub)
|
6. `git tag v<版本号>` 并推送两个远程(代码/tag 与 release 资产的镜像保持同步)
|
||||||
|
|
||||||
## 更新机制
|
## 更新机制
|
||||||
|
|
||||||
- 检查更新:先 Gitea 更新通道(强制直连,不走系统代理),失败回退 GitHub(走系统代理)。 electron-updater 用独立 session(partition `electron-updater`),代理模式在 `useFeed` 里按源切换
|
- 检查更新:**GitHub 优先**(走系统代理;前置 20 秒连通性探测 `probeGithub`——探测失败/超时直接兜底 Gitea,不给 electron-updater 挂起的机会),失败回退国内 Gitea 通用包通道(强制直连,不走系统代理)。 electron-updater 用独立 session(partition `electron-updater`),代理模式在 `useFeed` 里按源切换
|
||||||
- 更新日志:Gitea 仓库是私有的(匿名 API 404),改为从更新通道的 `release-notes.md` 读取(直连 session `openterminal-update-direct`),再回退 Gitea/GitHub releases API
|
- 更新日志:Gitea 仓库是私有的(匿名 API 404),改为从更新通道的 `release-notes.md` 读取(直连 session `openterminal-update-direct`),再回退 Gitea/GitHub releases API
|
||||||
- electron-updater 不支持 MSI 自动更新,自动更新只走 NSIS exe
|
- electron-updater 不支持 MSI 自动更新,自动更新只走 NSIS exe
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
# OpenTerminal Changelog
|
# OpenTerminal Changelog
|
||||||
|
|
||||||
|
## v1.0.19 - 2026-09-28
|
||||||
|
|
||||||
|
### Update mechanism change
|
||||||
|
- **GitHub is now the primary update source**: update checks go to GitHub releases first (following the system proxy), gated by a 20-second connectivity probe — without a proxy, or when GitHub is unreachable, the app does not hang but falls back to the domestic update channel (forced direct connection).
|
||||||
|
- **GitHub releases carry the installer assets again** (exe + blockmap + latest.yml), in step with the domestic channel.
|
||||||
|
|
||||||
|
### Terminal highlighting: performance and compatibility
|
||||||
|
- **Faster engine**: colour sequences are precomputed at compile time (no per-span hex parsing); span claiming moved from a linear scan to sorted insertion (binary search); escape-free text floods (e.g. cat of a large file) skip redundant rescans. Measured on 200KB payloads: ~19–56% faster on match-dense output, ~54% faster on plain streamed text, with output byte-identical to the previous version.
|
||||||
|
- **Broader escape-sequence coverage**: DCS/APC/PM/SOS (tmux passthrough, sixel, kitty graphics protocol) and DEC single-character sequences (save/restore cursor, etc.) are now recognised, so normal text on the same line no longer loses its highlighting in those scenarios.
|
||||||
|
|
||||||
|
### Highlight settings page fixes
|
||||||
|
- The "group by category" view now actually clusters by category (it was previously flattened back to priority order).
|
||||||
|
- New "basic rule" switch in the rule editor: your own rules can join the set that stays active in "basic only" mode.
|
||||||
|
- The profile editor lists the rules a partial selection leaves out.
|
||||||
|
- "Replace current rules" imports now ask for confirmation, and the dialog defaults back to "append" each time it opens.
|
||||||
|
- Assorted small fixes: rapid toggles could lose a change, value-band rows were not kept sorted by threshold, the colour field lingered after clearing a background, and more.
|
||||||
|
|
||||||
## v1.0.18 - 2026-09-24
|
## v1.0.18 - 2026-09-24
|
||||||
|
|
||||||
- **Fixed a serious v1.0.17 regression: the password could not be typed on the lock screen**. v1.0.17 swallowed all keyboard input at the renderer level while locked (meant to block zoom/reload shortcuts), but the default action of a key press is exactly "insert the character into the focused field" — so the lock screen's password box received nothing and the app could not be unlocked.
|
- **Fixed a serious v1.0.17 regression: the password could not be typed on the lock screen**. v1.0.17 swallowed all keyboard input at the renderer level while locked (meant to block zoom/reload shortcuts), but the default action of a key press is exactly "insert the character into the focused field" — so the lock screen's password box received nothing and the app could not be unlocked.
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
# OpenTerminal 更新履歴
|
# OpenTerminal 更新履歴
|
||||||
|
|
||||||
|
## v1.0.19 - 2026-09-28
|
||||||
|
|
||||||
|
### アップデート機構の変更
|
||||||
|
- **更新元を GitHub 優先に変更**:更新チェックはまず GitHub releases を使い(システムプロキシに追随)、20 秒の接続プローブ付き——プロキシが無い、または GitHub に届かない場合は待たされず、国内更新チャンネル(常時直连)へ自動でフォールバックします。
|
||||||
|
- **GitHub releases でインストーラー同梱を再開**(exe + blockmap + latest.yml)。国内チャンネルと同じ内容です。
|
||||||
|
|
||||||
|
### ターミナルハイライト:性能と互換性
|
||||||
|
- **エンジン高速化**:色シーケンスをコンパイル時に事前計算(span ごとの hex 解析を廃止)、span 確定を線形スキャンからソート済み挿入(二分探索)へ、エスケープを含まないテキスト洪水(大きなファイルの cat 等)では再スキャンをスキップ。200KB 負荷の実測:マッチ密集シーンで約 19–56%、プレーンテキストのストリームで約 54% 高速化。出力は旧版とバイト単位で同一です。
|
||||||
|
- **エスケープシーケンスのカバー拡大**:DCS/APC/PM/SOS(tmux パススルー、sixel、kitty グラフィクス)と DEC 単一文字シーケンス(カーソル保存/復帰など)を認識し、これらの場面で同じ行の通常テキストがハイライトを失わなくなりました。
|
||||||
|
|
||||||
|
### ハイライト設定ページの修正
|
||||||
|
- 「分類でグループ化」ビューが実際に分類ごとにまとまるように(以前は優先度ソートで打散されていました)。
|
||||||
|
- ルールエディターに「基本ルール」スイッチを追加:自作ルールを「基本のみ」モードの有効セットに加えられます。
|
||||||
|
- プロファイルエディターで一部のルールだけを選んだ場合、含まれないルールの一覧を表示。
|
||||||
|
- 「現在のルールを置き換える」インポートに確認ダイアログを追加し、ダイアログを開くたびに「追加」モードへ戻るように。
|
||||||
|
- その他の小さな修正:連続トグルで変更が失われる問題、値バンド行がしきい値順にならない問題、背景色クリア後にカラー欄が残る問題など。
|
||||||
|
|
||||||
## v1.0.18 - 2026-09-24
|
## v1.0.18 - 2026-09-24
|
||||||
|
|
||||||
- **v1.0.17 の重大なリグレッションを修正:ロック画面でパスワードを入力できない**。v1.0.17 ではロック中、レンダラー側ですべてのキーボード入力を握りつぶしていました(ズーム/再読み込みのショートカットを無効化する意図でした)。しかしキー入力の既定動作は「フォーカスされたフィールドへの文字挿入」であり、その結果、ロック画面のパスワード欄に何も入力できず、ロック解除もできなくなっていました。
|
- **v1.0.17 の重大なリグレッションを修正:ロック画面でパスワードを入力できない**。v1.0.17 ではロック中、レンダラー側ですべてのキーボード入力を握りつぶしていました(ズーム/再読み込みのショートカットを無効化する意図でした)。しかしキー入力の既定動作は「フォーカスされたフィールドへの文字挿入」であり、その結果、ロック画面のパスワード欄に何も入力できず、ロック解除もできなくなっていました。
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
# OpenTerminal 更新日志
|
# OpenTerminal 更新日志
|
||||||
|
|
||||||
|
## v1.0.19 - 2026-09-28
|
||||||
|
|
||||||
|
### 更新机制调整
|
||||||
|
- **更新源改为 GitHub 优先**:检查更新先走 GitHub releases(跟随系统代理),并带 20 秒连通性探测——没有代理或连不通时不会干等,自动改用国内更新通道(强制直连)兜底。
|
||||||
|
- **GitHub releases 恢复随版本发布安装包**(exe + blockmap + latest.yml),与国内通道保持一致。
|
||||||
|
|
||||||
|
### 终端高亮:性能与兼容性
|
||||||
|
- **引擎提速**:颜色序列改为编译期预计算(不再逐处解析 hex);高亮区间认领从线性扫描改为有序插入(二分查找);纯文本洪流(如 cat 大文件)跳过重扫描。实测 200KB 负载:密集匹配场景提速约 19–56%,纯文本流式提速约 54%,输出与旧版逐字节一致。
|
||||||
|
- **转义序列覆盖更全**:新增 DCS/APC/PM/SOS(tmux 透传、sixel、kitty 图形协议)与 DEC 单字符序列(保存/恢复光标等)的识别,这些场景下同行的正常文本不再丢失高亮。
|
||||||
|
|
||||||
|
### 高亮设置页修复
|
||||||
|
- 「按分类分组」视图现在真正按分类聚簇(此前会被优先级排序打散)。
|
||||||
|
- 规则编辑器新增「基础规则」开关:可将自建规则加入「仅基础」模式的生效集合。
|
||||||
|
- 规则集(profile)编辑器勾选部分规则时,会列出未包含的规则。
|
||||||
|
- 「替换现有规则」导入增加确认提示,且每次打开弹窗默认回到「追加」。
|
||||||
|
- 修复若干小问题:快速连续开关规则可能丢改动、数值分级行不按阈值排序、清除背景色后色块残留等。
|
||||||
|
|
||||||
## v1.0.18 - 2026-09-24
|
## v1.0.18 - 2026-09-24
|
||||||
|
|
||||||
- **修复 v1.0.17 的严重回归:锁屏后无法输入密码**。v1.0.17 在锁屏期间由渲染层拦截了全部键盘输入(本意是挡住缩放/刷新快捷键),但按键的默认行为正是「向聚焦的输入框插入字符」,导致锁屏界面密码框收不到任何输入、无法解锁。
|
- **修复 v1.0.17 的严重回归:锁屏后无法输入密码**。v1.0.17 在锁屏期间由渲染层拦截了全部键盘输入(本意是挡住缩放/刷新快捷键),但按键的默认行为正是「向聚焦的输入框插入字符」,导致锁屏界面密码框收不到任何输入、无法解锁。
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
# OpenTerminal 更新日誌
|
# OpenTerminal 更新日誌
|
||||||
|
|
||||||
|
## v1.0.19 - 2026-09-28
|
||||||
|
|
||||||
|
### 更新機制調整
|
||||||
|
- **更新來源改為 GitHub 優先**:檢查更新先走 GitHub releases(跟隨系統代理),並帶 20 秒連通性探測——沒有代理或連不通時不會空等,自動改用國內更新通道(強制直連)兜底。
|
||||||
|
- **GitHub releases 恢復隨版本發佈安裝包**(exe + blockmap + latest.yml),與國內通道保持一致。
|
||||||
|
|
||||||
|
### 終端高亮:效能與相容性
|
||||||
|
- **引擎提速**:顏色序列改為編譯期預計算(不再逐處解析 hex);高亮區間認領從線性掃描改為有序插入(二分搜尋);純文字洪流(如 cat 大檔案)跳過重複掃描。實測 200KB 負載:密集匹配場景提速約 19–56%,純文字流式提速約 54%,輸出與舊版逐位元組一致。
|
||||||
|
- **跳脫序列覆蓋更全**:新增 DCS/APC/PM/SOS(tmux 透傳、sixel、kitty 圖形協定)與 DEC 單字元序列(儲存/恢復游標等)的辨識,這些場景下同行的正常文字不再遺失高亮。
|
||||||
|
|
||||||
|
### 高亮設定頁修復
|
||||||
|
- 「依分類分組」檢視現在真正依分類聚簇(此前會被優先級排序打散)。
|
||||||
|
- 規則編輯器新增「基礎規則」開關:可將自建規則加入「僅基礎」模式的生效集合。
|
||||||
|
- 規則集(profile)編輯器勾選部分規則時,會列出未包含的規則。
|
||||||
|
- 「取代現有規則」匯入增加確認提示,且每次開啟視窗預設回到「附加」。
|
||||||
|
- 修復若干小問題:快速連續開關規則可能遺失改動、數值分級列不按閾值排序、清除背景色後色塊殘留等。
|
||||||
|
|
||||||
## v1.0.18 - 2026-09-24
|
## v1.0.18 - 2026-09-24
|
||||||
|
|
||||||
- **修復 v1.0.17 的嚴重回歸:鎖定後無法輸入密碼**。v1.0.17 在鎖定期間由繪製程序攔截了全部鍵盤輸入(本意是擋住縮放/重新整理快捷鍵),但按鍵的預設行為正是「向聚焦的輸入框插入字元」,導致鎖定畫面密碼框收不到任何輸入、無法解鎖。
|
- **修復 v1.0.17 的嚴重回歸:鎖定後無法輸入密碼**。v1.0.17 在鎖定期間由繪製程序攔截了全部鍵盤輸入(本意是擋住縮放/重新整理快捷鍵),但按鍵的預設行為正是「向聚焦的輸入框插入字元」,導致鎖定畫面密碼框收不到任何輸入、無法解鎖。
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "open-terminal",
|
"name": "open-terminal",
|
||||||
"productName": "OpenTerminal",
|
"productName": "OpenTerminal",
|
||||||
"version": "1.0.18",
|
"version": "1.0.19",
|
||||||
"description": "Open-source terminal with SSH, split panes, themes and fonts",
|
"description": "Open-source terminal with SSH, split panes, themes and fonts",
|
||||||
"main": "out/main/index.js",
|
"main": "out/main/index.js",
|
||||||
"author": "CodingPlan.Site",
|
"author": "CodingPlan.Site",
|
||||||
|
|||||||
+20
-2
@@ -254,7 +254,7 @@ async function github() {
|
|||||||
// Idempotent like gitea(): a re-run after a partial publish must reuse the
|
// Idempotent like gitea(): a re-run after a partial publish must reuse the
|
||||||
// release it created last time instead of dying on 422 already_exists and
|
// release it created last time instead of dying on 422 already_exists and
|
||||||
// leaving GitHub permanently half-uploaded until someone deletes it by hand.
|
// leaving GitHub permanently half-uploaded until someone deletes it by hand.
|
||||||
const byTag = (): Promise<Response> => gh(`${api}/releases/tags/v${V}`)
|
const byTag = () => gh(`${api}/releases/tags/v${V}`)
|
||||||
let resp = await byTag()
|
let resp = await byTag()
|
||||||
let rel
|
let rel
|
||||||
if (resp.ok) {
|
if (resp.ok) {
|
||||||
@@ -278,8 +278,26 @@ async function github() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const up = `https://uploads.github.com/repos/billowliu2/OpenTerminal/releases/${rel.id}/assets`
|
const up = `https://uploads.github.com/repos/billowliu2/OpenTerminal/releases/${rel.id}/assets`
|
||||||
|
// Skip assets a previous partial run already uploaded — the upload POST
|
||||||
|
// 422s on duplicates, so without this a retry could never get past them.
|
||||||
|
const assetsResp = await gh(`${api}/releases/${rel.id}/assets?per_page=100`)
|
||||||
|
const existing = new Set(assetsResp.ok ? (await assetsResp.json()).map((a) => a.name) : [])
|
||||||
for (const f of [...files, path.join(R, `OpenTerminal-${V}-setup.exe.blockmap`), path.join(R, 'latest.yml')]) {
|
for (const f of [...files, path.join(R, `OpenTerminal-${V}-setup.exe.blockmap`), path.join(R, 'latest.yml')]) {
|
||||||
await upload(up, f, env.GH_TOKEN, 'Bearer', true)
|
if (existing.has(path.basename(f))) {
|
||||||
|
console.log(` skip ${path.basename(f)} (already uploaded)`)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
// Large uploads through a proxy flake; retry transient network errors.
|
||||||
|
for (let attempt = 1; ; attempt++) {
|
||||||
|
try {
|
||||||
|
await upload(up, f, env.GH_TOKEN, 'Bearer', true)
|
||||||
|
break
|
||||||
|
} catch (e) {
|
||||||
|
if (attempt >= 3) throw e
|
||||||
|
console.log(` upload ${path.basename(f)} failed (${e.message}), retrying in 5s…`)
|
||||||
|
await new Promise((r) => setTimeout(r, 5000))
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+53
-14
@@ -8,9 +8,11 @@ import { loadSettings } from './settingsStore'
|
|||||||
import { markQuitting } from './tray'
|
import { markQuitting } from './tray'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update feeds: domestic Gitea generic package is tried first (fast in
|
* Update feeds: GitHub releases is tried first (system proxy, gated by a
|
||||||
* China); GitHub releases is the fallback. Both feeds carry the NSIS .exe —
|
* 20s connectivity probe so proxy-less users don't hang); the domestic
|
||||||
* electron-updater does NOT support MSI auto-updates, MSI is manual only.
|
* Gitea generic package is the fallback (forced direct). Both feeds carry
|
||||||
|
* the NSIS .exe — electron-updater does NOT support MSI auto-updates, MSI
|
||||||
|
* is manual only.
|
||||||
*/
|
*/
|
||||||
const GITEA_FEED =
|
const GITEA_FEED =
|
||||||
'https://git.codingplan.site/api/packages/admin/generic/openterminal-update/stable/'
|
'https://git.codingplan.site/api/packages/admin/generic/openterminal-update/stable/'
|
||||||
@@ -19,6 +21,9 @@ const GITEA_RELEASES_API =
|
|||||||
const GITHUB_REPO = { owner: 'billowliu2', repo: 'OpenTerminal' }
|
const GITHUB_REPO = { owner: 'billowliu2', repo: 'OpenTerminal' }
|
||||||
const GITHUB_RELEASES_API =
|
const GITHUB_RELEASES_API =
|
||||||
'https://api.github.com/repos/billowliu2/OpenTerminal/releases?per_page=10'
|
'https://api.github.com/repos/billowliu2/OpenTerminal/releases?per_page=10'
|
||||||
|
const GITHUB_PROBE_URL =
|
||||||
|
'https://api.github.com/repos/billowliu2/OpenTerminal/releases/latest'
|
||||||
|
const GITHUB_PROBE_TIMEOUT_MS = 20_000
|
||||||
|
|
||||||
let state: UpdateState = { status: 'idle', currentVersion: app.getVersion() }
|
let state: UpdateState = { status: 'idle', currentVersion: app.getVersion() }
|
||||||
let activeFeed: 'gitea' | 'github' = 'gitea'
|
let activeFeed: 'gitea' | 'github' = 'gitea'
|
||||||
@@ -70,23 +75,38 @@ function wireEvents(): void {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Check the active feed; on failure switch Gitea → GitHub and retry once. */
|
/**
|
||||||
|
* Check updates: GitHub releases first (system proxy, gated by a
|
||||||
|
* connectivity probe), domestic Gitea generic package as fallback.
|
||||||
|
*
|
||||||
|
* The feed is decided BEFORE touching the updater: checkForUpdates has no
|
||||||
|
* timeout, and racing it while mid-flight risks two concurrent checks
|
||||||
|
* polluting state.
|
||||||
|
*/
|
||||||
async function checkWithFallback(): Promise<void> {
|
async function checkWithFallback(): Promise<void> {
|
||||||
// The feed choice is per attempt: a transient Gitea failure must not pin
|
// The feed choice is per attempt: a transient GitHub failure must not pin
|
||||||
// every later check to GitHub (and its system proxy) for the whole session.
|
// every later check to Gitea (and its forced direct connection) — or vice
|
||||||
|
// versa — for the whole session.
|
||||||
|
let githubErr: string | undefined
|
||||||
|
if (await probeGithub()) {
|
||||||
|
useFeed('github')
|
||||||
|
try {
|
||||||
|
await autoUpdater.checkForUpdates()
|
||||||
|
return
|
||||||
|
} catch (err) {
|
||||||
|
console.warn('[updater] github feed failed, falling back to gitea:', err)
|
||||||
|
githubErr = err instanceof Error ? err.message : String(err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.warn('[updater] github probe failed or timed out, using gitea feed directly')
|
||||||
|
}
|
||||||
useFeed('gitea')
|
useFeed('gitea')
|
||||||
try {
|
try {
|
||||||
await autoUpdater.checkForUpdates()
|
await autoUpdater.checkForUpdates()
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('[updater] gitea feed failed, falling back to github:', err)
|
if (githubErr === undefined) throw err
|
||||||
const giteaErr = err instanceof Error ? err.message : String(err)
|
const giteaErr = err instanceof Error ? err.message : String(err)
|
||||||
useFeed('github')
|
throw new Error(t('main.updater.feedFailed', { gitea: giteaErr, github: githubErr }))
|
||||||
try {
|
|
||||||
await autoUpdater.checkForUpdates()
|
|
||||||
} catch (err2) {
|
|
||||||
const ghErr = err2 instanceof Error ? err2.message : String(err2)
|
|
||||||
throw new Error(t('main.updater.feedFailed', { gitea: giteaErr, github: ghErr }))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -121,6 +141,25 @@ async function directFetch(url: string): Promise<Response> {
|
|||||||
return s.fetch(url, { headers: { 'User-Agent': 'OpenTerminal' } })
|
return s.fetch(url, { headers: { 'User-Agent': 'OpenTerminal' } })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Connectivity probe for the GitHub feed: dedicated session in the same
|
||||||
|
* proxy mode as the feed (system), hard timeout so proxy-less users fall
|
||||||
|
* back to Gitea instead of hanging on a dead proxy/DNS.
|
||||||
|
*/
|
||||||
|
async function probeGithub(): Promise<boolean> {
|
||||||
|
try {
|
||||||
|
const s = session.fromPartition('openterminal-github-probe', { cache: false })
|
||||||
|
await s.setProxy({ mode: 'system' })
|
||||||
|
const resp = await s.fetch(GITHUB_PROBE_URL, {
|
||||||
|
headers: { 'User-Agent': 'OpenTerminal' },
|
||||||
|
signal: AbortSignal.timeout(GITHUB_PROBE_TIMEOUT_MS)
|
||||||
|
})
|
||||||
|
return resp.ok
|
||||||
|
} catch {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Changelog sources, in order:
|
* Changelog sources, in order:
|
||||||
* 1. update channel's release-notes.md — the Gitea repo itself is private
|
* 1. update channel's release-notes.md — the Gitea repo itself is private
|
||||||
|
|||||||
Reference in new issue
Block a user