common

package
v1.24.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2025 License: MIT Imports: 47 Imported by: 7

Documentation

Index

Constants

View Source
const (
	LowPriority     = Priority(-10)
	DefaultPriority = Priority(0)
	HighPriority    = Priority(10)
)
View Source
const RouterMockPointCommonLFS = "common-lfs"

Variables

This section is empty.

Functions

func AddOwnerRepoGitLFSRoutes added in v1.23.0

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

func BlockExpensive added in v1.23.7

func BlockExpensive() func(next http.Handler) http.Handler

func ChiRoutePathHandler added in v1.24.0

func ChiRoutePathHandler() func(h http.Handler) http.Handler

func DownloadActionsRunJobLogs added in v1.24.0

func DownloadActionsRunJobLogs(ctx *context.Base, ctxRepo *repo_model.Repository, curJob *actions_model.ActionRunJob) error

func DownloadActionsRunJobLogsWithIndex added in v1.24.0

func DownloadActionsRunJobLogsWithIndex(ctx *context.Base, ctxRepo *repo_model.Repository, runID, jobIndex int64) error

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 ForwardedHeadersHandler added in v1.24.0

func ForwardedHeadersHandler(limit int, trustedProxies []string) func(h http.Handler) http.Handler

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 PageTmplFunctions added in v1.24.0

func PageTmplFunctions(ctx *context.Context)

func ParseAPIDeadlineToEndOfDay added in v1.23.0

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

func ParseDeadlineDateToEndOfDay added in v1.23.0

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

func PrepareCodeSearch added in v1.23.0

func PrepareCodeSearch(ctx *context.Context) (ret struct {
	Keyword    string
	Language   string
	SearchMode indexer.SearchModeType
},
)

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 QoS added in v1.24.0

func QoS() func(next http.Handler) http.Handler

QoS implements quality of service for requests, based upon whether or not the user is logged in. All traffic may get dropped, and anonymous users are deprioritized.

func RenderMarkup added in v1.20.0

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 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 RequestContextHandler added in v1.24.0

func RequestContextHandler() func(h http.Handler) http.Handler

func ServeBlob

func ServeBlob(ctx *context.Base, repo *repo_model.Repository, 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 Priority added in v1.24.0

type Priority int

func (Priority) String added in v1.24.0

func (p Priority) String() string

type StopwatchTmplInfo added in v1.24.0

type StopwatchTmplInfo struct {
	IssueLink  string
	RepoSlug   string
	IssueIndex int64
	Seconds    int64
}

StopwatchTmplInfo is a view on a stopwatch specifically for template rendering

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