cdr

package module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 12 Imported by: 0

README

cdr-backend

Stupid backend for CDR.

APIs

Dice

Dice sharing

POST: /upload?key={api_key}

Upload a die.

Request Body:

{
    // Die data
}

Note: Only allows up to 1MB of data. If over 1MB returns 413. Further limits might be imposed in the future.

Response:

{
    "id": "die ID",
    "expiration": 0 // Unix time (Seconds) of expiration
}

GET: /die/{die id}?key={api_key}

Get an uploaded die.

Response:

{
    // die data minus uid
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(client *mongo.Client) *Backend

func (Backend) AcceptCrash added in v0.1.0

func (s Backend) AcceptCrash(cr crash.Individual) bool

func (Backend) Crashes

func (b Backend) Crashes() db.CrashTable

func (Backend) Extension

func (b Backend) Extension(req *stupid.Request) bool

func (Backend) GetDie

func (b Backend) GetDie(req *stupid.Request) bool

func (Backend) Logs

func (b Backend) Logs() db.LogTable

func (Backend) UploadDie

func (b Backend) UploadDie(req *stupid.Request) bool

type UploadedDie

type UploadedDie struct {
	Die        map[string]any `json:"die" bson:"die"`
	ID         string         `json:"id" bson:"_id"`
	Expiration int64          `json:"expiration" bson:"expiration"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL