1
0
Fork 0
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:
Unknown 2014-04-09 21:42:25 -04:00
parent 3487f17285
commit 5d4025cb5a
13 changed files with 62 additions and 7 deletions

View file

@ -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)
##### 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.

View file

@ -5,7 +5,7 @@ Gogs(Go Git Service) 是一个由 Go 语言编写的自助 Git 托管服务。
![Demo](http://gowalker.org/public/gogs_demo.gif)
##### 当前版本0.2.2 Alpha
##### 当前版本0.2.3 Alpha
## 开发目的

View file

@ -19,7 +19,7 @@ import (
// Test that go1.2 tag above is included in builds. main.go refers to this definition.
const go12tag = true
const APP_VER = "0.2.2.0409 Alpha"
const APP_VER = "0.2.3.0409 Alpha"
func init() {
base.AppVer = APP_VER

View file

@ -79,6 +79,7 @@ type Repository struct {
NumOpenIssues int `xorm:"-"`
IsPrivate bool
IsBare bool
IsGoget bool
Created time.Time `xorm:"created"`
Updated time.Time `xorm:"updated"`
}

View file

@ -289,11 +289,21 @@ func DeleteUser(user *User) error {
// TODO: check issues, other repos' commits
// Delete all followers.
if _, err = orm.Delete(&Follow{FollowId: user.Id}); err != nil {
return err
}
// Delete all feeds.
if _, err = orm.Delete(&Action{UserId: user.Id}); err != nil {
return err
}
// Delete all watches.
if _, err = orm.Delete(&Watch{UserId: user.Id}); err != nil {
return err
}
// Delete all accesses.
if _, err = orm.Delete(&Access{UserName: user.LowerName}); err != nil {
return err
@ -316,7 +326,6 @@ func DeleteUser(user *User) error {
}
_, err = orm.Delete(user)
// TODO: delete and update follower information.
return err
}

View file

@ -133,7 +133,7 @@ func RenderSpecialLink(rawBytes []byte, urlPrefix string) []byte {
}
func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
// body := RenderSpecialLink(rawBytes, urlPrefix)
body := RenderSpecialLink(rawBytes, urlPrefix)
// fmt.Println(string(body))
htmlFlags := 0
// htmlFlags |= gfm.HTML_USE_XHTML
@ -162,7 +162,7 @@ func RenderMarkdown(rawBytes []byte, urlPrefix string) []byte {
extensions |= gfm.EXTENSION_SPACE_HEADERS
extensions |= gfm.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK
body := gfm.Markdown(rawBytes, renderer, extensions)
body = gfm.Markdown(body, renderer, extensions)
// fmt.Println(string(body))
return body
}

View file

@ -427,6 +427,7 @@ func SettingPost(ctx *middleware.Context) {
ctx.Repo.Repository.Description = ctx.Query("desc")
ctx.Repo.Repository.Website = ctx.Query("site")
ctx.Repo.Repository.IsGoget = ctx.Query("goget") == "on"
if err := models.UpdateRepository(ctx.Repo.Repository); err != nil {
ctx.Handle(404, "repo.SettingPost(update)", err)
return

View file

@ -396,6 +396,10 @@ func Activate(ctx *middleware.Context) {
} else {
ctx.Data["Hours"] = base.Service.ActiveCodeLives / 60
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 {
ctx.Data["ServiceNotEnabled"] = true
@ -451,7 +455,17 @@ func ForgotPasswd(ctx *middleware.Context) {
return
}
if ctx.Cache.IsExist("MailResendLimit_" + u.LowerName) {
ctx.Data["ResendLimited"] = true
ctx.HTML(200, "user/forgot_passwd")
return
}
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["Hours"] = base.Service.ActiveCodeLives / 60
ctx.Data["IsResetSent"] = true

View file

@ -9,6 +9,7 @@
<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="_csrf" content="{{.CsrfToken}}" />
{{if .Repository.IsGoget}}<meta name="go-import" content="{{AppDomain}} git {{.CloneLink.HTTPS}}">{{end}}
<!-- Stylesheets -->
{{if IsProdMode}}

View file

@ -43,6 +43,7 @@
<input type="url" class="form-control" name="site" value="{{.Repository.Website}}" />
</div>
</div>
<hr>
<!-- <div class="form-group">
<label class="col-md-3 text-right">Default Branch</label>
<div class="col-md-9">
@ -51,6 +52,18 @@
</select>
</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="col-md-9 col-md-offset-3">
<button class="btn btn-primary" type="submit">Save Options</button>

View file

@ -9,6 +9,20 @@
<h4>Quick Guide</h4>
</div>
<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>
<div class="input-group col-md-8 col-md-offset-2 guide-buttons">
<span class="input-group-btn">

View file

@ -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>
{{if .IsRepoToolbarIssues}}
<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}}
<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}}

View file

@ -24,6 +24,8 @@
</div>
{{else if .IsResetDisable}}
<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}}
</form>
</div>