cdr

package
v0.0.0-...-cd871c7 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT, MIT Imports: 11 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 CDRBackend

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

func NewBackend

func NewBackend(db *mongo.Database) *CDRBackend

func (*CDRBackend) AddBackend

func (b *CDRBackend) AddBackend(back *backend.Backend)

func (CDRBackend) AppID

func (b CDRBackend) AppID() string

func (CDRBackend) CountTable

func (b CDRBackend) CountTable() backend.CountTable

func (CDRBackend) CrashTable

func (b CDRBackend) CrashTable() backend.CrashTable

func (CDRBackend) Extension

func (b CDRBackend) Extension(mux *http.ServeMux)

func (CDRBackend) GetDie

func (b CDRBackend) GetDie(w http.ResponseWriter, r *http.Request)

func (CDRBackend) ShouldAddCrash

func (s CDRBackend) ShouldAddCrash(ctx context.Context, cr backend.IndividualCrash) bool

func (CDRBackend) UploadDie

func (b CDRBackend) UploadDie(w http.ResponseWriter, r *http.Request)

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