chore(ci/cd): refine scripts and docs (#36)

* chore(ci/cd): refine scripts and docs

* text(server): fix incorrect server port
This commit is contained in:
Hexxa 2021-01-30 22:03:59 +08:00 committed by GitHub
parent e87a342c93
commit ede6c239f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 81 additions and 296 deletions

5
.gitignore vendored
View file

@ -12,4 +12,7 @@
# backend
**/*/quickshare.db
**/*/files/
**/*/uploadings/
**/*/uploadings/
# misc
dist

View file

@ -2,11 +2,11 @@
Quickshare
</h1>
<p align="center">
Simple file sharing server built with Go/Golang, Typescript, Gin, React, Boltdb, etc.
Simple file sharing service built with Go/Golang, Typescript, Gin, React, Boltdb, etc.
</p>
<p align="center">
<a href="https://travis-ci.org/ihexxa/quickshare">
<img src="https://travis-ci.org/ihexxa/quickshare.svg?branch=main" />
<a href="https://github.com/ihexxa/quickshare/actions">
<img src="https://github.com/ihexxa/quickshare/workflows/quickshare-ci/badge.svg" />
</a>
<a href="https://goreportcard.com/report/github.com/ihexxa/quickshare">
<img src="https://goreportcard.com/badge/github.com/ihexxa/quickshare" />
@ -16,29 +16,35 @@
</a>
<p>
![Quickshare demo](./demo.jpg)
![Quickshare on desktop](./docs/imgs/desktop.jpeg)
![Quickshare on mobile](./docs/imgs/mobile.jpeg)
Choose Language: English | [简体中文](./docs/README_zh-cn.md)
## Download
Visit [Release Page](https://github.com/ihexxa/quickshare/releases) to get Linux | Mac | Windows distribution(s).
## Main Features
- Uploading and downloading in browser without client
- Sharing files among different devices (Adaptive UI)
- Be compatible with Linux, Mac and Windows
- Sharing files among different devices (desktop & mobile)
- Stopping and resuming uploading/downloading
- Stopping and resuming uploading/downloading
- Do uploading and downloading in web browser
## Installation
## Quick Start
Coming soon.
**Downloading**: Download last distribution(s) in [Release Page](https://github.com/ihexxa/quickshare/releases).
**Unzipping**: Unzip it and run following command `./quickshare`. (You may update its execution permission: e.g. run `chmod u+x quickshare` on Linux)
**Starting**: At the first run, Quickshare will let you input your user name and generate a random password for you (here `quickshare` is the user name). It may output something like following (password is `2fdc98`):
```
Please input admin name: quickshare
password is generated: 2fdc98, please update it after login
user (quickshare) is created
```
**Accessing**: At last, open your browser and visit `http://127.0.0.1:8686`.
### FAQ
Please refer [FAQ document](./docs/FAQ_en-us.md)
### Contribution
TODO
Coming soon.

BIN
cmd/quickshare Executable file

Binary file not shown.

View file

@ -1,77 +0,0 @@
{
"AppName": "qs",
"AdminId": "admin",
"AdminPwd": "quicksh@re",
"SecretKey": "qs",
"Production": true,
"HostName": "",
"Port": 8888,
"MaxUpBytesPerSec": 10000000,
"MaxDownBytesPerSec": 10000000,
"MaxRangeLength": 10485760,
"Timeout": 7200000,
"ReadTimeout": 5000,
"WriteTimeout": 7200000,
"IdleTimeout": 10000,
"WorkerPoolSize": 16,
"TaskQueueSize": 16,
"QueueSize": 16,
"ParseFormBufSize": 5000000,
"MaxHeaderBytes": 1024,
"DownLimit": -1,
"MaxShares": 16384,
"LocalFileLimit": -1,
"CookieDomain": "",
"CookieHttpOnly": false,
"CookieMaxAge": 604800,
"CookiePath": "/",
"CookieSecure": false,
"KeyAdminId": "adminid",
"KeyAdminPwd": "adminpwd",
"KeyToken": "token",
"KeyFileName": "fname",
"KeyFileSize": "size",
"KeyShareId": "shareid",
"KeyStart": "start",
"KeyLen": "len",
"KeyChunk": "chunk",
"KeyAct": "act",
"KeyExpires": "expires",
"KeyDownLimit": "downlimit",
"ActStartUpload": "startupload",
"ActUpload": "upload",
"ActFinishUpload": "finishupload",
"ActLogin": "login",
"ActLogout": "logout",
"ActShadowId": "shadowid",
"ActPublishId": "publishid",
"ActSetDownLimit": "setdownlimit",
"ActAddLocalFiles": "addlocalfiles",
"AllUsers": "addlocalfiles",
"OpIdIpVisit": 0,
"OpIdUpload": 1,
"OpIdDownload": 2,
"OpIdLogin": 3,
"OpIdGetFInfo": 4,
"OpIdDelFInfo": 5,
"OpIdOpFInfo": 6,
"PathLocal": "files",
"PathLogin": "/login",
"PathDownloadLogin": "/download-login",
"PathDownload": "/download",
"PathUpload": "/upload",
"PathStartUpload": "/startupload",
"PathFinishUpload": "/finishupload",
"PathFileInfo": "/fileinfo",
"PathClient": "/",
"LimiterCap": 256,
"LimiterTtl": 3600,
"LimiterCyc": 1,
"BucketCap": 100,
"SpecialCapsStr": {
"0": 100,
"1": 100,
"2": 100,
"3": 1
}
}

BIN
demo.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 790 KiB

View file

@ -1,82 +0,0 @@
## Configuration
```Javascript
{
"AppName": "qs",
"AdminId": "admin", // login user name
"AdminPwd": "quicksh@re", // login password
"SecretKey": "qs", // key for hashing cookie (jwt)
"Production": true,
"HostName": "", // listening address
"Port": 8888, // listening port
"MaxUpBytesPerSec": 2000000, // upload speed limit
"MaxDownBytesPerSec": 1000000, // download speed limit
"MaxRangeLength": 10485760, // max length of chunk to upload at once
"Timeout": 7200000, // connection timeout
"ReadTimeout": 5000, // connection read request timeout
"WriteTimeout": 7200000, // connection write response timeout
"IdleTimeout": 10000, // connection idle timeout
"WorkerPoolSize": 16, // number of workers, it decides how many download connections are provided at same time
"TaskQueueSize": 16, // how many requests can be queued
"QueueSize": 16,
"ParseFormBufSize": 5000000, // buffer for parsing request
"MaxHeaderBytes": 1024, // max header size in byte
"DownLimit": -1, // default download limit
"MaxShares": 16384, // max number of sharing
"LocalFileLimit": -1, // max number of listing file at once
"CookieDomain": "",
"CookieHttpOnly": false,
"CookieMaxAge": 604800,
"CookiePath": "/",
"CookieSecure": false,
"KeyAdminId": "adminid",
"KeyAdminPwd": "adminpwd",
"KeyToken": "token",
"KeyFileName": "fname",
"KeyFileSize": "size",
"KeyShareId": "shareid",
"KeyStart": "start",
"KeyLen": "len",
"KeyChunk": "chunk",
"KeyAct": "act",
"KeyExpires": "expires",
"KeyDownLimit": "downlimit",
"ActStartUpload": "startupload",
"ActUpload": "upload",
"ActFinishUpload": "finishupload",
"ActLogin": "login",
"ActLogout": "logout",
"ActShadowId": "shadowid",
"ActPublishId": "publishid",
"ActSetDownLimit": "setdownlimit",
"ActAddLocalFiles": "addlocalfiles",
"AllUsers": "addlocalfiles",
"OpIdIpVisit": 0,
"OpIdUpload": 1,
"OpIdDownload": 2,
"OpIdLogin": 3,
"OpIdGetFInfo": 4,
"OpIdDelFInfo": 5,
"OpIdOpFInfo": 6,
"PathLocal": "files",
"PathLogin": "/login",
"PathDownloadLogin": "/download-login",
"PathDownload": "/download",
"PathUpload": "/upload",
"PathStartUpload": "/startupload",
"PathFinishUpload": "/finishupload",
"PathFileInfo": "/fileinfo",
"PathClient": "/",
"LimiterCap": 256,
"LimiterTtl": 3600,
"LimiterCyc": 1,
"BucketCap": 10, // operation is allowed at most 10 times per second, but SpecialCapsStr will override this value
"SpecialCapsStr": {
"0": 30, // IpVisit is allowed at most 30 times per second
"1": 10, // Uploading is allowed at most 10 times per second
"2": 10, // Downloading is allowed at most 10 times per second
"3": 1 // Login/Logout is allowed at most 1 time per second
// You can also add rate limits according to OpIdxxx above.
}
}
```

View file

@ -1,18 +0,0 @@
## FAQ
- How to change accound name and password?
- Go to quickshare folder
- Open config.json using text editor. (e.g. notpad++, sublime, vscode, etc...)
- Search for line `"AdminPwd": "quicksh@re",`
- Replace `quicksh@re` with your password, e.g. `"AdminPwd": "myPassword",`
- Then you can also update user name `"AdminId": "myUserName",` in above way.
- How to change listening address(or port)?
- Go to quickshare folder
- Open config.json using text editor. (e.g. notpad++, sublime, vscode, etc...)
- Search for line `"HostName": "",`
- Change the value of `HostName`, e.g. `"HostName": "192.168.0.6",`
- You can also change port value (`"Port": 8888,`) in above way
- How to change background?
- Go to `public` folder under quickshare folder
- Open style.css using text editor. (e.g. notpad++, sublime, vscode, etc...)
- Update `body`'s css.

View file

@ -1,17 +0,0 @@
## 常见问题
- 怎么改用户名和密码?
- 进入 quickshare 文件夹
- 用文本编辑器打开 config.json. (比如 notpad++, sublime, vscode, 等等...)
- 查找行 `"AdminPwd": "quicksh@re",`
- 用你的密码替换 `quicksh@re`, 比如 `"AdminPwd": "你的密码",`
- 怎么改监听地址(端口)?
- 进入 quickshare 文件夹
- 用文本编辑器打开 config.json. (比如 notpad++, sublime, vscode, 等等...)
- 查找行 `"HostName": "",`
- 更改`HostName`的值, 比如 `"HostName": "192.168.0.6",`
- 你可以用上面的方法更改端口值(`"Port": 8888,`)
- 怎么更改背景?
- 进入 quickshare 文件夹下的`public`文件夹
- 使用文本编辑器打开 style.css. (比如 notpad++, sublime, vscode, 等等...)
- 更新 `body`'的 css

View file

@ -1,12 +1,12 @@
<h1 align="center">
[未完成!!!] Quickshare
Quickshare
</h1>
<p align="center">
的文件共享服务, 使用Go/Golang, Typescript, Gin, React, Boltdb等构建.
的文件共享服务, 使用Go/Golang, Typescript, Gin, React, Boltdb等构建.
</p>
<p align="center">
<a href="https://travis-ci.org/ihexxa/quickshare">
<img src="https://travis-ci.org/ihexxa/quickshare.svg?branch=main" />
<a href="https://github.com/ihexxa/quickshare/actions">
<img src="https://github.com/ihexxa/quickshare/workflows/quickshare-ci/badge.svg" />
</a>
<a href="https://goreportcard.com/report/github.com/ihexxa/quickshare">
<img src="https://goreportcard.com/badge/github.com/ihexxa/quickshare" />
@ -16,58 +16,35 @@
</a>
<p>
![Quickshare 演示](../demo.jpg)
![Quickshare on desktop](./imgs/desktop.jpeg)
![Quickshare on mobile](./imgs/mobile.jpeg)
选择语言: [English](../README.md) | 简体中文
## 下载
## 主要功能
访问 [发布页](https://github.com/ihexxa/quickshare/releases) 获取 Linux | Mac | Windows 版本.
- 在多个设备之间共享文件 (自适应 UI)
- 兼容 Linux, Mac 和 Windows
- 上传下载都支持断点续传
- 在 Web 浏览器 中完成上传下载
## 特点
## 快速开始
- 在浏览器中上传下载, 无需安装任何客户端
- 在桌面电脑和移动设备件间共享文件
- 绿色软件
- 支持添加本地文件
- 支持添加文件下载次数上限
- 支持断点续传
**下载**: 先下载最新版本 [发布页](https://github.com/ihexxa/quickshare/releases).
## 安装
**解压**: 将其解压, 并在运行命令 `./quickshare`. (你可能需要为它更新执行权限: 比如在 linux 上执行 `chmod u+x quickshare`)
开始使用 quickshare 主要需要两步: 解压, 启动.
**运行**: 在第一次运行时, Quickshare 会让你输入你的用户名 (这里输入的用户名是 quickshare), 并会为你生成密码. 它可能会输出类似下面内容 (这里密码是`2fdc98`):
第一步, 解压下载包, 启动 quickshare.
```
Please input admin name: quickshare
password is generated: 2fdc98, please update it after login
user (quickshare) is created
```
### Linux
- 解压包: `unzip [package].` (`[package]` 可以是`quickshare_0.0.8_linux_x86_6 4.zip`)
- 进入文件夹, 启动 quickshare `./quickshare`
### Mac
- 解压包: `unzip [package].` (`[package]` 可以是`quickshare_0.0.8_macos_x86_6 4.zip`)
- 进入文件夹, 启动 quickshare `./quickshare`
### Windows
- 解压包
- 进入文件夹, 双击 `quickshare.exe` 启动 quickshare
最后一步, 在浏览器中面基 quickshare.
- Quickshare 会在启动后, 在命令中输出中显示 `quickshare starts @ [URL]` (举个栗子 `URL` 可以是 `192.168.0.1:8888`)
- 在浏览器中打开 `URL` 并使用 `admin``quicksh@re` 登入
- 开耍(不过别忘改密码[常见问题文档](./FAQ_zh-cn.md))
**访问**: 最后, 打开你的浏览器并访问 `http://127.0.0.1:8686`.
### 常见问题
请参考[常见问题文档](./FAQ_zh-cn.md)
### 配置
请参考[配置文档](./CONFIG_en-us.md)
### 贡献代码
待添加...
敬请期待.

BIN
docs/imgs/desktop.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 669 KiB

BIN
docs/imgs/mobile.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 200 KiB

View file

@ -4,13 +4,6 @@
"src/client/web"
],
"scripts": {
"dev:setup": "yarn && yarn dev:copy-immutable && yarn dev:copy-react-dom && yarn dev:copy-react",
"dev:copy-immutable": "cp node_modules/immutable/dist/immutable.min.js public/static/js/",
"dev:copy-react-dom": "cp node_modules/react-dom/umd/react-dom.development.js public/static/js/",
"dev:copy-react": "cp node_modules/react/umd/react.development.js public/static/js/",
"prod:setup": "yarn && yarn prod:copy-immutable && yarn prod:copy-react-dom && yarn prod:copy-react",
"prod:copy-immutable": "cp node_modules/immutable/dist/immutable.min.js public/static/js/",
"prod:copy-react-dom": "cp node_modules/react-dom/umd/react-dom.production.min.js public/static/js/",
"prod:copy-react": "cp node_modules/react/umd/react.production.min.js public/static/js/"
"build": "scripts/build"
}
}

8
scripts/build Executable file
View file

@ -0,0 +1,8 @@
export QSROOT=`pwd`
rm -r dist && mkdir dist
cd cmd
go build -o $QSROOT/dist/quickshare
cd $QSROOT/src/client/web
yarn build
cp -r $QSROOT/public $QSROOT/dist
cd $QSROOT

View file

@ -86,7 +86,7 @@
name="msapplication-TileImage"
content="/static/fav/ms-icon-144x144.png"
/> -->
<!-- <meta name="theme-color" content="#ffffff" />
<meta name="theme-color" content="#ffffff" />
</head>
<body>
<div id="content"><div id="mount"></div></div>

View file

@ -4,20 +4,19 @@
"description": "web client for quickshare",
"main": "",
"scripts": {
"build": "webpack --config webpack.app.prod.js",
"build": "yarn prod:addjs && webpack --config webpack.app.prod.js",
"build:watch": "webpack --config webpack.app.prod.js --watch",
"build:dev": "webpack --config webpack.app.dev.js --watch",
"build:admin": "webpack --config webpack.admin.prod.js",
"build:admin:watch": "webpack --config webpack.admin.prod.js --watch",
"build:admin:dev": "webpack --config webpack.admin.dev.js --watch",
"build:task": "webpack --config webpack.task.prod.js",
"build:task:watch": "webpack --config webpack.task.prod.js --watch",
"build:task:dev": "webpack --config webpack.task.dev.js --watch",
"e2e": "jest -c jest.e2e.config.js",
"e2e:watch": "jest --watch -c jest.e2e.config.js",
"build:dev": "yarn dev:addjs && webpack --config webpack.app.dev.js --watch",
"test": "jest test --maxWorkers=2",
"test:watch": "jest test --watch --maxWorkers=2",
"copy": "cp -r ../../static ../../../dockers/nginx/"
"dev:addjs": "yarn && yarn dev:copy-immutable && yarn dev:copy-react-dom && yarn dev:copy-react",
"dev:copy-immutable": "cp ../../../node_modules/immutable/dist/immutable.min.js ../../../public/static/js/",
"dev:copy-react-dom": "cp ../../../node_modules/react-dom/umd/react-dom.development.js ../../../public/static/js/",
"dev:copy-react": "cp ../../../node_modules/react/umd/react.development.js ../../../public/static/js/",
"prod:addjs": "yarn && yarn prod:copy-immutable && yarn prod:copy-react-dom && yarn prod:copy-react",
"prod:copy-immutable": "cp ../../../node_modules/immutable/dist/immutable.min.js ../../../public/static/js/",
"prod:copy-react-dom": "cp ../../../node_modules/react-dom/umd/react-dom.production.min.js ../../../public/static/js/",
"prod:copy-react": "cp ../../../node_modules/react/umd/react.production.min.js ../../../public/static/js/"
},
"author": "hexxa",
"license": "LGPL-3.0",

View file

@ -83,9 +83,9 @@ export class Browser extends React.Component<Props, State, {}> {
};
addUploads = (event: React.ChangeEvent<HTMLInputElement>) => {
const fileList = List<File>();
let fileList = List<File>();
for (let i = 0; i < event.target.files.length; i++) {
fileList.push(event.target.files[i]);
fileList = fileList.push(event.target.files[i]);
}
updater().addUploads(fileList);
this.update(updater().setBrowser);

View file

@ -5,10 +5,6 @@ const dev = require("./webpack.dev.js");
module.exports = merge(dev, {
entry: "./src/app.tsx",
// entry: [
// "./src/app.tsx",
// "./src/worker/uploader.worker.ts",
// ],
context: `${__dirname}`,
output: {
globalObject: "this",

View file

@ -7,6 +7,7 @@ module.exports = merge(prod, {
entry: "./src/app.tsx",
context: `${__dirname}`,
output: {
globalObject: "this",
path: `${__dirname}/../../../public/static`,
chunkFilename: "[name].bundle.js",
filename: "[name].bundle.js"
@ -15,7 +16,8 @@ module.exports = merge(prod, {
new HtmlWebpackPlugin({
template: `${__dirname}/build/template/index.template.html`,
hash: true,
filename: `../index.html`
filename: `../index.html`,
minify: false
})
]
});

View file

@ -65,12 +65,7 @@ module.exports = {
chunks: "all",
minChunks: 2,
reuseExistingChunk: true,
},
// worker: {
// name: "worker",
// test: /[\\/]worker[\\/]/,
// filename: "[name].bundle.js"
// }
}
},
},
},

View file

@ -62,7 +62,7 @@ func DefaultConfig() (string, error) {
Server: &ServerCfg{
Debug: false,
Host: "0.0.0.0",
Port: 8888,
Port: 8686,
ReadTimeout: 2000,
WriteTimeout: 1000 * 3600 * 24, // 1 day
MaxHeaderBytes: 512,

View file

@ -18,7 +18,7 @@ import (
)
func TestFileHandlers(t *testing.T) {
addr := "http://127.0.0.1:8888"
addr := "http://127.0.0.1:8686"
root := "testData"
config := `{
"users": {

View file

@ -9,7 +9,7 @@ import (
)
func TestSingleUserHandlers(t *testing.T) {
addr := "http://127.0.0.1:8888"
addr := "http://127.0.0.1:8686"
root := "testData"
config := `{
"users": {

View file

@ -32,7 +32,7 @@ func startTestServer(config string) *Server {
}
func waitForReady(addr string) bool {
retry := 10
retry := 20
setCl := client.NewSettingsClient(addr)
for retry > 0 {