January 25, 20215 yr GitHubhttps://github.com/Mykindos/OSTrackerIf you found this repository useful, please consider giving it a star!AboutIn late 2019, OSTracker 1.0 was released which was a client-server implementation that strived to collect user data for scripters with ease. There were a few problems with this type of implementation, and most of them were performance related and mostly poor ways of communication between the client and the database.Today I am happy to release OSTracker 2.0, which transitions from this Client-Server approach to a RESTful API which allows for much easier and less intensive data submission and tracking.OSTracker 2.0 API is built on Laravel, a PHP framework that specialises in the development of web applications.Tracked Data (per user)Experience gained for all skillsItems Received, Lost, or Spent (e.g. arrows and runes)Time ranError logs (if setup)UpcomingData retrieval end points that will allow you to filter certain users, scripts, skills, items, and more. Client-side installationIntegration with your OSBot script is relatively simple. Simply copy the contents of the 'client' directory in this repo into your scripts code base.In your scripts onStart, you should initialise OSTracker like so.private Tracker tracker; @Overridepublic void onStart(){ try { tracker = new Tracker(getBot(), getName(), "BASE_API_URL", "YOUR_TOKEN") .setUpdateInterval(30) // Defaults to an hour .start(); tracker.getSessionTracker().setVersion(getVersion()); } catch (Exception e) {if (tracker != null) { tracker.stop();} e.printStackTrace(); }}And end the tracker in your scripts onExit like so@Overridepublic void onExit(){if(tracker != null){ tracker.stop(); }}Your token will be created when deploying the Laravel API to your server, or it will be provided to you if you are choosing to integrate with somebody else's API.From here, OSTracker will automatically handle experience, loot, and script runtime tracking, and by default will submit this data to the API once per hour. Data will also be submitted when the script is stopped.API installationDon't fancy setting all this up? I can host your data for you for $3 USD per month. Spoiler RequirementsA Linux based or Windows OS VPS / Dedicated server. (for this installation, I used a Centos 7 VPS)PHP 7.2+ApacheComposerGitMySQL ServerZip, Unzip (yum install zip unzip php-zip)I would recommend following this tutorial, as it encompasses most of the requirements. You will need to replace Step 4 with this repository however. https://tecadmin.net/install-laravel-framework-on-centos/ StepsClone this repository to your desired location, e.g. '/var/www', you can do this by running git clone https://github.com/tomhoogstra/OSTracker.git in the repository of choice.Once cloned, navigate to the api subdirectory.Run composer install and wait for all the dependencies to downloaded, this can take a few minutes.After composer has finished doing its thing, you will need to create a copy of the '.env.example' file and name it '.env'.Run the following commands php artisan key:generateWith MySQL, create a new scheme with whatever name you want, and give your user access to it.After the schema has been created, you will need to update the '.env' file with your database credentials, e.g. DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 DB_DATABASE=ostracker DB_USERNAME=myusername DB_PASSWORD=mypassword 8. Run the following commands to create all the necessary tables with default data php artisan migrate php artisan db:seed 9. Update the file read / write permissions if you are on a linux based system chown -R apache.apache /var/www/OSTracker/api chmod -R 755 /var/www/OSTracker/api chmod -R 755 /var/www/OSTracker/api/storage 10. Update the apache config to point to the base directory of the API (on Centos 7, the config can be found at '/etc/httpd/conf/httpd.conf') To do this, add this to the bottom of the config (change the paths where necessary) <VirtualHost *:80> DocumentRoot /var/www/OSTracker/api/public <Directory /var/www/OSTracker/api> AllowOverride All </Directory> </VirtualHost> 11. Restart the apache service (On Centos 7 you can do this with service httpd restart) 12. Installation should now be complete, and you should be able to access the Laravel default page by going to your hostname in any web browser Post-installation instructions / API endpointsSpoilerAfter installation, you will need to create your first user to get an API token which will be used in your script and for future data retrieval.You can do this by calling the register endpoint of your newly deployed API. This can be easily done in Postman, or anywhere of your choosing.Once the user has been created and you have your API token, you will need to do some work in the MySQL database to allocate any scripts to this user.Start off by adding your own scripts / service to the scripts table. e.g.Once your scripts have been created, you can give your user access by adding the userID to scriptID mapping in the userscripts table. If i want to allocate these 9 scripts to the user we just created 'Tom', I would goto the users table and get the ID for the user first, then insert it into userscripts like so.Given that Tom is the first user I have created, the ID is '1'.Tom now has access to submit data for these 9 scripts Submitting dataCurrently there is 4 endpoints which you can use to submit data for users of your script or service, these are:itemsexperienceruntimelogIn order to submit data, you will need to include the API token you were provided when you created your user as the bearer token in any post request you make. The OSTracker client will handle this for you, but you can do this in Postman under the Authorization tab, and selecting 'Bearer Token' as the type.Here are some example requests for each of these endpoints. You can also import this collection into postman using the following link:https://www.postman.com/collections/de64e1ae43dc4dfca476API Documentation: http://api.mykindos.me/doc.htmlItemsNote: The JSON format seperating each item received, lost, or spent.ExperienceRuntimeLogRetrieving DatagetDataByUser getDataByScriptgetItemPrice Edited Wednesday at 05:45 PM4 days by Tom
January 25, 20215 yr POG EDIT: Will check this out, hopefully OSTracker 3_0 has some node js in it. Edited January 25, 20215 yr by Czar
February 28, 20223 yr Thank you for sharing! I hope it will be better than the first OS Tracker because it was not working. I like that the integration with your OSBot script is relatively simple, and you don't need to lose a lot of time on it. When I was using the first version of OS Tracker, I was stocking all the data on my SSD. Unfortunately, water destroyed it, so I lost all the data. My mistake was that I had thrown the SSD because, at that time, I didn't know that there were such services as salvagedata.com that could restore the data from such SSDs. Edited March 4, 20223 yr by AnnaMurray75NSA
March 3, 20223 yr Author On 2/28/2022 at 10:45 PM, AnnaMurray75NSA said: Thank you for sharing! I hope it will be better than the first OS Tracker because it was not working. I like that the integration with your OSBot script is relatively simple, and you don't need to lose a lot of time on it. Yep, the first version was awful. I tried to keep the script implementation as simple as possible, the server-side setup is a little more complicated though 16 hours ago, Fich420 said: I made my own ghetto way of doing this... and then found this Nice, hopefully you can find some use of the code / idea
Create an account or sign in to comment