Remove GoGet option from repository and handle it with ?go-get=1 instead
The normal go get protocol is to show the go-import meta tag when ?go-get=1 is appended to the url. This commit implements that behaviour and cleans the go-get option from the repository settings page.
This commit is contained in:
parent
d85366930c
commit
e6fc58a744
|
@ -281,8 +281,6 @@ init_readme = Initialize this repository with a README.md
|
||||||
create_repo = Create Repository
|
create_repo = Create Repository
|
||||||
default_branch = Default Branch
|
default_branch = Default Branch
|
||||||
mirror_interval = Mirror Interval (hour)
|
mirror_interval = Mirror Interval (hour)
|
||||||
goget_meta = Go-Get Meta
|
|
||||||
goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>
|
|
||||||
|
|
||||||
need_auth = Need Authorization
|
need_auth = Need Authorization
|
||||||
migrate_type = Migration Type
|
migrate_type = Migration Type
|
||||||
|
|
|
@ -154,7 +154,6 @@ type Repository struct {
|
||||||
|
|
||||||
IsPrivate bool
|
IsPrivate bool
|
||||||
IsBare bool
|
IsBare bool
|
||||||
IsGoget bool
|
|
||||||
|
|
||||||
IsMirror bool
|
IsMirror bool
|
||||||
*Mirror `xorm:"-"`
|
*Mirror `xorm:"-"`
|
||||||
|
|
|
@ -52,7 +52,6 @@ type RepoSettingForm struct {
|
||||||
Branch string `form:"branch"`
|
Branch string `form:"branch"`
|
||||||
Interval int `form:"interval"`
|
Interval int `form:"interval"`
|
||||||
Private bool `form:"private"`
|
Private bool `form:"private"`
|
||||||
GoGet bool `form:"goget"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
func (f *RepoSettingForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
|
||||||
|
|
|
@ -394,8 +394,7 @@ func RepoAssignment(redirect bool, args ...bool) macaron.Handler {
|
||||||
}
|
}
|
||||||
ctx.Data["CloneLink"] = ctx.Repo.CloneLink
|
ctx.Data["CloneLink"] = ctx.Repo.CloneLink
|
||||||
|
|
||||||
if ctx.Repo.Repository.IsGoget {
|
if ctx.Query("go-get") == "1" {
|
||||||
ctx.Data["GoGetLink"] = fmt.Sprintf("%s%s/%s", setting.AppUrl, u.LowerName, repo.LowerName)
|
|
||||||
ctx.Data["GoGetImport"] = fmt.Sprintf("%s/%s/%s", setting.Domain, u.LowerName, repo.LowerName)
|
ctx.Data["GoGetImport"] = fmt.Sprintf("%s/%s/%s", setting.Domain, u.LowerName, repo.LowerName)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,9 +8,9 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
"path"
|
|
||||||
|
|
||||||
"github.com/Unknwon/com"
|
"github.com/Unknwon/com"
|
||||||
|
|
||||||
|
@ -84,7 +84,6 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) {
|
||||||
ctx.Repo.Repository.Description = form.Description
|
ctx.Repo.Repository.Description = form.Description
|
||||||
ctx.Repo.Repository.Website = form.Website
|
ctx.Repo.Repository.Website = form.Website
|
||||||
ctx.Repo.Repository.IsPrivate = form.Private
|
ctx.Repo.Repository.IsPrivate = form.Private
|
||||||
ctx.Repo.Repository.IsGoget = form.GoGet
|
|
||||||
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
|
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
|
||||||
ctx.Handle(404, "UpdateRepository", err)
|
ctx.Handle(404, "UpdateRepository", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<meta name="description" content="Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language" />
|
<meta name="description" content="Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language" />
|
||||||
<meta name="keywords" content="go, git">
|
<meta name="keywords" content="go, git">
|
||||||
<meta name="_csrf" content="{{.CsrfToken}}" />
|
<meta name="_csrf" content="{{.CsrfToken}}" />
|
||||||
{{if .Repository.IsGoget}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
|
{{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
|
||||||
|
|
||||||
<!-- Stylesheets -->
|
<!-- Stylesheets -->
|
||||||
{{if CdnMode}}
|
{{if CdnMode}}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" />
|
<meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" />
|
||||||
<meta name="keywords" content="go, git, self-hosted, gogs">
|
<meta name="keywords" content="go, git, self-hosted, gogs">
|
||||||
<meta name="_csrf" content="{{.CsrfToken}}" />
|
<meta name="_csrf" content="{{.CsrfToken}}" />
|
||||||
{{if .Repository.IsGoget}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
|
{{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}
|
||||||
|
|
||||||
<link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" />
|
<link rel="shortcut icon" href="{{AppSubUrl}}/img/favicon.png" />
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,6 @@
|
||||||
<input class="ipt-chk" id="visibility" name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}} />
|
<input class="ipt-chk" id="visibility" name="private" type="checkbox" {{if .Repository.IsPrivate}}checked{{end}} />
|
||||||
<span>{{.i18n.Tr "repo.visiblity_helper" | Str2html}}</span>
|
<span>{{.i18n.Tr "repo.visiblity_helper" | Str2html}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="field">
|
|
||||||
<label for="goget">{{.i18n.Tr "repo.goget_meta"}}</label>
|
|
||||||
<input class="ipt-chk" id="goget" name="goget" type="checkbox" {{if .Repository.IsGoget}}checked{{end}} />
|
|
||||||
<span>{{.i18n.Tr "repo.goget_meta_helper" | Str2html}}</span>
|
|
||||||
</div>
|
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<span class="form-label"></span>
|
<span class="form-label"></span>
|
||||||
<button class="btn btn-green btn-large btn-radius" id="change-reponame-btn" href="#change-reponame-modal">{{.i18n.Tr "repo.settings.update_settings"}}</button>
|
<button class="btn btn-green btn-large btn-radius" id="change-reponame-btn" href="#change-reponame-modal">{{.i18n.Tr "repo.settings.update_settings"}}</button>
|
||||||
|
|
Loading…
Reference in a new issue