stulbe

package module
v0.6.3 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2022 License: AGPL-3.0 Imports: 21 Imported by: 0

README

stulbe - strimertul backend

Back-end portion of strimertul for features that require one:

  • KV sync for remote applications
  • User-facing loyalty points info (redeem APIs not available yet sorry!)
  • Webhook subscription for alerts

Platform support is limited to Twitch only for the time being (sorry!)

Getting started

Docker image

A prebuilt docker image is available in Docker Hub at strimertul/stulbe.

Pre-build binaries

You can find pre-build binaries for Windows and Linux in our Release section.

Building manually

You can build the app like any other Go project:

go build
Starting stulbe

To start stulbe succesfully you will have to configure the following environment variables:

TWITCH_CLIENT_ID=Twitch client ID
TWITCH_CLIENT_SECRET=Twitch client secret
TWITCH_WEBHOOK_SECRET=some random secret string
REDIRECT_URI=https://redirect.uri.for.auth/oauth
WEBHOOK_URI=https://webhook.uri.for.twitch.alerts/webhook

To obtain the Twitch client credentials, create an Application in the Twitch dev console, make sure to set the REDIRECT_URI to a reacheable URL and to make sure it's in the "OAuth Redirect URLs" section of the application!

License

The entire project is licensed under AGPL-3.0-only (see LICENSE).

FAQ

How do I use it?

Swagger or whatever docs coming soon, meanwhile look at this Go client.

Does this scale?

lol no it uses a single-writer on-disk KV store

Make it scale then!

The aim of the strimertul suite is to be lean and hackable. Making a distributed cloud-native <more devop buzzwords here> thingamajig is way out of scope.

I don't know realistically how much load this system can take, but I highly suggest looking elsewhere if you think your scale could be an issue. If you made/know a FOSS tool like this that scales, let me know!

Where's the API docs?

Soon™

Gib awoos

Here you go

Documentation

Index

Constants

View Source
const MAX_ARCHIVE = 100

Variables

This section is empty.

Functions

func Cors added in v0.5.0

func Cors(next http.Handler) http.Handler

Types

type APIError

type APIError struct {
	Ok    bool   `json:"ok"`
	Error string `json:"error"`
}

type AuthResponse added in v0.5.0

type AuthResponse struct {
	AccessToken  string   `json:"access_token"`
	RefreshToken string   `json:"refresh_token"`
	TokenType    string   `json:"token_type"`
	ExpiresIn    int      `json:"expires_in"`
	Scope        []string `json:"scope"`
	Time         time.Time
}

type Backend added in v0.5.0

type Backend struct {
	Hub    *kv.Hub
	DB     *database.DBModule
	Auth   *auth.Storage
	Log    *zap.Logger
	Client *helix.Client
	// contains filtered or unexported fields
}

func NewBackend added in v0.5.0

func NewBackend(hub *kv.Hub, db *database.DBModule, authStore *auth.Storage, config BackendConfig, log *zap.Logger) (*Backend, error)

func (*Backend) BindRoutes added in v0.5.0

func (b *Backend) BindRoutes() *mux.Router

func (*Backend) ClearSubscriptions added in v0.6.2

func (b *Backend) ClearSubscriptions(user string) (int, error)

func (*Backend) GetChannelByID added in v0.5.0

func (b *Backend) GetChannelByID(channelid string) (string, error)

func (*Backend) GetUserByID added in v0.5.0

func (b *Backend) GetUserByID(userid string) (helix.User, error)

func (*Backend) RunHTTPServer added in v0.5.0

func (b *Backend) RunHTTPServer(bind string) error

type BackendConfig added in v0.5.0

type BackendConfig struct {
	WebhookURL    string
	RedirectURL   string
	WebhookSecret string
	Twitch        *helix.Options
}

type RefreshResponse added in v0.5.0

type RefreshResponse struct {
	AccessToken  string   `json:"access_token"`
	RefreshToken string   `json:"refresh_token"`
	TokenType    string   `json:"token_type"`
	Scope        []string `json:"scope"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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