chattransfer 0.0.0-stage → 2.0.11

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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.ar.md +208 -0
  3. package/README.md +207 -2
  4. package/README.zh-CN.md +208 -0
  5. package/bin/chattransfer.js +41 -0
  6. package/frontend/README.md +5 -0
  7. package/frontend/dist/assets/browser-CjtO9Bzi.js +8 -0
  8. package/frontend/dist/assets/index-CiTzjW7h.js +976 -0
  9. package/frontend/dist/assets/index-Dw5X-Gok.css +1 -0
  10. package/frontend/dist/assets/logo-DQUxWwh1.png +0 -0
  11. package/frontend/dist/index.html +14 -0
  12. package/frontend/dist/pin.svg +1 -0
  13. package/frontend/dist/vite.svg +1 -0
  14. package/package.json +62 -4
  15. package/server/cli-options.js +69 -0
  16. package/server/config/loader.js +36 -0
  17. package/server/config.js +63 -0
  18. package/server/index.js +132 -0
  19. package/server/room-manager.js +75 -0
  20. package/server/routes/checkLogin.js +24 -0
  21. package/server/routes/files.js +49 -0
  22. package/server/routes/geneBUserQR.js +37 -0
  23. package/server/routes/geneQR.js +39 -0
  24. package/server/routes/getHomeDir.js +27 -0
  25. package/server/routes/getIndexInfo.js +42 -0
  26. package/server/routes/getIndexInfo2.js +42 -0
  27. package/server/routes/index.js +36 -0
  28. package/server/routes/openCachePath.js +63 -0
  29. package/server/routes/qr.js +63 -0
  30. package/server/routes/scanLogin.js +33 -0
  31. package/server/routes/session.js +15 -0
  32. package/server/routes/setCachePath.js +94 -0
  33. package/server/routes/system.js +107 -0
  34. package/server/services/message-history-service.js +476 -0
  35. package/server/services/message-service.js +31 -0
  36. package/server/socket/index.js +232 -0
  37. package/server/socket/session-manager.js +3 -0
  38. package/server/telemetry/amplitude-provider.js +17 -0
  39. package/server/telemetry/compat.js +17 -0
  40. package/server/telemetry/index.js +26 -0
  41. package/server/telemetry/noop-provider.js +7 -0
  42. package/server/tool.js +71 -0
  43. package/server/utils/app-root.js +11 -0
  44. package/server/utils/network.js +21 -0
  45. package/server/utils/request-url.js +15 -0
  46. package/server/utils/runtime-options.js +90 -0
  47. package/server/utils/runtime-paths.js +87 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 suncx and ChatTransfer Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.ar.md ADDED
