Documentation
¶
Index ¶
- Constants
- func AddOwnerRepoGitLFSRoutes(m *web.Router, middlewares ...any)
- func BlockExpensive() func(next http.Handler) http.Handler
- func ChiRoutePathHandler() func(h http.Handler) http.Handler
- func DownloadActionsRunJobLogs(ctx *context.Base, ctxRepo *repo_model.Repository, ...) error
- func DownloadActionsRunJobLogsWithID(ctx *context.Base, ctxRepo *repo_model.Repository, runID, jobID int64) error
- func FetchRedirectDelegate(resp http.ResponseWriter, req *http.Request)
- func FindHeadRepo(ctx context.Context, baseRepo *repo_model.Repository, headUserID int64) (*repo_model.Repository, error)
- func ForwardedHeadersHandler(limit int, trustedProxies []string) func(h http.Handler) http.Handler
- func GetHeadOwnerAndRepo(ctx context.Context, baseRepo *repo_model.Repository, ...) (headOwner *user_model.User, headRepo *repo_model.Repository, err error)
- func InitDBEngine(ctx context.Context) (err error)
- func MaintenanceModeHandler() func(h http.Handler) http.Handler
- func MustInitSessioner() func(next http.Handler) http.Handler
- func PageGlobalData(ctx *context.Context)
- func ParseAPIDeadlineToEndOfDay(t *time.Time) (timeutil.TimeStamp, error)
- func ParseDeadlineDateToEndOfDay(date string) (timeutil.TimeStamp, error)
- func ParseIssueFilterStateIsClosed(state string) optional.Option[bool]
- func ParseIssueFilterTypeIsPull(typ string) optional.Option[bool]
- func PrepareCodeSearch(ctx *context.Context) (ret struct{ ... })
- func ProtocolMiddlewares() (handlers []any)
- func QoS() func(next http.Handler) http.Handler
- func RenderMarkup(ctx *context.Base, ctxRepo *context.Repository, ...)
- func RequestContextHandler() func(h http.Handler) http.Handler
- func ServeBlob(ctx *context.Base, repo *repo_model.Repository, filePath string, ...) error
- type AuthResult
- type CompareRouterReq
- type Priority
- type StopwatchTmplInfo
- type VerifyOptions
Constants ¶
const ( LowPriority = Priority(-10) DefaultPriority = Priority(0) HighPriority = Priority(10) )
const RouterMockPointCommonLFS = "common-lfs"
Variables ¶
This section is empty.
Functions ¶
func AddOwnerRepoGitLFSRoutes ¶ added in v1.23.0
func ChiRoutePathHandler ¶ added in v1.24.0
func DownloadActionsRunJobLogs ¶ added in v1.24.0
func DownloadActionsRunJobLogs(ctx *context.Base, ctxRepo *repo_model.Repository, curJob *actions_model.ActionRunJob) error
func DownloadActionsRunJobLogsWithID ¶ added in v1.26.0
func DownloadActionsRunJobLogsWithID(ctx *context.Base, ctxRepo *repo_model.Repository, runID, jobID 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 FindHeadRepo ¶ added in v1.25.3
func FindHeadRepo(ctx context.Context, baseRepo *repo_model.Repository, headUserID int64) (*repo_model.Repository, error)
FindHeadRepo tries to find the head repository based on the base repository and head user ID.
func ForwardedHeadersHandler ¶ added in v1.24.0
func GetHeadOwnerAndRepo ¶ added in v1.26.0
func GetHeadOwnerAndRepo(ctx context.Context, baseRepo *repo_model.Repository, compareReq *CompareRouterReq) (headOwner *user_model.User, headRepo *repo_model.Repository, err error)
func InitDBEngine ¶
InitDBEngine In case of problems connecting to DB, retry connection. Eg, PGSQL in Docker Container on Synology
func MaintenanceModeHandler ¶ added in v1.26.0
func MustInitSessioner ¶ added in v1.26.0
func PageGlobalData ¶ added in v1.25.0
func ParseAPIDeadlineToEndOfDay ¶ added in v1.23.0
func ParseDeadlineDateToEndOfDay ¶ added in v1.23.0
func ParseIssueFilterStateIsClosed ¶ added in v1.26.0
func ParseIssueFilterTypeIsPull ¶ added in v1.26.0
func PrepareCodeSearch ¶ added in v1.23.0
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
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 RequestContextHandler ¶ added in v1.24.0
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 CompareRouterReq ¶ added in v1.26.0
type CompareRouterReq struct {
BaseOriRef string
BaseOriRefSuffix string
CompareSeparator string
HeadOwner string
HeadRepoName string
HeadOriRef string
}
func ParseCompareRouterParam ¶ added in v1.26.0
func ParseCompareRouterParam(routerParam string) *CompareRouterReq
ParseCompareRouterParam Get compare information from the router parameter. A full compare url is of the form:
0. /{:baseOwner}/{:baseRepoName}/compare 1. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headBranch} 2. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headOwner}:{:headBranch} 3. /{:baseOwner}/{:baseRepoName}/compare/{:baseBranch}...{:headOwner}/{:headRepoName}:{:headBranch} 4. /{:baseOwner}/{:baseRepoName}/compare/{:headBranch} 5. /{:baseOwner}/{:baseRepoName}/compare/{:headOwner}:{:headBranch} 6. /{:baseOwner}/{:baseRepoName}/compare/{:headOwner}/{:headRepoName}:{:headBranch}
Here we obtain the infoPath "{:baseBranch}...[{:headOwner}/{:headRepoName}:]{:headBranch}" as ctx.PathParam("*") with the :baseRepo in ctx.Repo.
Note: Generally :headRepoName is not provided here - we are only passed :headOwner.
How do we determine the :headRepo?
1. If :headOwner is not set then the :headRepo = :baseRepo 2. If :headOwner is set - then look for the fork of :baseRepo owned by :headOwner 3. But... :baseRepo could be a fork of :headOwner's repo - so check that 4. Now, :baseRepo and :headRepos could be forks of the same repo - so check that
format: <base branch>...[<head repo>:]<head branch> base<-head: master...head:feature same repo: master...feature
func (*CompareRouterReq) DirectComparison ¶ added in v1.26.0
func (cr *CompareRouterReq) DirectComparison() bool
type StopwatchTmplInfo ¶ added in v1.24.0
StopwatchTmplInfo is a view on a stopwatch specifically for template rendering