Skip to content

API for retrieving stats from Gold Mine Community Game Server

Notifications You must be signed in to change notification settings

robbiew/goldmine-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Gold Mine Log Stats API

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.

Features

  • 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.

Getting Started

Prerequisites

  • Go 1.14 or later
  • Synchronet BBS running as Door Server, with log files in the specified directory (e.g. /var/log)

Installation

  1. Clone the repository:

    git clone https://github.com/robbiew/goldmine-api.git
    cd synchronet-log-stats-api
    
  2. Build the project:

    go build -o goldmine-api main.go
    

Usage

  1. 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.

  1. Access the API endpoints:

API Endpoints

GET /top10

  • 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
    },
    ...
  ]
}

GET /stats

  • 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
      },
      ...
    ],
    ...
  }
}

GET /library

  • 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"
  },
  ...
]

About

API for retrieving stats from Gold Mine Community Game Server

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published