From 4b5d2b656b08b5e3a89d354fd114ef27addbbb0b Mon Sep 17 00:00:00 2001 From: nite Date: Sat, 7 Feb 2026 04:18:36 +0800 Subject: [PATCH] feat: i18n --- README.md | 102 +++++++++--------- README.zh.md | 91 ++++++++++++++++ .../mesh-drop/internal/config/config.ts | 12 +++ .../mesh-drop/internal/config/index.ts | 1 + .../mesh-drop/internal/config/models.ts | 10 ++ frontend/package-lock.json | 71 ++++++++++++ frontend/package.json | 1 + frontend/src/components/MainLayout.vue | 14 +-- frontend/src/components/PeerCard.vue | 39 ++++--- frontend/src/components/SettingsView.vue | 51 +++++++-- frontend/src/components/TransferItem.vue | 47 +++++--- frontend/src/locales/en.json | 40 +++++++ frontend/src/locales/zh-Hans.json | 40 +++++++ frontend/src/plugins/i18n.ts | 15 +++ frontend/src/plugins/index.ts | 10 +- frontend/tsconfig.tsbuildinfo | 2 +- internal/config/config.go | 34 ++++++ 17 files changed, 482 insertions(+), 98 deletions(-) create mode 100644 README.zh.md create mode 100644 frontend/src/locales/en.json create mode 100644 frontend/src/locales/zh-Hans.json create mode 100644 frontend/src/plugins/i18n.ts diff --git a/README.md b/README.md index 065f83d..b72c9b0 100644 --- a/README.md +++ b/README.md @@ -1,88 +1,90 @@ # Mesh Drop -简易、快速的局域网文件传输工具,基于 Wails 和 Vue 构建。 +English | [中文](./README.zh.md) -## 功能特性 +Simple, fast LAN file transfer tool, built with Wails and Vue. -- **文件传输**:支持多文件发送,轻松共享。 -- **文件夹传输**:支持发送整个文件夹结构。 -- **文本传输**:快速同步设备间的文本内容。 -- **加密传输**:确保数据在传输过程中的安全性。 -- **安全身份**:基于 Ed25519 的签名验证,防止伪造。 +## Features -## 安全机制 +- **File Transfer**: Support multi-file sending, easily share. +- **Folder Transfer**: Support sending entire folder structures. +- **Text Transfer**: Quickly sync text content between devices. +- **Encrypted Transmission**: Ensure data security during transmission. +- **Secure Identity**: Ed25519-based signature verification to prevent spoofing. -Mesh Drop 采用多层安全设计来保护用户免受潜在的恶意攻击: +## Security Mechanisms -1. **身份验证 (Identity)** - - 每个设备在首次启动时生成一对唯一的 Ed25519 密钥。 - - 所有广播包(Presence Broadcast)都使用私钥签名。 - - 接收端通过公钥验证签名,确保身份未被篡改。 +Mesh Drop uses a multi-layered security design to protect users from potential malicious attacks: -2. **信任机制 (Trust)** - - 采用 TOFU (Trust On First Use) 策略。 - - 用户可以选择“信任”某个 Peer,一旦信任,该 Peer 的公钥将被固定(Pinning)。 - - 之后收到该 Peer ID 的所有数据包,必须通过已保存公钥的验证,否则会被标记为 **Mismatch**。 - - **防欺骗**:如果有人试图伪造已信任 Peer 的 ID,UI 会显示明显的“Mismatch”安全警告,并阻止元数据被覆盖。 +1. **Identity** + - Each device generates a unique pair of Ed25519 keys on first startup. + - All presence broadcasts are signed with the private key. + - The receiver verifies the signature with the public key to ensure the identity has not been tampered with. -3. **传输加密 (Encryption)** - - 文件传输服务使用 HTTPS 协议。 - - 自动生成自签名证书进行通信加密,防止传输内容被窃听。 +2. **Trust** + - Uses TOFU (Trust On First Use) strategy. + - Users can choose to "Trust" a Peer. Once trusted, that Peer's public key is pinned. + - Subsequent packets from that Peer ID must be verified by the saved public key, otherwise they will be marked as **Mismatch**. + - **Anti-spoofing**: If someone tries to spoof a trusted Peer ID, the UI will display a clear "Mismatch" security warning and prevent metadata from being overwritten. -## 截图 +3. **Encryption** + - File transfer service uses HTTPS protocol. + - Automatically generates self-signed certificates for communication encryption to prevent eavesdropping. + +## Screenshots | ![Mesh Drop](./screenshot/1.png) | ![Mesh Drop](./screenshot/2.png) | | -------------------------------- | -------------------------------- | -## 待办事项 +## Todo -- [x] 剪辑板传输 -- [x] 文件夹传输 -- [x] 取消传输 -- [x] 多文件发送 -- [x] 加密传输 -- [x] 设置页面 -- [x] 单例模式 -- [x] 系统通知 -- [x] 清理历史 -- [x] 自动接收 -- [x] 应用图标 -- [x] 信任Peer -- [ ] 系统托盘(最小化到托盘)徽章 https://github.com/wailsapp/wails/issues/4494 -- [ ] 多语言 +- [x] Clipboard transfer +- [x] Folder transfer +- [x] Cancel transfer +- [x] Multi-file sending +- [x] Encrypted transmission +- [x] Settings page +- [x] Single instance mode +- [x] System notifications +- [x] Clear history +- [x] Auto accept +- [x] App icon +- [x] Trust Peer +- [x] Multi-language support +- [ ] System tray (minimize to tray) badges https://github.com/wailsapp/wails/issues/4494 -## 技术栈 +## Tech Stack -本项目使用现代化的技术栈构建: +This project is built using a modern tech stack: -- **后端**: [Go](https://go.dev/) + [Wails v3](https://v3.wails.io/) -- **前端**: [Vue 3](https://vuejs.org/) + [TypeScript](https://www.typescriptlang.org/) -- **UI 框架**: [Vuetify](https://vuetifyjs.com/) +- **Backend**: [Go](https://go.dev/) + [Wails v3](https://v3.wails.io/) +- **Frontend**: [Vue 3](https://vuejs.org/) + [TypeScript](https://www.typescriptlang.org/) +- **UI Framework**: [Vuetify](https://vuetifyjs.com/) -## 开发 +## Development -### 前置条件 +### Prerequisites -在开始之前,请确保您的开发环境已安装以下工具: +Before starting, ensure your development environment has the following tools installed: -1. **Go** (版本 >= 1.25) +1. **Go** (version >= 1.25) 2. **Node.js** 3. **Wails CLI** 4. **UPX** -### 安装依赖 +### Install Dependencies ```bash -# 进入项目目录 +# Enter project directory cd mesh-drop -# 安装前端依赖 (通常 Wails 会自动处理,但手动安装可确保环境清晰) +# Install frontend dependencies (Wails usually handles this automatically, but manual installation ensures a clean environment) cd frontend npm install cd .. ``` -### 运行开发环境 +### Run Development Environment ```bash wails3 dev diff --git a/README.zh.md b/README.zh.md new file mode 100644 index 0000000..4ffcc11 --- /dev/null +++ b/README.zh.md @@ -0,0 +1,91 @@ +# Mesh Drop + +[English](./README.md) | 中文 + +简易、快速的局域网文件传输工具,基于 Wails 和 Vue 构建。 + +## 功能特性 + +- **文件传输**:支持多文件发送,轻松共享。 +- **文件夹传输**:支持发送整个文件夹结构。 +- **文本传输**:快速同步设备间的文本内容。 +- **加密传输**:确保数据在传输过程中的安全性。 +- **安全身份**:基于 Ed25519 的签名验证,防止伪造。 + +## 安全机制 + +Mesh Drop 采用多层安全设计来保护用户免受潜在的恶意攻击: + +1. **身份验证 (Identity)** + - 每个设备在首次启动时生成一对唯一的 Ed25519 密钥。 + - 所有广播包(Presence Broadcast)都使用私钥签名。 + - 接收端通过公钥验证签名,确保身份未被篡改。 + +2. **信任机制 (Trust)** + - 采用 TOFU (Trust On First Use) 策略。 + - 用户可以选择“信任”某个 Peer,一旦信任,该 Peer 的公钥将被固定(Pinning)。 + - 之后收到该 Peer ID 的所有数据包,必须通过已保存公钥的验证,否则会被标记为 **Mismatch**。 + - **防欺骗**:如果有人试图伪造已信任 Peer 的 ID,UI 会显示明显的“Mismatch”安全警告,并阻止元数据被覆盖。 + +3. **传输加密 (Encryption)** + - 文件传输服务使用 HTTPS 协议。 + - 自动生成自签名证书进行通信加密,防止传输内容被窃听。 + +## 截图 + +| ![Mesh Drop](./screenshot/1.png) | ![Mesh Drop](./screenshot/2.png) | +| -------------------------------- | -------------------------------- | + +## 待办事项 + +- [x] 剪辑板传输 +- [x] 文件夹传输 +- [x] 取消传输 +- [x] 多文件发送 +- [x] 加密传输 +- [x] 设置页面 +- [x] 单例模式 +- [x] 系统通知 +- [x] 清理历史 +- [x] 自动接收 +- [x] 应用图标 +- [x] 信任Peer +- [x] 多语言 +- [ ] 系统托盘(最小化到托盘)徽章 https://github.com/wailsapp/wails/issues/4494 + +## 技术栈 + +本项目使用现代化的技术栈构建: + +- **后端**: [Go](https://go.dev/) + [Wails v3](https://v3.wails.io/) +- **前端**: [Vue 3](https://vuejs.org/) + [TypeScript](https://www.typescriptlang.org/) +- **UI 框架**: [Vuetify](https://vuetifyjs.com/) + +## 开发 + +### 前置条件 + +在开始之前,请确保您的开发环境已安装以下工具: + +1. **Go** (版本 >= 1.25) +2. **Node.js** +3. **Wails CLI** +4. **UPX** + +### 安装依赖 + +```bash +# 进入项目目录 +cd mesh-drop + +# 安装前端依赖 (通常 Wails 会自动处理,但手动安装可确保环境清晰) +cd frontend +npm install +cd .. +``` + +### 运行开发环境 + +```bash +wails3 dev +``` diff --git a/frontend/bindings/mesh-drop/internal/config/config.ts b/frontend/bindings/mesh-drop/internal/config/config.ts index e8e365f..51b16c0 100644 --- a/frontend/bindings/mesh-drop/internal/config/config.ts +++ b/frontend/bindings/mesh-drop/internal/config/config.ts @@ -25,6 +25,14 @@ export function GetID(): $CancellablePromise { return $Call.ByID(4240411568); } +export function GetLanguage(): $CancellablePromise<$models.Language> { + return $Call.ByID(480133131); +} + +export function GetLanguageByString(str: string): $CancellablePromise<$models.Language> { + return $Call.ByID(905794983, str); +} + export function GetSaveHistory(): $CancellablePromise { return $Call.ByID(2178923392); } @@ -72,6 +80,10 @@ export function SetHostName(hostName: string): $CancellablePromise { return $Call.ByID(1580131496, hostName); } +export function SetLanguage(language: $models.Language): $CancellablePromise { + return $Call.ByID(933959199, language); +} + export function SetSaveHistory(saveHistory: boolean): $CancellablePromise { return $Call.ByID(3779587628, saveHistory); } diff --git a/frontend/bindings/mesh-drop/internal/config/index.ts b/frontend/bindings/mesh-drop/internal/config/index.ts index 0425068..04e7ced 100644 --- a/frontend/bindings/mesh-drop/internal/config/index.ts +++ b/frontend/bindings/mesh-drop/internal/config/index.ts @@ -7,5 +7,6 @@ export { }; export { + Language, WindowState } from "./models.js"; diff --git a/frontend/bindings/mesh-drop/internal/config/models.ts b/frontend/bindings/mesh-drop/internal/config/models.ts index ee7b617..bb01db2 100644 --- a/frontend/bindings/mesh-drop/internal/config/models.ts +++ b/frontend/bindings/mesh-drop/internal/config/models.ts @@ -5,6 +5,16 @@ // @ts-ignore: Unused imports import { Create as $Create } from "@wailsio/runtime"; +export enum Language { + /** + * The Go zero value for the underlying type of the enum. + */ + $zero = "", + + LanguageEnglish = "en", + LanguageChinese = "zh-Hans", +}; + /** * WindowState 定义窗口状态 */ diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 0f1ac1e..1ee858d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -12,6 +12,7 @@ "@mdi/font": "7.4.47", "@wailsio/runtime": "^3.0.0-alpha.79", "vue": "^3.5.21", + "vue-i18n": "^11.2.8", "vuetify": "^3.10.1" }, "devDependencies": { @@ -509,6 +510,50 @@ "url": "https://github.com/sponsors/ayuhito" } }, + "node_modules/@intlify/core-base": { + "version": "11.2.8", + "resolved": "https://registry.npmjs.org/@intlify/core-base/-/core-base-11.2.8.tgz", + "integrity": "sha512-nBq6Y1tVkjIUsLsdOjDSJj4AsjvD0UG3zsg9Fyc+OivwlA/oMHSKooUy9tpKj0HqZ+NWFifweHavdljlBLTwdA==", + "license": "MIT", + "dependencies": { + "@intlify/message-compiler": "11.2.8", + "@intlify/shared": "11.2.8" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, + "node_modules/@intlify/message-compiler": { + "version": "11.2.8", + "resolved": "https://registry.npmjs.org/@intlify/message-compiler/-/message-compiler-11.2.8.tgz", + "integrity": "sha512-A5n33doOjmHsBtCN421386cG1tWp5rpOjOYPNsnpjIJbQ4POF0QY2ezhZR9kr0boKwaHjbOifvyQvHj2UTrDFQ==", + "license": "MIT", + "dependencies": { + "@intlify/shared": "11.2.8", + "source-map-js": "^1.0.2" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, + "node_modules/@intlify/shared": { + "version": "11.2.8", + "resolved": "https://registry.npmjs.org/@intlify/shared/-/shared-11.2.8.tgz", + "integrity": "sha512-l6e4NZyUgv8VyXXH4DbuucFOBmxLF56C/mqh2tvApbzl2Hrhi1aTDcuv5TKdxzfHYmpO3UB0Cz04fgDT9vszfw==", + "license": "MIT", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.13", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", @@ -1350,6 +1395,12 @@ "@vue/shared": "3.5.27" } }, + "node_modules/@vue/devtools-api": { + "version": "6.6.4", + "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.6.4.tgz", + "integrity": "sha512-sGhTPMuXqZ1rVOk32RylztWkfXTRhuS7vgAKv0zjqk8gbsHkJ7xfFf+jbySxt7tWObEJwyKaHMikV/WGDiQm8g==", + "license": "MIT" + }, "node_modules/@vue/language-core": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.2.4.tgz", @@ -3165,6 +3216,26 @@ } } }, + "node_modules/vue-i18n": { + "version": "11.2.8", + "resolved": "https://registry.npmjs.org/vue-i18n/-/vue-i18n-11.2.8.tgz", + "integrity": "sha512-vJ123v/PXCZntd6Qj5Jumy7UBmIuE92VrtdX+AXr+1WzdBHojiBxnAxdfctUFL+/JIN+VQH4BhsfTtiGsvVObg==", + "license": "MIT", + "dependencies": { + "@intlify/core-base": "11.2.8", + "@intlify/shared": "11.2.8", + "@vue/devtools-api": "^6.5.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/kazupon" + }, + "peerDependencies": { + "vue": "^3.0.0" + } + }, "node_modules/vue-tsc": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/vue-tsc/-/vue-tsc-3.2.4.tgz", diff --git a/frontend/package.json b/frontend/package.json index 1f8bb3e..81b0971 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -16,6 +16,7 @@ "@mdi/font": "7.4.47", "@wailsio/runtime": "^3.0.0-alpha.79", "vue": "^3.5.21", + "vue-i18n": "^11.2.8", "vuetify": "^3.10.1" }, "devDependencies": { diff --git a/frontend/src/components/MainLayout.vue b/frontend/src/components/MainLayout.vue index 25b598c..fd0c5d6 100644 --- a/frontend/src/components/MainLayout.vue +++ b/frontend/src/components/MainLayout.vue @@ -1,6 +1,7 @@ - + @@ -79,7 +100,7 @@ const changeSavePath = async () => { > - + @@ -93,7 +114,7 @@ const changeSavePath = async () => { > - + @@ -107,7 +128,7 @@ const changeSavePath = async () => { > - + @@ -115,5 +136,21 @@ const changeSavePath = async () => {
{{ version }}
+ + + + + diff --git a/frontend/src/components/TransferItem.vue b/frontend/src/components/TransferItem.vue index 0f2a373..783f66e 100644 --- a/frontend/src/components/TransferItem.vue +++ b/frontend/src/components/TransferItem.vue @@ -1,6 +1,7 @@