]> source.dussan.org Git - gitea.git/commitdiff
minor UI fix and fix ssh race
authorUnknwon <u@gogs.io>
Sat, 14 Nov 2015 18:21:31 +0000 (13:21 -0500)
committerUnknwon <u@gogs.io>
Sat, 14 Nov 2015 18:21:31 +0000 (13:21 -0500)
13 files changed:
README.md
cmd/web.go
gogs.go
modules/ssh/ssh.go
routers/repo/commit.go
templates/.VERSION
templates/repo/commits.tmpl
templates/repo/settings/deploy_keys.tmpl
templates/repo/settings/githook_edit.tmpl
templates/repo/settings/githooks.tmpl
templates/repo/settings/hook_new.tmpl
templates/repo/settings/hooks.tmpl
templates/repo/settings/options.tmpl

index 03cb070e2593841a5d5e5866986eba56b3331e74..02e624c0a8671b4c53afaf35c13ce1d60a840082 100644 (file)
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@ Gogs - Go Git Service [![Build Status](https://travis-ci.org/gogits/gogs.svg?bra
 
 ![](public/img/gogs-large-resize.png)
 
-##### Current version: 0.7.9 Beta
+##### Current version: 0.7.10 Beta
 
 <table>
     <tr>
index e51b1bb978c9d919f575c2ec74c46e495fa55bf3..950c3d48cfd6b9f0016889e13a90fa41c1498d94 100644 (file)
@@ -87,6 +87,7 @@ func checkVersion() {
                {"github.com/go-macaron/csrf", csrf.Version, "0.0.3"},
                {"github.com/go-macaron/i18n", i18n.Version, "0.0.7"},
                {"github.com/go-macaron/session", session.Version, "0.1.6"},
+               {"github.com/go-macaron/toolbox", toolbox.Version, "0.1.0"},
                {"gopkg.in/ini.v1", ini.Version, "1.3.4"},
        }
        for _, c := range checkers {
@@ -463,7 +464,7 @@ func runWeb(ctx *cli.Context) {
                        })
 
                })
