electerm 5.5.15 → 5.5.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/README.md +94 -205
  2. package/README_cn.md +152 -0
  3. package/npm/install.js +149 -19
  4. package/package.json +23 -29
package/README.md CHANGED
@@ -1,263 +1,152 @@
1
1
  <h1 align="center" style="padding-top: 60px;padding-bottom: 40px;">
2
2
  <a href="https://electerm.org">
3
- <img src="https://github.com/electerm/electerm-resource/raw/master/static/images/electerm.png", alt="" />
3
+ <img src="https://github.com/electerm/electerm-resource/raw/master/static/images/electerm.png" alt="electerm" />
4
4
  </a>
5
5
  </h1>
6
6
 
7
- [![GitHub version](https://badgers.space/github/release/electerm/electerm?corner_radius=m)](https://github.com/electerm/electerm/releases)
8
- [![Build Status](https://github.com/electerm/electerm/actions/workflows/mac-test-1.yml/badge.svg)](https://github.com/electerm/electerm/actions)
9
- [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/electerm/electerm/blob/master/LICENSE)
10
- [![GitHub Sponsors](https://img.shields.io/github/sponsors/electerm?label=Sponsors)](https://github.com/sponsors/electerm)
11
- [![star](https://atomgit.com/electerm/electerm/star/badge.svg)](https://atomgit.com/electerm/electerm)
12
-
13
- [English](README.md) | [中文](build/docs/README_cn.md) | [日本語](build/docs/README_jp.md)
14
-
15
- Open-sourced terminal/ssh/sftp/telnet/serialport/RDP/VNC/Spice/ftp client(Linux, Mac, Windows, Android, HarmonyOS, iOS).
16
-
17
- Besides mainstream Windows/macOS/Linux/Android, electerm also supports HarmonyOS, iOS, and older systems — Ubuntu 18, Windows 7, macOS 10+, and special Chinese Linux distributions such as UOS, Kylin, and LoongArch (both old-world and new-world).
18
-
19
- <p>
20
- <a href="https://electerm.org">Homepage / Downloads</a> ·
21
- <a href="https://theme.electerm.org">Theme</a> ·
22
- <a href="https://github.com/electerm/electerm-web-docker">Docker</a> ·
23
- <a href="https://demo.electerm.org">Online demo</a> ·
24
- <a href="https://github.com/electerm/electerm-android">Android</a> ·
25
- <a href="https://github.com/electerm/electerm-harmony">HarmonyOS</a> ·
26
- <a href="https://apps.apple.com/cn/app/electerm/id6792971552">Apple App Store</a> ·
27
- <a href="https://appgallery.huawei.com/app/detail?id=org.electerm.electerm">Huawei AppGallery</a> ·
28
- <a href="https://www.microsoft.com/store/apps/9NCN7272GTFF">Microsoft Store</a> ·
29
- <a href="https://snapcraft.io/electerm">Snap Store</a> ·
30
- <a href="https://repos.electerm.org/deb">deb repo</a> ·
31
- <a href="https://repos.electerm.org/rpm">rpm repo</a>
32
- </p>
33
-
34
- <div>🌐 <strong><a href="https://cloud.electerm.org">electerm online</a></strong> — Public free online electerm app</div>
35
- <div>🤖 <strong><a href="https://ai.electerm.org">electerm AI</a></strong> — Free AI for electerm users</div>
36
- <div>💻 <strong><a href="https://github.com/electerm/electerm-web">electerm-web</a></strong> — Web app version running in browser (including mobile device)</div>
37
-
38
- ## Sponsors
39
-
40
- <div align="center">
41
- <a href="https://www.atlascloud.ai/?ref=PCAEL2&utm_source=github&utm_medium=link&utm_campaign=electerm">
42
- <img src="https://github.com/electerm/electerm-resource/blob/master/static/images/atlas-cloud.png?raw=true" alt="Atlas Cloud" height="200" />
43
- </a>
44
- </div>
45
-
46
- [Atlas Cloud](https://www.atlascloud.ai/?ref=PCAEL2&utm_source=github&utm_medium=link&utm_campaign=electerm) provides OpenAI-compatible AI APIs and model access for AI-powered workflows in electerm.
47
-
48
- ----
49
-
50
- <div align="center">
51
- <br />
52
- <br />
53
- <a href="https://go.apimart.ai/gh-electerm">
54
- <img src="https://github.com/electerm/electerm-resource/blob/master/static/images/apimart.jpg?raw=true" alt="ApiMart" width="200" />
55
- </a>
56
- <br />
57
- <br />
58
- </div>
59
-
60
- Thanks to APIMart for sponsoring electerm! APIMart is a low-cost API platform for AI image & video generation — GPT-Image-2 from $0.006/image, 160+ images per dollar. One async API covers both image and video: submit a task, get an ID, fetch results via polling or callback. Batch tens of thousands of images without timeouts, switch models without changing code. Pay-as-you-go with no monthly fee — [sign up here to get started](https://go.apimart.ai/gh-electerm).
61
-
62
- ----
63
-
64
- <div align="center">
65
- <a href="https://www.apismart.ai">
66
- <img src="https://github.com/electerm/electerm-resource/blob/master/static/images/apismart400x400.png?raw=true" alt="ApiSmart" width="200" />
67
- </a>
68
- </div>
69
-
70
- [ApiSmart](https://www.apismart.ai) provides unified access to leading AI models through a single API. Use one API key to connect with LLM, image, and video models through an OpenAI-compatible interface, without managing multiple providers separately. Switch models easily, simplify billing, and improve reliability with intelligent routing and automatic failover. Build and scale AI applications faster with one streamlined API platform.
71
-
72
- ----
73
-
74
- <div align="center">
75
-
76
- <a href="https://www.digitalocean.com/?refcode=c10bcb28b846&utm_campaign=Referral_Invite&utm_medium=Referral_Program&utm_source=badge"><img align="middle" src="https://web-platforms.sfo2.cdn.digitaloceanspaces.com/WWW/Badge%202.svg" alt="DigitalOcean Referral Badge" /></a>&nbsp;&nbsp;&nbsp;<a href="https://oss-directory.vercel.app"><img align="middle" src="https://github.com/electerm/electerm-resource/blob/master/static/images/vercel-oss-2005.png?raw=true" alt="Vercel OSS Program" /></a>
77
-
78
- </div>
79
-
80
- <div align="center">
81
- <img src="https://github.com/electerm/electerm-resource/raw/master/static/images/electerm-banner-1.jpg", alt="" />
82
- </div>
83
-
84
- ## Features
85
-
86
- - Works as a terminal/file manager, ssh/sftp/ftp/telnet/serialport/RDP/VNC/Spice client
87
- - Support Window 7+(X64/ARM64), HarmonyOS,Android, iOS, Mac OS 10.15+(x64/arm64), Linux(x64/arm64/Loong64 new world & old world), even old Linux with glibc 2.17+ like UOS/Kylin/Ubuntu 18.04 etc
88
- - Global hotkey to toggle window visibility (similar to guake, default is `ctrl + 2`)
89
- - 🇺🇸 🇨🇳 🇧🇷 🇷🇺 🇪🇸 🇫🇷 🇹🇷 🇭🇰 🇯🇵 🇸🇦 🇩🇪 🇰🇷 🇮🇩 🇵🇱 Multi-language support([electerm-locales](https://github.com/electerm/electerm-locales), contributions/fixes welcome)
90
- - Double click to directly edit (small) remote files.
91
- - All kind of auth methods: publicKey, password, ssh agent, certificates, otp, netbird etc.
92
- - Support Zmodem(rz, sz), and [Trzsz](https://github.com/trzsz/trzsz)(trz/tsz).
93
- - Support ssh related features: tunnel, connection hopping.
94
- - Customizable UI: themes, background image, transparent window(Mac, win).
95
- - Global/session proxy.
96
- - Quick commands/triggers to do predefined tasks and automattic operations
97
- - Sync data including bookmarks to github/gitee secret gist/webdav/custom server/electerm cloud
98
- - Quick input/mirror input to one or all terminals.
99
- - AI assistant integration (supporting multiple LLM API formats — OpenAI Chat Completions, OpenAI Responses, and Anthropic Messages) to help with command suggestions, script writing, and explaining selected terminal content, create bookmarks/themes, and agent mode to directly do terminal operations
100
- - MCP (Model Context Protocol) widget for AI assistants and external tools integration - see [MCP Widget Usage Guide](https://github.com/electerm/electerm/wiki/MCP-Widget-Usage-Guide)
101
- - Deep link support: Open connections with URLs like `telnet://192.168.2.31:34554` or `ssh://user@host:22` - see [Deep link support wiki](https://github.com/electerm/electerm/wiki/Deep-link-support)
102
- - Command line usage: check [wiki](https://github.com/electerm/electerm/wiki/Command-line-usage)
7
+ [![npm version](https://img.shields.io/npm/v/electerm.svg)](https://www.npmjs.com/package/electerm)
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/electerm/electerm-npm/blob/master/LICENSE)
9
+ [![GitHub release](https://badgers.space/github/release/electerm/electerm?corner_radius=m)](https://github.com/electerm/electerm/releases)
103
10
 
104
- ## Install
11
+ [English](https://github.com/electerm/electerm-npm/blob/master/README.md) | [中文](https://github.com/electerm/electerm-npm/blob/master/README_cn.md)
105
12
 
106
- - For Mac user: `brew install --cask electerm`
107
- - With snap: `sudo snap install electerm --classic`
108
- - For some Linux distribution, you can find it from OS default App store(Ubuntu, Deepin, Mint...).
109
- - For some linux OS, the `rpm`, `deb`, or `snap` release may not work, you can try the `tar.gz` or `.appImage` release.
110
- - For Windows users, you can install it from [windows store](https://www.microsoft.com/store/apps/9NCN7272GTFF), command-line installer [winget](https://github.com/microsoft/winget-cli) and [scoop](https://github.com/lukesampson/scoop) is also recommended:
13
+ > This is the **npm installer for electerm**, not the electerm app itself.
14
+ > The app source lives in [electerm/electerm](https://github.com/electerm/electerm).
15
+ > This repo ([electerm/electerm-npm](https://github.com/electerm/electerm-npm)) only contains the npm installer and its publish workflow.
111
16
 
112
- ```powershell
113
- # winget https://github.com/microsoft/winget-cli
114
- winget install electerm.electerm
17
+ ## What is this?
115
18
 
116
- # scoop https://github.com/lukesampson/scoop
117
- scoop bucket add dorado https://github.com/chawyehsu/dorado
118
- scoop install dorado/electerm
119
- ```
19
+ `npm i -g electerm` installs a small installer that detects your OS / CPU architecture, downloads the matching prebuilt electerm binary from [electerm releases](https://github.com/electerm/electerm/releases), and launches it via the `electerm` command.
120
20
 
121
- - Install from Debian repository (for Debian/Ubuntu-based systems) with `apt` command
21
+ The package version always tracks the electerm release version, so `electerm@5.5.16` installs the `v5.5.16` binaries.
122
22
 
123
- Check [https://repos.electerm.org/deb](https://repos.electerm.org/deb)
23
+ ## Install
124
24
 
125
- - Install from npm
25
+ Requirements: Node.js >= 16.
126
26
 
127
27
  ```bash
128
28
  npm i -g electerm
129
-
130
29
  ```
131
30
 
132
- ## Upgrade
31
+ This runs `postinstall` (`node npm/install.js`), which downloads the binary for your platform. No manual download needed.
133
32
 
134
- - Auto upgrade: When a new version is released, you will get an upgrade notification after you start electerm again. You can then click the upgrade button to upgrade.
135
- - Download: Just download the latest edition, reinstall.
136
- - Npm: If you install from npm, just run `npm i -g electerm` again.
137
- - If use Snap or some other distribution system, these systems may provide upgrades.
33
+ If the download fails (network / proxy), you can retry without reinstalling the package:
138
34
 
139
- ## Known issues
35
+ ```bash
36
+ node "$(npm root -g)/electerm/npm/install.js"
37
+ ```
140
38
 
141
- [https://github.com/electerm/electerm/wiki/Know-issues](https://github.com/electerm/electerm/wiki/Know-issues)
39
+ ### Use a GitHub proxy (optional)
142
40
 
143
- ## Troubleshoot
41
+ If `github.com` is slow or blocked, set `GITHUB_PROXY` before installing:
144
42
 
145
- [https://github.com/electerm/electerm/wiki/Troubleshoot](https://github.com/electerm/electerm/wiki/Troubleshoot)
43
+ ```bash
44
+ GITHUB_PROXY=https://your-proxy.example npm i -g electerm
45
+ ```
146
46
 
147
- ## Discussion
47
+ Only `github.com` URLs are proxied.
148
48
 
149
- [![Discord](https://img.shields.io/badge/Discord-Join-blue?logo=discord)](https://discord.gg/855W7g8EVd)
49
+ ## Usage
150
50
 
151
- [Discussion board](https://github.com/electerm/electerm/discussions)
51
+ ```bash
52
+ electerm
53
+ ```
152
54
 
153
- ![electerm-wechat-group-qr.jpg](https://electerm.org/electerm-wechat-group-qr.jpg)
55
+ - macOS: installs `electerm.app` into `/Applications`, then launches `/Applications/electerm.app/Contents/MacOS/electerm`.
56
+ - Windows: launches `<global-node-modules>/electerm/electerm/electerm.exe`.
57
+ - Linux: launches `<global-node-modules>/electerm/electerm/electerm` (adds `--no-sandbox` automatically unless `chrome-sandbox` is root-owned with mode `4755`).
154
58
 
155
- ## Support
59
+ Extra CLI args are passed through to the app, e.g. `electerm --help`.
156
60
 
157
- Would love to hear from you, please tell me what you think, [submit an issue](https://github.com/electerm/electerm/issues), [Start a new discussion](https://github.com/electerm/electerm/discussions/new), [create/fix language files](https://github.com/electerm/electerm-locales) or create pull requests, all welcome.
61
+ ## Upgrade / reinstall / uninstall
158
62
 
159
- ## Sponsor this project
63
+ ```bash
64
+ # upgrade to latest
65
+ npm i -g electerm@latest
160
66
 
161
- github sponsor
67
+ # install a specific version (matches electerm release tag vX.Y.Z)
68
+ npm i -g electerm@5.5.16
162
69
 
163
- [https://github.com/sponsors/electerm](https://github.com/sponsors/electerm)
70
+ # force re-download the binary for the current version
71
+ node "$(npm root -g)/electerm/npm/install.js"
164
72
 
165
- kofi
73
+ # uninstall
74
+ npm rm -g electerm
75
+ ```
166
76
 
167
- [https://ko-fi.com/zhaoxudong](https://ko-fi.com/zhaoxudong)
77
+ On macOS, uninstalling the npm package does not remove `/Applications/electerm.app` — delete it manually if needed.
168
78
 
169
- wechat donate
79
+ ## Supported platforms
170
80
 
171
- [![wechat donate](https://electerm.org/electerm-wechat-donate.png)](https://github.com/electerm)
81
+ | OS | Arch | Asset installed |
82
+ | --- | --- | --- |
83
+ | Windows 10+ | x64, ia32 | `electerm-<ver>-win-x64.tar.gz` |
84
+ | Windows 10+ | arm64 | `electerm-<ver>-win-arm64.tar.gz` |
85
+ | Windows 7 | x64 | `electerm-<ver>-win7.tar.gz` |
86
+ | macOS 11+ | x64 | `electerm-<ver>-mac-x64.dmg` |
87
+ | macOS 11+ | arm64 | `electerm-<ver>-mac-arm64.dmg` |
88
+ | macOS 10.x | x64 | `electerm-<ver>-mac10-x64.dmg` |
89
+ | Linux | x64, arm64, armv7l, loong64 | `electerm-<ver>-linux-<arch>.tar.gz` |
90
+ | Linux (glibc < 2.34) | x64, arm64, armv7l, loong64 | `electerm-<ver>-linux-<arch>-legacy.tar.gz` |
91
+ | Linux | riscv64, ppc64le | `electerm-<ver>-linux-<arch>.tar.gz` (no legacy variant) |
172
92
 
173
- TRON TRN20
93
+ Notes:
174
94
 
175
- [![TRN20 donate](https://github.com/electerm/electerm-resource/blob/master/static/images/trn20.png?raw=true)]
95
+ - 32-bit Node (`ia32`) on a 64-bit host installs the 64-bit build.
96
+ - On Linux with glibc < 2.34 (e.g. UOS / Kylin / Ubuntu 18.04), the `-legacy` (glibc 2.17+) build is picked automatically where published.
97
+ - `riscv64` / `ppc64le` (little-endian only) have no `-legacy` build; the standard build is used even on old glibc.
98
+ - On Linux you may optionally enable the Electron sandbox:
99
+ `sudo chown root:root <pkg>/electerm/chrome-sandbox && sudo chmod 4755 <pkg>/electerm/chrome-sandbox`.
176
100
 
177
- Address: TXk3pQNmQu1vihH76RaEFnK9wg13x4LLCZ
101
+ ## How it works
178
102
 
179
- ## Dev
103
+ 1. `postinstall` reads the latest version from `https://electerm.org/version.html` and the release asset list from `https://electerm.org/data/electerm-github-release.json`.
104
+ 2. It resolves the asset for `os.platform()` / `os.arch()` (plus win7 / mac10 / linux-legacy detection).
105
+ 3. It downloads and extracts it to `<package>/electerm/` (Linux/Windows) or installs the `.app` to `/Applications` (macOS).
106
+ 4. The `electerm` bin script (`npm/electerm`) finds and launches that binary.
180
107
 
181
- ```bash
182
- # May only works in Linux
183
- # needs nodejs/npm, suggest using nvm to install nodejs/npm
184
- # with nodejs 24.x
108
+ Publishing is driven by the electerm release itself via [`npm.yml`](https://github.com/electerm/electerm-npm/blob/master/.github/workflows/npm.yml) — see [CONTRIBUTING.md](https://github.com/electerm/electerm-npm/blob/master/CONTRIBUTING.md).
185
109
 
186
- git clone git@github.com:electerm/electerm.git
187
- cd electerm
188
- npm config set legacy-peer-deps true
189
- npm i
110
+ ## About electerm
190
111
 
191
- # start vite dev server, requires port 5570
192
- npm start
112
+ Electerm is an open-sourced terminal / ssh / sftp / telnet / serialport / RDP / VNC / Spice / ftp client for Linux, Mac, Windows, Android, HarmonyOS and iOS.
193
113
 
194
- # in a separate terminal session run app
195
- npm run app
114
+ It also supports older / special systems: Ubuntu 18, Windows 7, macOS 10+, UOS / Kylin / LoongArch (old-world and new-world), riscv64 and ppc64le Linux.
196
115
 
197
- # code format check
198
- npm run lint
116
+ Highlights (full docs in the [main repo](https://github.com/electerm/electerm)):
199
117
 
200
- # code format fix
201
- npm run fix
202
- ```
203
-
204
- ## Test
118
+ - Terminal + file manager, ssh/sftp/ftp/telnet/serialport/RDP/VNC/Spice
119
+ - Global hotkey to toggle window (`ctrl + 2` by default)
120
+ - Multi-language support ([electerm-locales](https://github.com/electerm/electerm-locales))
121
+ - Public key / password / ssh-agent / certificate / OTP auth, tunnels, jump hosts
122
+ - Zmodem (`rz`/`sz`) and [trzsz](https://github.com/trzsz/trzsz) (`trz`/`tsz`)
123
+ - Themes, transparency, background image
124
+ - Global / session proxy, quick commands, sync via gist / webdav / electerm cloud
125
+ - AI assistant, MCP widget, deep links (`ssh://`, `telnet://`), CLI usage
205
126
 
206
- ```bash
207
- npm run b
208
- npm run prepare-test
209
- cp ./build/.sample.env ./.env
127
+ Related links / projects:
210
128
 
211
- # edit .env, fill your test host/username/password, may only works in mac OS
212
- npm run test
213
- ```
129
+ - [Homepage / downloads](https://electerm.org) · [Releases](https://github.com/electerm/electerm/releases) · [Videos](https://electerm.org/videos)
130
+ - [Theme](https://theme.electerm.org) · [Docker](https://github.com/electerm/electerm-web-docker) · [Online demo](https://demo.electerm.org)
131
+ - [Android](https://github.com/electerm/electerm-android) · [HarmonyOS](https://github.com/electerm/electerm-harmony) · [Web version](https://github.com/electerm/electerm-web)
132
+ - [electerm online](https://cloud.electerm.org) · [electerm AI](https://ai.electerm.org)
133
+ - [Apple App Store](https://apps.apple.com/cn/app/electerm/id6792971552) · [Huawei AppGallery](https://appgallery.huawei.com/app/detail?id=org.electerm.electerm) · [Microsoft Store](https://www.microsoft.com/store/apps/9NCN7272GTFF) · [Snap Store](https://snapcraft.io/electerm)
134
+ - [deb repo](https://repos.electerm.org/deb) · [rpm repo](https://repos.electerm.org/rpm)
214
135
 
215
- ## Test build
136
+ ## Issues / support
216
137
 
217
- ```bash
218
- # May only works in Linux
219
- # Install yarn first(to do yarn autoclean)
220
- # See https://yarnpkg.com/en/docs/install
221
-
222
- # Build linux only with -l
223
- npm i
224
- npm run b
225
- npm run pb
226
- ./node_modules/.bin/electron-builder --linux tar.gz
227
- # or replace tar.gz to rpm/deb/AppImage
228
- # check dist/ folder
229
-
230
- # build for linux arm/
231
- ./node_modules/.bin/electron-builder --linux --arm64
232
- ```
138
+ - Installer problems (`npm i -g electerm` fails, wrong binary, launch failure): open an issue in [electerm-npm](https://github.com/electerm/electerm-npm/issues).
139
+ - App bugs / feature requests: open an issue in [electerm/electerm](https://github.com/electerm/electerm/issues) or start a [discussion](https://github.com/electerm/electerm/discussions).
140
+ - Language files: [electerm-locales](https://github.com/electerm/electerm-locales).
233
141
 
234
- ## Video guide
142
+ ## Contributing
235
143
 
236
- - [https://electerm.org/videos](https://electerm.org/videos)
144
+ This repo only holds the installer (`npm/`) and the publish workflow. See [CONTRIBUTING.md](https://github.com/electerm/electerm-npm/blob/master/CONTRIBUTING.md) for layout, tests (`npm test`, `npm run test-network`, `npm run pack-check`) and the release-driven publishing flow.
237
145
 
238
146
  ## Change log
239
147
 
240
- Visit [Releases](https://github.com/electerm/electerm/releases).
241
-
242
- ## Contact author
243
-
244
- [zxdong@gmail.com](mailto:zxdong@gmail.com)
245
-
148
+ See [electerm releases](https://github.com/electerm/electerm/releases) — the npm version tracks it 1:1.
246
149
 
247
150
  ## License
248
151
 
249
152
  MIT
250
-
251
- ## Star History
252
-
253
- <p>
254
- <a href="https://www.star-history.com/electerm/electerm"><img src="https://api.star-history.com/badge?repo=electerm/electerm" alt="Star History Rank" /></a>
255
- </p>
256
-
257
- <a href="https://www.star-history.com/?repos=electerm%2Felecterm&type=date&legend=top-left">
258
- <picture>
259
- <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=electerm/electerm&type=date&legend=top-left&sealed_token=DvPlttPaLtq6RPIWRANYX08-8ZJyrJalhombrkDcg1IwWOMPMIplgi85q0FiwrbhE3lRIi_yxvOWdell731CGQvzlfJMt2Sa6VfCvQ80BwEtQ6RpPchEiw" />
260
- <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=electerm/electerm&type=date&legend=top-left&sealed_token=DvPlttPaLtq6RPIWRANYX08-8ZJyrJalhombrkDcg1IwWOMPMIplgi85q0FiwrbhE3lRIi_yxvOWdell731CGQvzlfJMt2Sa6VfCvQ80BwEtQ6RpPchEiw" />
261
- <img alt="Star History Chart" src="https://api.star-history.com/chart?repos=electerm/electerm&type=date&legend=top-left&sealed_token=DvPlttPaLtq6RPIWRANYX08-8ZJyrJalhombrkDcg1IwWOMPMIplgi85q0FiwrbhE3lRIi_yxvOWdell731CGQvzlfJMt2Sa6VfCvQ80BwEtQ6RpPchEiw" />
262
- </picture>
263
- </a>
package/README_cn.md ADDED
@@ -0,0 +1,152 @@
1
+ <h1 align="center" style="padding-top: 60px;padding-bottom: 40px;">
2
+ <a href="https://electerm.org">
3
+ <img src="https://github.com/electerm/electerm-resource/raw/master/static/images/electerm.png" alt="electerm" />
4
+ </a>
5
+ </h1>
6
+
7
+ [![npm version](https://img.shields.io/npm/v/electerm.svg)](https://www.npmjs.com/package/electerm)
8
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/electerm/electerm-npm/blob/master/LICENSE)
9
+ [![GitHub release](https://badgers.space/github/release/electerm/electerm?corner_radius=m)](https://github.com/electerm/electerm/releases)
10
+
11
+ [English](https://github.com/electerm/electerm-npm/blob/master/README.md) | [中文](https://github.com/electerm/electerm-npm/blob/master/README_cn.md)
12
+
13
+ > 这是 **electerm 的 npm 安装器**,不是 electerm 应用本身。
14
+ > 应用源码在 [electerm/electerm](https://github.com/electerm/electerm)。
15
+ > 本仓库([electerm/electerm-npm](https://github.com/electerm/electerm-npm))只包含 npm 安装器和发布流程。
16
+
17
+ ## 这是什么?
18
+
19
+ `npm i -g electerm` 会安装一个小安装器:自动识别你的操作系统 / CPU 架构,从 [electerm releases](https://github.com/electerm/electerm/releases) 下载对应的预编译二进制包,并通过 `electerm` 命令启动。
20
+
21
+ 包版本与 electerm 发行版版本一一对应,例如 `electerm@5.5.16` 安装的就是 `v5.5.16` 的二进制包。
22
+
23
+ ## 安装
24
+
25
+ 要求:Node.js >= 16。
26
+
27
+ ```bash
28
+ npm i -g electerm
29
+ ```
30
+
31
+ 安装过程会自动执行 `postinstall`(`node npm/install.js`)下载对应平台的二进制包,无需手动下载。
32
+
33
+ 如果下载失败(网络 / 代理问题),无需重装包,直接重试即可:
34
+
35
+ ```bash
36
+ node "$(npm root -g)/electerm/npm/install.js"
37
+ ```
38
+
39
+ ### 使用 GitHub 代理(可选)
40
+
41
+ 如果 `github.com` 访问缓慢或被屏蔽,可在安装前设置 `GITHUB_PROXY`:
42
+
43
+ ```bash
44
+ GITHUB_PROXY=https://your-proxy.example npm i -g electerm
45
+ ```
46
+
47
+ 只有 `github.com` 的 URL 会走代理。
48
+
49
+ ## 使用
50
+
51
+ ```bash
52
+ electerm
53
+ ```
54
+
55
+ - macOS:把 `electerm.app` 安装到 `/Applications`,然后启动 `/Applications/electerm.app/Contents/MacOS/electerm`。
56
+ - Windows:启动 `<global-node-modules>/electerm/electerm/electerm.exe`。
57
+ - Linux:启动 `<global-node-modules>/electerm/electerm/electerm`(除非 `chrome-sandbox` 已是 root 属主且权限为 `4755`,否则会自动加上 `--no-sandbox`)。
58
+
59
+ 多余的命令行参数会透传给应用,例如 `electerm --help`。
60
+
61
+ ## 升级 / 重装 / 卸载
62
+
63
+ ```bash
64
+ # 升级到最新版
65
+ npm i -g electerm@latest
66
+
67
+ # 安装指定版本(对应 electerm 发行版 tag vX.Y.Z)
68
+ npm i -g electerm@5.5.16
69
+
70
+ # 强制重新下载当前版本的二进制包
71
+ node "$(npm root -g)/electerm/npm/install.js"
72
+
73
+ # 卸载
74
+ npm rm -g electerm
75
+ ```
76
+
77
+ macOS 上卸载 npm 包不会删除 `/Applications/electerm.app`,如需删除请手动处理。
78
+
79
+ ## 支持的平台
80
+
81
+ | 系统 | 架构 | 安装的包 |
82
+ | --- | --- | --- |
83
+ | Windows 10+ | x64, ia32 | `electerm-<ver>-win-x64.tar.gz` |
84
+ | Windows 10+ | arm64 | `electerm-<ver>-win-arm64.tar.gz` |
85
+ | Windows 7 | x64 | `electerm-<ver>-win7.tar.gz` |
86
+ | macOS 11+ | x64 | `electerm-<ver>-mac-x64.dmg` |
87
+ | macOS 11+ | arm64 | `electerm-<ver>-mac-arm64.dmg` |
88
+ | macOS 10.x | x64 | `electerm-<ver>-mac10-x64.dmg` |
89
+ | Linux | x64, arm64, armv7l, loong64 | `electerm-<ver>-linux-<arch>.tar.gz` |
90
+ | Linux(glibc < 2.34) | x64, arm64, armv7l, loong64 | `electerm-<ver>-linux-<arch>-legacy.tar.gz` |
91
+ | Linux | riscv64, ppc64le | `electerm-<ver>-linux-<arch>.tar.gz`(无 legacy 版本) |
92
+
93
+ 说明:
94
+
95
+ - 64 位机器上的 32 位 Node(`ia32`)会安装 64 位构建。
96
+ - glibc < 2.34 的 Linux(如 UOS / 麒麟 / Ubuntu 18.04),在有 `-legacy`(glibc 2.17+)构建时会自动选用。
97
+ - `riscv64` / `ppc64le`(仅小端)没有 `-legacy` 构建,即使是旧 glibc 也会用标准构建。
98
+ - Linux 可选开启 Electron sandbox:
99
+ `sudo chown root:root <pkg>/electerm/chrome-sandbox && sudo chmod 4755 <pkg>/electerm/chrome-sandbox`。
100
+
101
+ ## 工作原理
102
+
103
+ 1. `postinstall` 从 `https://electerm.org/version.html` 读取最新版本,从 `https://electerm.org/data/electerm-github-release.json` 读取发行版资源列表。
104
+ 2. 根据 `os.platform()` / `os.arch()`(外加 win7 / mac10 / linux-legacy 识别)确定要下载的资源。
105
+ 3. 下载并解压到 `<package>/electerm/`(Linux/Windows),macOS 则把 `.app` 安装到 `/Applications`。
106
+ 4. `electerm` 可执行脚本(`npm/electerm`)负责找到并启动该二进制文件。
107
+
108
+ 发布由 electerm 发行版自动触发([`npm.yml`](https://github.com/electerm/electerm-npm/blob/master/.github/workflows/npm.yml)),详见 [CONTRIBUTING.md](https://github.com/electerm/electerm-npm/blob/master/CONTRIBUTING.md)。
109
+
110
+ ## 关于 electerm
111
+
112
+ Electerm 是开源的 terminal / ssh / sftp / telnet / serialport / RDP / VNC / Spice / ftp 客户端,支持 Linux、Mac、Windows、Android、HarmonyOS 和 iOS。
113
+
114
+ 同时支持老旧 / 特殊系统:Ubuntu 18、Windows 7、macOS 10+、UOS / 麒麟 / 龙芯 LoongArch(新世界和旧世界)、riscv64 和 ppc64le Linux。
115
+
116
+ 主要特性(完整文档见[主仓库](https://github.com/electerm/electerm)):
117
+
118
+ - 终端 + 文件管理,ssh/sftp/ftp/telnet/serialport/RDP/VNC/Spice
119
+ - 全局快捷键切换窗口(默认 `ctrl + 2`)
120
+ - 多语言支持([electerm-locales](https://github.com/electerm/electerm-locales))
121
+ - 公钥 / 密码 / ssh-agent / 证书 / OTP 登录,隧道、跳板机
122
+ - Zmodem(`rz`/`sz`)与 [trzsz](https://github.com/trzsz/trzsz)(`trz`/`tsz`)
123
+ - 主题、透明窗口、背景图
124
+ - 全局 / 会话代理、快捷命令、经 gist / webdav / electerm cloud 同步
125
+ - AI 助手、MCP 组件、deep link(`ssh://`、`telnet://`)、命令行用法
126
+
127
+ 相关链接 / 项目:
128
+
129
+ - [官网 / 下载](https://electerm.org) · [Releases](https://github.com/electerm/electerm/releases) · [视频教程](https://electerm.org/videos)
130
+ - [主题](https://theme.electerm.org) · [Docker](https://github.com/electerm/electerm-web-docker) · [在线演示](https://demo.electerm.org)
131
+ - [Android](https://github.com/electerm/electerm-android) · [HarmonyOS](https://github.com/electerm/electerm-harmony) · [网页版](https://github.com/electerm/electerm-web)
132
+ - [electerm online](https://cloud.electerm.org) · [electerm AI](https://ai.electerm.org)
133
+ - [Apple App Store](https://apps.apple.com/cn/app/electerm/id6792971552) · [华为应用市场](https://appgallery.huawei.com/app/detail?id=org.electerm.electerm) · [Microsoft Store](https://www.microsoft.com/store/apps/9NCN7272GTFF) · [Snap Store](https://snapcraft.io/electerm)
134
+ - [deb 源](https://repos.electerm.org/deb) · [rpm 源](https://repos.electerm.org/rpm)
135
+
136
+ ## 问题反馈 / 支持
137
+
138
+ - 安装器问题(`npm i -g electerm` 失败、下错二进制、启动失败):请提 issue 到 [electerm-npm](https://github.com/electerm/electerm-npm/issues)。
139
+ - 应用本身的 bug / 功能建议:请提 issue 到 [electerm/electerm](https://github.com/electerm/electerm/issues),或发起 [discussion](https://github.com/electerm/electerm/discussions)。
140
+ - 语言文件:[electerm-locales](https://github.com/electerm/electerm-locales)。
141
+
142
+ ## 参与贡献
143
+
144
+ 本仓库只放安装器(`npm/`)和发布流程。目录结构、测试(`npm test`、`npm run test-network`、`npm run pack-check`)与发行版驱动的发布流程见 [CONTRIBUTING.md](https://github.com/electerm/electerm-npm/blob/master/CONTRIBUTING.md)。
145
+
146
+ ## 更新日志
147
+
148
+ 见 [electerm releases](https://github.com/electerm/electerm/releases) —— npm 版本与之 1:1 对应。
149
+
150
+ ## License
151
+
152
+ MIT
package/npm/install.js CHANGED
@@ -17,7 +17,29 @@ const { phin, download, extractTarGz, GITHUB_PROXY, applyProxy } = require('./ut
17
17
 
18
18
  const plat = os.platform()
19
19
  const arch = os.arch()
20
- const { homepage } = require('../package.json')
20
+
21
+ /**
22
+ * In the published package this file is at <pkg>/npm/install.js so the manifest
23
+ * is one level up. In this repo the layout is identical (npm/install.js next to
24
+ * the root manifest), so the first candidate is the one that resolves. The
25
+ * second is kept for checkouts that nest the installer deeper. Look in both so
26
+ * the installer can be required (and tested) straight from the repo.
27
+ */
28
+ function readHomepage () {
29
+ for (const p of ['../package.json', '../../package.json']) {
30
+ try {
31
+ const { homepage } = require(p)
32
+ if (homepage) {
33
+ return homepage
34
+ }
35
+ } catch (e) {
36
+ // not here, try the next location
37
+ }
38
+ }
39
+ return 'https://electerm.org'
40
+ }
41
+
42
+ const homepage = readHomepage()
21
43
 
22
44
  const releaseInfoUrl = `${homepage}/data/electerm-github-release.json?_=${+new Date()}`
23
45
  const versionUrl = `${homepage}/version.html?_=${+new Date()}`
@@ -120,6 +142,111 @@ function isLinuxLegacy (platform) {
120
142
  }
121
143
  }
122
144
 
145
+ // ---------------------------------------------------------------------------
146
+ // Architecture -> release asset resolution
147
+ // ---------------------------------------------------------------------------
148
+
149
+ // Every Linux release asset we can install, keyed by `os.arch()`.
150
+ //
151
+ // `legacy: true` means a `-legacy` variant (glibc 2.17+) is published as well.
152
+ // riscv64 and ppc64le have no legacy variant on purpose: the Electron runtime
153
+ // for those architectures is only published built against a newer glibc, so
154
+ // there is nothing to fall back to and the legacy flag must be ignored there
155
+ // instead of producing a `linux-riscv64-legacy.tar.gz` that does not exist.
156
+ //
157
+ // `ia32` (32-bit node on a 64-bit host) maps to x64 on purpose: the kernel runs
158
+ // the 64-bit build fine, and electron has no 32-bit build any more.
159
+ const LINUX_TARGETS = {
160
+ x64: { name: 'linux-x64', legacy: true },
161
+ ia32: { name: 'linux-x64', legacy: true },
162
+ arm64: { name: 'linux-arm64', legacy: true },
163
+ aarch64: { name: 'linux-arm64', legacy: true },
164
+ arm: { name: 'linux-armv7l', legacy: true },
165
+ armv7l: { name: 'linux-armv7l', legacy: true },
166
+ loong64: { name: 'linux-loong64', legacy: true },
167
+ riscv64: { name: 'linux-riscv64', legacy: false },
168
+ ppc64le: { name: 'linux-ppc64le', legacy: false },
169
+ // node reports `ppc64` for both endiannesses, we only publish little endian
170
+ ppc64: { name: 'linux-ppc64le', legacy: false, littleEndianOnly: true }
171
+ }
172
+
173
+ const SUPPORTED_LINUX_ARCHES = Object.keys(LINUX_TARGETS).sort().join(', ')
174
+
175
+ /**
176
+ * Resolve the release asset to install for the running platform/arch.
177
+ *
178
+ * @param {string} platform - os.platform()
179
+ * @param {string} arch - os.arch()
180
+ * @param {object} options
181
+ * @param {boolean} options.win7 - Windows 7 or earlier detected
182
+ * @param {boolean} options.mac10 - macOS 10.x detected
183
+ * @param {boolean} options.legacy - Linux with glibc < 2.34 detected
184
+ * @param {string} options.endianness - os.endianness(), only used for ppc64
185
+ * @returns {{type: string, filePattern: string, legacyUnavailable?: boolean}|{type: 'unsupported', reason: string}}
186
+ */
187
+ function getDownloadTarget (platform, arch, options = {}) {
188
+ const {
189
+ win7,
190
+ mac10,
191
+ legacy,
192
+ endianness = os.endianness()
193
+ } = options
194
+
195
+ if (platform === 'win32') {
196
+ if (win7) {
197
+ return { type: 'win7', filePattern: 'win7.tar.gz' }
198
+ }
199
+ if (arch === 'arm64') {
200
+ return { type: 'win-arm64', filePattern: 'win-arm64.tar.gz' }
201
+ }
202
+ if (arch === 'x64' || arch === 'ia32') {
203
+ return { type: 'win-x64', filePattern: 'win-x64.tar.gz' }
204
+ }
205
+ return { type: 'unsupported', reason: `Windows on "${arch}" is not supported` }
206
+ }
207
+
208
+ if (platform === 'darwin') {
209
+ if (mac10) {
210
+ return { type: 'mac10-x64', filePattern: 'mac10-x64.dmg' }
211
+ }
212
+ if (arch === 'arm64') {
213
+ return { type: 'mac-arm64', filePattern: 'mac-arm64.dmg' }
214
+ }
215
+ if (arch === 'x64' || arch === 'ia32') {
216
+ return { type: 'mac-x64', filePattern: 'mac-x64.dmg' }
217
+ }
218
+ return { type: 'unsupported', reason: `macOS on "${arch}" is not supported` }
219
+ }
220
+
221
+ if (platform === 'linux') {
222
+ const entry = LINUX_TARGETS[arch]
223
+ if (!entry) {
224
+ return {
225
+ type: 'unsupported',
226
+ reason: `Linux architecture "${arch}" is not supported (supported: ${SUPPORTED_LINUX_ARCHES})`
227
+ }
228
+ }
229
+ if (entry.littleEndianOnly && endianness === 'BE') {
230
+ return {
231
+ type: 'unsupported',
232
+ reason: `Linux ${arch} big-endian is not supported, only little-endian (ppc64le) builds are published`
233
+ }
234
+ }
235
+ const useLegacy = !!legacy && entry.legacy
236
+ const type = useLegacy ? `${entry.name}-legacy` : entry.name
237
+ const result = {
238
+ type,
239
+ filePattern: `${type}.tar.gz`
240
+ }
241
+ if (legacy && !entry.legacy) {
242
+ result.legacyUnavailable = true
243
+ }
244
+ return result
245
+ }
246
+
247
+ return { type: 'unsupported', reason: `Platform "${platform}" is not supported` }
248
+ }
249
+
123
250
  // ---------------------------------------------------------------------------
124
251
  // Launch the extracted binary
125
252
  // ---------------------------------------------------------------------------
@@ -160,7 +287,7 @@ async function runLinux (folderName, filePattern) {
160
287
  rm('-rf', [target, extractDir])
161
288
 
162
289
  console.log(' Fetching release info...')
163
- const releaseInfo = await getReleaseInfo(r => r.name.includes(filePattern))
290
+ const releaseInfo = await getReleaseInfo(r => r.name.endsWith(filePattern))
164
291
  if (!releaseInfo) {
165
292
  throw new Error(`No release found for pattern: ${filePattern}`)
166
293
  }
@@ -471,7 +598,7 @@ async function main () {
471
598
  console.log('========================================')
472
599
  console.log('electerm binary installer')
473
600
  console.log('========================================')
474
- console.log(`Platform: ${plat}, Architecture: ${arch}`)
601
+ console.log(`Platform: ${plat}, Architecture: ${arch}${os.endianness() === 'BE' ? ' (big-endian)' : ''}`)
475
602
 
476
603
  if (GITHUB_PROXY) {
477
604
  console.log(`GitHub Proxy: ${GITHUB_PROXY}`)
@@ -491,10 +618,24 @@ async function main () {
491
618
  console.log(' Fetching release information...')
492
619
 
493
620
  try {
621
+ const target = getDownloadTarget(plat, arch, {
622
+ win7,
623
+ mac10,
624
+ legacy: linuxLegacy
625
+ })
626
+
627
+ if (target.type === 'unsupported') {
628
+ throw new Error(target.reason)
629
+ }
630
+
631
+ if (target.legacyUnavailable) {
632
+ console.log(` Note: no -legacy build is published for ${arch}, installing the standard build`)
633
+ }
634
+
494
635
  if (plat === 'win32') {
495
636
  if (win7) {
496
637
  await runWin7()
497
- } else if (arch === 'arm64') {
638
+ } else if (target.type === 'win-arm64') {
498
639
  await runWin('arm64')
499
640
  } else {
500
641
  await runWin('x64')
@@ -502,26 +643,13 @@ async function main () {
502
643
  } else if (plat === 'darwin') {
503
644
  if (mac10) {
504
645
  await runMac10()
505
- } else if (arch === 'arm64') {
646
+ } else if (target.type === 'mac-arm64') {
506
647
  await runMac('arm64')
507
648
  } else {
508
649
  await runMac('x64')
509
650
  }
510
- } else if (plat === 'linux') {
511
- const suffix = linuxLegacy ? '-legacy' : ''
512
- if (arch === 'arm64' || arch === 'aarch64') {
513
- await runLinux(`linux-arm64${suffix}`, `linux-arm64${suffix}.tar.gz`)
514
- } else if (arch === 'arm') {
515
- await runLinux(`linux-armv7l${suffix}`, `linux-armv7l${suffix}.tar.gz`)
516
- } else if (arch.includes('loong')) {
517
- await runLinux(`linux-loong64${suffix}`, `linux-loong64${suffix}.tar.gz`)
518
- } else if (arch === 'riscv64' || arch.includes('riscv')) {
519
- await runLinux(`linux-riscv64${suffix}`, `linux-riscv64${suffix}.tar.gz`)
520
- } else {
521
- await runLinux(`linux-x64${suffix}`, `linux-x64${suffix}.tar.gz`)
522
- }
523
651
  } else {
524
- throw new Error(`Platform "${plat}" is not supported.`)
652
+ await runLinux(target.type, target.filePattern)
525
653
  }
526
654
  } catch (err) {
527
655
  console.error('')
@@ -546,10 +674,12 @@ module.exports = {
546
674
  isWindows7OrEarlier,
547
675
  isMacOS10,
548
676
  isLinuxLegacy,
677
+ getDownloadTarget,
549
678
  sanitizeVersion,
550
679
  sanitizeFilename,
551
680
  getElectermExePath,
552
681
  isElectermExtracted,
682
+ LINUX_TARGETS,
553
683
  // Expose for test injection
554
684
  _packageRoot: packageRoot,
555
685
  _extractDir: extractDir
package/package.json CHANGED
@@ -1,17 +1,21 @@
1
1
  {
2
2
  "name": "electerm",
3
- "version": "5.5.15",
3
+ "version": "5.5.35",
4
4
  "description": "Terminal/ssh/telnet/serialport/sftp client(linux, mac, win)",
5
- "main": "app.js",
6
5
  "bin": "npm/electerm",
7
6
  "scripts": {
8
7
  "postinstall": "node npm/install.js",
9
- "postpublish": "node build/bin/postpublish.js"
8
+ "test": "node --test test/npm-install-target.spec.js",
9
+ "test-network": "node test/npm-install2.spec.js",
10
+ "lint": "./node_modules/.bin/standard --verbose",
11
+ "fix": "./node_modules/.bin/standard --fix",
12
+ "pack-check": "npm pack --dry-run"
10
13
  },
11
14
  "license": "MIT",
15
+ "homepage": "https://electerm.org",
12
16
  "repository": {
13
17
  "type": "git",
14
- "url": "git+https://github.com/electerm/electerm.git"
18
+ "url": "git+https://github.com/electerm/electerm-npm.git"
15
19
  },
16
20
  "author": {
17
21
  "name": "ZHAO Xudong",
@@ -19,43 +23,33 @@
19
23
  "url": "https://github.com/zxdong262"
20
24
  },
21
25
  "bugs": {
22
- "url": "https://github.com/electerm/electerm/issues"
26
+ "url": "https://github.com/electerm/electerm-npm/issues"
23
27
  },
24
- "homepage": "https://electerm.org",
28
+ "releases": "https://github.com/electerm/electerm/releases",
25
29
  "engines": {
26
30
  "node": ">=16.0.0"
27
31
  },
28
32
  "preferGlobal": true,
29
- "dependencies": {
30
- "tar": "*"
31
- },
32
- "overrides": {
33
- "ip-address": "^10.3.1",
34
- "qs": "^6.16.0",
35
- "body-parser": "^2.3.0",
36
- "form-data": "^4.0.6",
37
- "fast-uri": "^3.1.6",
38
- "js-yaml": "^4.3.2",
39
- "@xmldom/xmldom": "^0.8.15",
40
- "browserslist": "^4.28.7",
41
- "baseline-browser-mapping": "^2.11.0",
42
- "postcss": "^8.5.23",
43
- "glob": {
44
- "minimatch": {
45
- "brace-expansion": "^5.0.7"
46
- }
47
- }
33
+ "publishConfig": {
34
+ "access": "public"
48
35
  },
49
36
  "files": [
50
37
  "npm",
51
38
  "README.md",
39
+ "README_cn.md",
52
40
  "LICENSE"
53
41
  ],
54
- "allowScripts": {
55
- "@serialport/bindings-cpp@13.0.0": true,
56
- "node-pty@1.2.0-beta.15": true
42
+ "dependencies": {
43
+ "shelljs": "^0.8.5",
44
+ "tar": "^7.5.21"
57
45
  },
58
46
  "devDependencies": {
59
- "shelljs": "^0.10.0"
47
+ "standard": "^17.1.2"
48
+ },
49
+ "standard": {
50
+ "ignore": [
51
+ "/electerm",
52
+ "/node_modules"
53
+ ]
60
54
  }
61
55
  }