@@ -0,0 +1,208 @@
1
+ # ChatTransfer
2
+
3
+ [![GitHub Downloads](https://img.shields.io/github/downloads/turboxing/ChatTransfer/total?style=flat-square&logo=github&color=44cc11)](https://github.com/turboxing/ChatTransfer/releases)
4
+ [![GitHub Release](https://img.shields.io/github/v/release/turboxing/ChatTransfer?style=flat-square&color=fe7d37)](https://github.com/turboxing/ChatTransfer/releases)
5
+ [![GitHub last commit](https://img.shields.io/github/last-commit/turboxing/ChatTransfer?style=flat-square&color=a4a61d)](https://github.com/turboxing/ChatTransfer/commits/main)
6
+ [![GitHub stars](https://img.shields.io/github/stars/turboxing/ChatTransfer?style=flat-square&color=dfb317)](https://github.com/turboxing/ChatTransfer/stargazers)
7
+ [![MIT License](https://img.shields.io/github/license/turboxing/ChatTransfer?style=flat-square&color=007ec6)](./LICENSE)
8
+
9
+ [English](./README.md) | [简体中文](./README.zh-CN.md) | العربية
10
+
11
+ > أداة بسيطة للدردشة ونقل الملفات عبر الشبكة المحلية، موجهة للمطورين والمختبرين والفرق الصغيرة. امسح رمز QR، افتح المتصفح، وشارك النصوص والصور والملفات فورًا — بدون حسابات أو رفع سحابي أو تطبيقات إضافية.
12
+
13
+ ## عرض توضيحي
14
+
15
+ - [عرض على YouTube](https://www.youtube.com/watch?v=gZxeBqd7vbY)
16
+ - [عرض على Bilibili](https://www.bilibili.com/video/BV13QJp6vE3r/?vd_source=b4939bcf1ffecbca608b946bbdd9c475)
17
+
18
+ ## لماذا ChatTransfer
19
+
20
+ أنا مهندس اختبار. في عملي اليومي، أنقل باستمرار الأشياء بين الكمبيوتر وهواتف الاختبار: حزم التثبيت ومعاملات الاختبار والروابط تذهب إلى الهاتف، والسجلات ولقطات الشاشة وتسجيلات الشاشة تعود إلى الكمبيوتر. كثيرًا ما يسألني زملائي:
21
+
22
+ - “كيف أنقل تسجيل الشاشة إلى الكمبيوتر؟”
23
+ - “هل يجب أن أجهّز أدوات تطوير لتثبيت حزمة الاختبار على الهاتف؟”
24
+ - “هل يمكن تحويل هذه الصورة إلى رابط؟”
25
+ - “هل يمكن تحويل هذا الرابط إلى رمز QR؟”
26
+
27
+ تبدو هذه أمورًا صغيرة، لكنها تستهلك أكبر وقت عندما تكون مطلوبة فورًا. أريد أن يجعل ChatTransfer لحظات “المشاركة السريعة” بسيطة قدر الإمكان.
28
+
29
+ هذه الاحتياجات دائمًا “مؤقتة”، لكن الحلول المعتادة ثقيلة: تثبيت تطبيق مراسلة، تسجيل الدخول، الرفع إلى منصة خارجية، القلق على الخصوصية بعد المشاركة، إلغاء التثبيت، وإعادة ضبط هواتف الاختبار المستعارة. بعد تكرار هذه الدورة مرات كثيرة، طوّرت ChatTransfer في عطلة الأسبوع: أداة نقل عبر الشبكة المحلية، متعددة المنصات، بدون تثبيت، وتُستخدم ثم تُترك، تجعل المشاركة المؤقتة بين الأجهزة بسيطة وقابلة للتحكم وخفيفة. بعد قرابة 3 سنوات من التطوير، أثبت ChatTransfer فعاليته في العديد من السيناريوهات الواقعية، لذلك قررت مشاركته هنا.
30
+
31
+ أستخدمه يوميًا وأطوّره باستمرار بناءً على سيناريوهات واقعية. سيبقى مجانيًا. إذا واجهت مشكلة أو لديك فكرة أفضل، افتح Issue في هذا المستودع؛ ملاحظاتك تساعده على التطور.
32
+
33
+ ## الميزات
34
+
35
+ - **امسح للاتصال** — يتم إنشاء رمز QR عند بدء التشغيل، ويمكنك فتح المحادثة في متصفح الهاتف.
36
+ - **دردشة جماعية فورية** — عدة مستخدمين في نفس الغرفة المحلية مع مزامنة فورية.
37
+ - **نقل الملفات** — إرسال نصوص وصور وملفات في ثوانٍ.
38
+ - **رفع مجمّع** — اسحب وأفلت عدة ملفات دفعة واحدة.
39
+ - **تثبيت وإبراز الرسائل** — إبقاء الرسائل المهمة ظاهرة.
40
+ - **رمز QR للرسائل** — تحويل أي رسالة إلى رمز QR لسهولة المشاركة.
41
+ - **سجل محادثات محلي** — تخزين مؤقت محلي مع إمكانية المسح.
42
+ - **متعدد المنصات** — يدعم Windows و macOS.
43
+ - **واجهة متعددة اللغات** — الصينية والإنجليزية.
44
+
45
+ ## حالات الاستخدام
46
+
47
+ - **كمبيوتر ↔ كمبيوتر** — مشاركة السجلات وملفات الإعداد وحزم الاختبار ولقطات الشاشة والروابط.
48
+ - **كمبيوتر ↔ هاتف** — إرسال روابط التصحيح ورموز QR ولقطات الشاشة إلى الهاتف، وإعادة الصور والتسجيلات إلى الكمبيوتر.
49
+ - **هاتف ↔ هاتف** — مشاركة سريعة داخل فريق صغير دون تثبيت تطبيق مراسلة آخر.
50
+ - **عروض مباشرة** — توزيع المواد فورًا أثناء الاجتماعات.
51
+
52
+ ## التحميل والتثبيت
53
+
54
+ حمّل أحدث ملف تنفيذي من صفحة [الإصدارات](https://github.com/turboxing/ChatTransfer/releases).
55
+
56
+ ### npm
57
+
58
+ إذا كنت تستخدم Node.js 20 أو أحدث، يمكنك تشغيل ChatTransfer مباشرة:
59
+
60
+ ```bash
61
+ npx chattransfer
62
+ ```
63
+
64
+ أو تثبيته عالميًا:
65
+
66
+ ```bash
67
+ npm install -g chattransfer
68
+ chattransfer
69
+ ```
70
+
71
+ لخادم Linux بدون واجهة رسومية:
72
+
73
+ ```bash
74
+ chattransfer --no-browser
75
+ ```
76
+
77
+ | النظام | الملف |
78
+ |--------|--------|
79
+ | macOS | `ChatTransfer-macos-x64-v{version_with_underscores}` |
80
+ | Windows | `ChatTransfer-windows-x64-v{version}.exe` |
81
+
82
+ ### Windows
83
+
84
+ 1. حمّل ملف Windows التنفيذي.
85
+ 2. انقر نقرًا مزدوجًا لتشغيله.
86
+ 3. إذا ظهرت رسالة أمان، اختر **Run anyway**.
87
+
88
+ ### macOS
89
+
90
+ 1. حمّل ملف macOS التنفيذي وانقله إلى المكان الذي تفضله.
91
+ 2. إذا ظهرت رسالة “لا يمكن التحقق من المطوّر”، اضغط **Cancel**.
92
+ 3. افتح **System Settings → Privacy & Security**، اضغط **Allow Anyway**، وأدخل كلمة المرور.
93
+ 4. افتح التطبيق مرة أخرى واختر **Open**.
94
+
95
+ بعد بدء التطبيق، يفتح المتصفح تلقائيًا ويعرض رمز QR. امسحه بهاتفك للانضمام إلى المحادثة.
96
+
97
+ ## التشغيل من المصدر
98
+
99
+ ### المتطلبات
100
+
101
+ - Node.js 20+
102
+ - npm 9+
103
+
104
+ ### الأوامر
105
+
106
+ ```bash
107
+ npm install
108
+ cd frontend
109
+ npm install
110
+ cd ..
111
+ npm run dev
112
+ ```
113
+
114
+ يعمل التطبيق على `http://localhost:55556`.
115
+
116
+ لتطوير الواجهة:
117
+
118
+ ```bash
119
+ cd frontend
120
+ npm run dev
121
+ ```
122
+
123
+ ### الاختبار والبناء
124
+
125
+ ```bash
126
+ npm test
127
+ cd frontend
128
+ npm run build
129
+ ```
130
+
131
+ ### التغليف
132
+
133
+ ```bash
134
+ sh publish.sh mac
135
+ sh publish.sh win
136
+ sh publish.sh all
137
+ ```
138
+
139
+ تُكتب الملفات المُغلّفة في `dist/`.
140
+
141
+ ## دعم المنصات
142
+
143
+ - macOS 10.15+
144
+ - Windows 10+
145
+ - أي متصفح حديث على الكمبيوتر أو الهاتف
146
+ - الملفات التنفيذية الجاهزة لا تحتاج إلى Node.js أو تبعيات إضافية
147
+
148
+ ## البنية التقنية
149
+
150
+ يعتمد ChatTransfer على مجموعة تقنيات خفيفة ومركّزة:
151
+
152
+ - **الواجهة:** Vue 3 و Vite و Vue Router و Element Plus و Socket.IO Client.
153
+ - **الخادم:** Node.js و Express و Socket.IO و `express-fileupload`.
154
+ - **التغليف:** `pkg` لإنشاء ملفات تنفيذية مستقلة لـ macOS و Windows.
155
+
156
+ ### هيكل المشروع
157
+
158
+ ```text
159
+ ChatTransfer/
160
+ ├── server/ # Express API وأحداث Socket.IO والخدمات والقياس
161
+ ├── frontend/ # تطبيق Vue 3
162
+ ├── tests/ # اختبارات الخادم والمستودع
163
+ ├── docs/ # أدلة التطوير والإصدار والقياس
164
+ ├── release/ # وثائق الإصدارات وسجل التغييرات
165
+ └── publish.sh # سكربت التغليف
166
+ ```
167
+
168
+ لمزيد من التفاصيل، راجع [ARCHITECTURE.md](./ARCHITECTURE.md).
169
+
170
+ ## الخصوصية والأمان
171
+
172
+ - يتم حفظ سجل المحادثات والملفات محليًا على جهازك.
173
+ - يحدث النقل داخل شبكتك المحلية فقط.
174
+ - لا يوجد نظام حسابات ولا تخزين سحابي مدمج.
175
+ - القياس معطّل افتراضيًا، ولا تتضمن النسخة مفتوحة المصدر أي مفتاح مزوّد.
176
+ - إذا فعّلت القياس، يجب أن تضع مفتاح API الخاص بك في `config/local.json`؛ بدون مفتاح، لا يرسل ChatTransfer أي طلب قياس خارجي.
177
+
178
+ راجع [docs/telemetry.md](./docs/telemetry.md).
179
+
180
+ ## التطوير
181
+
182
+ - [دليل التطوير](./docs/development.md)
183
+ - [دليل الإصدار](./docs/release.md)
184
+ - [دليل المساهمة](./CONTRIBUTING.md)
185
+ - [مدونة قواعد السلوك](./CODE_OF_CONDUCT.md)
186
+
187
+ ## الأسئلة الشائعة
188
+
189
+ **لا تفتح الصفحة بعد مسح رمز QR.**
190
+ تأكد من أن هاتفك وكمبيوترك على نفس الشبكة المحلية.
191
+
192
+ **فشل نقل الملف.**
193
+ تحقق من تجاوز الملف للحد المسموح، ثم أعد المحاولة.
194
+
195
+ **كيف أبدّل اللغة؟**
196
+ افتح **الإعدادات** في الزاوية العلوية اليمنى واختر لغتك.
197
+
198
+ ## سجل التغييرات
199
+
200
+ راجع [release/CHANGELOG.ar.md](./release/CHANGELOG.ar.md).
201
+
202
+ ## الترخيص
203
+
204
+ [رخصة MIT](./LICENSE)
205
+
206
+ ## المؤلف
207
+
208
+ Created by suncx.
package/README.md CHANGED
@@ -1,3 +1,208 @@
1
- # Temporary Holding Version
1
+ # ChatTransfer
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![GitHub Downloads](https://img.shields.io/github/downloads/turboxing/ChatTransfer/total?style=flat-square&logo=github&color=44cc11)](https://github.com/turboxing/ChatTransfer/releases)
4
+ [![GitHub Release](https://img.shields.io/github/v/release/turboxing/ChatTransfer?style=flat-square&color=fe7d37)](https://github.com/turboxing/ChatTransfer/releases)
5
+ [![GitHub last commit](https://img.shields.io/github/last-commit/turboxing/ChatTransfer?style=flat-square&color=a4a61d)](https://github.com/turboxing/ChatTransfer/commits/main)
6
+ [![GitHub stars](https://img.shields.io/github/stars/turboxing/ChatTransfer?style=flat-square&color=dfb317)](https://github.com/turboxing/ChatTransfer/stargazers)
7
+ [![MIT License](https://img.shields.io/github/license/turboxing/ChatTransfer?style=flat-square&color=007ec6)](./LICENSE)
8
+
9
+ English | [简体中文](./README.zh-CN.md) | [العربية](./README.ar.md)
10
+
11
+ > A minimal LAN chat and file-transfer tool for developers, testers, and small teams. Scan a QR code, open a browser, and share text, images, and files instantly—without accounts, cloud uploads, or extra apps.
12
+
13
+ ## Demo
14
+
15
+ - [YouTube demo](https://www.youtube.com/watch?v=gZxeBqd7vbY)
16
+ - [Bilibili demo](https://www.bilibili.com/video/BV13QJp6vE3r/?vd_source=b4939bcf1ffecbca608b946bbdd9c475)
17
+
18
+ ## Why ChatTransfer
19
+
20
+ I am a QA engineer. In my daily work, I constantly move things between my computer and test phones: builds, test parameters, and links go to the phone; logs, screenshots, and screen recordings come back to the computer. Colleagues often ask:
21
+
22
+ - “How do I get that screen recording onto my computer?”
23
+ - “Do I need to set up dev tools to install this test build on a phone?”
24
+ - “Can you turn this image into a link?”
25
+ - “Can this link become a QR code?”
26
+
27
+ These sound like small things, but they cost the most time exactly when you need them right now. I want ChatTransfer to make these “quick share” moments simple enough.
28
+
29
+ These needs are always “temporary,” but the usual solutions are heavy: install an IM app, sign in, upload to a third-party platform, worry about privacy after sharing, uninstall it, and restore borrowed test phones. After repeating that cycle too many times, I built ChatTransfer on weekends: a cross-platform, no-install, use-and-leave LAN transfer tool that keeps temporary cross-device sharing simple, controllable, and lightweight. After nearly 3 years of iteration, ChatTransfer has proven effective in many real scenarios, so I decided to share it here.
30
+
31
+ I use it every day and keep improving it based on real scenarios. It will stay free. If you run into a problem or have a better idea, please open an Issue; your feedback directly helps it grow.
32
+
33
+ ## Features
34
+
35
+ - **Scan to connect** — generate a QR code on startup and open the chat in a phone browser.
36
+ - **Real-time group chat** — multiple users can join the same LAN room and sync instantly.
37
+ - **File transfer** — send text, images, and files in seconds.
38
+ - **Batch upload** — drag and drop multiple files at once.
39
+ - **Pin and highlight messages** — keep important messages visible.
40
+ - **Message QR codes** — turn any message into a QR code for easy sharing.
41
+ - **Local chat history** — cache messages locally and clear them when needed.
42
+ - **Cross-platform** — supports Windows and macOS.
43
+ - **Multi-language UI** — Chinese and English.
44
+
45
+ ## Use Cases
46
+
47
+ - **PC ↔ PC** — share logs, config snippets, test builds, screenshots, and links.
48
+ - **PC ↔ Phone** — send debug links, QR codes, and screenshots to phones; return photos and recordings to computers.
49
+ - **Phone ↔ Phone** — share files quickly in a small team without installing another IM app.
50
+ - **Live demos** — distribute materials instantly during meetings.
51
+
52
+ ## Download and Install
53
+
54
+ Download the latest executable from the [Releases](https://github.com/turboxing/ChatTransfer/releases) page.
55
+
56
+ ### npm
57
+
58
+ If you use Node.js 20 or later, you can run ChatTransfer directly:
59
+
60
+ ```bash
61
+ npx chattransfer
62
+ ```
63
+
64
+ Or install it globally:
65
+
66
+ ```bash
67
+ npm install -g chattransfer
68
+ chattransfer
69
+ ```
70
+
71
+ For a headless Linux server:
72
+
73
+ ```bash
74
+ chattransfer --no-browser
75
+ ```
76
+
77
+ | System | File |
78
+ |--------|------|
79
+ | macOS | `ChatTransfer-macos-x64-v{version_with_underscores}` |
80
+ | Windows | `ChatTransfer-windows-x64-v{version}.exe` |
81
+
82
+ ### Windows
83
+
84
+ 1. Download the Windows executable.
85
+ 2. Double-click to run it.
86
+ 3. If Windows shows a security prompt, choose **Run anyway**.
87
+
88
+ ### macOS
89
+
90
+ 1. Download the macOS executable and move it to your preferred location.
91
+ 2. If macOS says it cannot verify the developer, click **Cancel**.
92
+ 3. Open **System Settings → Privacy & Security**, click **Allow Anyway**, and enter your password.
93
+ 4. Open the app again and confirm with **Open**.
94
+
95
+ After the app starts, a browser window opens automatically with a QR code. Scan it with your phone to join the chat.
96
+
97
+ ## Run from Source
98
+
99
+ ### Requirements
100
+
101
+ - Node.js 20+
102
+ - npm 9+
103
+
104
+ ### Commands
105
+
106
+ ```bash
107
+ npm install
108
+ cd frontend
109
+ npm install
110
+ cd ..
111
+ npm run dev
112
+ ```
113
+
114
+ The app starts at `http://localhost:55556`.
115
+
116
+ For frontend development:
117
+
118
+ ```bash
119
+ cd frontend
120
+ npm run dev
121
+ ```
122
+
123
+ ### Test and Build
124
+
125
+ ```bash
126
+ npm test
127
+ cd frontend
128
+ npm run build
129
+ ```
130
+
131
+ ### Package
132
+
133
+ ```bash
134
+ sh publish.sh mac
135
+ sh publish.sh win
136
+ sh publish.sh all
137
+ ```
138
+
139
+ Packaged files are written to `dist/`.
140
+
141
+ ## Platform Support
142
+
143
+ - macOS 10.15+
144
+ - Windows 10+
145
+ - Any modern browser on desktop or mobile
146
+ - Prebuilt executables require no Node.js or additional dependencies
147
+
148
+ ## Architecture
149
+
150
+ ChatTransfer uses a small, focused stack:
151
+
152
+ - **Frontend:** Vue 3, Vite, Vue Router, Element Plus, and Socket.IO Client.
153
+ - **Backend:** Node.js, Express, Socket.IO, and `express-fileupload`.
154
+ - **Packaging:** `pkg` for standalone macOS and Windows executables.
155
+
156
+ ### Project Structure
157
+
158
+ ```text
159
+ ChatTransfer/
160
+ ├── server/ # Express API, Socket.IO events, services, telemetry
161
+ ├── frontend/ # Vue 3 application
162
+ ├── tests/ # Backend and repository-level tests
163
+ ├── docs/ # Development, release, and telemetry guides
164
+ ├── release/ # Release-page documentation and changelogs
165
+ └── publish.sh # Packaging script
166
+ ```
167
+
168
+ See [ARCHITECTURE.md](./ARCHITECTURE.md) for more details.
169
+
170
+ ## Privacy and Security
171
+
172
+ - Chat history and files are stored locally on your device.
173
+ - Transfers stay inside your local network.
174
+ - There is no account system and no built-in cloud storage.
175
+ - Telemetry is disabled by default and never contains a provider key.
176
+ - If you enable telemetry, you must provide your own API key in `config/local.json`; without a key, ChatTransfer makes no external telemetry request.
177
+
178
+ See [docs/telemetry.md](./docs/telemetry.md) for details.
179
+
180
+ ## Development
181
+
182
+ - [Development guide](./docs/development.md)
183
+ - [Release guide](./docs/release.md)
184
+ - [Contributing guide](./CONTRIBUTING.md)
185
+ - [Code of Conduct](./CODE_OF_CONDUCT.md)
186
+
187
+ ## FAQ
188
+
189
+ **The page will not open after scanning the QR code.**
190
+ Make sure your phone and computer are on the same local network.
191
+
192
+ **File transfer failed.**
193
+ Check whether the file exceeds the configured size limit, then try uploading again.
194
+
195
+ **How do I switch languages?**
196
+ Open **Settings** in the top-right corner and choose your language.
197
+
198
+ ## Changelog
199
+
200
+ See [release/CHANGELOG.en.md](./release/CHANGELOG.en.md).
201
+
202
+ ## License
203
+
204
+ [MIT License](./LICENSE)
205
+
206
+ ## Author
207
+
208
+ Created by suncx.
@@ -0,0 +1,208 @@
1
+ # ChatTransfer(聊天快传)
2
+
3
+ [![GitHub Downloads](https://img.shields.io/github/downloads/turboxing/ChatTransfer/total?style=flat-square&logo=github&color=44cc11)](https://github.com/turboxing/ChatTransfer/releases)
4
+ [![GitHub Release](https://img.shields.io/github/v/release/turboxing/ChatTransfer?style=flat-square&color=fe7d37)](https://github.com/turboxing/ChatTransfer/releases)
5
+ [![GitHub last commit](https://img.shields.io/github/last-commit/turboxing/ChatTransfer?style=flat-square&color=a4a61d)](https://github.com/turboxing/ChatTransfer/commits/main)
6
+ [![GitHub stars](https://img.shields.io/github/stars/turboxing/ChatTransfer?style=flat-square&color=dfb317)](https://github.com/turboxing/ChatTransfer/stargazers)
7
+ [![MIT License](https://img.shields.io/github/license/turboxing/ChatTransfer?style=flat-square&color=007ec6)](./LICENSE)
8
+
9
+ [English](./README.md) | 简体中文 | [العربية](./README.ar.md)
10
+
11
+ > 一款面向开发者、测试人员和小团队的极简局域网聊天与文件互传工具。扫码即用,无需账号、无需云上传、无需额外安装 App,即可在浏览器中实时互发文字、图片和文件。
12
+
13
+ ## 演示
14
+
15
+ - [YouTube 演示](https://www.youtube.com/watch?v=gZxeBqd7vbY)
16
+ - [B 站演示](https://www.bilibili.com/video/BV13QJp6vE3r/?vd_source=b4939bcf1ffecbca608b946bbdd9c475)
17
+
18
+ ## 为什么做 ChatTransfer
19
+
20
+ 我本职是一名测试工程师。日常工作里,我经常要在电脑和测试手机之间来回传东西:安装包、测试参数、链接要发到手机;日志、截图、录屏又要从手机回传到电脑。很多时候同事也会随口来一句:
21
+
22
+ - “刚刚录屏怎么传到电脑上?”
23
+ - “测试包要装手机上,是不是还得装开发工具?”
24
+ - “能把这张图片生成一个链接吗?”
25
+ - “这个链接能不能直接生成二维码?”
26
+
27
+ 这些看似小事,往往临时要用的时候最费时间。我希望 ChatTransfer 能把这类“随手分享”的动作做到足够简单。
28
+
29
+ 这些需求都很“临时”,但解决起来总是很“重”:装个 IM、登账号、传三方平台、传完怕隐私还得卸载,借来的测试机还要恢复干净……反复折腾,浪费时间。于是我在周末开发了 ChatTransfer:一个跨平台、免安装、用完即走的局域网互传工具,尽量把“临时跨设备传输”这件事做得简单、可控、无负担。经过我长达 3 年的迭代,ChatTransfer 已经在多个场景下被证明是有效的。所以决定把它上传到这里,分享给大家!
30
+
31
+ 这个工具我自己每天都在用,也会持续根据真实场景迭代。软件长期免费,如果你在使用中遇到任何问题、或者对功能有更好的想法,欢迎在仓库的 Issues 里提建议;你的反馈会直接帮助它变得更好。
32
+
33
+ ## 核心功能
34
+
35
+ - **扫码即连** — 启动后自动生成二维码,手机扫码即可在浏览器中打开聊天页面。
36
+ - **实时群聊** — 多人同时在线,消息实时同步。
37
+ - **文件传输** — 支持文本、图片、各类文件的秒级互传。
38
+ - **批量上传** — 支持拖拽批量上传文件。
39
+ - **Pin 与置顶消息** — 固定重要消息,方便随时查看。
40
+ - **消息二维码** — 任意消息皆可生成二维码,方便分享。
41
+ - **本地聊天记录** — 本地缓存聊天记录,支持清空。
42
+ - **跨平台** — 支持 Windows 和 macOS。
43
+ - **多语言界面** — 支持中文和英文切换。
44
+
45
+ ## 使用场景
46
+
47
+ - **电脑 ↔ 电脑** — 开发联调时互传日志、配置片段、测试包、截图和链接。
48
+ - **电脑 ↔ 手机** — 把调试链接、二维码、截图发到手机,或把照片、录屏回传到电脑。
49
+ - **手机 ↔ 手机** — 小团队临时共享文件,不想再安装一个复杂 IM。
50
+ - **现场演示** — 会议中即时分发资料,无需加好友。
51
+
52
+ ## 下载与安装
53
+
54
+ 前往 [Releases](https://github.com/turboxing/ChatTransfer/releases) 页面下载最新可执行文件。
55
+
56
+ ### npm
57
+
58
+ 如果你使用 Node.js 20 或更高版本,可以直接运行:
59
+
60
+ ```bash
61
+ npx chattransfer
62
+ ```
63
+
64
+ 也可以全局安装:
65
+
66
+ ```bash
67
+ npm install -g chattransfer
68
+ chattransfer
69
+ ```
70
+
71
+ 无桌面 Linux 服务器可使用:
72
+
73
+ ```bash
74
+ chattransfer --no-browser
75
+ ```
76
+
77
+ | 系统 | 文件 |
78
+ |------|------|
79
+ | macOS | `ChatTransfer-macos-x64-v{版本号_下划线}` |
80
+ | Windows | `ChatTransfer-windows-x64-v{版本号}.exe` |
81
+
82
+ ### Windows
83
+
84
+ 1. 下载 Windows 可执行文件。
85
+ 2. 双击运行。
86
+ 3. 如果系统出现安全提示,选择 **允许运行**。
87
+
88
+ ### macOS
89
+
90
+ 1. 下载 macOS 可执行文件,并移动到你想保存的位置。
91
+ 2. 如果首次运行提示“无法验证开发者”,先点击 **取消**。
92
+ 3. 打开 **系统设置 → 隐私与安全性**,点击 **仍然允许**,并输入密码。
93
+ 4. 再次打开应用,在确认弹窗中选择 **打开**。
94
+
95
+ 应用启动后会自动打开浏览器并显示二维码,手机扫码即可加入聊天。
96
+
97
+ ## 从源码运行
98
+
99
+ ### 环境要求
100
+
101
+ - Node.js 20+
102
+ - npm 9+
103
+
104
+ ### 命令
105
+
106
+ ```bash
107
+ npm install
108
+ cd frontend
109
+ npm install
110
+ cd ..
111
+ npm run dev
112
+ ```
113
+
114
+ 应用默认运行在 `http://localhost:55556`。
115
+
116
+ 前端单独开发:
117
+
118
+ ```bash
119
+ cd frontend
120
+ npm run dev
121
+ ```
122
+
123
+ ### 测试与构建
124
+
125
+ ```bash
126
+ npm test
127
+ cd frontend
128
+ npm run build
129
+ ```
130
+
131
+ ### 打包
132
+
133
+ ```bash
134
+ sh publish.sh mac
135
+ sh publish.sh win
136
+ sh publish.sh all
137
+ ```
138
+
139
+ 打包产物会输出到 `dist/`。
140
+
141
+ ## 平台支持
142
+
143
+ - macOS 10.15+
144
+ - Windows 10+
145
+ - 桌面或移动端的现代浏览器
146
+ - 预编译可执行文件无需安装 Node.js 或其他依赖
147
+
148
+ ## 技术架构
149
+
150
+ ChatTransfer 使用轻量、聚焦的技术栈:
151
+
152
+ - **前端:** Vue 3、Vite、Vue Router、Element Plus、Socket.IO Client。
153
+ - **后端:** Node.js、Express、Socket.IO、`express-fileupload`。
154
+ - **打包:** 使用 `pkg` 生成 macOS 和 Windows 独立可执行文件。
155
+
156
+ ### 项目结构
157
+
158
+ ```text
159
+ ChatTransfer/
160
+ ├── server/ # Express API、Socket.IO 事件、服务与埋点
161
+ ├── frontend/ # Vue 3 应用
162
+ ├── tests/ # 后端与仓库级测试
163
+ ├── docs/ # 开发、发布与埋点文档
164
+ ├── release/ # 发布页文档与更新日志
165
+ └── publish.sh # 打包脚本
166
+ ```
167
+
168
+ 更多细节见 [ARCHITECTURE.md](./ARCHITECTURE.md)。
169
+
170
+ ## 隐私与安全
171
+
172
+ - 聊天记录和文件默认仅保存在本机。
173
+ - 传输只发生在局域网内。
174
+ - 无账号体系,无内置云存储。
175
+ - 埋点默认关闭,开源版本不包含任何提供方 key。
176
+ - 如果你启用埋点,需要在 `config/local.json` 中填写自己的 API key;没有 key 时不会发起任何外部埋点请求。
177
+
178
+ 详见 [docs/telemetry.md](./docs/telemetry.md)。
179
+
180
+ ## 开发
181
+
182
+ - [开发指南](./docs/development.md)
183
+ - [发布指南](./docs/release.md)
184
+ - [贡献指南](./CONTRIBUTING.md)
185
+ - [行为准则](./CODE_OF_CONDUCT.md)
186
+
187
+ ## 常见问题
188
+
189
+ **扫码后页面打不开。**
190
+ 请确认手机和电脑是否在同一个局域网。
191
+
192
+ **文件传输失败。**
193
+ 请检查文件是否超过限制大小,然后重新上传。
194
+
195
+ **如何切换语言?**
196
+ 点击右上角 **设置**,选择语言。
197
+
198
+ ## 更新日志
199
+
200
+ 见 [release/CHANGELOG.md](./release/CHANGELOG.md)。
201
+
202
+ ## 许可证
203
+
204
+ [MIT License](./LICENSE)
205
+
206
+ ## 作者
207
+
208
+ Created by suncx.
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env node
2
+
3
+ process.env.CHATTRANSFER_RUNTIME = process.env.CHATTRANSFER_RUNTIME || 'npm';
4
+
5
+ const { getHelpText, parseCliArguments, toStartOptions } = require('../server/cli-options');
6
+ const { start } = require('../server/index');
7
+ const pkg = require('../package.json');
8
+
9
+ async function main() {
10
+ const cliValues = parseCliArguments();
11
+
12
+ if (cliValues.help) {
13
+ console.log(getHelpText());
14
+ return;
15
+ }
16
+
17
+ if (cliValues.version) {
18
+ console.log(pkg.version);
19
+ return;
20
+ }
21
+
22
+ const options = toStartOptions(cliValues);
23
+
24
+ if (options.dataDir) {
25
+ process.env.CHATTRANSFER_DATA_DIR = options.dataDir;
26
+ }
27
+
28
+ if (options.publicUrl) {
29
+ process.env.CHATTRANSFER_PUBLIC_URL = options.publicUrl;
30
+ }
31
+
32
+ const server = await start(options);
33
+ if (!server) {
34
+ process.exitCode = 1;
35
+ }
36
+ }
37
+
38
+ main().catch((error) => {
39
+ console.error(`ChatTransfer: ${error.message}`);
40
+ process.exitCode = 1;
41
+ });