web

package
v1.148.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: AGPL-3.0 Imports: 42 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const AccesTokenIsDev = "yes they're a dev"
View Source
const DarkstatHttpSock = "/tmp/darkstat/http.sock"
View Source
const URLPing core_types.Url = "GET /ping"
View Source
const UrlStatic core_types.Url = "/"

Variables

View Source
var DiscoOauthSiteUrl = "https://discoverygc.com"
View Source
var (
	Log = logus.Log.WithScope("web")
)
View Source
var UrlGeneralizer *regexp.Regexp = regexy.InitRegex(`-[\w0-9]*`)

Functions

func AuthMiddleware

func AuthMiddleware(next http.Handler) http.Handler

func CorsMiddleware

func CorsMiddleware(next http.Handler) http.Handler

func IsTempusValid

func IsTempusValid(encrypted string, logger *typelog.Logger) bool

func NewEndpointPing

func NewEndpointPing(w *Web) *registry.Endpoint

ShowAccount godoc @Summary Check Darkstat health @Router /ping [get]

func NewEndpointStatic

func NewEndpointStatic(w *Web) *registry.Endpoint

func NewOauthAccept added in v1.70.0

func NewOauthAccept(w *Web) *registry.Endpoint

for local testing, manually replace incoming incoming redirect to http://localhost:8000

func NewOauthStart added in v1.70.0

func NewOauthStart(w *Web) *registry.Endpoint

func NewTempusToken

func NewTempusToken() string

func Recovery added in v1.85.3

func Recovery(next http.Handler) http.Handler

func RedirectPageRender added in v1.99.2

func RedirectPageRender(msg string, site_url string, wr io.Writer) error

Types

type AuthPermission

type AuthPermission struct {
	ExpirationDate time.Time
	IsValid        bool
}

type Mutex

type Mutex interface {
	Lock()
	Unlock()
	RLock()
	RUnlock()
}

type OauthAnswer added in v1.70.0

type OauthAnswer struct {
	Error       *string `json:"error"`
	AccessToken *string `json:"access_token"`
}

I return either {"error": "nope"} or {"access_token": "yes they're a dev"}

type RedirectArgs added in v1.99.2

type RedirectArgs struct {
	Msg     string
	SiteUrl string
}

type ServerClose added in v1.63.0

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

func (ServerClose) Close added in v1.63.0

func (s ServerClose) Close()

type Web

type Web struct {
	AppDataMutex Mutex
	// contains filtered or unexported fields
}

func NewWeb

func NewWeb(filesystems []*builder.Filesystem, opts ...WebOpt) *Web

func NewWebBasic added in v1.70.4

func NewWebBasic(filesystems []*builder.Filesystem, opts ...WebOpt) *Web

func (*Web) GetMux

func (w *Web) GetMux() *http.ServeMux

func (*Web) Serve

func (w *Web) Serve(opts WebServeOpts) ServerClose

func (*Web) SetNewData added in v1.132.4

func (w *Web) SetNewData(app_data_mutex Mutex, fs []*builder.Filesystem, data *appdata.AppData, mu *sync.RWMutex)

type WebOpt

type WebOpt func(w *Web)

func WithAppData added in v1.72.1

func WithAppData(data *appdata.AppData) WebOpt

func WithCtx added in v1.83.0

func WithCtx(ctx context.Context) WebOpt

func WithMutexableData

func WithMutexableData(app_data_mutex Mutex) WebOpt

func WithSiteRoot

func WithSiteRoot(site_root string) WebOpt

type WebServeOpts

type WebServeOpts struct {
	Port        *int
	SockAddress string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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