diff --git a/src/resources.ts b/src/resources.ts index c93f52e1dc..dec8fb0a94 100644 --- a/src/resources.ts +++ b/src/resources.ts @@ -4,56 +4,286 @@ import * as utils from "./utils"; export const indexPage: string = `\ - + - Piping Server + 流式数据传输(不限制传输文件大小) -

Piping Server

-${VERSION} - -

Streaming Data Transfer Server over HTTP/HTTPS

-

Step 1: Choose a file or text

- -: Text mode

- - - -
- -

Step 2: Write your secret path

-(e.g. "abcd1234", "mysecret.png")
-
-

Step 3: Click the send button

-
-
-
-
-Piping UI for Web
-Transfer without JavaScript
-Command-line usage
+
+

📡 流式数据传输(不限制传输文件大小)

+

基于 HTTP/HTTPS 的实时数据中继服务

+
版本 ${VERSION}
+
+ +
+ +
+

🖥️ 网页操作

+ +

第一步:选择文件或输入文本

+ +

+ + + +

第二步:设置传输路径

+ + +

第三步:发送数据

+ + +
+ + +
+ + +
+

💻 命令行操作

+ +
+
💡 提示
+ 请将 ${url} 替换为您的服务器地址(如 http://localhost:8080) +
+ +

接收数据

+
curl ${url}/mypath
+ +

发送文件

+
curl -T myfile ${url}/mypath
+ +

发送文本

+
echo '你好!' | curl -T - ${url}/mypath
+ +

发送目录

+
# zip 格式
+zip -q -r - ./mydir | curl -T - ${url}/mypath
+
+# tar.gz 格式
+tar zfcp - ./mydir | curl -T - ${url}/mypath
+ +

加密传输

+
# 发送加密
+cat myfile | openssl aes-256-cbc | curl -T - ${url}/mypath
+
+# 接收解密
+curl ${url}/mypath | openssl aes-256-cbc -d
+ +

多接收者(同时下载)

+
# 发送端指定 3 个接收者
+curl -T video.mp4 "${url}/video?n=3"
+
+# 三个终端同时接收
+curl "${url}/video?n=3" -o part1.mp4 &
+curl "${url}/video?n=3" -o part2.mp4 &
+curl "${url}/video?n=3" -o part3.mp4
+
+
+ @@ -137,14 +390,14 @@ export function noScriptHtml(queryParams: URLSearchParams, styleNonce: string): const escapedPath = utils.escapeHtmlAttribute(path); return `\ - + - File transfer without JavaScript + 无 JavaScript 文件传输 -

File transfer without JavaScript

+

无 JavaScript 文件传输

-

Step 1: Specify path and mode

- -
- File - Text
+

第一步:设置路径和模式

+ +
+ 文件 + 文本
${ (mode === "text") ? ` -

Step 2: Input text

- ` +

第二步:输入文本

+ ` : ` -

Step 2: Choose a file

+

第二步:选择文件

`} -

Step 3: Send

- +

第三步:发送

+

- Version ${VERSION}
- Piping Server: + 版本 ${VERSION}
+ Piping Server: https://github.com/nwtgck/piping-server
- Top page
+ 返回首页
`; } /** - * Generate help page + * 生成帮助页面 * @param {string} url * @returns {string} */ // tslint:disable-next-line:no-shadowed-variable export function generateHelpPage(url: string): string { return ( -`Help for Piping Server ${VERSION} -(Repository: https://github.com/nwtgck/piping-server) +`Piping Server 帮助文档 ${VERSION} +(项目地址:https://github.com/nwtgck/piping-server) -======= Get ======= +======= 接收数据 ======= curl ${url}/mypath -======= Send ======= -# Send a file +======= 发送数据 ======= +# 发送文件 curl -T myfile ${url}/mypath -# Send a text -echo 'hello!' | curl -T - ${url}/mypath +# 发送文本 +echo '你好!' | curl -T - ${url}/mypath -# Send a directory (zip) +# 发送目录(zip 格式) zip -q -r - ./mydir | curl -T - ${url}/mypath -# Send a directory (tar.gz) +# 发送目录(tar.gz 格式) tar zfcp - ./mydir | curl -T - ${url}/mypath -# Encryption -## Send +# 加密传输 +## 发送加密数据 cat myfile | openssl aes-256-cbc | curl -T - ${url}/mypath -## Get +## 接收并解密数据 curl ${url}/mypath | openssl aes-256-cbc -d `); }