forked from Gitlink/gitea-1120-rc1
fix: add wiki_clone_link
This commit is contained in:
parent
7a98e1ad9a
commit
2d5a3202bd
|
@ -6,16 +6,15 @@
|
|||
*/
|
||||
package structs
|
||||
|
||||
import "code.gitea.io/gitea/modules/git"
|
||||
|
||||
type WikiesResponse struct {
|
||||
type WikiesResponse struct {
|
||||
WikiMeta
|
||||
WikiCloneLink CloneLink `json:"wiki_clone_link"`
|
||||
}
|
||||
|
||||
type WikiMeta struct {
|
||||
Name string `json:"name"`
|
||||
Commit WikiCommit `json:"commit"`
|
||||
WikiRepo *git.Repository `json:"wiki_repo"`
|
||||
//WikiCloneLink CloneLink `json:"wiki_clone_link"`
|
||||
}
|
||||
|
||||
type WikiCommit struct {
|
||||
|
@ -42,3 +41,7 @@ type WikiOption struct {
|
|||
Content string `json:"content"`
|
||||
CommitMessage string `json:"commit_message"`
|
||||
}
|
||||
type CloneLink struct {
|
||||
SSH string `json:"ssh"`
|
||||
HTTPS string `json:"https"`
|
||||
}
|
||||
|
|
|
@ -35,6 +35,9 @@ func WikiList(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/WikiList"
|
||||
|
||||
repository := ctx.Repo.Repository
|
||||
wikiCloneLink := repository.WikiCloneLink()
|
||||
|
||||
wikiRepo, commit, err := wikies.FindWikiRepoCommit(ctx)
|
||||
if err != nil {
|
||||
if wikiRepo != nil {
|
||||
|
@ -80,9 +83,12 @@ func WikiList(ctx *context.APIContext) {
|
|||
return
|
||||
}
|
||||
wikies = append(wikies, api.WikiesResponse{
|
||||
WikiCloneLink: api.CloneLink{
|
||||
HTTPS: wikiCloneLink.HTTPS,
|
||||
SSH: wikiCloneLink.SSH,
|
||||
},
|
||||
WikiMeta: api.WikiMeta{
|
||||
Name: wikiName,
|
||||
WikiRepo: wikiRepo,
|
||||
Commit: api.WikiCommit{
|
||||
Author: api.WikiUser{
|
||||
Name: c.Author.Name,
|
||||
|
@ -130,9 +136,6 @@ func GetWiki(ctx *context.APIContext) {
|
|||
// "200":
|
||||
// "$ref": "#/responses/Wiki"
|
||||
|
||||
|
||||
|
||||
|
||||
wikiRepo, commit, _ := wikies.FindWikiRepoCommit(ctx)
|
||||
|
||||
pageName := wiki_service.NormalizeWikiName(ctx.Params(":page"))
|
||||
|
@ -162,7 +165,6 @@ func GetWiki(ctx *context.APIContext) {
|
|||
wiki := api.WikiResponse{
|
||||
WikiMeta: api.WikiMeta{
|
||||
Name: pageName,
|
||||
WikiRepo: wikiRepo,
|
||||
Commit: api.WikiCommit{
|
||||
Author: api.WikiUser{
|
||||
Name: c.Author.Name,
|
||||
|
@ -235,7 +237,7 @@ func CreateWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
wiki := api.WikiResponse{
|
||||
WikiMeta: api.WikiMeta{
|
||||
Name: form.Name,
|
||||
WikiRepo: wikiRepo,
|
||||
|
||||
Commit: api.WikiCommit{
|
||||
Author: api.WikiUser{
|
||||
Name: c.Author.Name,
|
||||
|
@ -319,7 +321,6 @@ func EditWiki(ctx *context.APIContext, form api.WikiOption) {
|
|||
wiki := api.WikiResponse{
|
||||
WikiMeta: api.WikiMeta{
|
||||
Name: form.Name,
|
||||
WikiRepo: wikiRepo,
|
||||
Commit: api.WikiCommit{
|
||||
Author: api.WikiUser{
|
||||
Name: c.Author.Name,
|
||||
|
|
|
@ -8965,7 +8965,7 @@
|
|||
}
|
||||
],
|
||||
"responses": {
|
||||
"201": {
|
||||
"200": {
|
||||
"$ref": "#/responses/Wiki"
|
||||
}
|
||||
}
|
||||
|
@ -9046,7 +9046,7 @@
|
|||
"204": {
|
||||
"$ref": "#/responses/empty"
|
||||
},
|
||||
"404": {
|
||||
"500": {
|
||||
"$ref": "#/responses/notFound"
|
||||
}
|
||||
}
|
||||
|
@ -11464,6 +11464,20 @@
|
|||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"CloneLink": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"https": {
|
||||
"type": "string",
|
||||
"x-go-name": "HTTPS"
|
||||
},
|
||||
"ssh": {
|
||||
"type": "string",
|
||||
"x-go-name": "SSH"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
},
|
||||
"Comment": {
|
||||
"description": "Comment represents a comment on a commit or issue",
|
||||
"type": "object",
|
||||
|
@ -15574,6 +15588,9 @@
|
|||
"name": {
|
||||
"type": "string",
|
||||
"x-go-name": "Name"
|
||||
},
|
||||
"wiki_clone_link": {
|
||||
"$ref": "#/definitions/CloneLink"
|
||||
}
|
||||
},
|
||||
"x-go-package": "code.gitea.io/gitea/modules/structs"
|
||||
|
|
Loading…
Reference in New Issue