From 62bc88477a3b662a72264daeeb6678e209845bd0 Mon Sep 17 00:00:00 2001 From: nite Date: Wed, 4 Feb 2026 03:55:38 +0800 Subject: [PATCH] u --- README.md | 65 +------- .../mesh-drop/internal/transfer/service.ts | 4 + frontend/src/components/MainLayout.vue | 17 +- frontend/src/components/TransferItem.vue | 49 +++++- internal/transfer/client.go | 145 ++++++++++++++++++ internal/transfer/server.go | 94 +++++++++++- 6 files changed, 302 insertions(+), 72 deletions(-) diff --git a/README.md b/README.md index ad12c3f..540bd5d 100644 --- a/README.md +++ b/README.md @@ -1,59 +1,8 @@ -# Welcome to Your New Wails3 Project! +TODO -Congratulations on generating your Wails3 application! This README will guide you through the next steps to get your project up and running. - -## Getting Started - -1. Navigate to your project directory in the terminal. - -2. To run your application in development mode, use the following command: - - ``` - wails3 dev - ``` - - This will start your application and enable hot-reloading for both frontend and backend changes. - -3. To build your application for production, use: - - ``` - wails3 build - ``` - - This will create a production-ready executable in the `build` directory. - -## Exploring Wails3 Features - -Now that you have your project set up, it's time to explore the features that Wails3 offers: - -1. **Check out the examples**: The best way to learn is by example. Visit the `examples` directory in the `v3/examples` directory to see various sample applications. - -2. **Run an example**: To run any of the examples, navigate to the example's directory and use: - - ``` - go run . - ``` - - Note: Some examples may be under development during the alpha phase. - -3. **Explore the documentation**: Visit the [Wails3 documentation](https://v3.wails.io/) for in-depth guides and API references. - -4. **Join the community**: Have questions or want to share your progress? Join the [Wails Discord](https://discord.gg/JDdSxwjhGf) or visit the [Wails discussions on GitHub](https://github.com/wailsapp/wails/discussions). - -## Project Structure - -Take a moment to familiarize yourself with your project structure: - -- `frontend/`: Contains your frontend code (HTML, CSS, JavaScript/TypeScript) -- `main.go`: The entry point of your Go backend -- `app.go`: Define your application structure and methods here -- `wails.json`: Configuration file for your Wails project - -## Next Steps - -1. Modify the frontend in the `frontend/` directory to create your desired UI. -2. Add backend functionality in `main.go`. -3. Use `wails3 dev` to see your changes in real-time. -4. When ready, build your application with `wails3 build`. - -Happy coding with Wails3! If you encounter any issues or have questions, don't hesitate to consult the documentation or reach out to the Wails community. +- [ ] 断点续传 +- [x] 加密传输 +- [x] 剪辑板传输 +- [ ] 文件夹传输 +- [x] 多样化图标 +- [ ] 取消传输 \ No newline at end of file diff --git a/frontend/bindings/mesh-drop/internal/transfer/service.ts b/frontend/bindings/mesh-drop/internal/transfer/service.ts index ec9f08f..1ab5529 100644 --- a/frontend/bindings/mesh-drop/internal/transfer/service.ts +++ b/frontend/bindings/mesh-drop/internal/transfer/service.ts @@ -35,6 +35,10 @@ export function SendFile(target: discovery$0.Peer | null, targetIP: string, file return $Call.ByID(2954589433, target, targetIP, filePath); } +export function SendFolder(target: discovery$0.Peer | null, targetIP: string, folderPath: string): $CancellablePromise { + return $Call.ByID(3258308403, target, targetIP, folderPath); +} + export function SendText(target: discovery$0.Peer | null, targetIP: string, text: string): $CancellablePromise { return $Call.ByID(1497421440, target, targetIP, text); } diff --git a/frontend/src/components/MainLayout.vue b/frontend/src/components/MainLayout.vue index 50bf8a4..eda8b9c 100644 --- a/frontend/src/components/MainLayout.vue +++ b/frontend/src/components/MainLayout.vue @@ -40,6 +40,7 @@ import { GetTransferList, SendFile, SendText, + SendFolder, } from "../../bindings/mesh-drop/internal/transfer/service"; import { Dialogs, Clipboard } from "@wailsio/runtime"; @@ -115,8 +116,6 @@ const pendingCount = computed(() => { // --- 操作 --- -const dialog = useDialog(); - const handleSendFile = async (ip: string) => { try { const filePath = await Dialogs.OpenFile({ @@ -134,9 +133,21 @@ const handleSendFile = async (ip: string) => { }; const handleSendFolder = async (ip: string) => { - // TODO + const opts: Dialogs.OpenFileDialogOptions = { + Title: "Select folder to send", + CanChooseDirectories: true, + CanChooseFiles: false, + AllowsMultipleSelection: false, + }; + const folderPath = await Dialogs.OpenFile(opts); + if (!folderPath) return; + const peer = await GetPeerByIP(ip); + if (!peer) return; + await SendFolder(peer, ip, folderPath as string); + activeKey.value = "transfers"; }; +const dialog = useDialog(); const handleSendText = (ip: string) => { const textContent = ref(""); const d = dialog.create({ diff --git a/frontend/src/components/TransferItem.vue b/frontend/src/components/TransferItem.vue index e6dc6db..5e3b3b0 100644 --- a/frontend/src/components/TransferItem.vue +++ b/frontend/src/components/TransferItem.vue @@ -1,5 +1,5 @@