Skip to content

kinvaris/tshockweb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TSHOCK WEB V2

Description

This is the new, improved & lightweight version of the TSHOCK WEB

Status

Currently in alpha

Requirements

  • Flask: 0.11.1
  • python-pip: 1.5.6-5
  • Python-2.7

Easy deployment

  • Edit the following config file: config/tshockweb.json
  • The tshock_web section contains the api and web settings
  • The tshock_server section contains the settings to the tshock terraria server
  • Execute as: python tshockweb.py
  • Visit the following pages to validate the workability: http://127.0.0.1:14789 & http://127.0.0.1:14789/api

GUI

  • Easily manage your tshockweb with account(s) that have superadmin rights

  • Easily monitor your tshock terraria server with the dashboard

  • Easily manage your raw tshock commands with an online command tool

  • Check and manage what online users are doing/carrying on your server

Development

  • Easy python API:
from thw.model.lists.players import PlayerList
from thw.helpers.api import TSHOCKClient

api = TSHOCKClient(ip="tshock-api-url", port=7878, username='superadmin-username', password='superadmin-password')
print PlayerList.get_current_players(api=api)
  • Easy API:
import requests

requests.get('http://127.0.0.1:14789/api/login', json={"username": "superadmin-username", "password": "superadmin-password"}
{
  "result": {
    "token": "B542D501E90A62615F257BCCC47996B4597BAF0E06C9BB727785FFB880CA6F9E"
  }, 
  "status": 200, 
  "valid": true
}

requests.get('http://127.0.0.1:14789/api/model/lists/players/get_current_players', json={"token": "B542D501E90A62615F257BCCC47996B4597BAF0E06C9BB727785FFB880CA6F9E"})
{
  "result": {
    "api_path": "model/lists/players", 
    "method": "get_current_players", 
    "output": []
  }, 
  "status": 200, 
  "valid": true
}

curl -H "Content-Type: application/json" -X GET -d '{"username":"superadmin-username","password":"superadmin-password"}' http://localhost:14789/api/login
  • Default JSON output:
{
  "result": {},  // result of the api call
  "status": 200, // status code of tshockweb api call
  "valid": true  // is valid call to the tshock terraria server
}

Documentation

We try to make the API as generic and self documenting as possible. Currently we list the whole directory structure with classes,methods and their respective parameters.

http://127.0.0.1:14789/api/documentation

{
  "result": {
    "controllers": {
      "groups": {
        "add_group": [
          "group_name", 
          "permissions"
        ], 
        "delete_group": [
          "group_name"
        ], 
        "update_group": [
          "group_name", 
          "permissions"
        ]
      }, 
      "manager": {
        "execute_cmd": [
          "command"
        ]
      }, 
      "players": {
        "add_player": [
          "username", 
          "password", 
          "group", 
          "ip"
        ], 
        "ban_player_by_ip": [
          "ip", 
          "reason"
        ], 
        "ban_player_by_username": [
          "username", 
          "reason"
        ], 
        "delete_player": [
          "username"
        ], 
        "kick_player_by_username": [
          "username", 
          "reason"
        ], 
        "kill_player_by_username": [
          "username", 
          "reason"
        ], 
        

Fetching new terraria images

You can convert your terraria images to image/PNG with TExtract: https://forums.terraria.org/index.php?threads/textract-extract-terrarias-images-sound-effects-and-music.937/ Items can be mapped through this website: http://terraria.gamepedia.com/Item_IDs_Part1 Copy everything to a file, delete the tabs and delete everything matching .+?(png)

Known issues

  • The meteor can sometimes throw a Internal server error, this is being discussed in Pryaxis/TShock#1361
  • Armor/Inventory can sometimes show up other items than in reality (although 90% should be spot on). This because of ID overlapping in terraria itself. As seen here: http://terraria.gamepedia.com/Item_IDs#1801_.E2.86.92_2100
  • If a item is not available in our image databank, it will display a empty image
  • If the tshock server crashes its possible that the internal Flask server will crash with a Broken Pipe error. A restart of the server is required when this occurs.
  • Missing (de)buffs in the terraria_buffs.json result in XXX not found and broken image in GUI.

Current unimplemented features

  • The Server Activity is currently generating fake results
  • The Live server status is currently generating fake results

About

Easy web interface for TShock Terraria server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • CSS 43.8%
  • JavaScript 33.5%
  • HTML 22.1%
  • Other 0.6%