This project provides an HTTP API to generate and serve statistics from Synchronet log files for the Gold Mine Game Server. The statistics include the top 10 most launched games and detailed stats based on monthly, yearly, or all-time data.
- Parses log files from a specified directory.
- Generates JSON statistics for:
- Top 10 most launched games.
- Monthly statistics.
- Yearly statistics.
- All-time statistics.
- Provides a library endpoint to list all games with details.
- Automatically reloads and refreshes data every 24 hours.
- Go 1.14 or later
- Synchronet BBS running as Door Server, with log files in the specified directory (e.g. /var/log)
-
Clone the repository:
git clone https://github.com/robbiew/goldmine-api.git cd synchronet-log-stats-api
-
Build the project:
go build -o goldmine-api main.go
- Run the server:
sudo ./goldmine-api --logdir=/path/to/your/log/dir
Note, for Linux, Synchronet writes logs to /var/log/syslog*. This server listens on port 80.
- Access the API endpoints:
- Top 10 Games: https://localhost/top10?period=all
- Replace all with month or year or a specific month (e.g., july) or year (e.g., 2024).
- Detailed Stats: https://localhost/stats?period=all
- Replace all with month or year or a specific month (e.g., july) or year (e.g., 2024).
- Library: https://localhost/library
- Retrieve the top 10 most launched games.
Query Parameters:
- period (required): The time period for the statistics. Valid values are month, year, all, or a specific month (e.g., july) or year (e.g., 2024).
Response:
- 200 OK: A JSON object containing the top 10 most launched games.
- 400 Bad Request: If the period parameter is missing or invalid.
{
"period": "all",
"games": [
{
"game_name": "Adventurer's Maze II",
"door_code": "AM2",
"category": "RPGs: Medieval & Fantasy",
"launch_count": 42
},
...
]
}
- Retrieve detailed statistics.
Query Parameters:
- period (required): The time period for the statistics. Valid values are month, year, all, or a specific month (e.g., july) or year (e.g., 2024).
Response:
- 200 OK: A JSON object containing detailed statistics.
- 400 Bad Request: If the period parameter is missing or invalid.
{
"month": {
"january": [
{
"game_name": "Adventurer's Maze II",
"door_code": "AM2",
"category": "RPGs: Medieval & Fantasy",
"launch_count": 42
},
...
],
...
}
}
- Retrieve a list of all games with details.
Query Parameters:
- None
Response:
- 200 OK: A JSON object containing the list of all games.
[
{
"game_name": "Adventurer's Maze II",
"door_code": "AM2",
"category": "RPGs: Medieval & Fantasy"
},
...
]