common

package
v1.22.6 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 32 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FetchRedirectDelegate added in v1.21.0

func FetchRedirectDelegate(resp http.ResponseWriter, req *http.Request)

FetchRedirectDelegate helps the "fetch" requests to redirect to the correct location

func InitDBEngine

func InitDBEngine(ctx context.Context) (err error)

InitDBEngine In case of problems connecting to DB, retry connection. Eg, PGSQL in Docker Container on Synology

func ProtocolMiddlewares added in v1.20.0

func ProtocolMiddlewares() (handlers []any)

ProtocolMiddlewares returns HTTP protocol related middlewares, and it provides a global panic recovery

func RenderMarkup added in v1.20.0

func RenderMarkup(ctx *context.Base, repo *context.Repository, mode, text, urlPathContext, filePath string, wiki bool)

RenderMarkup renders markup text for the /markup and /markdown endpoints

func RenderPanicErrorPage added in v1.20.0

func RenderPanicErrorPage(w http.ResponseWriter, req *http.Request, err any)

RenderPanicErrorPage renders a 500 page, and it never panics

func ServeBlob

func ServeBlob(ctx *context.Base, filePath string, blob *git.Blob, lastModified *time.Time) error

ServeBlob download a git.Blob

func ServeContentByReadSeeker added in v1.20.0

func ServeContentByReadSeeker(ctx *context.Base, filePath string, modTime *time.Time, reader io.ReadSeeker)

func ServeContentByReader added in v1.20.0

func ServeContentByReader(ctx *context.Base, filePath string, size int64, reader io.Reader)

func Sessioner added in v1.20.0

func Sessioner() func(next http.Handler) http.Handler

Types

type AuthResult added in v1.21.0

type AuthResult struct {
	Doer        *user_model.User
	IsBasicAuth bool
}

func AuthShared added in v1.21.0

func AuthShared(ctx *context.Base, sessionStore auth_service.SessionStore, authMethod auth_service.Method) (ar AuthResult, err error)

type CompareInfo added in v1.22.0

type CompareInfo struct {
	HeadUser         *user_model.User
	HeadRepo         *repo_model.Repository
	HeadGitRepo      *git.Repository
	CompareInfo      *git.CompareInfo
	BaseBranch       string
	HeadBranch       string
	DirectComparison bool
}

CompareInfo represents the collected results from ParseCompareInfo

type VerifyOptions added in v1.21.0

type VerifyOptions struct {
	SignInRequired  bool
	SignOutRequired bool
	AdminRequired   bool
	DisableCSRF     bool
}

VerifyOptions contains required or check options

Jump to

Keyboard shortcuts

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