]> source.dussan.org Git - gitea.git/commitdiff
Add go get meta support
authorUnknown <joe2010xtmf@163.com>
Thu, 10 Apr 2014 01:42:25 +0000 (21:42 -0400)
committerUnknown <joe2010xtmf@163.com>
Thu, 10 Apr 2014 01:42:25 +0000 (21:42 -0400)
13 files changed:
README.md
README_ZH.md
gogs.go
models/repo.go
models/user.go
modules/base/markdown.go
routers/repo/repo.go
routers/user/user.go
templates/base/head.tmpl
templates/repo/setting.tmpl
templates/repo/single_bare.tmpl
templates/repo/toolbar.tmpl
templates/user/forgot_passwd.tmpl

index a4e8901c5db1bc359fd111d614ed38d1c60bb64e..619f9a9dd6b64e9816ef9345413c671c25806d36 100644 (file)
--- a/README.md
+++ b/README.md
@@ -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.
 
index 2f80154102738a549e89b17cb4100e020ad5e983..35a0b7630d4cf46e0045a62e30369094358a2665 100644 (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
 
 ## 开发目的
 
diff --git a/gogs.go b/gogs.go
index 45be7e8712ba0ac7c43bbda8352955dbdaf413d4..29710071546a7eaff93afd0c1f16c4f761879037 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -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
index 4f58f407faf6caf714afe2cf2f40fc47d42fbb53..573e0f4e6f5dcd8e30f91d5a7c521fa7d1fd3082 100644 (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"`
 }
index 0fcf72437e6da1c22980a4443a9e2f58d7bea113..b2fddd0a1d5e5687b796fb0e5b328a39d12dd481 100644 (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
 }
 
index e1ff3856ecb4825045c4c870219c55d4eeb6f926..cc1807750d40e2ff57b21b14079f11336c64af8b 100644 (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
 }
index 32c198f2f43eddf3f029d0dd8e0871dbd1f71a92..aebaa65a45bdc0c0c1ff11e1536b2de9dedcf745 100644 (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
index f6a39b86c7cc288d38ab1ffe5848a2b3807af154..084d0bbde2b3158bac922c10c9064e7588dba6bf 100644 (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
index 2f88e918f31137ef971036f4a763218924135c48..648eb7c4679b2d059102eefbe8939ca4929284f7 100644 (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}}
index 85d08c5973dbe7c078dcef483e81d52e40ffb5fe..1adf0090c78a85cbc762c380a0899bcc9bd711f8 100644 (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">
                             </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>
index fc0a3bd96c49f5a6df0f64d9c8e635b479d8fe6d..3f63915352558f74a3d9f6838399faeb26f271b1 100644 (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">
index d8ab26214c208ff51ff39ffb0e00e2d2c421ee82..9c137e5179d0550b0680a15135295f92109f4f58 100644 (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}}
index ff25406fd0d2b152942fff7eeb37c7d2513f3e49..a099ff2744f3f86b2509c6a8675e01ae9f410ee2 100644 (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>