web

package
Version: v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2022 License: GPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

func NewHandler

func NewHandler(th *things.Things, tibiaSprPath, tibiaPicPath string) *Handler

NewHandler constructs web handler for the passed things. It also needs access to the .spr and .pic directly.

func (*Handler) RegisterMapRoute

func (h *Handler) RegisterMapRoute(r *mux.Router, mapDataSource gameworld.MapDataSource)

func (*Handler) RegisterRoutes

func (h *Handler) RegisterRoutes(r *mux.Router)

RegisterRoutes registers routes allowing fetching of various images derived from raw data files.

TODO: Rename to RegisterImageRoutes.

func (*Handler) RegisterSubscriptionCreateRoute added in v0.0.5

func (h *Handler) RegisterSubscriptionCreateRoute(r *mux.Router, subscriptionManager *SubscriptionManager)

type Subscriber added in v0.0.5

type Subscriber struct {
	UserEmail string // without mailto:
	Data      webpush.Subscription
	Create    time.Time
	Access    time.Time
}

func (*Subscriber) SendNotification_prototype added in v0.0.5

func (s *Subscriber) SendNotification_prototype(ctx context.Context, body []byte, sm *SubscriptionManager) error

type SubscriptionManager added in v0.0.5

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

func NewSubscriptionManager added in v0.0.5

func NewSubscriptionManager(bundle io.Reader) (*SubscriptionManager, error)

NewSubscriptionManager creates a subscription manager using configuration from the passed io.Reader. If nil, the JSON is not decoded.

The bundle can be created by invoking the subscription manager's Save method.

The io.Reader must be closed by the caller even if this function returns an error.

func (*SubscriptionManager) Save added in v0.0.5

func (sm *SubscriptionManager) Save(bundle io.Writer) error

Save saves the configuration to the passed io.Writer. This includes subscriptions known to the subscription manager.

The io.Writer must be closed by the caller even if this function returns an error.

Jump to

Keyboard shortcuts

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