common

package
v0.0.0-...-e61ee7f Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

View Source
const RouterMockPointCommonLFS = "common-lfs"

Variables

This section is empty.

Functions

func AddOwnerRepoGitLFSRoutes

func AddOwnerRepoGitLFSRoutes(m *web.Router, middlewares ...any)

func FetchRedirectDelegate

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 ParseAPIDeadlineToEndOfDay

func ParseAPIDeadlineToEndOfDay(t *time.Time) (timeutil.TimeStamp, error)

func ParseDeadlineDateToEndOfDay

func ParseDeadlineDateToEndOfDay(date string) (timeutil.TimeStamp, error)

func ProtocolMiddlewares

func ProtocolMiddlewares() (handlers []any)

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

func RenderMarkup

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

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

func RenderPanicErrorPage

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

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

func ServeContentByReader

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

func Sessioner

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

Types

type AuthResult

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

func AuthShared

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

type CompareInfo

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

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
JackTT - Gopher 🇻🇳