Giter Site home page Giter Site logo

vote-handler-rs's Introduction

Vote-Handler Proxy

This applications purpose is only to keep state in a local cache for as long as the bot's vote endpoint is unavailable.

This application can be run multiple-times across different nodes using a load-balancer to achieve high-availability.

Env vars

  • RUST_LOG | Set logging level
  • VOTE_ENDPOINT | (Mandatory) Set the endpoint to proxy requests to
  • VOTE_ENDPOINT_AUTH_TOKEN | Set the token provided to the endpoint in Authorization header, defaults from VOTE_AUTH_TOKEN
  • VOTE_RESEND_DELAY | The interval in seconds between resend executions, default 5
  • VOTE_RESEND_BULK_COUNT | The amount of requests per resend-execution, default 100
  • VOTE_AUTH_TOKEN | The token provided in Authorization header to validate requests against on vote/generic endpoint
  • VOTE_AUTH_TOKEN_TOPGG | The token provided in Authorization header to validate requests against on vote/topgg endpoint
  • VOTE_AUTH_TOKEN_DBL | The token provided in Authorization header to validate requests against on vote/dbl/{botid} endpoint
  • VOTE_AUTH_TOKEN_BFD | The token provided in Authorization header to validate requests against on vote/bfd endpoint
  • VOTE_AUTH_TOKEN_DBOATS | The token provided in Authorization header to validate requests against on vote/dboats endpoint
  • VOTE_AUTH_TOKEN_DLIST | The token provided to sign JWT tokens for dlist request bodies on the vote/dlist endpoint

Usage

Your endpoint has to return a Status-Code 200 with the response {"status":"OK"}, at least the status-node with the value Ok must be present.

This service POSTs to the given VOTE_ENDPOINT with VOTE_ENDPOINT_AUTH_TOKEN in the Authorization header.

The vote-handler proxy exposes 5 different endpoints for various bot-lists:

  • /vote/generic
  • /vote/topgg
  • /vote/dbl/{botid}
  • /vote/bfd
  • /vote/dboats
  • /vote/dlist

The requests will be accepted and unified to the following struct:

#[derive(Debug, Deserialize, Serialize, Clone)]
#[serde(rename_all = "camelCase")]
pub struct VoteRequest {
    pub bot: Snowflake,
    pub user: Snowflake,
    pub r#type: String,
    pub is_weekend: bool,
    pub query: Option<String>,
    pub src: Option<String>,
}

Possible values for src are the same as the endpoints:

  • topgg
  • dbl
  • bfd
  • dboats
  • dlist

isWeekend will default to false if it's not set, as only topgg sends this.

type will be either "vote" or "test".

vote-handler-rs's People

Contributors

bytealex avatar toxicmushroom avatar

Stargazers

Nayv avatar  avatar Vetlix avatar Trent Wiles avatar doge avatar  avatar Gerard Smit avatar

Watchers

James Cloos avatar

Forkers

toxicmushroom

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.