mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-12-21 12:44:49 -05:00
Add go get meta support
This commit is contained in:
parent
3487f17285
commit
5d4025cb5a
13 changed files with 62 additions and 7 deletions
|
@ -5,7 +5,7 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language
|
||||||
|
|
||||||
![Demo](http://gowalker.org/public/gogs_demo.gif)
|
![Demo](http://gowalker.org/public/gogs_demo.gif)
|
||||||
|
|
||||||
##### Current version: 0.2.2 Alpha
|
##### Current version: 0.2.3 Alpha
|
||||||
|
|
||||||
#### Due to testing purpose, data of [try.gogits.org](http://try.gogits.org) has been reset in April 6, 2014 and will reset multiple times after. Please do NOT put your important data on the site.
|
#### Due to testing purpose, data of [try.gogits.org](http://try.gogits.org) has been reset in April 6, 2014 and will reset multiple times after. Please do NOT put your important data on the site.
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。
|
||||||
|
|
||||||
![Demo](http://gowalker.org/public/gogs_demo.gif)
|
![Demo](http://gowalker.org/public/gogs_demo.gif)
|
||||||
|
|
||||||
##### 当前版本:0.2.2 Alpha
|
##### 当前版本:0.2.3 Alpha
|
||||||
|
|
||||||
## 开发目的
|
## 开发目的
|
||||||
|
|
||||||
|
|
2
gogs.go
2
gogs.go
|
@ -19,7 +19,7 @@ import (
|
||||||
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
|
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
|
||||||
const go12tag = true
|
const go12tag = true
|
||||||
|
|
||||||
const APP_VER = "0.2.2.0409 Alpha"
|
const APP_VER = "0.2.3.0409 Alpha"
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
base.AppVer = APP_VER
|
base.AppVer = APP_VER
|
||||||
|
|
|
@ -79,6 +79,7 @@ type Repository struct {
|
||||||
NumOpenIssues int `xorm:"-"`
|
NumOpenIssues int `xorm:"-"`
|
||||||
IsPrivate bool
|
IsPrivate bool
|
||||||
IsBare bool
|
IsBare bool
|
||||||
|
IsGoget bool
|
||||||
Created time.Time `xorm:"created"`
|
Created time.Time `xorm:"created"`
|
||||||
Updated time.Time `xorm:"updated"`
|
Updated time.Time `xorm:"updated"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -289,11 +289,21 @@ func DeleteUser(user *User) error {
|
||||||
|
|
||||||
// TODO: check issues, other repos' commits
|
// TODO: check issues, other repos' commits
|
||||||
|
|
||||||
|
// Delete all followers.
|
||||||
|
if _, err = orm.Delete(&Follow{FollowId: user.Id}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Delete all feeds.
|
// Delete all feeds.
|
||||||
if _, err = orm.Delete(&Action{UserId: user.Id}); err != nil {
|
if _, err = orm.Delete(&Action{UserId: user.Id}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Delete all watches.
|
||||||
|
if _, err = orm.Delete(&Watch{UserId: user.Id}); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// Delete all accesses.
|
// Delete all accesses.
|
||||||
if _, err = orm.Delete(&Access{UserName: user.LowerName}); err != nil {
|
if _, err = orm.Delete(&Access{UserName: user.LowerName}); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -316,7 +326,6 @@ func DeleteUser(user *User) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = orm.Delete(user)
|
_, err = orm.Delete(user)
|
||||||
// TODO: delete and update follower information.
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
|
||||||
}
|
}
|
||||||
|
|
||||||
func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
|
func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
|
||||||
// body := RenderSpecialLink(rawBytes, urlPrefix)
|
body := RenderSpecialLink(rawBytes, urlPrefix)
|
||||||
// fmt.Println(string(body))
|
// fmt.Println(string(body))
|
||||||
htmlFlags := 0
|
htmlFlags := 0
|
||||||
// htmlFlags |= gfm.HTML_USE_XHTML
|
// htmlFlags |= gfm.HTML_USE_XHTML
|
||||||
|
@ -162,7 +162,7 @@ func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
|
||||||
extensions |= gfm.EXTENSION_SPACE_HEADERS
|
extensions |= gfm.EXTENSION_SPACE_HEADERS
|
||||||
extensions |= gfm.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
|
extensions |= gfm.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
|
||||||
|
|
||||||
body := gfm.Markdown(rawBytes, renderer, extensions)
|
body = gfm.Markdown(body, renderer, extensions)
|
||||||
// fmt.Println(string(body))
|
// fmt.Println(string(body))
|
||||||
return body
|
return body
|
||||||
}
|
}
|
||||||
|
|
|
@ -427,6 +427,7 @@ func SettingPost(ctx *middleware.Context) {
|
||||||
|
|
||||||
ctx.Repo.Repository.Description = ctx.Query("desc")
|
ctx.Repo.Repository.Description = ctx.Query("desc")
|
||||||
ctx.Repo.Repository.Website = ctx.Query("site")
|
ctx.Repo.Repository.Website = ctx.Query("site")
|
||||||
|
ctx.Repo.Repository.IsGoget = ctx.Query("goget") == "on"
|
||||||
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
|
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
|
||||||
ctx.Handle(404, "repo.SettingPost(update)", err)
|
ctx.Handle(404, "repo.SettingPost(update)", err)
|
||||||
return
|
return
|
||||||
|
|
|
@ -396,6 +396,10 @@ func Activate(ctx *middleware.Context) {
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
|
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
|
||||||
mailer.SendActiveMail(ctx.Render, ctx.User)
|
mailer.SendActiveMail(ctx.Render, ctx.User)
|
||||||
|
|
||||||
|
if err := ctx.Cache.Put("MailResendLimit_"+ctx.User.LowerName, ctx.User.LowerName, 180); err != nil {
|
||||||
|
log.Error("Set cache(MailResendLimit) fail: %v", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["ServiceNotEnabled"] = true
|
ctx.Data["ServiceNotEnabled"] = true
|
||||||
|
@ -451,7 +455,17 @@ func ForgotPasswd(ctx *middleware.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) {
|
||||||
|
ctx.Data["ResendLimited"] = true
|
||||||
|
ctx.HTML(200, "user/forgot_passwd")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
mailer.SendResetPasswdMail(ctx.Render, u)
|
mailer.SendResetPasswdMail(ctx.Render, u)
|
||||||
|
if err = ctx.Cache.Put("MailResendLimit_"+u.LowerName, u.LowerName, 180); err != nil {
|
||||||
|
log.Error("Set cache(MailResendLimit) fail: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
ctx.Data["Email"] = email
|
ctx.Data["Email"] = email
|
||||||
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
|
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
|
||||||
ctx.Data["IsResetSent"] = true
|
ctx.Data["IsResetSent"] = true
|
||||||
|
|
|
@ -9,6 +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="{{AppDomain}} git {{.CloneLink.HTTPS}}">{{end}}
|
||||||
|
|
||||||
<!-- Stylesheets -->
|
<!-- Stylesheets -->
|
||||||
{{if IsProdMode}}
|
{{if IsProdMode}}
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
<input type="url" class="form-control" name="site" value="{{.Repository.Website}}" />
|
<input type="url" class="form-control" name="site" value="{{.Repository.Website}}" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<hr>
|
||||||
<!-- <div class="form-group">
|
<!-- <div class="form-group">
|
||||||
<label class="col-md-3 text-right">Default Branch</label>
|
<label class="col-md-3 text-right">Default Branch</label>
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
|
@ -51,6 +52,18 @@
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div> -->
|
</div> -->
|
||||||
|
|
||||||
|
<div class="form-group">
|
||||||
|
<div class="col-md-offset-3 col-md-9">
|
||||||
|
<div class="checkbox">
|
||||||
|
<label style="line-height: 15px;">
|
||||||
|
<input type="checkbox" name="goget" {{if .Repository.IsGoget}}checked{{end}}>
|
||||||
|
<strong>Enable 'go get' meta</strong>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-md-9 col-md-offset-3">
|
<div class="col-md-9 col-md-offset-3">
|
||||||
<button class="btn btn-primary" type="submit">Save Options</button>
|
<button class="btn btn-primary" type="submit">Save Options</button>
|
||||||
|
|
|
@ -9,6 +9,20 @@
|
||||||
<h4>Quick Guide</h4>
|
<h4>Quick Guide</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body guide-content text-center">
|
<div class="panel-body guide-content text-center">
|
||||||
|
<form action="{{.RepoLink}}/import" method="post">
|
||||||
|
{{.CsrfTokenHtml}}
|
||||||
|
<h3>Clone from existing repository</h3>
|
||||||
|
<div class="input-group col-md-6 col-md-offset-3">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button class="btn btn-default" type="button">URL</button>
|
||||||
|
</span>
|
||||||
|
<input name="passwd" type="password" class="form-control" placeholder="Type existing repository address" required="required">
|
||||||
|
<span class="input-group-btn">
|
||||||
|
<button type="submit" class="btn btn-default" type="button">Clone</button>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
<h3>Clone this repository</h3>
|
<h3>Clone this repository</h3>
|
||||||
<div class="input-group col-md-8 col-md-offset-2 guide-buttons">
|
<div class="input-group col-md-8 col-md-offset-2 guide-buttons">
|
||||||
<span class="input-group-btn">
|
<span class="input-group-btn">
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="{{.RepoLink}}/issues">{{if .Repository.NumOpenIssues}}<span class="badge">{{.Repository.NumOpenIssues}}</span> {{end}}Issues <!--<span class="badge">42</span>--></a></li>
|
<li class="{{if .IsRepoToolbarIssues}}active{{end}}"><a href="{{.RepoLink}}/issues">{{if .Repository.NumOpenIssues}}<span class="badge">{{.Repository.NumOpenIssues}}</span> {{end}}Issues <!--<span class="badge">42</span>--></a></li>
|
||||||
{{if .IsRepoToolbarIssues}}
|
{{if .IsRepoToolbarIssues}}
|
||||||
<li class="tmp">{{if .IsRepoToolbarIssuesList}}<a href="{{.RepoLink}}/issues/new"><button class="btn btn-primary btn-sm">New Issue</button>
|
<li class="tmp">{{if .IsRepoToolbarIssuesList}}<a href="{{.RepoLink}}/issues/new"><button class="btn btn-primary btn-sm">New Issue</button>
|
||||||
</a>{{else}}<a href="{{.RepoLink}}/issues"><button class="btn btn-primary btn-sm">Issues List</button></a>{{end}}</li>
|
</a>{{end}}</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
<li class="{{if .IsRepoToolbarReleases}}active{{end}}"><a href="{{.RepoLink}}/releases">{{if .Repository.NumReleases}}<span class="badge">{{.Repository.NumReleases}}</span> {{end}}Releases</a></li>
|
<li class="{{if .IsRepoToolbarReleases}}active{{end}}"><a href="{{.RepoLink}}/releases">{{if .Repository.NumReleases}}<span class="badge">{{.Repository.NumReleases}}</span> {{end}}Releases</a></li>
|
||||||
{{if .IsRepoToolbarReleases}}
|
{{if .IsRepoToolbarReleases}}
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
</div>
|
</div>
|
||||||
{{else if .IsResetDisable}}
|
{{else if .IsResetDisable}}
|
||||||
<p>Sorry, mail service is not enabled.</p>
|
<p>Sorry, mail service is not enabled.</p>
|
||||||
|
{{else if .ResendLimited}}
|
||||||
|
<p>Sorry, you are sending e-mail too frequently, please wait 3 minutes.</p>
|
||||||
{{end}}
|
{{end}}
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue