Mirror fix and update

This commit is contained in:
Unknown 2014-03-29 10:01:52 -04:00
parent ecce694d77
commit 2c073afbec
7 changed files with 30 additions and 15 deletions

View File

@ -7,6 +7,8 @@ Gogs(Go Git Service) is a Self Hosted Git Service in the Go Programming Language
##### Current version: 0.1.9 Alpha ##### Current version: 0.1.9 Alpha
#### Due to testing purpose, data of [try.gogits.org](http://try.gogits.org) has been reset in March 29, 2014 and will reset multiple times after. Please do NOT put your important data on the site.
#### Other language version #### Other language version
- [简体中文](README_ZH.md) - [简体中文](README_ZH.md)

View File

@ -198,12 +198,19 @@ func CreateRepository(user *User, repoName, desc, repoLang, license string, priv
c := exec.Command("git", "update-server-info") c := exec.Command("git", "update-server-info")
c.Dir = repoPath c.Dir = repoPath
err = c.Run() if err = c.Run(); err != nil {
if err != nil {
log.Error("repo.CreateRepository(exec update-server-info): %v", err) log.Error("repo.CreateRepository(exec update-server-info): %v", err)
} }
return repo, NewRepoAction(user, repo) if err = NewRepoAction(user, repo); err != nil {
log.Error("repo.CreateRepository(NewRepoAction): %v", err)
}
if err = WatchRepo(user.Id, repo.Id, true); err != nil {
log.Error("repo.CreateRepository(WatchRepo): %v", err)
}
return repo, nil
} }
// extractGitBareZip extracts git-bare.zip to repository path. // extractGitBareZip extracts git-bare.zip to repository path.

View File

@ -2,16 +2,17 @@
// Use of this source code is governed by a MIT-style // Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
package routers package v1
import "github.com/gogits/gogs/modules/middleware" import (
"github.com/gogits/gogs/modules/base"
"github.com/gogits/gogs/modules/middleware"
)
func Preview(ctx *middleware.Context) { func Markdown(ctx *middleware.Context) {
content := ctx.Query("content") content := ctx.Query("content")
// todo : gfm render content
// content = Markdown(content)
ctx.Render.JSON(200, map[string]interface{}{ ctx.Render.JSON(200, map[string]interface{}{
"ok": true, "ok": true,
"content": "preview : " + content, "content": string(base.RenderMarkdown([]byte(content), "")),
}) })
} }

View File

@ -15,11 +15,11 @@
</div> </div>
<div class="form-group panel-body"> <div class="form-group panel-body">
<div class="md-help pull-right"><!-- todo help link --> <div class="md-help pull-right"><!-- todo help link -->
Content with <a href="#">Markdown</a> Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
</div> </div>
<ul class="nav nav-tabs" data-init="tabs"> <ul class="nav nav-tabs" data-init="tabs">
<li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li> <li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li>
<li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/preview?repo=repo_id&issue=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li> <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/api/v1/markdown?repo=repo_id&issue=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane" id="issue-textarea"> <div class="tab-pane" id="issue-textarea">

View File

@ -69,11 +69,11 @@
<div class="panel-body"> <div class="panel-body">
<div class="form-group"> <div class="form-group">
<div class="md-help pull-right"><!-- todo help link --> <div class="md-help pull-right"><!-- todo help link -->
Content with <a href="#">Markdown</a> Content with <a href="https://help.github.com/articles/markdown-basics">Markdown</a>
</div> </div>
<ul class="nav nav-tabs" data-init="tabs"> <ul class="nav nav-tabs" data-init="tabs">
<li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li> <li class="active issue-write"><a href="#issue-textarea" data-toggle="tab">Write</a></li>
<li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/preview?repo=repo_id&issue=issue_id&comment=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li> <li class="issue-preview"><a href="#issue-preview" data-toggle="tab" data-ajax="/api/v1/markdown?repo=repo_id&issue=issue_id&comment=new" data-ajax-name="issue-preview" data-ajax-method="post" data-preview="#issue-preview">Preview</a></li>
</ul> </ul>
<div class="tab-content"> <div class="tab-content">
<div class="tab-pane" id="issue-textarea"> <div class="tab-pane" id="issue-textarea">

View File

@ -44,7 +44,7 @@
</div> </div>
<div class="form-group text-center" id="social-login"> <div class="form-group text-center" id="social-login">
<a class="btn btn-danger btn-lg">Register new account</a> <a class="btn btn-danger btn-lg" href="/user/sign_up">Register new account</a>
</div> </div>
</form> </form>
</div> </div>

7
web.go
View File

@ -24,6 +24,7 @@ import (
"github.com/gogits/gogs/modules/middleware" "github.com/gogits/gogs/modules/middleware"
"github.com/gogits/gogs/routers" "github.com/gogits/gogs/routers"
"github.com/gogits/gogs/routers/admin" "github.com/gogits/gogs/routers/admin"
"github.com/gogits/gogs/routers/api/v1"
"github.com/gogits/gogs/routers/dev" "github.com/gogits/gogs/routers/dev"
"github.com/gogits/gogs/routers/repo" "github.com/gogits/gogs/routers/repo"
"github.com/gogits/gogs/routers/user" "github.com/gogits/gogs/routers/user"
@ -72,6 +73,7 @@ func newMartini() *martini.ClassicMartini {
} }
func runWeb(*cli.Context) { func runWeb(*cli.Context) {
fmt.Println("Server is running...")
globalInit() globalInit()
base.NewServices() base.NewServices()
checkRunMode() checkRunMode()
@ -95,7 +97,10 @@ func runWeb(*cli.Context) {
m.Get("/pulls", reqSignIn, user.Pulls) m.Get("/pulls", reqSignIn, user.Pulls)
m.Get("/stars", reqSignIn, user.Stars) m.Get("/stars", reqSignIn, user.Stars)
m.Get("/help", routers.Help) m.Get("/help", routers.Help)
m.Post("/preview", routers.Preview)
m.Group("/api/v1", func(r martini.Router) {
r.Post("/markdown", v1.Markdown)
})
avt := avatar.CacheServer("public/img/avatar/", "public/img/avatar_default.jpg") avt := avatar.CacheServer("public/img/avatar/", "public/img/avatar_default.jpg")
m.Get("/avatar/:hash", avt.ServeHTTP) m.Get("/avatar/:hash", avt.ServeHTTP)