Add openapi API documentation (#294)

* Initial version

- Add OpenAPI documentation generator
- Update README.md to remove endpoint documentations

* Adds new endpoints

- Fixes build with swag
- Adds new endpoints

* Adds more endpoints documentation

- Also removes swag from Dockerfile and build script

* Finally adds all endpoints documentation

* Initial version

- Add OpenAPI documentation generator
- Update README.md to remove endpoint documentations

* Adds new endpoints

- Fixes build with swag
- Adds new endpoints

* Adds more endpoints documentation

- Also removes swag from Dockerfile and build script

* Finally adds all endpoints documentation

* Update README (#1)

* Update README

I completely redid the `README.md`. Now it's much easier to read and understand.

---------

Co-authored-by: cocool97 <34218602+cocool97@users.noreply.github.com>

* Improves documentation

* Delete server/config.db

* Update README.md

* Update README.md

* fix download in api docs

* add api docs to web

---------

Co-authored-by: Shadeov <144587546+shadeov@users.noreply.github.com>
Co-authored-by: nikk gitanes <tsynik@gmail.com>
This commit is contained in:
cocool97
2023-11-13 07:59:23 +01:00
committed by GitHub
parent aa061fd24c
commit b72c66d433
32 changed files with 5375 additions and 2024 deletions

1
.gitignore vendored
View File

@@ -19,6 +19,7 @@
TorrServer.iml TorrServer.iml
.idea/ .idea/
.vscode
src/github.com/ src/github.com/
src/golang.org/ src/golang.org/

473
README.md
View File

@@ -1,24 +1,165 @@
## TorrServer <p align="center" style="text-align: center">
TorrServer, stream torrent to http <img src="https://github.com/YouROK/TorrServer/assets/144587546/53f7175a-cda4-4a06-86b6-2ac07582dcf1" width="33%"><br/>
</p>
<p align="center">
Simple and powerful tool for streaming torrents.
<br/>
<br/>
<a href="https://github.com/YouROK/TorrServer/blob/master/LICENSE">
<img alt="GitHub" src="https://img.shields.io/github/license/YouROK/TorrServer"/>
</a>
<a href="https://goreportcard.com/report/github.com/YouROK/TorrServer">
<img src="https://goreportcard.com/badge/github.com/YouROK/TorrServer" />
</a>
<a href="https://pkg.go.dev/github.com/YouROK/TorrServer">
<img src="https://pkg.go.dev/badge/github.com/YouROK/TorrServer.svg" alt="Go Reference"/>
</a>
<a href="https://github.com/YouROK/TorrServer/issues">
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" />
</a>
<a href="https://github.com/YouROK/TorrServer/actions/workflows/github-actions-docker.yml" rel="nofollow">
<img src="https://img.shields.io/github/actions/workflow/status/YouROK/TorrServer/github-actions-docker.yml?logo=Github" alt="Build" />
</a>
<a href="https://github.com/YouROK/TorrServer/tags" rel="nofollow">
<img alt="GitHub tag (latest SemVer pre-release)" src="https://img.shields.io/github/v/tag/YouROK/TorrServer?include_prereleases&label=version"/>
</a>
</p>
## Introduction
TorrServer is a program that allows users to view torrents online without the need for preliminary file downloading.
The core functionality of TorrServer includes caching torrents and subsequent data transfer via the HTTP protocol,
allowing the cache size to be adjusted according to the system parameters and the user's internet connection speed.
## Features
- Caching
- Streaming
- Local and Remote Server
- Viewing torrents on various devices
- Selecting a player for video playback
- Integration with other apps
## Getting Started
### Installation ### Installation
Just download server from releases and exec file\
https://github.com/YouROK/TorrServer/releases \
Then open the browser link http://127.0.0.1:8090 or https://127.0.0.1:8091 if the server was started with --ssl option \
On linux systems you may need to set the environment variable before run \
***export GODEBUG=madvdontneed=1***
#### macOS install / configure / uninstall script Download the application for the required platform in the [releases](https://github.com/YouROK/TorrServer/releases) page. After installation, open the link <http://127.0.0.1:8090> in the browser.'
Just run in Terminal: `curl -s https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerMac.sh -o installTorrserverMac.sh && chmod 755 installTorrServerMac.sh && sudo ./installTorrServerMac.sh`
Alternative install script for Intel Macs: https://github.com/dancheskus/TorrServerMacInstaller
#### Linux on VPS install / configure / uninstall script #### Windows
Just run in console: `curl -s https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerLinux.sh | sudo bash`
#### Unofficial TorrServer iocage plugin Run `TorrServer-windows-amd64.exe`.
On FreeBSD (TrueNAS/FreeNAS) you can use this plugin
https://github.com/filka96/iocage-plugin-TorrServer #### Linux
Run in console
```bash
curl -s https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerLinux.sh | sudo bash
```
#### macOS
Run in console
```bash
curl -s https://raw.githubusercontent.com/YouROK/TorrServer/master/installTorrServerMac.sh -o installTorrserverMac.sh && chmod 755 installTorrServerMac.sh && sudo ./installTorrServerMac.sh
```
Alternative install script for Intel Macs: <https://github.com/dancheskus/TorrServerMacInstaller>
#### IOCage Plugin (Unofficial)
On FreeBSD (TrueNAS/FreeNAS) you can use this plugin: <https://github.com/filka96/iocage-plugin-TorrServer>
#### For NAS Systems (Unofficial)
- Several releases are available through this link: <https://github.com/vladlenas>
- **Synology NAS** packages repo source: <https://grigi.lt>
### Server args
- `--port PORT`, `-p PORT` - web server port, default 8090
- `--ssl` - enables https for web server
- `--sslport PORT` - web server https port, default 8091. If not set, will be taken from db (if stored previously) or use default.
- `--sslcert PATH` - path to ssl cert file. If not set, will be taken from db (if stored previously) or default self-signed certificate/key will be generated.
- `--sslkey PATH` - path to ssl key file. If not set, will be taken from db (if stored previously) or default self-signed certificate/key will be generated.
- `--path PATH`, `-d PATH` - database dir path
- `--logpath LOGPATH`, `-l LOGPATH` - server log file path
- `--weblogpath WEBLOGPATH`, `-w WEBLOGPATH` - web access log file path
- `--rdb`, `-r` - start in read-only DB mode
- `--httpauth`, `-a` - enable http auth on all requests
- `--dontkill`, `-k` - don't kill server on signal
- `--ui`, `-u` - open torrserver page in browser
- `--torrentsdir TORRENTSDIR`, `-t TORRENTSDIR` - autoload torrents from dir
- `--torrentaddr TORRENTADDR` - Torrent client address (format [IP]:PORT, ex. :32000, 127.0.0.1:32768 etc)
- `--pubipv4 PUBIPV4`, `-4 PUBIPV4` - set public IPv4 addr
- `--pubipv6 PUBIPV6`, `-6 PUBIPV6` - set public IPv6 addr
- `--searchwa`, `-s` - allow search without authentication
- `--help`, `-h` - display this help and exit
- `--version` - display version and exit
Example:
```bash
TorrServer-darwin-arm64 [--port PORT] [--path PATH] [--logpath LOGPATH] [--weblogpath WEBLOGPATH] [--rdb] [--httpauth] [--dontkill] [--ui] [--torrentsdir TORRENTSDIR] [--torrentaddr TORRENTADDR] [--pubipv4 PUBIPV4] [--pubipv6 PUBIPV6] [--searchwa]
```
### Running in Docker & Docker Compose
Run in console
```bash
docker run --rm -d --name torrserver -p 8090:8090 ghcr.io/yourok/torrserver:latest
```
For running in persistence mode, just mount volume to container by adding `-v ~/ts:/opt/ts`, where `~/ts` folder path is just example, but you could use it anyway... Result example command:
```bash
docker run --rm -d --name torrserver -v ~/ts:/opt/ts -p 8090:8090 ghcr.io/yourok/torrserver:latest
```
#### Environments
- `TS_HTTPAUTH` - 1, and place auth file into `~/ts/config` folder for enabling basic auth
- `TS_RDB` - if 1, then the enabling `--rdb` flag
- `TS_DONTKILL` - if 1, then the enabling `--dontkill` flag
- `TS_PORT` - for changind default port to **5555** (example), also u need to change `-p 8090:8090` to `-p 5555:5555` (example)
- `TS_CONF_PATH` - for overriding torrserver config path inside container. Example `/opt/tsss`
- `TS_TORR_DIR` - for overriding torrents directory. Example `/opt/torr_files`
- `TS_LOG_PATH` - for overriding log path. Example `/opt/torrserver.log`
Example with full overrided command (on default values):
```bash
docker run --rm -d -e TS_PORT=5665 -e TS_DONTKILL=1 -e TS_HTTPAUTH=1 -e TS_RDB=1 -e TS_CONF_PATH=/opt/ts/config -e TS_LOG_PATH=/opt/ts/log -e TS_TORR_DIR=/opt/ts/torrents --name torrserver -v ~/ts:/opt/ts -p 5665:5665 ghcr.io/yourok/torrserver:latest
```
#### Docker Compose
```yml
# docker-compose.yml
version: '3.3'
services:
torrserver:
image: ghcr.io/yourok/torrserver
container_name: torrserver
environment:
- TS_PORT=5665
- TS_DONTKILL=1
- TS_HTTPAUTH=0
- TS_CONF_PATH=/opt/ts/config
- TS_TORR_DIR=/opt/ts/torrents
volumes:
- './CACHE:/opt/ts/torrents'
- './CONFIG:/opt/ts/config'
ports:
- '5665:5665'
restart: unless-stopped
```
#### NAS releases #### NAS releases
https://github.com/vladlenas https://github.com/vladlenas
@@ -26,264 +167,98 @@ https://github.com/vladlenas
Synology NAS packages repo source: https://grigi.lt Synology NAS packages repo source: https://grigi.lt
### Build ### Build
Install golang 1.16+ by instruction: https://golang.org/doc/install \
Goto dir to source\
Run build script under linux build-all.sh\
For build web page need install npm and yarn\
For instal yarn: _npm i -g yarn_ after install npm\
For build android server need android toolchain\
Download android ndk and change NDK_TOOLCHAIN in build.sh to\
path/to/Android/sdk/ndk/ver/toolchains/llvm/prebuilt/platform
# #### Server
### Server args:
#### Usage
TorrServer-darwin-arm64 [--port PORT] [--ssl] [--sslport PORT] [--sslcert PATH] [--sslkey PATH] [--path PATH] [--logpath LOGPATH] [--weblogpath WEBLOGPATH] [--rdb] [--httpauth] [--dontkill] [--ui] [--torrentsdir TORRENTSDIR] [--torrentaddr TORRENTADDR] [--pubipv4 PUBIPV4] [--pubipv6 PUBIPV6] [--searchwa]
#### Options - Install [Golang](https://golang.org/doc/install) 1.18+
* --port PORT, -p PORT - Go to the TorrServer source directory
* web server port, default 8090 - Run build script under linux or macOS `build-all.sh`
* --ssl
* enables https
* --sslport PORT
* web server ssl port, If not set, will be set to default 8091 or taken from db(if stored previously). Accepted if --ssl enabled.
* --sslcert PATH
* path to ssl cert file. If not set, will be taken from db(if stored previously) or default self-signed certificate/key will be generated. Accepted if --ssl enabled.
* --sslkey PATH
* path to ssl key file. If not set, will be taken from db(if stored previously) or default self-signed certificate/key will be generated. Accepted if --ssl enabled.
* --path PATH, -d PATH
* database dir path
* --logpath LOGPATH, -l LOGPATH
* server log file path
* --weblogpath WEBLOGPATH, -w WEBLOGPATH
* web access log file path
* --rdb, -r
* start in read-only DB mode
* --httpauth, -a
* enable http auth on all requests
* --dontkill, -k
* don't kill server on signal
* --ui, -u
* open torrserver page in browser
* --torrentsdir TORRENTSDIR, -t TORRENTSDIR
* autoload torrents from dir
* --torrentaddr TORRENTADDR
* Torrent client address (format [IP]:PORT, ex. :32000, 127.0.0.1:32768 etc)
* --pubipv4 PUBIPV4, -4 PUBIPV4
* set public IPv4 addr
* --pubipv6 PUBIPV6, -6 PUBIPV6
* set public IPv6 addr
* --searchwa, -s
* search without auth
* --help, -h
* display this help and exit
* --version
* display version and exit
#### Web
# - Install **npm** and **yarn**
### Http Api of TorrServer: - Go to the web directory
#### GET - Run `NODE_OPTIONS=--openssl-legacy-provider yarn build`
###### /echo #### Android
*Return version of server*
###### /shutdown To build an Android server you will need the Android Toolchain.
*Shutdown server*
###### /stream... #### Swagger
#### args:
* link - magnet/hash/link to torrent
* index - index of file
* preload - preload torrent
* stat - return stat of torrent
* save - save to db
* m3u - return m3u
* fromlast - return m3u from last play
* play - start stream torrent
* title - set title of torrent
* poster - set poster link of torrent
##### Examples: `swag` must be installed on the system to [re]build Swagger documentation.
>**get stat**
>
>http://127.0.0.1:8090/stream/fname?link=...&stat
>
>**get m3u**
>
>http://127.0.0.1:8090/stream/fname?link=...&index=1&m3u
>http://127.0.0.1:8090/stream/fname?link=...&index=1&m3u&fromlast
>
>**stream torrent**
>
>http://127.0.0.1:8090/stream/fname?link=...&index=1&play
>http://127.0.0.1:8090/stream/fname?link=...&index=1&play&save
>http://127.0.0.1:8090/stream/fname?link=...&index=1&play&save&title=...&poster=...
>
>**only save**
>
>http://127.0.0.1:8090/stream/fname?link=...&save&title=...&poster=...
###### /play/:hash/:id ```bash
#### params: go install github.com/swaggo/swag/cmd/swag@latest
* hash - hash of torrent cd server; swag init -g web/server.go
* index - index of file
###### /playlistall/all.m3u
*Get all http links of all torrents in m3u list*
###### /playlist
*Get http link of torrent in m3u list*
#### args:
* hash - hash of torrent
* fromlast - from last play file
#
#### POST
###### /torrents
##### Send json:
{\
"action": "add/get/set/rem/list/drop",\
"link": "hash/magnet/link to torrent",\
"hash": "hash of torrent",\
"title": "title of torrent",\
"poster": "link to poster of torrent",\
"data": "custom data of torrent, may be json",\
"save_to_db": true/false\
}
##### Return json of torrent(s)
###### /torrent/upload
##### Send multipart/form data
Only one file support
#### args:
* title - set title of torrent
* poster - set poster link of torrent
* data - set custom data of torrent, may be json
* save - save to db
###### /cache
##### Send json:
{\
"action": "get"\
"hash" : ""hash": "hash of torrent",\
}
##### Return cache stat
https://github.com/YouROK/TorrServer/blob/d36d0c28f805ceab39adb4aac2869cd7a272085b/server/torr/storage/state/state.go
###### /settings
##### Send json:
{\
"action": "get/set/def",\
_fields of BTSets_\
}
##### Return json of BTSets
https://github.com/YouROK/TorrServer/blob/d36d0c28f805ceab39adb4aac2869cd7a272085b/server/settings/btsets.go
###### /viewed
##### Send json:
{\
"action": "set/rem/list",\
"hash": "hash of torrent",\
"file_index": int, id of file,\
}
##### Return
if hash is empty, return all viewed files\
if hash is not empty, return viewed file of torrent
##### Json struct see in
https://github.com/YouROK/TorrServer/blob/d36d0c28f805ceab39adb4aac2869cd7a272085b/server/settings/viewed.go
#
### Authorization
The user data file should be located near to the settings.\
Basic auth, read more in wiki \
https://en.wikipedia.org/wiki/Basic_access_authentication
File name: *accs.db*\
File format:
{\
"User1": "Pass1",\
"User2": "Pass2"\
}
#
### Whitelist/Blacklist ip
The lists file should be located near to the settings.
whitelist file name: wip.txt\
blacklist file name: bip.txt
whitelist has prior
Example:\
local:127.0.0.0-127.0.0.255\
127.0.0.0-127.0.0.255\
local:127.0.0.1\
127.0.0.1\
\# at the beginning of the line, comment
#
### MSX Install:
Open msx and goto: Settings -> Start Parameter -> Setup \
Enter current ip address and port of server e.g. _127.0.0.1:8090_
#
### Running in docker
Just run: `docker run --rm -d --name torrserver -p 8090:8090 ghcr.io/yourok/torrserver:latest` \
For running in persistence mode, just mount volume to container by adding `-v ~/ts:/opt/ts`, where `~/ts` folder path is just example, but you could use it anyway... Result example command: `docker run --rm -d --name torrserver -v ~/ts:/opt/ts -p 8090:8090 ghcr.io/yourok/torrserver:latest` \
Other options:
- add `-e TS_HTTPAUTH=1` and place [auth file](#authorization) into `~/ts/config` forlder for enabling basic auth
- add `-e TS_RDB=1` for enabling `--rdb` flag
- add `-e TS_DONTKILL=1` for enabling `--dontkill` flag
- add `-e TS_PORT=5555` for changind default port to 5555(example), also u need to change `-p 8090:8090` to `-p 5555:5555` (example)
- add `-e TS_CONF_PATH=/opt/tsss` for overriding torrserver config path inside container
- add `-e TS_TORR_DIR=/opt/torr_files` for overriding torrents directory
- add `-e TS_LOG_PATH=/opt/torrserver.log` for overriding log path
Example with full overrided command(on default values):
```
docker run --rm -d -e TS_PORT=5665 -e TS_DONTKILL=1 -e TS_HTTPAUTH=1 -e TS_RDB=1 -e TS_CONF_PATH=/opt/ts/config -e TS_LOG_PATH=/opt/ts/log -e TS_TORR_DIR=/opt/ts/torrents --name torrserver -v ~/ts:/opt/ts -p 5665:5665 ghcr.io/yourok/torrserver:latest
# Documentation can be linted using
swag fmt
``` ```
### MSX Install
# Open msx and goto: Settings -> Start Parameter -> Setup
### Donate:
[QIWI](https://qiwi.com/n/YOUROK85) \
[YooMoney](https://yoomoney.ru/to/410013733697114/200) \
[PayPal](https://www.paypal.me/yourok)
SberBank card: **5484 4000 2285 7839** Enter current ip address and port of server _e.g. 127.0.0.1:8090_
YooMoney card: **4048 4150 1812 8179** ## API
### API Docs
# API documentation is hosted as Swagger format available at path `/swagger/index.html`.
### Thanks to everyone who tested and helped
###### @nacrolix **Matt Joiner** [github.com/anacrolix](https://github.com/anacrolix/) ### API Authentication
###### @tsynik [github.com/tsynik](https://github.com/tsynik) The user data file should be located near to the settings. Basic auth, read more in wiki <https://en.wikipedia.org/wiki/Basic_access_authentication>.
###### @dancheskus [github.com/dancheskus](https://github.com/dancheskus) `accs.db` in JSON format:
###### @kolsys [github.com/kolsys](https://github.com/kolsys) ```json
{
"User1": "Pass1",
"User2": "Pass2"
}
```
###### @vladlenas [github.com/vladlenas](https://github.com/vladlenas) ## Whitelist/Blacklist IP
###### @Nemiroff aka **Tw1cker** [github.com/Nemiroff](https://github.com/Nemiroff) The lists file should be located in the same directory with config.db.
###### @spawnlmg **SpAwN_LMG** [github.com/spawnlmg](https://github.com/spawnlmg) - Whitelist file name: `wip.txt`
- Blacklist file name: `bip.txt`
###### @TopperBG **Dimitar Maznekov** [github.com/TopperBG](https://github.com/TopperBG) Whitelist has priority over everything else.
###### @FaintGhost **Zhang Yaowei** [github.com/FaintGhost](https://github.com/FaintGhost) Example:
###### @Anton111111 **Anton Potekhin** [github.com/Anton111111](https://github.com/Anton111111) ```text
local:127.0.0.0-127.0.0.255
127.0.0.0-127.0.0.255
local:127.0.0.1
127.0.0.1
# at the beginning of the line, comment
```
## Donate
- [QIWI](https://qiwi.com/n/YOUROK85)
- [YooMoney](https://yoomoney.ru/to/410013733697114/200)
- [PayPal](https://www.paypal.me/yourok)
- SberBank Card: **5484 4000 2285 7839**
- YooMoney Card: **4048 4150 1812 8179**
## Thanks to everyone who tested and helped
- [anacrolix (Matt Joiner)](https://github.com/anacrolix)
- [tsynik](https://github.com/tsynik)
- [dancheskus](https://github.com/dancheskus)
- [kolsys](https://github.com/kolsys)
- [vladlenas](https://github.com/vladlenas)
- [Nemiroff (Tw1cker)](https://github.com/Nemiroff)
- [spawnlmg (SpAwN_LMG)](https://github.com/spawnlmg)
- [TopperBG (Dimitar Maznekov)](https://github.com/TopperBG)
- [FaintGhost (Zhang Yaowei)](https://github.com/FaintGhost)
- [Anton111111 (Anton Potekhin)](https://github.com/Anton111111)
- [lieranderl (Evgeni)](https://github.com/lieranderl)
- [cocool97](https://github.com/cocool97)

View File

@@ -14,6 +14,7 @@ import (
"github.com/pkg/browser" "github.com/pkg/browser"
"server" "server"
"server/docs"
"server/log" "server/log"
"server/settings" "server/settings"
"server/torr" "server/torr"
@@ -69,6 +70,8 @@ func main() {
log.TLogln("Use HTTP Auth file", settings.Path+"/accs.db") log.TLogln("Use HTTP Auth file", settings.Path+"/accs.db")
} }
docs.SwaggerInfo.Version = version.Version
dnsResolve() dnsResolve()
Preconfig(params.DontKill) Preconfig(params.DontKill)

1092
server/docs/docs.go Normal file

File diff suppressed because it is too large Load Diff

1067
server/docs/swagger.json Normal file

File diff suppressed because it is too large Load Diff

711
server/docs/swagger.yaml Normal file
View File

@@ -0,0 +1,711 @@
basePath: /
definitions:
api.cacheReqJS:
properties:
action:
type: string
hash:
type: string
type: object
api.setsReqJS:
properties:
action:
type: string
sets:
$ref: '#/definitions/settings.BTSets'
type: object
api.torrReqJS:
properties:
action:
type: string
data:
type: string
hash:
type: string
link:
type: string
poster:
type: string
save_to_db:
type: boolean
title:
type: string
type: object
api.viewedReqJS:
properties:
action:
type: string
file_index:
type: integer
hash:
type: string
type: object
models.TorrentDetails:
properties:
audioQuality:
type: integer
categories:
type: string
createDate:
type: string
hash:
type: string
imdbid:
type: string
link:
type: string
magnet:
type: string
name:
type: string
names:
items:
type: string
type: array
peer:
type: integer
seed:
type: integer
size:
type: string
title:
type: string
tracker:
type: string
videoQuality:
type: integer
year:
type: integer
type: object
settings.BTSets:
properties:
cacheSize:
description: Cache
type: integer
connectionsLimit:
type: integer
disableDHT:
type: boolean
disablePEX:
type: boolean
disableTCP:
type: boolean
disableUPNP:
type: boolean
disableUTP:
type: boolean
disableUpload:
type: boolean
downloadRateLimit:
description: in kb, 0 - inf
type: integer
enableDLNA:
description: DLNA
type: boolean
enableDebug:
description: debug logs
type: boolean
enableIPv6:
description: BT Config
type: boolean
enableRutorSearch:
description: Rutor
type: boolean
forceEncrypt:
description: Torrent
type: boolean
friendlyName:
type: string
peersListenPort:
type: integer
preloadCache:
description: in percent
type: integer
readerReadAHead:
description: in percent, 5%-100%, [...S__X__E...] [S-E] not clean
type: integer
removeCacheOnDrop:
type: boolean
retrackersMode:
description: 0 - don`t add, 1 - add retrackers (def), 2 - remove retrackers
3 - replace retrackers
type: integer
sslCert:
type: string
sslKey:
type: string
sslPort:
description: HTTPS
type: integer
torrentDisconnectTimeout:
description: in seconds
type: integer
torrentsSavePath:
type: string
uploadRateLimit:
description: in kb, 0 - inf
type: integer
useDisk:
description: Disk
type: boolean
type: object
settings.Viewed:
properties:
file_index:
type: integer
hash:
type: string
type: object
state.CacheState:
properties:
capacity:
type: integer
filled:
type: integer
hash:
type: string
pieces:
additionalProperties:
$ref: '#/definitions/state.ItemState'
type: object
piecesCount:
type: integer
piecesLength:
type: integer
readers:
items:
$ref: '#/definitions/state.ReaderState'
type: array
torrent:
$ref: '#/definitions/state.TorrentStatus'
type: object
state.ItemState:
properties:
completed:
type: boolean
id:
type: integer
length:
type: integer
priority:
type: integer
size:
type: integer
type: object
state.ReaderState:
properties:
end:
type: integer
reader:
type: integer
start:
type: integer
type: object
state.TorrentFileStat:
properties:
id:
type: integer
length:
type: integer
path:
type: string
type: object
state.TorrentStat:
enum:
- 0
- 1
- 2
- 3
- 4
- 5
type: integer
x-enum-varnames:
- TorrentAdded
- TorrentGettingInfo
- TorrentPreload
- TorrentWorking
- TorrentClosed
- TorrentInDB
state.TorrentStatus:
properties:
active_peers:
type: integer
bit_rate:
type: string
bytes_read:
type: integer
bytes_read_data:
type: integer
bytes_read_useful_data:
type: integer
bytes_written:
type: integer
bytes_written_data:
type: integer
chunks_read:
type: integer
chunks_read_useful:
type: integer
chunks_read_wasted:
type: integer
chunks_written:
type: integer
connected_seeders:
type: integer
data:
type: string
download_speed:
type: number
duration_seconds:
type: number
file_stats:
items:
$ref: '#/definitions/state.TorrentFileStat'
type: array
half_open_peers:
type: integer
hash:
type: string
loaded_size:
type: integer
name:
type: string
pending_peers:
type: integer
pieces_dirtied_bad:
type: integer
pieces_dirtied_good:
type: integer
poster:
type: string
preload_size:
type: integer
preloaded_bytes:
type: integer
stat:
$ref: '#/definitions/state.TorrentStat'
stat_string:
type: string
timestamp:
type: integer
title:
type: string
torrent_size:
type: integer
total_peers:
type: integer
upload_speed:
type: number
type: object
externalDocs:
description: OpenAPI
url: https://swagger.io/resources/open-api/
info:
contact: {}
description: Torrent streaming server.
license:
name: GPL 3.0
title: Swagger Torrserver API
version: '{version.Version}'
paths:
/cache:
post:
description: Return cache stats.
parameters:
- description: Cache stats request
in: body
name: request
required: true
schema:
$ref: '#/definitions/api.cacheReqJS'
produces:
- application/json
responses:
"200":
description: Cache stats
schema:
$ref: '#/definitions/state.CacheState'
summary: Return cache stats
tags:
- API
/download/{size}:
get:
description: Download the test file of given size (for speed testing purpose).
parameters:
- description: Test file size
in: path
name: size
required: true
type: string
produces:
- application/octet-stream
responses:
"200":
description: OK
schema:
type: file
summary: Generates test file of given size
tags:
- API
/echo:
get:
description: Tests whether server is alive or not
produces:
- text/plain
responses:
"200":
description: Server version
schema:
type: string
summary: Tests server status
tags:
- API
/ffp:
get:
description: Gather informations using ffprobe.
parameters:
- description: Torrent hash
in: query
name: hash
required: true
type: string
- description: File index in torrent
in: query
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: Data returned from ffprobe
summary: Gather informations using ffprobe
tags:
- API
/magnets:
get:
description: Get HTML of magnet links.
produces:
- text/html
responses:
"200":
description: Magnet links
summary: Get HTML of magnet links
tags:
- Pages
/msx:
get:
description: Multi usage endpoint.
parameters:
- description: Magnet/hash/link to torrent
in: query
name: link
required: true
type: string
produces:
- application/json
responses:
"200":
description: Data returned according to query
summary: Multi usage endpoint
tags:
- MSX
/msx/imdb:
get:
description: Get MSX IMDB informations.
produces:
- application/json
responses:
"200":
description: JSON MSX IMDB informations
summary: Get MSX IMDB informations
tags:
- MSX
/msx/imdb/:id:
get:
description: Get MSX IMDB informations.
parameters:
- description: IMDB ID
in: path
name: id
required: true
type: string
produces:
- application/json
responses:
"200":
description: JSON MSX IMDB informations
summary: Get MSX IMDB informations
tags:
- MSX
/play:
get:
description: Play given torrent referenced by hash.
parameters:
- description: Torrent hash
in: query
name: hash
required: true
type: string
- description: File index in torrent
in: query
name: id
required: true
type: string
- description: Not authenticated
in: query
name: not_auth
type: boolean
produces:
- application/octet-stream
responses:
"200":
description: Torrent data
summary: Play given torrent referenced by hash
tags:
- API
/playlist:
get:
description: Get HTTP link of torrent in M3U list.
parameters:
- description: Torrent hash
in: query
name: hash
required: true
type: string
- description: From last play file
in: query
name: fromlast
type: boolean
produces:
- audio/x-mpegurl
responses:
"200":
description: OK
schema:
type: file
summary: Get HTTP link of torrent in M3U list
tags:
- API
/playlistall/all.m3u:
get:
description: Retrieve all torrents and generates a bundled M3U playlist.
produces:
- audio/x-mpegurl
responses:
"200":
description: OK
schema:
type: file
summary: Get a M3U playlist with all torrents
tags:
- API
/search:
get:
description: Makes a rutor search.
parameters:
- description: Rutor query
in: query
name: query
required: true
type: string
produces:
- application/json
responses:
"200":
description: Rutor torrent search result(s)
schema:
items:
$ref: '#/definitions/models.TorrentDetails'
type: array
summary: Makes a rutor search
tags:
- API
/settings:
post:
consumes:
- application/json
description: Allow to get or set server settings.
parameters:
- description: Settings request
in: body
name: request
required: true
schema:
$ref: '#/definitions/api.setsReqJS'
produces:
- application/json
responses:
"200":
description: Depends on what action has been asked
schema:
$ref: '#/definitions/settings.BTSets'
summary: Get / Set server settings
tags:
- API
/shutdown:
get:
description: Gracefully shuts down server after 1 second.
responses:
"200":
description: OK
summary: Shuts down server
tags:
- API
/stat:
get:
description: Stat server.
produces:
- text/plain
responses:
"200":
description: Stats
summary: Stat server
tags:
- Pages
/stream:
get:
description: Multi usage endpoint.
parameters:
- description: Magnet/hash/link to torrent
in: query
name: link
required: true
type: string
- description: File index in torrent
in: query
name: index
type: string
- description: Should preload torrent
in: query
name: preload
type: string
- description: Get statistics from torrent
in: query
name: stat
type: string
- description: Should save torrent
in: query
name: save
type: string
- description: Get torrent as M3U playlist
in: query
name: m3u
type: string
- description: Get m3u from last play
in: query
name: fromlast
type: string
- description: Start stream torrent
in: query
name: play
type: string
- description: Set title of torrent
in: query
name: title
required: true
type: string
- description: File index in torrent
in: query
name: poster
required: true
type: string
- description: Set poster link of torrent
in: query
name: not_auth
required: true
type: string
produces:
- application/octet-stream
responses:
"200":
description: Data returned according to query
summary: Multi usage endpoint
tags:
- API
/torrent/upload:
post:
consumes:
- multipart/form-data
description: Only one file support.
parameters:
- description: Torrent file to insert
in: formData
name: file
required: true
type: file
- description: Save to DB
in: formData
name: save
type: string
- description: Torrent title
in: formData
name: title
type: string
- description: Torrent poster
in: formData
name: poster
type: string
- description: Torrent data
in: formData
name: data
type: string
produces:
- application/json
responses:
"200":
description: Torrent status
schema:
$ref: '#/definitions/state.TorrentStatus'
summary: Only one file support
tags:
- API
/torrents:
post:
consumes:
- application/json
description: Allow to add, get or set torrents to server. The action depends
of what has been asked.
parameters:
- description: Torrent request
in: body
name: request
required: true
schema:
$ref: '#/definitions/api.torrReqJS'
produces:
- application/json
responses:
"200":
description: OK
summary: Handle torrents informations
tags:
- API
/viewed:
post:
consumes:
- application/json
description: Allow to set, list or remove viewed torrents from server.
parameters:
- description: Viewed torrent request
in: body
name: request
required: true
schema:
$ref: '#/definitions/api.viewedReqJS'
produces:
- application/json
responses:
"200":
description: OK
schema:
items:
$ref: '#/definitions/settings.Viewed'
type: array
summary: Set / List / Remove viewed torrents
tags:
- API
securityDefinitions:
BasicAuth:
type: basic
swagger: "2.0"

View File

@@ -18,6 +18,9 @@ require (
github.com/kljensen/snowball v0.8.0 github.com/kljensen/snowball v0.8.0
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pkg/errors v0.9.1 github.com/pkg/errors v0.9.1
github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.2
go.etcd.io/bbolt v1.3.8 go.etcd.io/bbolt v1.3.8
golang.org/x/image v0.13.0 golang.org/x/image v0.13.0
golang.org/x/time v0.3.0 golang.org/x/time v0.3.0
@@ -25,6 +28,7 @@ require (
) )
require ( require (
github.com/KyleBanks/depth v1.2.1 // indirect
github.com/RoaringBitmap/roaring v1.6.0 // indirect github.com/RoaringBitmap/roaring v1.6.0 // indirect
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
github.com/alexflint/go-scalar v1.2.0 // indirect github.com/alexflint/go-scalar v1.2.0 // indirect
@@ -51,15 +55,21 @@ require (
github.com/frankban/quicktest v1.14.6 // indirect github.com/frankban/quicktest v1.14.6 // indirect
github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect
github.com/gin-contrib/sse v0.1.0 // indirect github.com/gin-contrib/sse v0.1.0 // indirect
github.com/go-openapi/jsonpointer v0.20.0 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/spec v0.20.9 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.15.5 // indirect github.com/go-playground/validator/v10 v10.15.5 // indirect
github.com/goccy/go-json v0.10.2 // indirect github.com/goccy/go-json v0.10.2 // indirect
github.com/google/btree v1.1.2 // indirect github.com/google/btree v1.1.2 // indirect
github.com/huandu/xstrings v1.4.0 // indirect github.com/huandu/xstrings v1.4.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/leodido/go-urn v1.2.4 // indirect github.com/leodido/go-urn v1.2.4 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
@@ -76,6 +86,7 @@ require (
golang.org/x/sync v0.4.0 // indirect golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.13.0 // indirect golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect
golang.org/x/tools v0.14.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect
) )

View File

@@ -4,6 +4,8 @@ crawshaw.io/iox v0.0.0-20181124134642-c51c3df30797/go.mod h1:sXBiorCo8c46JlQV3oX
crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4= crawshaw.io/sqlite v0.3.2/go.mod h1:igAO5JulrQ1DbdZdtVq48mnZUBAPOeFzer7VhDWNtW4=
filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU= filippo.io/edwards25519 v1.0.0-rc.1 h1:m0VOOB23frXZvAOK44usCgLWvtsxIoMCTBGJZlpmGfU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/KyleBanks/depth v1.2.1 h1:5h8fQADFrWtarTdtDudMmGsC7GPbOAu6RVB3ffsVFHc=
github.com/KyleBanks/depth v1.2.1/go.mod h1:jzSb9d0L43HxTQfT+oSA1EEp2q+ne2uh6XgeJcm8brE=
github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w= github.com/RoaringBitmap/roaring v0.4.7/go.mod h1:8khRDP4HmeXns4xIj9oGrKSz7XTQiJx2zgh7AcNke4w=
github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI= github.com/RoaringBitmap/roaring v0.4.17/go.mod h1:D3qVegWTmfCaX4Bl5CrBE9hfrSrrXIr8KVNvRsDi1NI=
github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
@@ -128,6 +130,7 @@ github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uq
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g= github.com/gin-contrib/cors v1.4.0 h1:oJ6gwtUl3lqV0WEIwM/LxPF1QZ5qe2lGWdY2+bz7y0g=
github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs= github.com/gin-contrib/cors v1.4.0/go.mod h1:bs9pNM0x/UsmHPBWT2xZz9ROh8xYjYkiURUfmBoMlcs=
github.com/gin-contrib/gzip v0.0.6 h1:NjcunTcGAj5CO1gn4N8jHOSIeRFHIbn51z6K+xaN4d4=
github.com/gin-contrib/location v0.0.2 h1:QZKh1+K/LLR4KG/61eIO3b7MLuKi8tytQhV6texLgP4= github.com/gin-contrib/location v0.0.2 h1:QZKh1+K/LLR4KG/61eIO3b7MLuKi8tytQhV6texLgP4=
github.com/gin-contrib/location v0.0.2/go.mod h1:NGoidiRlf0BlA/VKSVp+g3cuSMeTmip/63PhEjRhUAc= github.com/gin-contrib/location v0.0.2/go.mod h1:NGoidiRlf0BlA/VKSVp+g3cuSMeTmip/63PhEjRhUAc=
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
@@ -146,6 +149,21 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs=
github.com/go-openapi/jsonpointer v0.20.0 h1:ESKJdU9ASRfaPNOPRx12IUyA1vn3R9GiE3KYD14BXdQ=
github.com/go-openapi/jsonpointer v0.20.0/go.mod h1:6PGzBjjIIumbLYysB73Klnms1mwnU4G3YHOECG3CedA=
github.com/go-openapi/jsonreference v0.20.0/go.mod h1:Ag74Ico3lPc+zR+qjn4XBUmXymS4zJbYVCZmcgkasdo=
github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE=
github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k=
github.com/go-openapi/spec v0.20.9 h1:xnlYNQAwKd2VQRRfwTEI0DcK+2cbuvI/0c7jx3gA8/8=
github.com/go-openapi/spec v0.20.9/go.mod h1:2OpW+JddWPrpXSCIX8eOx7lZ5iyuWj3RYR6VaaBKcWA=
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU=
github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s= github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
@@ -208,6 +226,8 @@ github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63
github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.3.1/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU=
github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
@@ -237,6 +257,11 @@ github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgx
github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY=
github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q=
github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4=
github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
@@ -254,6 +279,7 @@ github.com/mschoch/smat v0.2.0 h1:8imxQsjDm8yFEAVBe7azKmKSgzSkZXDuKkSq9374khM=
github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw= github.com/mschoch/smat v0.2.0/go.mod h1:kc9mz7DoBKqDyiRL7VZN8KvXQMWeTaVnttLRXOlotKw=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8= github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
@@ -319,6 +345,12 @@ github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/swaggo/files v1.0.1 h1:J1bVJ4XHZNq0I46UU90611i9/YzdrF7x92oX1ig5IdE=
github.com/swaggo/files v1.0.1/go.mod h1:0qXmMNH6sXNf+73t65aKeB+ApmgxdnkQzVTAj2uaMUg=
github.com/swaggo/gin-swagger v1.6.0 h1:y8sxvQ3E20/RCyrXeFfg60r6H0Z+SwpTjMYsMm+zy8M=
github.com/swaggo/gin-swagger v1.6.0/go.mod h1:BG00cCEy294xtVpyIAHG6+e2Qzj/xKlRdOqDkvq0uzo=
github.com/swaggo/swag v1.16.2 h1:28Pp+8DkQoV+HLzLx8RGJZXNGKbFqnuvSbAAtoxiY04=
github.com/swaggo/swag v1.16.2/go.mod h1:6YzXnDcpr0767iOejs318CwYkCQqyGer6BizOg03f+E=
github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.0/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= github.com/tinylib/msgp v1.1.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE=
@@ -335,6 +367,7 @@ github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZ
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA=
go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
@@ -362,6 +395,8 @@ golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTk
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro= golang.org/x/mod v0.5.1/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/mod v0.6.0-dev.0.20211013180041-c96bc1413d57/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
@@ -376,6 +411,8 @@ golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220524220425-1d687d428aca/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220524220425-1d687d428aca/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
@@ -387,6 +424,7 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -411,17 +449,20 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
@@ -434,6 +475,9 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU= golang.org/x/tools v0.1.8-0.20211029000441-d6a9af8af023/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc=
golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
@@ -460,6 +504,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLks
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
@@ -472,8 +517,10 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

View File

@@ -15,6 +15,18 @@ type cacheReqJS struct {
Hash string `json:"hash,omitempty"` Hash string `json:"hash,omitempty"`
} }
// cache godoc
//
// @Summary Return cache stats
// @Description Return cache stats.
//
// @Tags API
//
// @Param request body cacheReqJS true "Cache stats request"
//
// @Produce json
// @Success 200 {object} state.CacheState "Cache stats"
// @Router /cache [post]
func cache(c *gin.Context) { func cache(c *gin.Context) {
var req cacheReqJS var req cacheReqJS
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)

View File

@@ -40,6 +40,18 @@ func (f *fileReader) Seek(offset int64, whence int) (int64, error) {
return f.pos, nil return f.pos, nil
} }
// download godoc
//
// @Summary Generates test file of given size
// @Description Download the test file of given size (for speed testing purpose).
//
// @Tags API
//
// @Param size path string true "Test file size"
//
// @Produce application/octet-stream
// @Success 200 {file} file
// @Router /download/{size} [get]
func download(c *gin.Context) { func download(c *gin.Context) {
szStr := c.Param("size") szStr := c.Param("size")
sz, err := strconv.Atoi(szStr) sz, err := strconv.Atoi(szStr)

View File

@@ -11,6 +11,19 @@ import (
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
) )
// ffp godoc
//
// @Summary Gather informations using ffprobe
// @Description Gather informations using ffprobe.
//
// @Tags API
//
// @Param hash query string true "Torrent hash"
// @Param id query string true "File index in torrent"
//
// @Produce json
// @Success 200 "Data returned from ffprobe"
// @Router /ffp [get]
func ffp(c *gin.Context) { func ffp(c *gin.Context) {
hash := c.Param("hash") hash := c.Param("hash")
indexStr := c.Param("id") indexStr := c.Param("id")

View File

@@ -22,6 +22,16 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
) )
// allPlayList godoc
//
// @Summary Get a M3U playlist with all torrents
// @Description Retrieve all torrents and generates a bundled M3U playlist.
//
// @Tags API
//
// @Produce audio/x-mpegurl
// @Success 200 {file} file
// @Router /playlistall/all.m3u [get]
func allPlayList(c *gin.Context) { func allPlayList(c *gin.Context) {
torrs := torr.ListTorrent() torrs := torr.ListTorrent()
@@ -38,9 +48,19 @@ func allPlayList(c *gin.Context) {
sendM3U(c, "all.m3u", hash, list) sendM3U(c, "all.m3u", hash, list)
} }
// http://127.0.0.1:8090/playlist?hash=... // playList godoc
// http://127.0.0.1:8090/playlist?hash=...&fromlast //
// http://127.0.0.1:8090/playlist/fname?hash=... // @Summary Get HTTP link of torrent in M3U list
// @Description Get HTTP link of torrent in M3U list.
//
// @Tags API
//
// @Param hash query string true "Torrent hash"
// @Param fromlast query bool false "From last play file"
//
// @Produce audio/x-mpegurl
// @Success 200 {file} file
// @Router /playlist [get]
func playList(c *gin.Context) { func playList(c *gin.Context) {
hash, _ := c.GetQuery("hash") hash, _ := c.GetQuery("hash")
_, fromlast := c.GetQuery("fromlast") _, fromlast := c.GetQuery("fromlast")

View File

@@ -12,6 +12,20 @@ import (
"server/web/api/utils" "server/web/api/utils"
) )
// play godoc
//
// @Summary Play given torrent referenced by hash
// @Description Play given torrent referenced by hash.
//
// @Tags API
//
// @Param hash query string true "Torrent hash"
// @Param id query string true "File index in torrent"
// @Param not_auth query bool false "Not authenticated"
//
// @Produce application/octet-stream
// @Success 200 "Torrent data"
// @Router /play [get]
func play(c *gin.Context) { func play(c *gin.Context) {
hash := c.Param("hash") hash := c.Param("hash")
indexStr := c.Param("id") indexStr := c.Param("id")
@@ -69,5 +83,4 @@ func play(c *gin.Context) {
} }
tor.Stream(index, c.Request, c.Writer) tor.Stream(index, c.Request, c.Writer)
return
} }

View File

@@ -1,12 +1,7 @@
package api package api
import ( import (
"net/http"
"time"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
sets "server/settings"
"server/torr"
) )
type requestI struct { type requestI struct {
@@ -36,7 +31,7 @@ func SetupRoute(route *gin.RouterGroup) {
route.GET("/playlistall/all.m3u", allPlayList) route.GET("/playlistall/all.m3u", allPlayList)
route.GET("/playlist", playList) route.GET("/playlist", playList)
route.GET("/playlist/*fname", playList) route.GET("/playlist/*fname", playList) // Is this endpoint still needed ? `fname` is never used in handler
route.GET("/download/:size", download) route.GET("/download/:size", download)
@@ -44,15 +39,3 @@ func SetupRoute(route *gin.RouterGroup) {
route.GET("/ffp/:hash/:id", ffp) route.GET("/ffp/:hash/:id", ffp)
} }
func shutdown(c *gin.Context) {
if sets.ReadOnly {
c.Status(http.StatusForbidden)
return
}
c.Status(200)
go func() {
time.Sleep(1000)
torr.Shutdown()
}()
}

View File

@@ -11,6 +11,18 @@ import (
sets "server/settings" sets "server/settings"
) )
// rutorSearch godoc
//
// @Summary Makes a rutor search
// @Description Makes a rutor search.
//
// @Tags API
//
// @Param query query string true "Rutor query"
//
// @Produce json
// @Success 200 {array} models.TorrentDetails "Rutor torrent search result(s)"
// @Router /search [get]
func rutorSearch(c *gin.Context) { func rutorSearch(c *gin.Context) {
if !sets.BTsets.EnableRutorSearch { if !sets.BTsets.EnableRutorSearch {
c.JSON(http.StatusBadRequest, []string{}) c.JSON(http.StatusBadRequest, []string{})

View File

@@ -5,9 +5,10 @@ import (
"server/rutor" "server/rutor"
"server/dlna"
"github.com/gin-gonic/gin" "github.com/gin-gonic/gin"
"github.com/pkg/errors" "github.com/pkg/errors"
"server/dlna"
sets "server/settings" sets "server/settings"
"server/torr" "server/torr"
@@ -19,6 +20,19 @@ type setsReqJS struct {
Sets *sets.BTSets `json:"sets,omitempty"` Sets *sets.BTSets `json:"sets,omitempty"`
} }
// settings godoc
//
// @Summary Get / Set server settings
// @Description Allow to get or set server settings.
//
// @Tags API
//
// @Param request body setsReqJS true "Settings request"
//
// @Accept json
// @Produce json
// @Success 200 {object} sets.BTSets "Depends on what action has been asked"
// @Router /settings [post]
func settings(c *gin.Context) { func settings(c *gin.Context) {
var req setsReqJS var req setsReqJS
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)

View File

@@ -0,0 +1,30 @@
package api
import (
"net/http"
sets "server/settings"
"server/torr"
"time"
"github.com/gin-gonic/gin"
)
// shutdown godoc
// @Summary Shuts down server
// @Description Gracefully shuts down server after 1 second.
//
// @Tags API
//
// @Success 200
// @Router /shutdown [get]
func shutdown(c *gin.Context) {
if sets.ReadOnly {
c.Status(http.StatusForbidden)
return
}
c.Status(200)
go func() {
time.Sleep(1000)
torr.Shutdown()
}()
}

View File

@@ -28,6 +28,28 @@ import (
// only save // only save
// http://127.0.0.1:8090/stream/fname?link=...&save&title=...&poster=... // http://127.0.0.1:8090/stream/fname?link=...&save&title=...&poster=...
// stream godoc
//
// @Summary Multi usage endpoint
// @Description Multi usage endpoint.
//
// @Tags API
//
// @Param link query string true "Magnet/hash/link to torrent"
// @Param index query string false "File index in torrent"
// @Param preload query string false "Should preload torrent"
// @Param stat query string false "Get statistics from torrent"
// @Param save query string false "Should save torrent"
// @Param m3u query string false "Get torrent as M3U playlist"
// @Param fromlast query string false "Get m3u from last play"
// @Param play query string false "Start stream torrent"
// @Param title query string true "Set title of torrent"
// @Param poster query string true "File index in torrent"
// @Param not_auth query string true "Set poster link of torrent"
//
// @Produce application/octet-stream
// @Success 200 "Data returned according to query"
// @Router /stream [get]
func stream(c *gin.Context) { func stream(c *gin.Context) {
link := c.Query("link") link := c.Query("link")
indexStr := c.Query("index") indexStr := c.Query("index")

View File

@@ -26,6 +26,19 @@ type torrReqJS struct {
SaveToDB bool `json:"save_to_db,omitempty"` SaveToDB bool `json:"save_to_db,omitempty"`
} }
// torrents godoc
//
// @Summary Handle torrents informations
// @Description Allow to add, get or set torrents to server. The action depends of what has been asked.
//
// @Tags API
//
// @Param request body torrReqJS true "Torrent request"
//
// @Accept json
// @Produce json
// @Success 200
// @Router /torrents [post]
func torrents(c *gin.Context) { func torrents(c *gin.Context) {
var req torrReqJS var req torrReqJS
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)
@@ -59,7 +72,6 @@ func torrents(c *gin.Context) {
{ {
dropTorrent(req, c) dropTorrent(req, c)
} }
} }
} }

View File

@@ -3,12 +3,31 @@ package api
import ( import (
"net/http" "net/http"
"github.com/gin-gonic/gin"
"server/log" "server/log"
"server/torr" "server/torr"
"server/web/api/utils" "server/web/api/utils"
"github.com/gin-gonic/gin"
) )
// torrentUpload godoc
//
// @Summary Only one file support
// @Description Only one file support.
//
// @Tags API
//
// @Param file formData file true "Torrent file to insert"
// @Param save formData string false "Save to DB"
// @Param title formData string false "Torrent title"
// @Param poster formData string false "Torrent poster"
// @Param data formData string false "Torrent data"
//
// @Accept multipart/form-data
//
// @Produce json
// @Success 200 {object} state.TorrentStatus "Torrent status"
// @Router /torrent/upload [post]
func torrentUpload(c *gin.Context) { func torrentUpload(c *gin.Context) {
form, err := c.MultipartForm() form, err := c.MultipartForm()
if err != nil { if err != nil {

View File

@@ -3,8 +3,9 @@ package api
import ( import (
"net/http" "net/http"
"github.com/gin-gonic/gin"
sets "server/settings" sets "server/settings"
"github.com/gin-gonic/gin"
) )
/* /*
@@ -17,6 +18,19 @@ type viewedReqJS struct {
*sets.Viewed *sets.Viewed
} }
// viewed godoc
//
// @Summary Set / List / Remove viewed torrents
// @Description Allow to set, list or remove viewed torrents from server.
//
// @Tags API
//
// @Param request body viewedReqJS true "Viewed torrent request"
//
// @Accept json
// @Produce json
// @Success 200 {array} sets.Viewed
// @Router /viewed [post]
func viewed(c *gin.Context) { func viewed(c *gin.Context) {
var req viewedReqJS var req viewedReqJS
err := c.ShouldBindJSON(&req) err := c.ShouldBindJSON(&req)

View File

@@ -31,7 +31,24 @@ func asset(c *gin.Context, t string, d []byte) {
} }
func SetupRoute(r *gin.RouterGroup) { func SetupRoute(r *gin.RouterGroup) {
r.GET("/msx/:pth", func(c *gin.Context) { r.GET("/msx/:pth", msxPTH)
r.GET("/msx/imdb", msxIMDB)
r.GET("/msx/imdb/:id", msxIMDBID)
}
// msxPTH godoc
//
// @Summary Multi usage endpoint
// @Description Multi usage endpoint.
//
// @Tags MSX
//
// @Param link query string true "Magnet/hash/link to torrent"
//
// @Produce json
// @Success 200 "Data returned according to query"
// @Router /msx [get]
func msxPTH(c *gin.Context) {
js := []string{"http://msx.benzac.de/js/tvx-plugin.min.js"} js := []string{"http://msx.benzac.de/js/tvx-plugin.min.js"}
switch p := c.Param("pth"); p { switch p := c.Param("pth"); p {
case "start.json": case "start.json":
@@ -66,15 +83,39 @@ func SetupRoute(r *gin.RouterGroup) {
default: default:
c.AbortWithStatus(404) c.AbortWithStatus(404)
} }
}) }
r.GET("/msx/imdb", func(c *gin.Context) {
// msxIMDB godoc
//
// @Summary Get MSX IMDB informations
// @Description Get MSX IMDB informations.
//
// @Tags MSX
//
// @Produce json
// @Success 200 "JSON MSX IMDB informations"
// @Router /msx/imdb [get]
func msxIMDB(c *gin.Context) {
idb.Lock() idb.Lock()
defer idb.Unlock() defer idb.Unlock()
l := len(ids) l := len(ids)
ids = make(map[string]string) ids = make(map[string]string)
c.JSON(200, l) c.JSON(200, l)
}) }
r.GET("/msx/imdb/:id", func(c *gin.Context) {
// msxIMDB godoc
//
// @Summary Get MSX IMDB informations
// @Description Get MSX IMDB informations.
//
// @Tags MSX
//
// @Param id path string true "IMDB ID"
//
// @Produce json
// @Success 200 "JSON MSX IMDB informations"
// @Router /msx/imdb/:id [get]
func msxIMDBID(c *gin.Context) {
idb.Lock() idb.Lock()
defer idb.Unlock() defer idb.Unlock()
p := c.Param("id") p := c.Param("id")
@@ -94,5 +135,4 @@ func SetupRoute(r *gin.RouterGroup) {
ids[p] = i ids[p] = i
} }
c.JSON(200, i) c.JSON(200, i)
})
} }

View File

@@ -15,11 +15,31 @@ func SetupRoute(route *gin.RouterGroup) {
route.GET("/magnets", getTorrents) route.GET("/magnets", getTorrents)
} }
// stat godoc
//
// @Summary Stat server
// @Description Stat server.
//
// @Tags Pages
//
// @Produce text/plain
// @Success 200 "Stats"
// @Router /stat [get]
func statPage(c *gin.Context) { func statPage(c *gin.Context) {
torr.WriteStatus(c.Writer) torr.WriteStatus(c.Writer)
c.Status(200) c.Status(200)
} }
// getTorrents godoc
//
// @Summary Get HTML of magnet links
// @Description Get HTML of magnet links.
//
// @Tags Pages
//
// @Produce text/html
// @Success 200 "Magnet links"
// @Router /magnets [get]
func getTorrents(c *gin.Context) { func getTorrents(c *gin.Context) {
list := settings.ListTorrent() list := settings.ListTorrent()
http := "<div>" http := "<div>"

View File

@@ -23,6 +23,9 @@ import (
"server/web/blocker" "server/web/blocker"
"server/web/pages" "server/web/pages"
"server/web/sslcerts" "server/web/sslcerts"
swaggerFiles "github.com/swaggo/files" // swagger embed files
ginSwagger "github.com/swaggo/gin-swagger" // gin-swagger middleware
) )
var ( var (
@@ -30,6 +33,18 @@ var (
waitChan = make(chan error) waitChan = make(chan error)
) )
// @title Swagger Torrserver API
// @version {version.Version}
// @description Torrent streaming server.
// @license.name GPL 3.0
// @BasePath /
// @securityDefinitions.basic BasicAuth
// @externalDocs.description OpenAPI
// @externalDocs.url https://swagger.io/resources/open-api/
func Start() { func Start() {
log.TLogln("Start TorrServer " + version.Version + " torrent " + version.GetTorrentVersion()) log.TLogln("Start TorrServer " + version.Version + " torrent " + version.GetTorrentVersion())
ips := getLocalIps() ips := getLocalIps()
@@ -73,6 +88,8 @@ func Start() {
dlna.Start() dlna.Start()
} }
route.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler))
//check if https enabled //check if https enabled
if settings.Ssl { if settings.Ssl {
//if no cert and key files set in db/settings, generate new self-signed cert and key files //if no cert and key files set in db/settings, generate new self-signed cert and key files
@@ -113,6 +130,16 @@ func Stop() {
waitChan <- nil waitChan <- nil
} }
// echo godoc
//
// @Summary Tests server status
// @Description Tests whether server is alive or not
//
// @Tags API
//
// @Produce plain
// @Success 200 {string} string "Server version"
// @Router /echo [get]
func echo(c *gin.Context) { func echo(c *gin.Context) {
c.String(200, "%v", version.Version) c.String(200, "%v", version.Version)
} }

View File

@@ -52,6 +52,7 @@
"@babel/cli": "^7.23.0", "@babel/cli": "^7.23.0",
"@babel/core": "^7.23.3", "@babel/core": "^7.23.3",
"@babel/plugin-proposal-class-properties": "^7.13.0", "@babel/plugin-proposal-class-properties": "^7.13.0",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-react-jsx": "^7.22.15", "@babel/plugin-transform-react-jsx": "^7.22.15",
"babel-minify": "^0.5.1", "babel-minify": "^0.5.1",
"babel-preset-minify": "^0.5.1", "babel-preset-minify": "^0.5.1",

View File

@@ -70,6 +70,7 @@ export default function AboutDialog() {
<LinkComponent name={t('ProjectSource')} link='https://github.com/YouROK/TorrServer' /> <LinkComponent name={t('ProjectSource')} link='https://github.com/YouROK/TorrServer' />
<LinkComponent name={t('Releases')} link='https://github.com/YouROK/TorrServer/releases' /> <LinkComponent name={t('Releases')} link='https://github.com/YouROK/TorrServer/releases' />
<LinkComponent name={t('NasReleases')} link='https://github.com/vladlenas' /> <LinkComponent name={t('NasReleases')} link='https://github.com/vladlenas' />
<LinkComponent name={t('ApiDocs')} link='swagger/index.html' />
</div> </div>
</Section> </Section>
@@ -77,8 +78,8 @@ export default function AboutDialog() {
<span>{t('SpecialThanks')}</span> <span>{t('SpecialThanks')}</span>
<div> <div>
<LinkComponent name='Daniel Shleifman' link='https://github.com/dancheskus' />
<LinkComponent name='Matt Joiner' link='https://github.com/anacrolix' /> <LinkComponent name='Matt Joiner' link='https://github.com/anacrolix' />
<LinkComponent name='Daniel Shleifman' link='https://github.com/dancheskus' />
<LinkComponent name='nikk' link='https://github.com/tsynik' /> <LinkComponent name='nikk' link='https://github.com/tsynik' />
<LinkComponent name='kolsys' link='https://github.com/kolsys' /> <LinkComponent name='kolsys' link='https://github.com/kolsys' />
<LinkComponent name='tw1cker' link='https://github.com/Nemiroff' /> <LinkComponent name='tw1cker' link='https://github.com/Nemiroff' />
@@ -86,7 +87,10 @@ export default function AboutDialog() {
<LinkComponent name='damiva' link='https://github.com/damiva' /> <LinkComponent name='damiva' link='https://github.com/damiva' />
<LinkComponent name='Anton Potekhin' link='https://github.com/Anton111111' /> <LinkComponent name='Anton Potekhin' link='https://github.com/Anton111111' />
<LinkComponent name='FaintGhost' link='https://github.com/FaintGhost' /> <LinkComponent name='FaintGhost' link='https://github.com/FaintGhost' />
<LinkComponent name='vladlenas' link='https://github.com/vladlenas' /> <LinkComponent name='TopperBG' link='https://github.com/TopperBG' />
<LinkComponent name='FaintGhost' link='https://github.com/FaintGhost' />
<LinkComponent name='lieranderl' link='https://github.com/lieranderl' />
<LinkComponent name='cocool97' link='https://github.com/cocool97' />
</div> </div>
</Section> </Section>
</div> </div>

View File

@@ -21,6 +21,7 @@
}, },
"AddFromLink": "Добавете торент", "AddFromLink": "Добавете торент",
"AddNewTorrent": "Добавете нов торент", "AddNewTorrent": "Добавете нов торент",
"ApiDocs": "Документация на API",
"B": "B", "B": "B",
"bps": "bps", "bps": "bps",
"Buffer": "Предварителен буфер / кеш", "Buffer": "Предварителен буфер / кеш",
@@ -66,6 +67,7 @@
"MB": "MB", "MB": "MB",
"Mbps": "Mbps", "Mbps": "Mbps",
"Name": "Име", "Name": "Име",
"NasReleases": "NAS Releases",
"NoTorrentsAdded": "Няма добавени торенти", "NoTorrentsAdded": "Няма добавени торенти",
"Offline": "Извън линия", "Offline": "Извън линия",
"OK": "OK", "OK": "OK",
@@ -76,7 +78,6 @@
"Playlist": "Плейлист", "Playlist": "Плейлист",
"Preload": "Предварително зареждане", "Preload": "Предварително зареждане",
"ProjectSource": "GitHub на проекта", "ProjectSource": "GitHub на проекта",
"NasReleases": "NAS Releases GitHub",
"PWAGuide": { "PWAGuide": {
"Header": "Инсталирайте приложение", "Header": "Инсталирайте приложение",
"Description": "Инсталирайте приложението на вашето устройство за лесен достъп до него по всяко време. Няма магазини за приложения. Няма сваляне.", "Description": "Инсталирайте приложението на вашето устройство за лесен достъп до него по всяко време. Няма магазини за приложения. Няма сваляне.",

View File

@@ -21,6 +21,7 @@
}, },
"AddFromLink": "Add Torrent", "AddFromLink": "Add Torrent",
"AddNewTorrent": "Add new torrent", "AddNewTorrent": "Add new torrent",
"ApiDocs": "API Docs",
"B": "B", "B": "B",
"bps": "bps", "bps": "bps",
"Buffer": "Preload Buffer / Cache", "Buffer": "Preload Buffer / Cache",
@@ -66,6 +67,7 @@
"MB": "MB", "MB": "MB",
"Mbps": "Mbps", "Mbps": "Mbps",
"Name": "Name", "Name": "Name",
"NasReleases": "NAS Releases",
"NoTorrentsAdded": "No torrents added", "NoTorrentsAdded": "No torrents added",
"Offline": "Offline", "Offline": "Offline",
"OK": "OK", "OK": "OK",
@@ -76,7 +78,6 @@
"Playlist": "Playlist", "Playlist": "Playlist",
"Preload": "Preload", "Preload": "Preload",
"ProjectSource": "Project GitHub", "ProjectSource": "Project GitHub",
"NasReleases": "NAS Releases GitHub",
"PWAGuide": { "PWAGuide": {
"Header": "Install application", "Header": "Install application",
"Description": "Install the app on your device to easily access it anytime. No app store. No download.", "Description": "Install the app on your device to easily access it anytime. No app store. No download.",

View File

@@ -21,6 +21,7 @@
}, },
"AddFromLink": "Добавить", "AddFromLink": "Добавить",
"AddNewTorrent": "Добавить новый торрент", "AddNewTorrent": "Добавить новый торрент",
"ApiDocs": "Документация API",
"B": "Б", "B": "Б",
"bps": "бит/c", "bps": "бит/c",
"Buffer": "Предзагрузка / Кеш", "Buffer": "Предзагрузка / Кеш",
@@ -66,6 +67,7 @@
"MB": "МБ", "MB": "МБ",
"Mbps": "Мбит/c", "Mbps": "Мбит/c",
"Name": "Название", "Name": "Название",
"NasReleases": "Релизы для NAS",
"NoTorrentsAdded": "Нет торрентов", "NoTorrentsAdded": "Нет торрентов",
"Offline": "Сервер недоступен", "Offline": "Сервер недоступен",
"OK": "OK", "OK": "OK",
@@ -76,7 +78,6 @@
"Playlist": "Плейлист", "Playlist": "Плейлист",
"Preload": "Предзагр.", "Preload": "Предзагр.",
"ProjectSource": "GitHub проекта", "ProjectSource": "GitHub проекта",
"NasReleases": "Релизы для NAS GitHub",
"PWAGuide": { "PWAGuide": {
"Header": "Установить приложение", "Header": "Установить приложение",
"Description": "Установите приложение на ваше устройство для быстрого доступа в любой момент. Без AppStore. Без загрузки.", "Description": "Установите приложение на ваше устройство для быстрого доступа в любой момент. Без AppStore. Без загрузки.",

View File

@@ -21,6 +21,7 @@
}, },
"AddFromLink": "Додати торент", "AddFromLink": "Додати торент",
"AddNewTorrent": "Додати новий торент", "AddNewTorrent": "Додати новий торент",
"ApiDocs": "Документація API",
"B": "Б", "B": "Б",
"bps": "біт/c", "bps": "біт/c",
"Buffer": "Буфер", "Buffer": "Буфер",
@@ -66,6 +67,7 @@
"MB": "МБ", "MB": "МБ",
"Mbps": "Мбіт/c", "Mbps": "Мбіт/c",
"Name": "Назва", "Name": "Назва",
"NasReleases": "Релізи для NAS",
"NoTorrentsAdded": "Немає торентів", "NoTorrentsAdded": "Немає торентів",
"Offline": "Сервер не доступний", "Offline": "Сервер не доступний",
"OK": "OK", "OK": "OK",
@@ -76,7 +78,6 @@
"Playlist": "Плейлист", "Playlist": "Плейлист",
"Preload": "Передзав.", "Preload": "Передзав.",
"ProjectSource": "Сайт проекту", "ProjectSource": "Сайт проекту",
"NasReleases": "Релізи для NAS GitHub",
"PWAGuide": { "PWAGuide": {
"Header": "Встановити додаток", "Header": "Встановити додаток",
"Description": "Встановіть програму на свій пристрій, щоб легко отримати до неї доступ у будь-який час. Немає магазину додатків. Немає завантаження.", "Description": "Встановіть програму на свій пристрій, щоб легко отримати до неї доступ у будь-який час. Немає магазину додатків. Немає завантаження.",

View File

@@ -21,6 +21,7 @@
}, },
"AddFromLink": "添加种子", "AddFromLink": "添加种子",
"AddNewTorrent": "添加新种子", "AddNewTorrent": "添加新种子",
"ApiDocs": "API 文档",
"B": "B", "B": "B",
"bps": "bps", "bps": "bps",
"Buffer": "预加载缓冲区/缓存", "Buffer": "预加载缓冲区/缓存",
@@ -66,6 +67,7 @@
"MB": "MB", "MB": "MB",
"Mbps": "Mbps", "Mbps": "Mbps",
"Name": "名称", "Name": "名称",
"NasReleases": "NAS 版本",
"NoTorrentsAdded": "没有添加种子", "NoTorrentsAdded": "没有添加种子",
"Offline": "离线", "Offline": "离线",
"OK": "确定", "OK": "确定",
@@ -76,7 +78,6 @@
"Playlist": "播放列表", "Playlist": "播放列表",
"Preload": "预加载", "Preload": "预加载",
"ProjectSource": "项目GitHub", "ProjectSource": "项目GitHub",
"NasReleases": "NAS GitHub 版本",
"PWAGuide": { "PWAGuide": {
"Header": "安装应用程序", "Header": "安装应用程序",
"Description": "将应用程序安装到您的设备上,以便随时方便地访问。无需应用商店、无需下载。", "Description": "将应用程序安装到您的设备上,以便随时方便地访问。无需应用商店、无需下载。",

File diff suppressed because it is too large Load Diff