-       }, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin)
+       }, reqSignIn, middleware.RepoAssignment(true), reqRepoAdmin, middleware.RepoRef())
 
        m.Group("/:username/:reponame", func() {
                m.Get("/action/:action", repo.Action)
diff --git a/gogs.go b/gogs.go
index 37259d367d3f1ae81006be2b5c55efa763b87df6..95b8e931f4d9939af8b1217f8db1fa5d6f57c17e 100644 (file)
--- a/gogs.go
+++ b/gogs.go
@@ -17,7 +17,7 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
-const APP_VER = "0.7.9.1114 Beta"
+const APP_VER = "0.7.10.1114 Beta"
 
 func init() {
        runtime.GOMAXPROCS(runtime.NumCPU())
index 5e3761ca19c52e753aeb431720bf5dc0d16e3613..706f5e7503e577075a6c289e02eb9fa39faf3674 100644 (file)
@@ -7,6 +7,7 @@
 package ssh
 
 import (
+       "fmt"
        "io"
        "io/ioutil"
        "net"
@@ -82,14 +83,16 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) {
                                                return
                                        }
 
-                                       go io.Copy(ch, stdout)
-                                       go io.Copy(ch.Stderr(), stderr)
-                                       go io.Copy(input, ch)
-
                                        if err = cmd.Start(); err != nil {
                                                log.Error(3, "Start: %v", err)
                                                return
-                                       } else if err = cmd.Wait(); err != nil {
+                                       }
+
+                                       go io.Copy(input, ch)
+                                       io.Copy(ch, stdout)
+                                       io.Copy(ch.Stderr(), stderr)
+
+                                       if err = cmd.Wait(); err != nil {
                                                log.Error(3, "Wait: %v", err)
                                                return
                                        }
@@ -142,7 +145,16 @@ func Listen(port int) {
                },
        }
 
-       privateBytes, err := ioutil.ReadFile(filepath.Join(models.SSHPath, "id_rsa"))
+       keyPath := filepath.Join(setting.AppDataPath, "ssh/gogs.rsa")
+       if !com.IsExist(keyPath) {
+               os.MkdirAll(filepath.Dir(keyPath), os.ModePerm)
+               _, stderr, err := com.ExecCmd("ssh-keygen", "-f", keyPath, "-t", "rsa", "-N", "")
+               if err != nil {
+                       panic(fmt.Sprintf("Fail to generate private key: %v - %s", err, stderr))
+               }
+       }
+
+       privateBytes, err := ioutil.ReadFile(keyPath)
        if err != nil {
                panic("Fail to load private key")
        }
index 101cb5c557c12f1aeb88e48607704bfe0e0a1808..0c9e7817a2ab979c4190803c9e5377ac36e1129f 100644 (file)
@@ -17,6 +17,8 @@ import (
        "github.com/gogits/gogs/modules/setting"
 )
 
+import "github.com/davecheney/profile"
+
 const (
        COMMITS base.TplName = "repo/commits"
        DIFF    base.TplName = "repo/diff"
@@ -43,6 +45,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List {
 }
 
 func Commits(ctx *middleware.Context) {
+       defer profile.Start(profile.CPUProfile).Stop()
        ctx.Data["PageIsCommits"] = true
 
        commitsCount, err := ctx.Repo.Commit.CommitsCount()
index 548d9a0ea693e79817fc2efac7e5063ccf7485cd..32d6c06db8686af757add6ecf6a76ea874b1f935 100644 (file)
@@ -1 +1 @@
-0.7.9.1114 Beta
\ No newline at end of file
+0.7.10.1114 Beta
\ No newline at end of file
index e54c9ed70ed2389e1a570585dba2ec2b363cf857..769841deeaee9c78693f099a1ae883ec08982f6b 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository commits">
        {{template "repo/header" .}}
   <div class="ui container">
+    {{template "repo/sidebar" .}}
                {{template "repo/commits_table" .}}
        </div>
 </div>
index 0574e9d80042738f0e4a052d00e43e3b6059d801..5a6958381b5f21eacd01b2d3d89d3a8cd64fbaf3 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository settings">
        {{template "repo/header" .}}
        <div class="ui container">
+    {{template "repo/sidebar" .}}
                <div class="ui grid">
                        {{template "repo/settings/navbar" .}}
                        <div class="twelve wide column content">
index b9b75a3aa6179b8d4f3864cabc89b8cc0292d050..2f79481a2ac0a82515c3414567948612241d3cd9 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository settings edit githook">
        {{template "repo/header" .}}
        <div class="ui container">
+    {{template "repo/sidebar" .}}
                <div class="ui grid">
                        {{template "repo/settings/navbar" .}}
                        <div class="twelve wide column content">
index 8120b80e17539142e35e980fe018d62113e382f1..980b98fde980af966a9d745eb09164c26ace9ca7 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository settings githooks">
        {{template "repo/header" .}}
        <div class="ui container">
+    {{template "repo/sidebar" .}}
                <div class="ui grid">
                        {{template "repo/settings/navbar" .}}
                        <div class="twelve wide column content">
index 7c9a5de1f0b309047b239814f98f4066da3ff37f..ac69b02f35b0cf7b33262b06dcd67448c5a32cc9 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository settings new webhook">
        {{template "repo/header" .}}
        <div class="ui container">
+    {{template "repo/sidebar" .}}
                <div class="ui grid">
                        {{template "repo/settings/navbar" .}}
                        <div class="twelve wide column content">
index e3f6f4ddae8d0e05be5f494b2a1f8f835f2d3de5..187bd563607aa1c11160236e02a71ae49b4d8f55 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository settings webhooks">
        {{template "repo/header" .}}
        <div class="ui container">
+    {{template "repo/sidebar" .}}
                <div class="ui grid">
                        {{template "repo/settings/navbar" .}}
                        {{template "repo/settings/hook_list" .}}
index 474d719eb7ac9ad6f6086939e859a8c50f2825d7..e109ec11c6e472b8ba1cc7e43fcc5fdee2648184 100644 (file)
@@ -2,6 +2,7 @@
 <div class="repository settings options">
        {{template "repo/header" .}}
        <div class="ui container">
+    {{template "repo/sidebar" .}}
                <div class="ui grid">
                        {{template "repo/settings/navbar" .}}
                        <div class="twelve wide column content">