Browse Source

fix: Add secret to all webhook's payload where it has been missing (#5199)

* fix: Add secret to all webhook's payload where it has been missing

affects webhooks for:
* Delete
* Fork
* IssueComment
* Release
tags/v1.7.0-dev
Peter Hoffmann 5 years ago
parent
commit
fb14458010

+ 2
- 2
Gopkg.lock View File



[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:5e7f14543006a44047fb1d0df16da08b2ebc2428f1fd53bd8af26a2b34928b11"
digest = "1:bf4f822f636b99ac7d4f8fa5210a7439bacaf8d1f15d5783956bdd5dd2069bdc"
name = "code.gitea.io/sdk" name = "code.gitea.io/sdk"
packages = ["gitea"] packages = ["gitea"]
pruneopts = "NUT" pruneopts = "NUT"
revision = "021567c9c12fe289b8980c34e81e6684434dd082"
revision = "11c860c8e49a23be26e6d6c6a039a46ad2ae1d27"


[[projects]] [[projects]]
digest = "1:3fcef06a1a6561955c94af6c7757a6fa37605eb653f0d06ab960e5bb80092195" digest = "1:3fcef06a1a6561955c94af6c7757a6fa37605eb653f0d06ab960e5bb80092195"

+ 27
- 0
templates/swagger/v1_json.tmpl View File

"format": "date-time", "format": "date-time",
"x-go-name": "Created" "x-go-name": "Created"
}, },
"fingerprint": {
"type": "string",
"x-go-name": "Fingerprint"
},
"id": { "id": {
"type": "integer", "type": "integer",
"format": "int64", "format": "int64",
"type": "string", "type": "string",
"x-go-name": "Key" "x-go-name": "Key"
}, },
"key_id": {
"type": "integer",
"format": "int64",
"x-go-name": "KeyID"
},
"read_only": { "read_only": {
"type": "boolean", "type": "boolean",
"x-go-name": "ReadOnly" "x-go-name": "ReadOnly"
}, },
"repository": {
"$ref": "#/definitions/Repository"
},
"title": { "title": {
"type": "string", "type": "string",
"x-go-name": "Title" "x-go-name": "Title"
"type": "string", "type": "string",
"x-go-name": "Key" "x-go-name": "Key"
}, },
"key_type": {
"type": "string",
"x-go-name": "KeyType"
},
"read_only": {
"type": "boolean",
"x-go-name": "ReadOnly"
},
"title": { "title": {
"type": "string", "type": "string",
"x-go-name": "Title" "x-go-name": "Title"
"url": { "url": {
"type": "string", "type": "string",
"x-go-name": "URL" "x-go-name": "URL"
},
"user": {
"$ref": "#/definitions/User"
} }
}, },
"x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea"
"description": "Repository represents a repository", "description": "Repository represents a repository",
"type": "object", "type": "object",
"properties": { "properties": {
"archived": {
"type": "boolean",
"x-go-name": "Archived"
},
"clone_url": { "clone_url": {
"type": "string", "type": "string",
"x-go-name": "CloneURL" "x-go-name": "CloneURL"

+ 11
- 11
vendor/code.gitea.io/sdk/gitea/admin_user.go View File

FullName string `json:"full_name" binding:"MaxSize(100)"` FullName string `json:"full_name" binding:"MaxSize(100)"`
// required: true // required: true
// swagger:strfmt email // swagger:strfmt email
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
Password string `json:"password" binding:"MaxSize(255)"`
Website string `json:"website" binding:"MaxSize(50)"`
Location string `json:"location" binding:"MaxSize(50)"`
Active *bool `json:"active"`
Admin *bool `json:"admin"`
AllowGitHook *bool `json:"allow_git_hook"`
AllowImportLocal *bool `json:"allow_import_local"`
MaxRepoCreation *int `json:"max_repo_creation"`
ProhibitLogin *bool `json:"prohibit_login"`
AllowCreateOrganization *bool `json:"allow_create_organization"`
Email string `json:"email" binding:"Required;Email;MaxSize(254)"`
Password string `json:"password" binding:"MaxSize(255)"`
Website string `json:"website" binding:"MaxSize(50)"`
Location string `json:"location" binding:"MaxSize(50)"`
Active *bool `json:"active"`
Admin *bool `json:"admin"`
AllowGitHook *bool `json:"allow_git_hook"`
AllowImportLocal *bool `json:"allow_import_local"`
MaxRepoCreation *int `json:"max_repo_creation"`
ProhibitLogin *bool `json:"prohibit_login"`
AllowCreateOrganization *bool `json:"allow_create_organization"`
} }


// AdminEditUser modify user informations // AdminEditUser modify user informations

+ 15
- 7
vendor/code.gitea.io/sdk/gitea/hook.go View File

Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret FIXME
// SetSecret modifies the secret of the CreatePayload
func (p *CreatePayload) SetSecret(secret string) { func (p *CreatePayload) SetSecret(secret string) {
p.Secret = secret p.Secret = secret
} }


// DeletePayload represents delete payload // DeletePayload represents delete payload
type DeletePayload struct { type DeletePayload struct {
Secret string `json:"secret"`
Ref string `json:"ref"` Ref string `json:"ref"`
RefType string `json:"ref_type"` RefType string `json:"ref_type"`
PusherType PusherType `json:"pusher_type"` PusherType PusherType `json:"pusher_type"`
Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret implements Payload
// SetSecret modifies the secret of the DeletePayload
func (p *DeletePayload) SetSecret(secret string) { func (p *DeletePayload) SetSecret(secret string) {
p.Secret = secret
} }


// JSONPayload implements Payload // JSONPayload implements Payload


// ForkPayload represents fork payload // ForkPayload represents fork payload
type ForkPayload struct { type ForkPayload struct {
Secret string `json:"secret"`
Forkee *Repository `json:"forkee"` Forkee *Repository `json:"forkee"`
Repo *Repository `json:"repository"` Repo *Repository `json:"repository"`
Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret implements Payload
// SetSecret modifies the secret of the ForkPayload
func (p *ForkPayload) SetSecret(secret string) { func (p *ForkPayload) SetSecret(secret string) {
p.Secret = secret
} }


// JSONPayload implements Payload // JSONPayload implements Payload


// IssueCommentPayload represents a payload information of issue comment event. // IssueCommentPayload represents a payload information of issue comment event.
type IssueCommentPayload struct { type IssueCommentPayload struct {
Secret string `json:"secret"`
Action HookIssueCommentAction `json:"action"` Action HookIssueCommentAction `json:"action"`
Issue *Issue `json:"issue"` Issue *Issue `json:"issue"`
Comment *Comment `json:"comment"` Comment *Comment `json:"comment"`
Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret implements Payload
// SetSecret modifies the secret of the IssueCommentPayload
func (p *IssueCommentPayload) SetSecret(secret string) { func (p *IssueCommentPayload) SetSecret(secret string) {
p.Secret = secret
} }


// JSONPayload implements Payload // JSONPayload implements Payload


// ReleasePayload represents a payload information of release event. // ReleasePayload represents a payload information of release event.
type ReleasePayload struct { type ReleasePayload struct {
Secret string `json:"secret"`
Action HookReleaseAction `json:"action"` Action HookReleaseAction `json:"action"`
Release *Release `json:"release"` Release *Release `json:"release"`
Repository *Repository `json:"repository"` Repository *Repository `json:"repository"`
Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret implements Payload
// SetSecret modifies the secret of the ReleasePayload
func (p *ReleasePayload) SetSecret(secret string) { func (p *ReleasePayload) SetSecret(secret string) {
p.Secret = secret
} }


// JSONPayload implements Payload // JSONPayload implements Payload
Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret FIXME
// SetSecret modifies the secret of the PushPayload
func (p *PushPayload) SetSecret(secret string) { func (p *PushPayload) SetSecret(secret string) {
p.Secret = secret p.Secret = secret
} }
Sender *User `json:"sender"` Sender *User `json:"sender"`
} }


// SetSecret set the payload's secret
// SetSecret modifies the secret of the RepositoryPayload
func (p *RepositoryPayload) SetSecret(secret string) { func (p *RepositoryPayload) SetSecret(secret string) {
p.Secret = secret p.Secret = secret
} }

+ 6
- 0
vendor/code.gitea.io/sdk/gitea/issue.go View File

// swagger:strfmt date-time // swagger:strfmt date-time
Deadline *time.Time `json:"due_date"` Deadline *time.Time `json:"due_date"`
} }

// EditPriorityOption options for updating priority
type EditPriorityOption struct {
// required:true
Priority int `json:"priority"`
}

+ 1
- 0
vendor/code.gitea.io/sdk/gitea/repo.go View File

Watchers int `json:"watchers_count"` Watchers int `json:"watchers_count"`
OpenIssues int `json:"open_issues_count"` OpenIssues int `json:"open_issues_count"`
DefaultBranch string `json:"default_branch"` DefaultBranch string `json:"default_branch"`
Archived bool `json:"archived"`
// swagger:strfmt date-time // swagger:strfmt date-time
Created time.Time `json:"created_at"` Created time.Time `json:"created_at"`
// swagger:strfmt date-time // swagger:strfmt date-time

+ 9
- 6
vendor/code.gitea.io/sdk/gitea/repo_key.go View File



// DeployKey a deploy key // DeployKey a deploy key
type DeployKey struct { type DeployKey struct {
ID int64 `json:"id"`
Key string `json:"key"`
URL string `json:"url"`
Title string `json:"title"`
ID int64 `json:"id"`
KeyID int64 `json:"key_id"`
Key string `json:"key"`
URL string `json:"url"`
Title string `json:"title"`
Fingerprint string `json:"fingerprint"`
// swagger:strfmt date-time // swagger:strfmt date-time
Created time.Time `json:"created_at"`
ReadOnly bool `json:"read_only"`
Created time.Time `json:"created_at"`
ReadOnly bool `json:"read_only"`
Repository *Repository `json:"repository,omitempty"`
} }


// ListDeployKeys list all the deploy keys of one repository // ListDeployKeys list all the deploy keys of one repository

+ 4
- 1
vendor/code.gitea.io/sdk/gitea/user_key.go View File

Title string `json:"title,omitempty"` Title string `json:"title,omitempty"`
Fingerprint string `json:"fingerprint,omitempty"` Fingerprint string `json:"fingerprint,omitempty"`
// swagger:strfmt date-time // swagger:strfmt date-time
Created time.Time `json:"created_at,omitempty"`
Created time.Time `json:"created_at,omitempty"`
Owner *User `json:"user,omitempty"`
ReadOnly bool `json:"read_only,omitempty"`
KeyType string `json:"key_type,omitempty"`
} }


// ListPublicKeys list all the public keys of the user // ListPublicKeys list all the public keys of the user

Loading…
Cancel
Save