Enhance README and refactor code structure for improved functionality
🚀 Deploy website via FTP / 🎉 Deploy (push) Failing after 8s

- Updated README.md with detailed project description, features, and installation instructions.
- Refactored functions.php to include configuration settings and improved database handling.
- Modified index.php for better user experience and added pagination controls.
- Introduced new utility functions for API handling and database interactions.
- Added CSS styles for improved layout and visibility of elements.
- Removed vault.csv as data is now managed through the database.
- Implemented FTP deployment workflow for automated deployment.
- Added exception handling classes for better error management.
- Created JavaScript functions for pagination of transaction records.
This commit is contained in:
Keith Solomon
2026-08-03 11:26:55 -05:00
parent 6e63c37071
commit 7f1f4de553
14 changed files with 692 additions and 267 deletions
+96 -22
View File
@@ -1,38 +1,112 @@
# Torn Vault Tracker
# <img alt="Torn Vault Tracker icon" src="favicon.png" width="30" style="vertical-align:bottom; margin-right:.5rem;"> Torn Vault Tracker
Track vault balances for shared private island vaults in [Torn City](https://torn.com/).
![PHP Version](https://img.shields.io/badge/PHP-8.3%2B-blue.svg)
![Database](https://img.shields.io/badge/Database-SQLite3-blue.svg)
[<img height="20" alt="Deployed with FTP Deploy Action" src="https://img.shields.io/badge/Deployed With-FTP DEPLOY ACTION-%3CCOLOR%3E?style=for-the-badge&color=0077b6">](https://github.com/SamKirkland/FTP-Deploy-Action)
A web-based tracking system for monitoring shared vault transactions in the [Torn City MMORPG](https://torn.com/).
## Description
Uses the [Torn API](https://www.torn.com/api.html) to pul the most recent vault transactions for you and your spouse. Note that in order to access the "Log" endpoint, the keys used must be created with Full Access permissions.
This tool automatically tracks deposits and withdrawals from your Torn City private island vault using the official Torn API. It provides real-time balance tracking, available vault space calculations, and a transaction history display for multiple users.
## Getting Started
Key Features:
### Dependencies
- 🕒 Automatic transaction synchronization via Torn API
- 💰 Real-time balance calculations (individual & combined)
- 📊 Color-coded transaction history (green deposits/red withdrawals)
- 🛡️ Secure API key management
- 📈 Vault space monitoring with individual user shares
- 💾 SQLite database for persistent storage
* Any reasonable LAMP stack (developed on Ubuntu 20.04 with Apache and PHP 8.1.10)
## Features
### Installing
### Core Functionality
* Create folder in your server's web root, for example, 'tvt'.
* Upload/clone this repo into your folder.
* Edit `functions.php` to add API keys and Torn user names for you and your spouse.
* Edit `vault.csv` to set initial balances for each user (see notes below).
* Open the tracker in any web browser.
* Style as you see fit in `style.css` (Optional, but if you make something cool, let me know!).
- Automated API polling for vault transaction logs
- Duplicate transaction prevention
- Responsive HTML/CSS interface
- Error handling for API failures and database issues
- Automatic database schema creation and history population
### Initial vault balance(s)
Currently, there's no way to get past vault transactions via the API. If you're starting new, you can use the vault balance before your spouse adds their first deposit. For existing vaults, you'll need to figure out the balances the hard way. Once you have the balances, put them into the `vault.csv` with the proper user names. The timestamp field doesn't matter, and can be left at the current value.
### Financial Tracking
### Automating transaction updates
- Individual user balances
- Total vault balance calculation
- Remaining vault space tracking (500M per user / 1B total)
- Historical transaction records with timestamps
I recommend using an external site monitoring service such as [cronitor.io](https://cronitor.io) set to check the URL of your server. A check rate of 15 minutes should be more than enough, since you can always force a refresh by simply opening the site in your browser.
## Installation
## Authors
### Requirements
Keith Solomon / [ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) on [Torn](https://torn.com/)
- Web server with PHP 8.1+
- SQLite3 extension enabled
- Write permissions for web server user
## Version History
> [!NOTE]
> If you need hosting, I recommend [InfinityFree](https://www.infinityfree.com/). They have a robust free hosting package that has everything you need to run this project (I run my personal copy of this project on their service).
* 0.1
* Initial Release
### Setup Steps
1. Upload the project files to your web hosting. You can do this with an FTP client or by using `git` directly on the server (if your host supports it).
- To use `git`: Clone repository to web directory (the command as written will put all files in a `tvt` directory):
```bash
git clone https://github.com/yourusername/tvt.git
```
2. Open `config.php` and configure the API keys and other settings.
3. Access the project in your web browser to initialize the database and start tracking transactions. The first run will create the database and import the vault transactions for both users.
Depending on the number of transactions, this may take some time (my dev install took about 25 seconds to pull in ~2,100 transactions). The browser will refresh when the process is complete.
### Configuration
> [!IMPORTANT]
> API keys **must** have "Full Access" permissions to access `log` endpoints.
Edit `config.php` to set up API access:
- `username1` and `username2` should be changed to your usernames.
```php
const USER_KEYS = [
'username1' => 'your_api_key_here',
'username2' => 'partner_api_key_here'
];
```
- If you want to change the number of rows per page in the transactions table (default is 15), change the `ROWS_PER_PAGE` constant
## Usage
Access the tracker through your web browser after setup and configuration:
- Transactions will automatically sync on page load going forward
- Balance calculations update in real-time
- Recent transactions display in chronological order
### Contribution
We welcome contributions! Please follow these guidelines:
- Fork the repository
- Create feature branch (git checkout -b feature/improvement)
- Follow existing PHP coding standards
- Test changes thoroughly
- Submit a pull request
### Credits
Primary Author: [Keith Solomon](https://KeithSolomon.net)
(_[ZarathosX75](https://www.torn.com/profiles.php?XID=2606457) in Torn City_)
### Acknowledgements
- [Torn City API documentation](https://www.torn.com/api.html)
- [Torn City API Development Forum](https://www.torn.com/forums.php?p=forums&f=63&b=0&a=0)
- [Roboto font by Christian Robertson](https://fonts.google.com/specimen/Roboto)
> [!IMPORTANT]
> **Disclaimer:** This project is not affiliated with or endorsed by Torn City