mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	minor UI fix and fix ssh race
This commit is contained in:
		| @@ -5,7 +5,7 @@ Gogs - Go Git Service [ |  | ||||||
|  |  | ||||||
| ##### Current version: 0.7.9 Beta | ##### Current version: 0.7.10 Beta | ||||||
|  |  | ||||||
| <table> | <table> | ||||||
|     <tr> |     <tr> | ||||||
|   | |||||||
| @@ -87,6 +87,7 @@ func checkVersion() { | |||||||
| 		{"github.com/go-macaron/csrf", csrf.Version, "0.0.3"}, | 		{"github.com/go-macaron/csrf", csrf.Version, "0.0.3"}, | ||||||
| 		{"github.com/go-macaron/i18n", i18n.Version, "0.0.7"}, | 		{"github.com/go-macaron/i18n", i18n.Version, "0.0.7"}, | ||||||
| 		{"github.com/go-macaron/session", session.Version, "0.1.6"}, | 		{"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"}, | 		{"gopkg.in/ini.v1", ini.Version, "1.3.4"}, | ||||||
| 	} | 	} | ||||||
| 	for _, c := range checkers { | 	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.Group("/:username/:reponame", func() { | ||||||
| 		m.Get("/action/:action", repo.Action) | 		m.Get("/action/:action", repo.Action) | ||||||
|   | |||||||
							
								
								
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								gogs.go
									
									
									
									
									
								
							| @@ -17,7 +17,7 @@ import ( | |||||||
| 	"github.com/gogits/gogs/modules/setting" | 	"github.com/gogits/gogs/modules/setting" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| const APP_VER = "0.7.9.1114 Beta" | const APP_VER = "0.7.10.1114 Beta" | ||||||
|  |  | ||||||
| func init() { | func init() { | ||||||
| 	runtime.GOMAXPROCS(runtime.NumCPU()) | 	runtime.GOMAXPROCS(runtime.NumCPU()) | ||||||
|   | |||||||
| @@ -7,6 +7,7 @@ | |||||||
| package ssh | package ssh | ||||||
|  |  | ||||||
| import ( | import ( | ||||||
|  | 	"fmt" | ||||||
| 	"io" | 	"io" | ||||||
| 	"io/ioutil" | 	"io/ioutil" | ||||||
| 	"net" | 	"net" | ||||||
| @@ -82,14 +83,16 @@ func handleServerConn(keyID string, chans <-chan ssh.NewChannel) { | |||||||
| 						return | 						return | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					go io.Copy(ch, stdout) |  | ||||||
| 					go io.Copy(ch.Stderr(), stderr) |  | ||||||
| 					go io.Copy(input, ch) |  | ||||||
|  |  | ||||||
| 					if err = cmd.Start(); err != nil { | 					if err = cmd.Start(); err != nil { | ||||||
| 						log.Error(3, "Start: %v", err) | 						log.Error(3, "Start: %v", err) | ||||||
| 						return | 						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) | 						log.Error(3, "Wait: %v", err) | ||||||
| 						return | 						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 { | 	if err != nil { | ||||||
| 		panic("Fail to load private key") | 		panic("Fail to load private key") | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -17,6 +17,8 @@ import ( | |||||||
| 	"github.com/gogits/gogs/modules/setting" | 	"github.com/gogits/gogs/modules/setting" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | import "github.com/davecheney/profile" | ||||||
|  |  | ||||||
| const ( | const ( | ||||||
| 	COMMITS base.TplName = "repo/commits" | 	COMMITS base.TplName = "repo/commits" | ||||||
| 	DIFF    base.TplName = "repo/diff" | 	DIFF    base.TplName = "repo/diff" | ||||||
| @@ -43,6 +45,7 @@ func RenderIssueLinks(oldCommits *list.List, repoLink string) *list.List { | |||||||
| } | } | ||||||
|  |  | ||||||
| func Commits(ctx *middleware.Context) { | func Commits(ctx *middleware.Context) { | ||||||
|  | 	defer profile.Start(profile.CPUProfile).Stop() | ||||||
| 	ctx.Data["PageIsCommits"] = true | 	ctx.Data["PageIsCommits"] = true | ||||||
|  |  | ||||||
| 	commitsCount, err := ctx.Repo.Commit.CommitsCount() | 	commitsCount, err := ctx.Repo.Commit.CommitsCount() | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| 0.7.9.1114 Beta | 0.7.10.1114 Beta | ||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository commits"> | <div class="repository commits"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
|   <div class="ui container"> |   <div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		{{template "repo/commits_table" .}} | 		{{template "repo/commits_table" .}} | ||||||
| 	</div> | 	</div> | ||||||
| </div> | </div> | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository settings"> | <div class="repository settings"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
| 	<div class="ui container"> | 	<div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		<div class="ui grid"> | 		<div class="ui grid"> | ||||||
| 			{{template "repo/settings/navbar" .}} | 			{{template "repo/settings/navbar" .}} | ||||||
| 			<div class="twelve wide column content"> | 			<div class="twelve wide column content"> | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository settings edit githook"> | <div class="repository settings edit githook"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
| 	<div class="ui container"> | 	<div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		<div class="ui grid"> | 		<div class="ui grid"> | ||||||
| 			{{template "repo/settings/navbar" .}} | 			{{template "repo/settings/navbar" .}} | ||||||
| 			<div class="twelve wide column content"> | 			<div class="twelve wide column content"> | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository settings githooks"> | <div class="repository settings githooks"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
| 	<div class="ui container"> | 	<div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		<div class="ui grid"> | 		<div class="ui grid"> | ||||||
| 			{{template "repo/settings/navbar" .}} | 			{{template "repo/settings/navbar" .}} | ||||||
| 			<div class="twelve wide column content"> | 			<div class="twelve wide column content"> | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository settings new webhook"> | <div class="repository settings new webhook"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
| 	<div class="ui container"> | 	<div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		<div class="ui grid"> | 		<div class="ui grid"> | ||||||
| 			{{template "repo/settings/navbar" .}} | 			{{template "repo/settings/navbar" .}} | ||||||
| 			<div class="twelve wide column content"> | 			<div class="twelve wide column content"> | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository settings webhooks"> | <div class="repository settings webhooks"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
| 	<div class="ui container"> | 	<div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		<div class="ui grid"> | 		<div class="ui grid"> | ||||||
| 			{{template "repo/settings/navbar" .}} | 			{{template "repo/settings/navbar" .}} | ||||||
| 			{{template "repo/settings/hook_list" .}} | 			{{template "repo/settings/hook_list" .}} | ||||||
|   | |||||||
| @@ -2,6 +2,7 @@ | |||||||
| <div class="repository settings options"> | <div class="repository settings options"> | ||||||
| 	{{template "repo/header" .}} | 	{{template "repo/header" .}} | ||||||
| 	<div class="ui container"> | 	<div class="ui container"> | ||||||
|  |     {{template "repo/sidebar" .}} | ||||||
| 		<div class="ui grid"> | 		<div class="ui grid"> | ||||||
| 			{{template "repo/settings/navbar" .}} | 			{{template "repo/settings/navbar" .}} | ||||||
| 			<div class="twelve wide column content"> | 			<div class="twelve wide column content"> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user