Back to godoc.org

Package widget

v0.0.0-...-018eb3e
Latest Go to latest

The latest major version is .

Published: Feb 20, 2020 | License: Apache-2.0 | Module: github.com/LeKovr/sfs

Overview

Package upload implements image upload handlers.

Index

Constants

const (
	// ErrNoSingleFile returned when does not contain single file in field 'file'
	ErrNoSingleFile = "field 'file' does not contains single item"
)

Variables

var (
	// ErrNoAnyFile returned when request does not contain item in field 'files[]'
	ErrNoAnyFile = errors.New("field 'file' does not contains any item")
	// ErrNoAuth returned on Internal Server Error (no auth for upload)
	ErrNoAuth = errors.New("This endpoint must be under AuthRequired")
)

type Config

type Config struct {
	CookieName   string `long:"cookie" default:"sfs_auth" description:"Auth cookie name"`
	HeaderName   string `long:"header" default:"X-SFS-Auth" description:"Auth header name"`
	CookieMaxAge int    `long:"cookie_ttl" default:"36000" description:"Auth cookie TTL"`
}

Config holds all config vars

type PageEvent

type PageEvent struct {
	RequestID string
	Layout    string
}

type Service

type Service struct {
	Config              *Config
	Log                 *log.SugaredLogger
	ContextKey          string
	ContextRequestIDKey string
	// contains filtered or unexported fields
}

Service holds upload service

func New

func New(cfg Config, logger *log.SugaredLogger, ps *pubsub.Service, key, idKey string) *Service

New creates an Service object

func (Service) HandlersClose

func (srv Service) HandlersClose()

func (Service) HandlersRun

func (srv Service) HandlersRun()

func (Service) RequestID

func (srv Service) RequestID() func(c *gin.Context)

AuthRequired is a simple middleware to check the session

func (Service) SetupRouter

func (srv Service) SetupRouter(r *gin.Engine)

func (Service) WidgetJS

func (srv Service) WidgetJS() func(c *gin.Context)

type WidgetEvent

type WidgetEvent struct {
	Type string `json:"type"`
	ID   string `json:"id"`
	Data string `json:"data"`
}

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier