1. These forums are being retired. Please ask all questions and help threads and any other type of discussions on GitHub. During this time, new threads and user registrations have been disabled.

REST Inventory Viewer v1.3.1

Allows you to view users inventories in a Terraria-like format

  1. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    Rest Inventory Viewer
    To use this you must be using at least TShock v4.2.4 and have a REST enabled in your config.json

    What does this do?
    The Rest Inventory Viewer provides you with an application that can read a players inventory, and then display it to you in a styled page that closely resembles that of the in-game interface. This is useful for checking players for illegal items, such as too many of one accessory equipped, Developer Armor, as well as any buffs that are impossible, such as Rapid Healing, without the appropriate Palladium Armor. It also provides the players position.


    What does this not do?
    It does not display prefixes on any items. It does not have any option for restricted access at this time. If you do not use any sort of directory access protection, then anyone can use the link to view anyone else's inventory.


    How do I set it up?
    Place all of the files in the zip into their own directory such as "view". Make sure this is within a web servers root directory, you will need to access this via a web browser. Once you have placed the files into a directory within your web servers root, visit it using your browser. This will present you with a page that asks for the details to connect to your server. The page may take a little longer than usual to load, this is because it is extracting the items zip.


    Now, make sure REST is enabled and that you have access to an account that has permissions "tshock.rest.useapi"and "tshock.rest.users.info". Enter the IP, Port, Username and Password then submit. If successful, you will now see a users list. This page is now usable by anyone who knows the link.

    Live example:
    If you want to get a grasp as to what this does, you can visit [link]. This displays users from Dark Gaming, and allows you to view their Inventories.


    Current Issues:
    Some images for items do not exist in the items zip.
    Some items may not have a correct item match. I have fixed everything that I've encountered in terms of the items_array.


    Credits:
    I thank Mr.Pineapple as he is the one that allowed me to design the Inventory page that would then be used in this application. He also introduced me to producing PHP pages that could get data via TShock's Rest API.


    Download
    There are 2 release zips. One is for updating, the other is for downloading a new copy. If you are updating from the previous release, get the zip with ToUpdate.

    Release
    Source
     
    • Like Like x 3
    • Useful Useful x 1
    #1 popstarfreas, Feb 5, 2015
    Last edited: Aug 3, 2016
  2. shaitan1977

    shaitan1977 Level 4

    Joined:
    Jul 6, 2014
    Messages:
    61
    Whenever two people access the site at the same time, it lags out the webserver for 5-10 minutes. Is there a way to make it so you "logout" the first person when person two goes there, or something similar?

    Nice work on this by the way. I like how it shows buffs/equipment. :)
     
  3. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    Never had this issue before. There are no cookies are any login-related information in this system. On a local webserver, I've visited the same persons inventory in two browsers simultaneously and there's been no 5-10 minute 'lag out'. Is there any more specific information you can give related to this issue?
     
  4. shaitan1977

    shaitan1977 Level 4

    Joined:
    Jul 6, 2014
    Messages:
    61
    I'm going to try something first. One of our other game developers added h5ai to our Apache webserver. removing that and seeing if it does it still..
    bah I wonder if he bananaed the webserver then. -.-
     
  5. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    Is there anything in any of the logs? If it's not to do with this specific piece of software, then it's probably best that this discussion would be taken to a PM. Most of the php stuff is in the php_error_log.
     
  6. bippity

    Plugin Developer

    Joined:
    Jan 14, 2012
    Messages:
    300
    Works great and haven't had any problems with it!
    May I suggest also displaying the user's ip and group in addition to the player's position when it reads the user?
     
  7. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    The only issue with the IP is that some people may want open access to these pages, but do not want users IP's being handed out. I could just add an option to disable the IP display if the directory is to be openly accessed, but I imagine some other method would be more suitable. I'll try and find a better way maybe including getting a person to login to verify they are an admin of somesort. The groups probably aren't sensitive information I imagine. Unless you think otherwise? I can certainly add them.

    Edit: To meet your request on a usable level, I've added a config.php file (you can edit this in any text editor), which has boolean values for displaying the Position, Group and IP.
     
    • Like Like x 1
  8. bippity

    Plugin Developer

    Joined:
    Jan 14, 2012
    Messages:
    300
    I just noticed that if someone tries to use the inventory viewer while the server is offline, then it'll toss out a warning/error for file_get_contents() and it'll display the Rest token :eek:.
    Any way to fix/suppress that? I just added a '@' to it when $token is being defined.
    PHP:
        $token json_decode(@file_get_contents("http://$location/token/create/$rest_user/$rest_pass"0$ctx));
     
    #8 bippity, Jun 24, 2015
    Last edited: Jun 24, 2015
  9. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    Didn't notice that, even though on the other projects I've done that to protect the token and user/pass. Thanks for pointing it out, I've fixed it and added @ to all file_get_contents to ensure there is no warning/error that would tell people about the user/pass or token if it fails.
     
    • Like Like x 1
  10. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
  11. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    popstarfreas updated Inventory Viewer with a new update entry:

    1.3 Update

    Read the rest of this update entry...
     
  12. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
  13. tanpro260196

    tanpro260196 Level 5

    Joined:
    Oct 30, 2015
    Messages:
    114
    Can you please explain more about how to install? Like what is "Web server root"? And when I try to open index.php, it is just a bunch of text......
     
  14. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    This isn't a TerrariaServer plugin. It's a PHP project that utilises TShock's REST API. You'll need to be running a web server, using something like Apache or NGINX, which receives http requests and processes the files from the inventory viewer. If you don't want to setup a web server just to use this, I can always add your server details to the one running on my own web server, so you can use it there.
     
  15. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
  16. Exrex

    Exrex Level 4

    Joined:
    Jul 26, 2015
    Messages:
    94
    Help.
    Server console:
    A rest login from IP was blocked as it currently has 9 token.
    And site error
    Notice: Undefined index: player in /home/h92449/data/www/inv.terradw.ru/index.php on line 90
     
    #16 Exrex, Mar 23, 2016
    Last edited: Mar 23, 2016
  17. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    Yeah I didn't notice one of the changes was incorrect. Go and put the contents of https://raw.githubusercontent.com/popstarfreas/Rest-Inventory/master/index.php into your index.php and that should fix it. I think you'll need to restart your server if you want it to not be blocked after this change.
     
  18. IamUSER

    IamUSER Level 7

    Joined:
    Jul 29, 2013
    Messages:
    184
    I like this plugin. Useful interface and simple! Thanks!

    However I am having the same token buildup mentioned above. I tried the updated index.php and it helped a few errors but not the token issue.
     
    #18 IamUSER, Mar 25, 2016
    Last edited: Mar 25, 2016
  19. popstarfreas

    Plugin Developer

    Joined:
    Feb 27, 2012
    Messages:
    357
    I'm not really sure how that is possible. Did you restart the server? I'm running pretty much the same version and there's been no token issues.
     
  20. Exrex

    Exrex Level 4

    Joined:
    Jul 26, 2015
    Messages:
    94
    Yes, i reload server.
    This did not solve my problem, which can be a problem in the server settings?