Compare commits

...

1 commit

Author SHA1 Message Date
8efe5c4c7a fixed style issues in README.md and main.go 2019-02-07 17:02:55 +01:00
2 changed files with 18 additions and 13 deletions

View file

@ -1,18 +1,20 @@
# tsviewer **[WIP]** # tsviewer **[WIP]**
A TS3 Viewer with REST API. A TS3 Viewer with REST API.
I´m a sick Fuck i like the sick F09ck
## DOCKER-Config ## Config
### Docker-Config
```bash ```bash
docker build -t name/cont:ver . docker build -t name/cont:ver .
docker run -e TS3_IP="<SERVER-IP>" -e TS3_PW="<SERVER-ADMIN_PW>" -e WEB_PORT="8080" -d -p 8080:8080 name/cont:ver docker run -e TS3_IP="<SERVER-IP>" -e TS3_PW="<SERVER-ADMIN_PW>" -e WEB_PORT="8080" -d -p 8080:8080 name/cont:ver
``` ```
ENV:
```Docker
ENV:
```Docker
ENV TS3_IP=127.0.0.1 ENV TS3_IP=127.0.0.1
ENV TS3_NAME=serveradmin ENV TS3_NAME=serveradmin
ENV TS3_PW=<changeMe> ENV TS3_PW=<changeMe>
@ -20,15 +22,12 @@ ENV TS3_PORT=9987
ENV TS3_QUERY=10011 ENV TS3_QUERY=10011
ENV WEB_PORT=8080 ENV WEB_PORT=8080
ENV BLACKLIST_USER=USER ENV BLACKLIST_USER=USER
``` ```
# Features ### API-Config
## Config
The config file is generated automatically on first startup. The config file is generated automatically on first startup.
```json ```json
{ {
"user": { "user": {
@ -47,17 +46,20 @@ The config file is generated automatically on first startup.
} }
``` ```
## URL-Parameter ## Features
### URL-Parameter
| Name | Type | Description | | Name | Type | Description |
| ---------- | ------ | ------------------------ | | ---------- | ------ | ------------------------ |
| `pretty` | `bool` | pretty-prints JSON | | `pretty` | `bool` | pretty-prints JSON |
| `envelope` | `bool` | wraps JSON in data array | | `envelope` | `bool` | wraps JSON in data array |
## Channels ### Channels
- **`GET`** `/v1/channels/:id` - **`GET`** `/v1/channels/:id`
- **`GET`** `/v1/channels` - **`GET`** `/v1/channels`
```json ```json
{ {
"databaseId": 1, "databaseId": 1,
@ -69,10 +71,11 @@ The config file is generated automatically on first startup.
} }
``` ```
## Clients ### Clients
- **`GET`** `/v1/clients/:id` - **`GET`** `/v1/clients/:id`
- **`GET`** `/v1/clients/` - **`GET`** `/v1/clients/`
```json ```json
{ {
"id": 1, "id": 1,
@ -85,9 +88,10 @@ The config file is generated automatically on first startup.
} }
``` ```
## Server ### Server
- **`GET`** `/v1/server/info` - **`GET`** `/v1/server/info`
```json ```json
{ {
"name": "TeamSpeak ]I[ Server", "name": "TeamSpeak ]I[ Server",

View file

@ -19,6 +19,7 @@ import (
"github.com/go-chi/cors" "github.com/go-chi/cors"
) )
// Routes includes middleware and distributes request to different Routers
func Routes(s service.Service, t template.Template) *chi.Mux { func Routes(s service.Service, t template.Template) *chi.Mux {
router := chi.NewRouter() router := chi.NewRouter()
cors := cors.New(cors.Options{ cors := cors.New(cors.Options{