Skip to content

Commit

Permalink
Merge pull request #3 from ZZHow1024/develop
Browse files Browse the repository at this point in the history
MagicShare2.0.0
  • Loading branch information
ZZHow1024 authored Feb 9, 2025
2 parents e002f68 + b29f172 commit bebea31
Show file tree
Hide file tree
Showing 75 changed files with 2,574 additions and 1,042 deletions.
44 changes: 36 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# [C/S项目]神奇分享_**MagicShare**(中文说明)
# 神奇分享_**MagicShare**(中文说明)

[**English**](./README_EN.md)

---

Website:

[[C/S项目]神奇分享_MagicShare | ZZHow](https://www.zzhow.com/MagicShare)
[神奇分享_MagicShare(中文说明) | ZZHow](https://www.zzhow.com/MagicShare)

Source Code:

Expand All @@ -26,13 +28,13 @@ MagicShare 是一款跨平台的内网文件分享工具,发送方使用桌面

![TechnicalRoute.png](./TechnicalRoute.png)

- 编程语言:Java 和 JavaScript
- 编程语言:**Java****JavaScript**

---

## 许可证

该项目根据 GNU 通用公共许可证 v3.0 获得许可 - 有关详细信息,请参阅 [LICENSE](./LICENSE) 文件。
该项目根据 GNU 通用公共许可证 v3.0 获得许可 - 有关详细信息,请参阅 [LICENSE](https://github.com/ZZHow1024/MagicShare/blob/main/LICENSE) 文件。

---

Expand Down Expand Up @@ -70,6 +72,11 @@ https://github.com/ZZHow1024/MagicShare/releases
- 下载对应的文件。
- Linux 和 macOS 需要执行安装操作后再运行,Windows 可直接运行 .zip 压缩包中的 .exe 可执行程序或选择 .exe 安装包与 .msi 安装包执行安装操作,.jar 包可直接通过 `java -jar` 命令运行。
- 启动 MagicShare 并认真阅读启动页说明,同意 “用户许可协议” 可继续使用。
- 在 MagicShare 的主界面右下方可以选择语言。
- 当前支持中文(简体 / 繁体)与英文。
- 选择是否启用连接密码
- 若希望启用连接密码,需勾选“启用密码”并自定义 3~10 位的密码。
- 若不希望启用连接密码,需取消勾选“启用密码”。
- 自定义端口后单击 “启动服务” 按钮
- 若提示 “启动成功”,则表示服务正常启动,可将 ”分享URL“ 提供给接收方。
- 若提示 ”端口被占用“,请尝试更换端口号。
Expand All @@ -78,13 +85,16 @@ https://github.com/ZZHow1024/MagicShare/releases
- 方式一:拖拽待分享的文件/文件夹至软件主界面上半部分。
- 方式二:单击 “选择文件夹” 按钮选择待分享的文件夹。
- 方式三:在 “分享的文件/文件夹” 文本输入框中输入待分享的文件/文件夹路径,按下 “Enter” 键。
- 在软件右上方可查看当前连接数。
- 按下 “停止服务” 按钮可立即终止分享。
- 按下 “清空分享列表” 按钮可立即清空分享列表。

### Web端

- 打开浏览器,访问 ”分享URL“。
- 启动 MagicShare 并认真阅读启动页说明,同意 “用户许可协议” 可继续使用。
- 在 MagicShare 的主界面右下方可以选择语言。
- 当前支持中文(简体 / 繁体)与英文。
- 下载文件
- 单击 ”快速下载“ 使用浏览器下载器通过 HTTP 协议快速下载文件。
- 单击 ”加密下载“ 使用 MagicShare 加密下载器通过 WebSocket 协议并使用 RSA+AES 混合加密下载文件,不支持同时加密下载多个文件。
Expand All @@ -96,8 +106,8 @@ https://github.com/ZZHow1024/MagicShare/releases

该项目需要以下库:

- [**Vue.js**](https://github.com/vuejs) 及配套组件用于构建 Web 前端程序。
- [**Spring Boot**](https://github.com/spring-projects/spring-boot) 及配套组件:用于构建 Web 后端程序。
- [**Vue.js**](https://github.com/vuejs)** 及配套组件****用于构建 Web 前端程序。
- [**Spring Boot**](https://github.com/spring-projects/spring-boot)** 及配套组件:用于构建 Web 后端程序。
- [**OpenJFX**](https://openjfx.io/):用于构建图形用户界面的 JavaFX 库。

---
Expand All @@ -110,15 +120,33 @@ https://github.com/ZZHow1024/MagicShare/releases
- Web 网页下载文件。
- 支持通过 HTTP 协议快速下载文件
- 支持通过 WebSocket 协议并使用 RSA+AES 混合加密下载文件
- MagicShare2.0.0
- 当前连接数显示。
- 自定义连接密码。
- 支持多语言。
- 中文(简体/繁体)
- 英文

---

## 各版本主界面

![MagicShare1.0.0-Desktop](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fcc029b9b-e911-4cd4-b9c7-4b0853fa6d04%2FMagicShare1.0.0-Desktop.png?table=block&id=17fe64bd-e40f-8066-8c2d-f5f8b1ab0a23&t=17fe64bd-e40f-8066-8c2d-f5f8b1ab0a23&width=707&cache=v2)
### MagicShare2.0.0

![MagicShare2.0.0-Desktop-ZH](https://lively-brook-dc1.notion.site/image/attachment%3A138de23b-f7c8-4c8e-8d39-7aec8d577d4d%3AMagicShare2.0.0-Desktop-ZH.png?table=block&id=24e96980-87c2-4fc8-8035-af74d7e96be0&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare2.0.0-Desktop-ZH

![MagicShare2.0.0-Web-ZH](https://lively-brook-dc1.notion.site/image/attachment%3Abdaae023-be5d-4c78-970a-49e835b5f90b%3AMagicShare2.0.0-Web-ZH.png?table=block&id=c391b6ab-fc8c-4657-8f8d-bc718423e298&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare2.0.0-Web-ZH

### MagicShare1.0.0

![MagicShare1.0.0-Desktop](https://lively-brook-dc1.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fcc029b9b-e911-4cd4-b9c7-4b0853fa6d04%2FMagicShare1.0.0-Desktop.png?table=block&id=17fe64bd-e40f-8066-8c2d-f5f8b1ab0a23&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare1.0.0-Desktop

![MagicShare1.0.0-Web](https://www.notion.so/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fa457bfec-f826-4936-8721-75fc46632fc2%2FMagicShare1.0.0-Web.png?table=block&id=17fe64bd-e40f-80d7-9c7c-fca929d6904d&t=17fe64bd-e40f-80d7-9c7c-fca929d6904d&width=707&cache=v2)
![MagicShare1.0.0-Web](https://lively-brook-dc1.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fa457bfec-f826-4936-8721-75fc46632fc2%2FMagicShare1.0.0-Web.png?table=block&id=17fe64bd-e40f-80d7-9c7c-fca929d6904d&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare1.0.0-Web
152 changes: 152 additions & 0 deletions README_EN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# **MagicShare(English)**

[**中文说明**](./README.md)

---

Website:

[MagicShare_EN | ZZHow](https://www.zzhow.com/en/MagicShareEN)

Source Code:

https://github.com/ZZHow1024/MagicShare

Releases:

https://github.com/ZZHow1024/MagicShare/releases

---

## What is it?

MagicShare is a cross-platform intranet file sharing tool.

---

## Technical route

![TechnicalRoute.png](./TechnicalRoute.png)

- programming language: **Java** and **JavaScript**

---

## **License**

This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](https://github.com/ZZHow1024/MagicShare/blob/main/LICENSE) file for details.

---

## User License Agreement

**Please read carefully before using this software:**

- Legal use: This software is limited to legal file sharing. It is strictly forbidden to share any files that infringe copyright, involve pornography, violence, fraud, illegal or other harmful content.
- Personal responsibility: You are fully responsible for the legality of the shared content. Please make sure that you have the legal authorization to share the file.
- Risk warning: This software cannot guarantee the security of the shared files. Please check the security of the files yourself.
- Disclaimer: The software author is not responsible for any direct or indirect losses caused by the use of this software.

The use of MagicShare requires agreement and compliance with the above.

---

## **Instructions for use**

Download address:

https://github.com/ZZHow1024/MagicShare/releases

### Desktop Client

- Determine the operating system you are using.
- Linux:
- Select the .deb installation package (Debian, Ubuntu) / .rpm (Red Hat, Fedora, SUSE) installation package.
- macOS:
- Determine the chip of the Mac you are using (Apple Silicon / Intel).
- Select the .dmg disk image / .pkg installation package.
- Windows:
- Select the .zip compressed package / .exe installation package / .msi installation package.
- General:
- Select the .jar package (the computer needs to have JRE configured)
- Download the corresponding file.
- Linux and macOS need to be installed before running. Windows can directly run the .exe executable program in the .zip compressed package or select the .exe installation package and .msi installation package to perform the installation operation. The .jar package can be directly run through the `java -jar` command.
- Launch MagicShare and read the instructions on the startup page carefully. You can continue to use it after agreeing to the "User License Agreement".
- You can select the language at the bottom right of the main interface of MagicShare.
- Currently supports Chinese (Simplified / Traditional) and English.
- Choose whether to enable the connection password
- If you want to enable the connection password, you need to check "Enable password" and customize a 3-10-digit password.
- If you do not want to enable the connection password, you need to uncheck "Enable password".
- After customizing the port, click the "Start Service" button
- If the prompt "Start Success" is displayed, it means that the service is started normally and the "Share URL" can be provided to the recipient.
- If the prompt "Port is occupied" is displayed, try to change the port number.
- If the prompt "Wrong port number", please check whether the customized port number is an integer between 1 and 65535.
- Add the files to be shared to the sharing list
- Method 1: Drag the file/folder to be shared to the upper half of the software main interface.
- Method 2: Click the "Select folder" button to select the folder to be shared.
- Method 3: Enter the path of the file/folder to be shared in the "Shared file/folder" text input box and press the "Enter" key.
- You can check the current number of connections in the upper right corner of the software.
- Press the "Stop Service" button to terminate sharing immediately.
- Press the "Clear sharing list" button to clear the share list immediately.

### Web client

- Open the browser and visit "Share URL".
- Launch MagicShare and read the instructions on the startup page carefully. Agree to the "User License Agreement" to continue using it.
- You can select the language in the lower right corner of the MagicShare main interface.
- Currently supports Chinese (Simplified/Traditional) and English.
- Download files
- Click "Quick download" to use the browser downloader to quickly download files via HTTP protocol.
- Click "Encrypted download" to use MagicShare encrypted downloader to download files via WebSocket protocol and use RSA+AES hybrid encryption. It does not support simultaneous encrypted download of multiple files.
- Click the "Decryption download progress" button, and the encrypted download progress drawer will pop up at the bottom of the page.

---

## **Dependencies**

This project requires the following libraries:

- [**Vue.js**](https://github.com/vuejs) and supporting components: used to build Web frontend programs.
- [**Spring Boot**](https://github.com/spring-projects/spring-boot) and supporting components: used to build Web backend programs.
- [**OpenJFX**](https://openjfx.io/): JavaFX library for building graphical user interfaces.

---

## **Functional introduction of each version**

- MagicShare1.0.0
- Start service on custom port.
- Find files by folder/file path and generate a list.
- Download files from Web page.
- Support fast file download via HTTP protocol
- Support downloading files via WebSocket protocol and using RSA+AES hybrid encryption
- MagicShare2.0.0
- Display the current number of connections.
- Customize the connection password.
- Support multiple languages.
- Chinese (Simplified/Traditional)
- English

---

## **Main interface of each version**

### MagicShare2.0.0

![MagicShare2.0.0-Desktop-EN](https://lively-brook-dc1.notion.site/image/attachment%3Af185d39b-6a7c-4334-b51a-6821c72586c5%3AMagicShare2.0.0-Desktop-EN.png?table=block&id=760a4fa4-e27f-49a6-afd8-9fa26d5bf88b&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare2.0.0-Desktop-EN

![MagicShare2.0.0-Web-EN](https://lively-brook-dc1.notion.site/image/attachment%3A7f1c2b9b-6013-4bf7-bab7-4ea71051fcb0%3AMagicShare2.0.0-Web-EN.png?table=block&id=b25b96d5-1040-4164-abd0-45f0c69b6c7a&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare2.0.0-Web-EN

### MagicShare1.0.0

![MagicShare1.0.0-Desktop](https://lively-brook-dc1.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fcc029b9b-e911-4cd4-b9c7-4b0853fa6d04%2FMagicShare1.0.0-Desktop.png?table=block&id=194e64bd-e40f-8068-a52e-efc6ba94c62e&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare1.0.0-Desktop

![MagicShare1.0.0-Web](https://lively-brook-dc1.notion.site/image/https%3A%2F%2Fprod-files-secure.s3.us-west-2.amazonaws.com%2F4b165318-6383-451c-8845-110b786c9f0a%2Fa457bfec-f826-4936-8721-75fc46632fc2%2FMagicShare1.0.0-Web.png?table=block&id=194e64bd-e40f-80d1-957a-c58c4ea64b02&spaceId=4b165318-6383-451c-8845-110b786c9f0a&width=1420&userId=&cache=v2)

MagicShare1.0.0-Web
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</parent>
<groupId>com.zzhow</groupId>
<artifactId>MagicShare</artifactId>
<version>1.0.0</version>
<version>2.0.0</version>
<name>MagicShare</name>
<description>MagicShare</description>
<url/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.zzhow.magicshare.config;

import com.zzhow.magicshare.service.FileService;
import com.zzhow.magicshare.websocket.FileWebSocketHandler;
import com.zzhow.magicshare.websocket.UserWebSocketHandler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
Expand All @@ -13,9 +16,13 @@
@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
@Autowired
private FileService fileService;

@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
// 注册 WebSocket 端点并指定处理器
registry.addHandler(new FileWebSocketHandler(), "/ws/download").setAllowedOrigins("*");
registry.addHandler(new UserWebSocketHandler(fileService), "/ws/connect").setAllowedOrigins("*");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.zzhow.magicshare.pojo.entity.FileDetail;
import com.zzhow.magicshare.repository.FileRepository;
import com.zzhow.magicshare.repository.UserRepository;
import com.zzhow.magicshare.util.CryptoUtil;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.http.HttpHeaders;
Expand All @@ -12,6 +14,7 @@
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Path;
import java.util.Base64;
import java.util.List;

/**
Expand All @@ -21,17 +24,34 @@
@RestController()
@RequestMapping("/api/download")
public class DownloadController {
private final CryptoUtil cryptoUtil = CryptoUtil.getInstance();

@GetMapping("/{fileId}")
public ResponseEntity<Resource> downloadFile(String shareId, @PathVariable String fileId) {
if (shareId == null || fileId == null) {
return ResponseEntity.badRequest().build();
}
public ResponseEntity<Resource> downloadFile(String token, String shareId, @PathVariable String fileId) {
try {
if (token == null || shareId == null || fileId == null) {
return ResponseEntity.badRequest().build();
}

if (!shareId.equals(FileRepository.getUuid())) {
return ResponseEntity.notFound().build();
}
fileId = fileId.replace("-", "/").replace("_", "+");
token = token.replace(" ", "+");
shareId = shareId.replace(" ", "+");

// AES 解密数据
String[] split = new String(cryptoUtil.decryptAes(Base64.getDecoder().decode(token))).split("#");

// 验证 sessionId#downloadId
if (!UserRepository.verifyDownloadId(split[0], split[1]))
return ResponseEntity.notFound().build();

// 解密数据
shareId = new String(cryptoUtil.decryptAes(Base64.getDecoder().decode(shareId)));
fileId = new String(cryptoUtil.decryptAes(Base64.getDecoder().decode(fileId)));

if (!shareId.equals(FileRepository.getUuid())) {
return ResponseEntity.notFound().build();
}

try {
// 构建文件路径
List<FileDetail> files = FileRepository.getFiles();
int index = files.indexOf(new FileDetail(fileId));
Expand Down

This file was deleted.

Loading

0 comments on commit bebea31

Please sign in to comment.