GithubHelp home page GithubHelp logo

kymppi / aocleaderboard Goto Github PK

View Code? Open in Web Editor NEW

This project forked from scarvalhojr/aocleaderboard

0.0 0.0 0.0 1.76 MB

Merge multiple Advent of Code leaderboards

License: MIT License

Rust 97.79% Dockerfile 2.21%

aocleaderboard's Introduction

aocleaderboard

Advent of Code private leaderboards are currently limited to 200 users. This web app can merge users from multiple leaderboards, recalculate their scores based on the total number of members, and present them in a single page with the same look and feel of the original Advent of Code website. It can also show an overall leaderboard with scores for all years combined.

Leaderboards are fetched in JSON format from the adventofcode.com API URL.

Screenshots

Leaderboard with local score:

alt text

Leaderboard with star count:

alt text

Overall leaderboard:

alt text

Requirements

This app is built with Rocket web framework and, therefore, requires a nightly version of Rust.

Install

  • On Linux, install the appropriate development tools for your system, for instance:
# On Fedora, RHEL, CentOS
# sudo dnf groupinstall "Development Tools"

# On Debian, Ubuntu
# sudo apt install build-essential
  • Install a recent version of Rust using rustup or update it with:
# rustup update
  • Install the nightly toolchain:
# rustup toolchain install nightly
  • Clone this repo:
# git clone https://github.com/scarvalhojr/aocleaderboard.git
  • Set the repo directory to use the nightly toolchain:
# cd aocleaderboard
# rustup override set nightly
  • Build:
# cargo build --release

Configure

Required configuration

# cp settings_sample.toml settings.toml
  • Edit the new settings.toml file and provide a list of private leaderboard IDs along with a leaderboard name and a session cookie from adventofcode.com with access to the leaderboards.
leaderboard_name = "me and my friends"
leaderboard_ids = [12345, 23456]
session_cookie = "session=<session cookie string>"

To obtain the session cookie, login to adventofcode.com and inspect the cookie stored in your browser. You must be a member of the leaderboards in order to fetch their data - check your leaderboards at https://adventofcode.com/leaderboard/private.

Other settings

  • In settings.toml:

    • leaderboard_default_order - default leaderboard ordering, either "local_score" (default) or "stars".
    • leaderboard_update_sec - how often to fetch leaderboards from adventofcode.com, in seconds.
    • latest_event_year - override the latest event year, which by default is the current year or the previous year if the current date is before Dec 1st (when first puzzle unlocks).
    • exclude_members - a list of member IDs to exclude from leaderboard.
  • To change any Rocket-specific settings, e.g. path to TLS certs an keys, or IP address and binding port, make a copy of Rocket_sample.toml called Rocket.toml.

Run

Running on bare metal

Start the app:

cargo run --release

Docker

Build the Docker image:

docker build . -t aocleaderboard

Start the image:

docker run -p 8000:8000 -v "$(pwd)/settings.toml:/app/settings.toml" aocleaderboard

This will mount the settings.toml file into the container.

Docker Compose

docker compose up
# Or, for detached
docker compose up -d

Use

Point your favourite browser to http://localhost:8000.

Features

  • To avoid overloading the Advent of Code website, leaderboards are cached in memory and fetched again after a configurable time limit (by default, 15 minutes).
  • Leaderboards can be ordered by local score (based on the time each star was acquired) or by number of stars. Ties are broken by the time the most recent star was acquired.
  • Overall leaderboard combines scores from all years.

Contribute

Feedback and pull requests are welcome.

Support Advent of Code

Advent of Code is a free online Advent calendar of small programming puzzles created by Eric Wastl and maintained by volunteers. Please consider supporting their work.

aocleaderboard's People

Contributors

scarvalhojr avatar kymppi avatar tatupesonen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.