Documentation ¶
Index ¶
- Constants
- func AuthorizedPublicKeyByContent(ctx context.Context, content string) (*ResponseText, ResponseExtra)
- func GenerateActionsRunnerToken(ctx context.Context, scope string) (*ResponseText, ResponseExtra)
- func HookPostReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) (*HookPostReceiveResult, ResponseExtra)
- func HookProcReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) (*HookProcReceiveResult, ResponseExtra)
- func SSHLog(ctx context.Context, isErr bool, msg string) error
- func SendEmail(ctx context.Context, subject, message string, to []string) (*ResponseText, ResponseExtra)
- func ServCommand(ctx context.Context, keyID int64, ownerName, repoName string, ...) (*ServCommandResults, ResponseExtra)
- func ServNoCommand(ctx context.Context, keyID int64) (*asymkey_model.PublicKey, *user_model.User, error)
- func UpdatePublicKeyInRepo(ctx context.Context, keyID, repoID int64) error
- type Email
- type FlushOptions
- type GenerateTokenRequest
- type GitPushOptions
- type HookOptions
- type HookPostReceiveBranchResult
- type HookPostReceiveResult
- type HookProcReceiveRefResult
- type HookProcReceiveResult
- type KeyAndOwner
- type LoggerOptions
- type Response
- type ResponseExtra
- func AddLogger(ctx context.Context, logger, writer, mode string, config map[string]any) ResponseExtra
- func FlushQueues(ctx context.Context, timeout time.Duration, nonBlocking bool) ResponseExtra
- func HookPreReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) ResponseExtra
- func PauseLogging(ctx context.Context) ResponseExtra
- func Processes(ctx context.Context, out io.Writer, flat, noSystem, stacktraces, json bool, ...) ResponseExtra
- func ReleaseReopenLogging(ctx context.Context) ResponseExtra
- func ReloadTemplates(ctx context.Context) ResponseExtra
- func RemoveLogger(ctx context.Context, logger, writer string) ResponseExtra
- func Restart(ctx context.Context) ResponseExtra
- func RestoreRepo(ctx context.Context, repoDir, ownerName, repoName string, units []string, ...) ResponseExtra
- func ResumeLogging(ctx context.Context) ResponseExtra
- func SetDefaultBranch(ctx context.Context, ownerName, repoName, branch string) ResponseExtra
- func SetLogSQL(ctx context.Context, on bool) ResponseExtra
- func Shutdown(ctx context.Context) ResponseExtra
- type ResponseText
- type RestoreParams
- type SSHLogOption
- type ServCommandResults
Constants ¶
const ( GitAlternativeObjectDirectories = "GIT_ALTERNATE_OBJECT_DIRECTORIES" GitObjectDirectory = "GIT_OBJECT_DIRECTORY" GitQuarantinePath = "GIT_QUARANTINE_PATH" GitPushOptionCount = "GIT_PUSH_OPTION_COUNT" )
Git environment variables
const ( GitPushOptionRepoPrivate = "repo.private" GitPushOptionRepoTemplate = "repo.template" GitPushOptionForcePush = "force-push" )
GitPushOptions keys
Variables ¶
This section is empty.
Functions ¶
func AuthorizedPublicKeyByContent ¶
func AuthorizedPublicKeyByContent(ctx context.Context, content string) (*ResponseText, ResponseExtra)
AuthorizedPublicKeyByContent searches content as prefix (leak e-mail part) and returns public key found.
func GenerateActionsRunnerToken ¶
func GenerateActionsRunnerToken(ctx context.Context, scope string) (*ResponseText, ResponseExtra)
GenerateActionsRunnerToken calls the internal GenerateActionsRunnerToken function
func HookPostReceive ¶
func HookPostReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) (*HookPostReceiveResult, ResponseExtra)
HookPostReceive updates services and users
func HookProcReceive ¶
func HookProcReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) (*HookProcReceiveResult, ResponseExtra)
HookProcReceive proc-receive hook
func SendEmail ¶
func SendEmail(ctx context.Context, subject, message string, to []string) (*ResponseText, ResponseExtra)
SendEmail calls the internal SendEmail function It accepts a list of usernames. If DB contains these users it will send the email to them. If to list == nil, it's supposed to send emails to every user present in DB
func ServCommand ¶
func ServCommand(ctx context.Context, keyID int64, ownerName, repoName string, mode perm.AccessMode, verbs ...string) (*ServCommandResults, ResponseExtra)
ServCommand preps for a serv call
func ServNoCommand ¶
func ServNoCommand(ctx context.Context, keyID int64) (*asymkey_model.PublicKey, *user_model.User, error)
ServNoCommand returns information about the provided key
Types ¶
type FlushOptions ¶
FlushOptions represents the options for the flush call
type GenerateTokenRequest ¶
type GenerateTokenRequest struct {
Scope string
}
type GitPushOptions ¶
GitPushOptions is a wrapper around a map[string]string
func (GitPushOptions) AddFromKeyValue ¶
func (g GitPushOptions) AddFromKeyValue(line string)
AddFromKeyValue adds a key value pair to the map by "key=value" format or "key" for empty value
type HookOptions ¶
type HookOptions struct { OldCommitIDs []string NewCommitIDs []string RefFullNames []git.RefName UserID int64 UserName string GitObjectDirectory string GitAlternativeObjectDirectories string GitQuarantinePath string GitPushOptions GitPushOptions PullRequestID int64 PushTrigger repository.PushTrigger DeployKeyID int64 // if the pusher is a DeployKey, then UserID is the repo's org user. IsWiki bool ActionPerm int }
HookOptions represents the options for the Hook calls
type HookPostReceiveBranchResult ¶
HookPostReceiveBranchResult represents an individual branch result from PostReceive
type HookPostReceiveResult ¶
type HookPostReceiveResult struct { Results []HookPostReceiveBranchResult RepoWasEmpty bool Err string }
HookPostReceiveResult represents an individual result from PostReceive
type HookProcReceiveRefResult ¶
type HookProcReceiveRefResult struct { OldOID string NewOID string Ref string OriginalRef git.RefName IsForcePush bool IsNotMatched bool Err string IsCreatePR bool URL string ShouldShowMessage bool HeadBranch string }
HookProcReceiveRefResult represents an individual result from ProcReceive
type HookProcReceiveResult ¶
type HookProcReceiveResult struct { Results []HookProcReceiveRefResult Err string }
HookProcReceiveResult represents an individual result from ProcReceive
type KeyAndOwner ¶
type KeyAndOwner struct { Key *asymkey_model.PublicKey `json:"key"` Owner *user_model.User `json:"user"` }
KeyAndOwner is the response from ServNoCommand
type LoggerOptions ¶
LoggerOptions represents the options for the add logger call
type Response ¶
type Response struct { Err string `json:"err,omitempty"` // server-side error log message, it won't be exposed to end users UserMsg string `json:"user_msg,omitempty"` // meaningful error message for end users, it will be shown in git client's output. }
Response is used for internal request response (for user message and error message)
type ResponseExtra ¶
ResponseExtra contains extra information about the response, especially for error responses.
func AddLogger ¶
func AddLogger(ctx context.Context, logger, writer, mode string, config map[string]any) ResponseExtra
AddLogger adds a logger
func FlushQueues ¶
FlushQueues calls the internal flush-queues function
func HookPreReceive ¶
func HookPreReceive(ctx context.Context, ownerName, repoName string, opts HookOptions) ResponseExtra
HookPreReceive check whether the provided commits are allowed
func PauseLogging ¶
func PauseLogging(ctx context.Context) ResponseExtra
PauseLogging pauses logging
func Processes ¶
func Processes(ctx context.Context, out io.Writer, flat, noSystem, stacktraces, json bool, cancel string) ResponseExtra
Processes return the current processes from this gitea instance
func ReleaseReopenLogging ¶
func ReleaseReopenLogging(ctx context.Context) ResponseExtra
ReleaseReopenLogging releases and reopens logging files
func ReloadTemplates ¶
func ReloadTemplates(ctx context.Context) ResponseExtra
ReloadTemplates calls the internal reload-templates function
func RemoveLogger ¶
func RemoveLogger(ctx context.Context, logger, writer string) ResponseExtra
RemoveLogger removes a logger
func Restart ¶
func Restart(ctx context.Context) ResponseExtra
Restart calls the internal restart function
func RestoreRepo ¶
func RestoreRepo(ctx context.Context, repoDir, ownerName, repoName string, units []string, validation bool) ResponseExtra
RestoreRepo calls the internal RestoreRepo function
func ResumeLogging ¶
func ResumeLogging(ctx context.Context) ResponseExtra
ResumeLogging resumes logging
func SetDefaultBranch ¶
func SetDefaultBranch(ctx context.Context, ownerName, repoName, branch string) ResponseExtra
SetDefaultBranch will set the default branch to the provided branch for the provided repository
func SetLogSQL ¶
func SetLogSQL(ctx context.Context, on bool) ResponseExtra
SetLogSQL sets database logging
func Shutdown ¶
func Shutdown(ctx context.Context) ResponseExtra
Shutdown calls the internal shutdown function
func (*ResponseExtra) HasError ¶
func (re *ResponseExtra) HasError() bool
type ResponseText ¶
type ResponseText struct {
Text string
}
ResponseText is used to get the response as text, instead of parsing it as JSON.
type RestoreParams ¶
type RestoreParams struct { RepoDir string OwnerName string RepoName string Units []string Validation bool }
RestoreParams structure holds a data for restore repository
type SSHLogOption ¶
SSHLogOption ssh log options
type ServCommandResults ¶
type ServCommandResults struct { IsWiki bool DeployKeyID int64 KeyID int64 // public key KeyName string // this field is ambiguous, it can be the name of DeployKey, or the name of the PublicKey UserName string UserEmail string UserID int64 OwnerName string RepoName string RepoID int64 }
ServCommandResults are the results of a call to the private route serv