Browse Source

cmd: code fix for #905

- routers/admin: add rewrite update hook operation
- conf/locale: update locale file due to ini behavior changes
- cmd/cert_stub.go: remove useless code
- cmd/fix.go: no longer need fix command(at least now)
tags/v0.9.99
Unknwon 9 years ago
parent
commit
f15fa9167a

+ 0
- 9
cmd/cert_stub.go View File

import ( import (
"fmt" "fmt"
"os" "os"
"time"


"github.com/codegangsta/cli" "github.com/codegangsta/cli"
) )
Description: `Generate a self-signed X.509 certificate for a TLS server. Description: `Generate a self-signed X.509 certificate for a TLS server.
Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`, Outputs to 'cert.pem' and 'key.pem' and will overwrite existing files.`,
Action: runCert, Action: runCert,
Flags: []cli.Flag{
cli.StringFlag{"host", "", "Comma-separated hostnames and IPs to generate a certificate for", ""},
cli.StringFlag{"ecdsa-curve", "", "ECDSA curve to use to generate a key. Valid values are P224, P256, P384, P521", ""},
cli.IntFlag{"rsa-bits", 2048, "Size of RSA key to generate. Ignored if --ecdsa-curve is set", ""},
cli.StringFlag{"start-date", "", "Creation date formatted as Jan 1 15:04:05 2011", ""},
cli.DurationFlag{"duration", 365 * 24 * time.Hour, "Duration that certificate is valid for", ""},
cli.BoolFlag{"ca", "whether this cert should be its own Certificate Authority", ""},
},
} }


func runCert(ctx *cli.Context) { func runCert(ctx *cli.Context) {

+ 1
- 1
cmd/dump.go View File

It can be used for backup and capture Gogs server image to send to maintainer`, It can be used for backup and capture Gogs server image to send to maintainer`,
Action: runDump, Action: runDump,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
cli.BoolFlag{"verbose, v", "show process details", ""}, cli.BoolFlag{"verbose, v", "show process details", ""},
cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
}, },
} }



+ 0
- 184
cmd/fix.go View File

// Copyright 2014 The Gogs Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.

package cmd

import (
"bufio"
"fmt"
"io"
"io/ioutil"
"os"
"path"
"runtime"
"strings"

"github.com/Unknwon/com"
"github.com/codegangsta/cli"

"github.com/gogits/gogs/models"
"github.com/gogits/gogs/modules/setting"
)

var CmdFix = cli.Command{
Name: "fix",
Usage: "This command for upgrade from old version",
Action: runFix,
Subcommands: fixCommands,
Flags: []cli.Flag{},
}

func runFix(ctx *cli.Context) {
}

var fixCommands = []cli.Command{
{
Name: "location",
Usage: "Change Gogs app location",
Description: `Command location fixes location change of Gogs

gogs fix location <old Gogs path>
`,
Action: runFixLocation,
},
}

// rewriteAuthorizedKeys replaces old Gogs path to the new one.
func rewriteAuthorizedKeys(sshPath, oldPath, newPath string) error {
fr, err := os.Open(sshPath)
if err != nil {
return err
}
defer fr.Close()

tmpPath := sshPath + ".tmp"
fw, err := os.Create(tmpPath)
if err != nil {
return err
}
defer fw.Close()

oldPath = "command=\"" + oldPath + " serv"
newPath = "command=\"" + newPath + " serv"
buf := bufio.NewReader(fr)
for {
line, errRead := buf.ReadString('\n')
line = strings.TrimSpace(line)

if errRead != nil {
if errRead != io.EOF {
return errRead
}

// Reached end of file, if nothing to read then break,
// otherwise handle the last line.
if len(line) == 0 {
break
}
}

// Still finding the line, copy the line that currently read.
if _, err = fw.WriteString(strings.Replace(line, oldPath, newPath, 1) + "\n"); err != nil {
return err
}

if errRead == io.EOF {
break
}
}

if err = os.Remove(sshPath); err != nil {
return err
}
return os.Rename(tmpPath, sshPath)
}

func rewriteUpdateHook(path, appPath string) error {
if runtime.GOOS == "windows" {
rp := strings.NewReplacer("\\", "/")
appPath = "\"" + rp.Replace(appPath) + "\""
} else {
rp := strings.NewReplacer("\\", "/", " ", "\\ ")
appPath = rp.Replace(appPath)
}

if err := ioutil.WriteFile(path, []byte(fmt.Sprintf(models.TPL_UPDATE_HOOK,
setting.ScriptType, appPath)), os.ModePerm); err != nil {
return err
}
return nil
}

func walkDir(rootPath, recPath, appPath string, depth int) error {
depth++
if depth > 3 {
return nil
} else if depth == 3 {
if err := rewriteUpdateHook(path.Join(rootPath, "hooks/update"), appPath); err != nil {
return err
}
}

dir, err := os.Open(rootPath)
if err != nil {
return err
}
defer dir.Close()

fis, err := dir.Readdir(0)
if err != nil {
return err
}

for _, fi := range fis {
if strings.Contains(fi.Name(), ".DS_Store") {
continue
}

relPath := path.Join(recPath, fi.Name())
curPath := path.Join(rootPath, fi.Name())
if fi.IsDir() {
if err = walkDir(curPath, relPath, appPath, depth); err != nil {
return err
}
}
}
return nil
}

func runFixLocation(ctx *cli.Context) {
if len(ctx.Args()) != 1 {
fmt.Println("Incorrect arguments number, expect 1")
os.Exit(2)
}

execPath, _ := setting.ExecPath()

oldPath := ctx.Args().First()
fmt.Printf("Old location: %s\n", oldPath)
fmt.Println("This command should be executed in the new Gogs path")
fmt.Printf("Do you want to change Gogs app path from old location to:\n")
fmt.Printf("-> %s?\n", execPath)
fmt.Print("Press <enter> to continue, use <Ctrl+c> to exit.")
fmt.Scanln()

// Fix in authorized_keys file.
sshPath := path.Join(models.SSHPath, "authorized_keys")
if com.IsFile(sshPath) {
fmt.Printf("Fixing pathes in file: %s\n", sshPath)
if err := rewriteAuthorizedKeys(sshPath, oldPath, execPath); err != nil {
fmt.Println(err)
os.Exit(1)
}
}

// Fix position in gogs-repositories.
setting.NewConfigContext()
fmt.Printf("Fixing pathes in repositories: %s\n", setting.RepoRootPath)
if err := walkDir(setting.RepoRootPath, "", execPath, 0); err != nil {
fmt.Println(err)
os.Exit(1)
}
fmt.Println("Fix position finished!")
}

+ 1
- 1
cmd/serve.go View File

Description: `Serv provide access auth for repositories`, Description: `Serv provide access auth for repositories`,
Action: runServ, Action: runServ,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
}, },
} }



+ 1
- 1
cmd/update.go View File

Description: `Update get pushed info and insert into database`, Description: `Update get pushed info and insert into database`,
Action: runUpdate, Action: runUpdate,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
}, },
} }



+ 3
- 2
cmd/web.go View File

Action: runWeb, Action: runWeb,
Flags: []cli.Flag{ Flags: []cli.Flag{
cli.StringFlag{"port, p", "3000", "Temporary port number to prevent conflict", ""}, cli.StringFlag{"port, p", "3000", "Temporary port number to prevent conflict", ""},
cli.StringFlag{"config, c", "custom/conf/app.ini", "Configuration file", ""},
cli.StringFlag{"config, c", "custom/conf/app.ini", "Custom configuration file path", ""},
}, },
} }


} }


func runWeb(ctx *cli.Context) { func runWeb(ctx *cli.Context) {
checkVersion()

if ctx.IsSet("config") { if ctx.IsSet("config") {
setting.CustomConf = ctx.String("config") setting.CustomConf = ctx.String("config")
} }
routers.GlobalInit() routers.GlobalInit()
checkVersion()


m := newMacaron() m := newMacaron()



+ 10
- 16
conf/locale/locale_de-DE.ini View File

run_user_helper=Der Benutzer muss die Zugriffsberechtigung für das Repository Root-Verzeichnis haben und der ausführende Benutzer von Gogs sein. run_user_helper=Der Benutzer muss die Zugriffsberechtigung für das Repository Root-Verzeichnis haben und der ausführende Benutzer von Gogs sein.
domain=Domain domain=Domain
domain_helper=Dies hat Auswirkung auf die SSH clone URLs. domain_helper=Dies hat Auswirkung auf die SSH clone URLs.
http_port=HTTP Port
http_port_helper=Port number which application will listen on.
app_url=Anwendungs-URL app_url=Anwendungs-URL
app_url_helper=Dies hat Auswirkung auf die HTTP/HTTPS clone URLs und für die E-Mails. app_url_helper=Dies hat Auswirkung auf die HTTP/HTTPS clone URLs und für die E-Mails.
email_title=E-Mail-Service Einstellungen (optional) email_title=E-Mail-Service Einstellungen (optional)
dashboard.delete_repo_archives_success=Alle Repositoriy-Archive wurden gelöscht. dashboard.delete_repo_archives_success=Alle Repositoriy-Archive wurden gelöscht.
dashboard.git_gc_repos=Führe Garbage Collection auf Repositories aus dashboard.git_gc_repos=Führe Garbage Collection auf Repositories aus
dashboard.git_gc_repos_success=Garbage Collection wurde auf allen Repositories erfolgreich ausgeführt. dashboard.git_gc_repos_success=Garbage Collection wurde auf allen Repositories erfolgreich ausgeführt.
dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)
dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=Server-Uptime dashboard.server_uptime=Server-Uptime
dashboard.current_goroutine=Aktuelle Goroutines dashboard.current_goroutine=Aktuelle Goroutines
dashboard.current_memory_usage=Aktuelle Speichernutzung dashboard.current_memory_usage=Aktuelle Speichernutzung
config.service_config=Service-Einstellungen config.service_config=Service-Einstellungen
config.register_email_confirm=E-Mail-Bestätigung bei Registrierung config.register_email_confirm=E-Mail-Bestätigung bei Registrierung
config.disable_register=Registrierung deaktivieren config.disable_register=Registrierung deaktivieren
config.show_registration_button = Registrierungs-Button anzeigen
config.show_registration_button=Show Register Button
config.require_sign_in_view=Ansehen erfordert Registrierung config.require_sign_in_view=Ansehen erfordert Registrierung
config.mail_notify=E-Mail-Benachrichtigung config.mail_notify=E-Mail-Benachrichtigung
config.enable_cache_avatar=Avatar-Cache aktivieren config.enable_cache_avatar=Avatar-Cache aktivieren
[action] [action]
create_repo=hat Repository <a href="%s/%s">%s</a> erstellt create_repo=hat Repository <a href="%s/%s">%s</a> erstellt
commit_repo=hat nach <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a> gepusht commit_repo=hat nach <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a> gepusht
create_issue=hat Issue <a href="%s/%s/issues/%s">%s#%s</a> eröffnet
comment_issue=hat Issue <a href="%s/%s/issues/%s">%s#%s</a> kommentiert
create_issue=`hat Issue <a href="%s/issues/%s">%[1]s#%[2]s</a> eröffnet`
comment_issue=`hat Issue <a href="%s/issues/%s">%[1]s#%[2]s</a> kommentiert`
transfer_repo=hat Repository <code>%s</code> transferiert an <a href="/%s%s">%s</a> transfer_repo=hat Repository <code>%s</code> transferiert an <a href="/%s%s">%s</a>
push_tag=hat nach <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a> gepusht push_tag=hat nach <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a> gepusht
compare_2_commits=Zeige Vergleich dieser 2 Commits compare_2_commits=Zeige Vergleich dieser 2 Commits
raw_seconds=Sekunden raw_seconds=Sekunden
raw_minutes=Minuten raw_minutes=Minuten

+ 8
- 5
conf/locale/locale_en-US.ini View File

smtp_host = SMTP Host smtp_host = SMTP Host
mailer_user = Sender E-mail mailer_user = Sender E-mail
mailer_password = Sender Password mailer_password = Sender Password
notify_title = Notification Settings(Optional)
notify_title = Notification Settings (Optional)
register_confirm = Enable Register Confirmation register_confirm = Enable Register Confirmation
mail_notify = Enable Mail Notification mail_notify = Enable Mail Notification
admin_title = Admin Account Settings admin_title = Admin Account Settings
init_readme = Initialize this repository with a README.md init_readme = Initialize this repository with a README.md
create_repo = Create Repository create_repo = Create Repository
default_branch = Default Branch default_branch = Default Branch
mirror_interval = Mirror Interval(hour)
mirror_interval = Mirror Interval (hour)
goget_meta = Go-Get Meta goget_meta = Go-Get Meta
goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span> goget_meta_helper = This repository will be <span class="label label-blue label-radius">Go-Getable</span>


dashboard.delete_repo_archives_success = All repositories archives have been deleted successfully. dashboard.delete_repo_archives_success = All repositories archives have been deleted successfully.
dashboard.git_gc_repos = Do garbage collection on repositories dashboard.git_gc_repos = Do garbage collection on repositories
dashboard.git_gc_repos_success = All repositories have done garbage collection successfully. dashboard.git_gc_repos_success = All repositories have done garbage collection successfully.
dashboard.resync_all_sshkeys = Rewrite '.ssh/autorized_key' file(caution: non-Gogs keys will be lost)
dashboard.resync_all_sshkeys = Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)
dashboard.resync_all_sshkeys_success = All public keys have been rewritten successfully. dashboard.resync_all_sshkeys_success = All public keys have been rewritten successfully.
dashboard.resync_all_update_hooks = Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success = All repositories' update hook have been rewritten successfully.

dashboard.server_uptime = Server Uptime dashboard.server_uptime = Server Uptime
dashboard.current_goroutine = Current Goroutines dashboard.current_goroutine = Current Goroutines
dashboard.current_memory_usage = Current Memory Usage dashboard.current_memory_usage = Current Memory Usage
[action] [action]
create_repo = created repository <a href="%s/%s">%s</a> create_repo = created repository <a href="%s/%s">%s</a>
commit_repo = pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a> commit_repo = pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>
create_issue = opened issue <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue = commented on issue <a href="%s/%s/issues/%s">%s#%s</a>
create_issue = `opened issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue = `commented on issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo = transfered repository <code>%s</code> to <a href="/%s%s">%s</a> transfer_repo = transfered repository <code>%s</code> to <a href="/%s%s">%s</a>
push_tag = pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a> push_tag = pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a>
compare_2_commits = View comparison for these 2 commits compare_2_commits = View comparison for these 2 commits

+ 5
- 2
conf/locale/locale_es-ES.ini View File

dashboard.git_gc_repos_success=Todos los repositorios han ejecutado correctamente el recolector de basuras. dashboard.git_gc_repos_success=Todos los repositorios han ejecutado correctamente el recolector de basuras.
dashboard.resync_all_sshkeys=Reescribir el fichero '.ssh/authorized_key'(atención: se perderán las claves que no pertenezcan a Gogs) dashboard.resync_all_sshkeys=Reescribir el fichero '.ssh/authorized_key'(atención: se perderán las claves que no pertenezcan a Gogs)
dashboard.resync_all_sshkeys_success=Todas las claves públicas se han reescrito correctamente. dashboard.resync_all_sshkeys_success=Todas las claves públicas se han reescrito correctamente.
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=Uptime del Servidor dashboard.server_uptime=Uptime del Servidor
dashboard.current_goroutine=Gorutinas Actuales dashboard.current_goroutine=Gorutinas Actuales
dashboard.current_memory_usage=Uso de Memoria Actual dashboard.current_memory_usage=Uso de Memoria Actual
[action] [action]
create_repo=created repository <a href="%s/%s">%s</a> create_repo=created repository <a href="%s/%s">%s</a>
commit_repo=pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a> commit_repo=pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>
create_issue=opened issue <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=commented on issue <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`opened issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`commented on issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=transfered repository <code>%s</code> to <a href="/%s%s">%s</a> transfer_repo=transfered repository <code>%s</code> to <a href="/%s%s">%s</a>
push_tag=pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a> push_tag=pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a>
compare_2_commits=View comparison for these 2 commits compare_2_commits=View comparison for these 2 commits

+ 10
- 15
conf/locale/locale_fr-CA.ini View File

run_user_helper=L'utilisateur doit avoir accès à la Racine du Référentiel et éxécuter Gogs. run_user_helper=L'utilisateur doit avoir accès à la Racine du Référentiel et éxécuter Gogs.
domain=Domaine domain=Domaine
domain_helper=Cela affecte les doublons d'URL SSH. domain_helper=Cela affecte les doublons d'URL SSH.
http_port=HTTP Port
http_port_helper=Port number which application will listen on.
app_url=URL de l'Application app_url=URL de l'Application
app_url_helper=Cela affecte les doublons d'URL HTTP/HTTPS et le contenu d'e-mail. app_url_helper=Cela affecte les doublons d'URL HTTP/HTTPS et le contenu d'e-mail.
email_title=Paramètres du Service de Messagerie (Facultatif) email_title=Paramètres du Service de Messagerie (Facultatif)
dashboard.delete_repo_archives_success=Toutes les archives de référentiels ont été supprimés avec succès. dashboard.delete_repo_archives_success=Toutes les archives de référentiels ont été supprimés avec succès.
dashboard.git_gc_repos=Collecter les déchets des référentiels dashboard.git_gc_repos=Collecter les déchets des référentiels
dashboard.git_gc_repos_success=Tous les référentiels ont effectué la collecte avec succès. dashboard.git_gc_repos_success=Tous les référentiels ont effectué la collecte avec succès.
dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)
dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=Durée de Marche Serveur dashboard.server_uptime=Durée de Marche Serveur
dashboard.current_goroutine=Goroutines actuelles dashboard.current_goroutine=Goroutines actuelles
dashboard.current_memory_usage=Utilisation Mémoire actuelle dashboard.current_memory_usage=Utilisation Mémoire actuelle
config.service_config=Configuration du Service config.service_config=Configuration du Service
config.register_email_confirm=Nécessite une confirmation par courriel config.register_email_confirm=Nécessite une confirmation par courriel
config.disable_register=Désactiver l'Enregistrement config.disable_register=Désactiver l'Enregistrement
config.show_registration_button=Show Register Button
config.require_sign_in_view=Connexion Obligatoire pour Visualiser config.require_sign_in_view=Connexion Obligatoire pour Visualiser
config.mail_notify=Mailer les Notifications config.mail_notify=Mailer les Notifications
config.enable_cache_avatar=Activer le Cache d'Avatar config.enable_cache_avatar=Activer le Cache d'Avatar
[action] [action]
create_repo=a crée le Référentiel <a href="%s/%s">%s</a> create_repo=a crée le Référentiel <a href="%s/%s">%s</a>
commit_repo=a soumis à <a href="%s/%s/src/%s">%s</a> chez <a href="%s/%s">%s</a> commit_repo=a soumis à <a href="%s/%s/src/%s">%s</a> chez <a href="%s/%s">%s</a>
create_issue=a ouvert un problème <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=a commenté le problème <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`a ouvert un problème <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`a commenté le problème <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=a transféré le Référentiel <code>%s</code> à <a href="/%s%s">%s</a> transfer_repo=a transféré le Référentiel <code>%s</code> à <a href="/%s%s">%s</a>
push_tag=a tagé <a href="%s/%s/src/%s">%s</a> à <a href="%s/%s">%s</a> push_tag=a tagé <a href="%s/%s/src/%s">%s</a> à <a href="%s/%s">%s</a>
compare_2_commits=Comparer ces 2 commissions compare_2_commits=Comparer ces 2 commissions
raw_seconds=secondes raw_seconds=secondes
raw_minutes=minutes raw_minutes=minutes

+ 5
- 2
conf/locale/locale_ja-JP.ini View File

dashboard.git_gc_repos_success=すべてのリポジトリは正常にガベージ コレクションを行いました。 dashboard.git_gc_repos_success=すべてのリポジトリは正常にガベージ コレクションを行いました。
dashboard.resync_all_sshkeys='.ssh/ autorized_key' ファイルを再生成します。(警告:Gogsキー以外は失われます) dashboard.resync_all_sshkeys='.ssh/ autorized_key' ファイルを再生成します。(警告:Gogsキー以外は失われます)
dashboard.resync_all_sshkeys_success=すべての公開鍵が正常に書き換えられました。 dashboard.resync_all_sshkeys_success=すべての公開鍵が正常に書き換えられました。
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=サーバーの稼働時間 dashboard.server_uptime=サーバーの稼働時間
dashboard.current_goroutine=現在のGoroutine dashboard.current_goroutine=現在のGoroutine
dashboard.current_memory_usage=現在のメモリ使用量 dashboard.current_memory_usage=現在のメモリ使用量
[action] [action]
create_repo=リポジトリ <a href="%s/%s"> %s</a>を作成しました create_repo=リポジトリ <a href="%s/%s"> %s</a>を作成しました
commit_repo=<a href="%s/%s">%s</a>を<a href="%s/%s/src/%s">%s</a>にプッシュしました commit_repo=<a href="%s/%s">%s</a>を<a href="%s/%s/src/%s">%s</a>にプッシュしました
create_issue=問題 <a href="%s/%s/issues/%s"> %s #%s</a> を開きました
comment_issue=問題 <a href="%s/%s/issues/%s"> %s #%s</a> のコメント
create_issue=`問題 <a href="%s/issues/%s">%[1]s#%[2]s</a> を開きました`
comment_issue=`問題 <a href="%s/issues/%s">%[1]s#%[2]s</a> のコメント`
transfer_repo=リポジトリ <code>%s</code> を <a href="/%s%s">%s</a> へ転送しました transfer_repo=リポジトリ <code>%s</code> を <a href="/%s%s">%s</a> へ転送しました
push_tag=<a href="%s/%s">%s</a> に タグ <a href="%s/%s/src/%s">%s</a> をプッシュしました push_tag=<a href="%s/%s">%s</a> に タグ <a href="%s/%s/src/%s">%s</a> をプッシュしました
compare_2_commits=これら 2 のコミットの比較を閲覧する compare_2_commits=これら 2 のコミットの比較を閲覧する

+ 5
- 2
conf/locale/locale_lv-LV.ini View File

dashboard.git_gc_repos_success=Datu sakārtošana visiem repozitorijiem veiksmīgi pabeigta. dashboard.git_gc_repos_success=Datu sakārtošana visiem repozitorijiem veiksmīgi pabeigta.
dashboard.resync_all_sshkeys=Pārrakstīt '.ssh/authorized_key' failu (brīdinājums: ne-Git atslēgas tiks pazaudētas) dashboard.resync_all_sshkeys=Pārrakstīt '.ssh/authorized_key' failu (brīdinājums: ne-Git atslēgas tiks pazaudētas)
dashboard.resync_all_sshkeys_success=Visas publiskās atslēgas tika veiksmīgi pārrakstītas. dashboard.resync_all_sshkeys_success=Visas publiskās atslēgas tika veiksmīgi pārrakstītas.
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=Servera darbības laiks dashboard.server_uptime=Servera darbības laiks
dashboard.current_goroutine=Izmantotās Gorutīnas dashboard.current_goroutine=Izmantotās Gorutīnas
dashboard.current_memory_usage=Pašreiz izmantotā atmiņa dashboard.current_memory_usage=Pašreiz izmantotā atmiņa
[action] [action]
create_repo=izveidoja repozitoriju <a href="%s/%s">%s</a> create_repo=izveidoja repozitoriju <a href="%s/%s">%s</a>
commit_repo=veica izmaiņu nosūtīšanu atzaram <a href="%s/%s/src/%s">%s</a> repozitorijā <a href="%s/%s">%s</a> commit_repo=veica izmaiņu nosūtīšanu atzaram <a href="%s/%s/src/%s">%s</a> repozitorijā <a href="%s/%s">%s</a>
create_issue=reģistrēja problēmu <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=pievienoja komentāru problēmai <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`reģistrēja problēmu <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`pievienoja komentāru problēmai <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=mainīja repozitorija <code>%s</code> īpašnieku uz <a href="/%s%s">%s</a> transfer_repo=mainīja repozitorija <code>%s</code> īpašnieku uz <a href="/%s%s">%s</a>
push_tag=pievienoja tagu <a href="%s/%s/src/%s">%s</a> repozitorijam <a href="%s/%s">%s</a> push_tag=pievienoja tagu <a href="%s/%s/src/%s">%s</a> repozitorijam <a href="%s/%s">%s</a>
compare_2_commits=Veikt salīdzināšanu starp šīm 2 revīzijām compare_2_commits=Veikt salīdzināšanu starp šīm 2 revīzijām

+ 5
- 2
conf/locale/locale_nl-NL.ini View File

dashboard.git_gc_repos_success=Garbage collectie met succes uitgevoerd. dashboard.git_gc_repos_success=Garbage collectie met succes uitgevoerd.
dashboard.resync_all_sshkeys=Herschrijf '.ssh/authorized_keys' (Let op: alle sleutels die niet van Gogs zijn zullen verloren gaan!) dashboard.resync_all_sshkeys=Herschrijf '.ssh/authorized_keys' (Let op: alle sleutels die niet van Gogs zijn zullen verloren gaan!)
dashboard.resync_all_sshkeys_success=Alle publieke sleutels zijn herschreven. dashboard.resync_all_sshkeys_success=Alle publieke sleutels zijn herschreven.
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=Uptime server dashboard.server_uptime=Uptime server
dashboard.current_goroutine=Huidige Goroutines dashboard.current_goroutine=Huidige Goroutines
dashboard.current_memory_usage=Huidige geheugen gebruik dashboard.current_memory_usage=Huidige geheugen gebruik
[action] [action]
create_repo=repositorie aangemaakt in <a href="%s/%s">%s</a> create_repo=repositorie aangemaakt in <a href="%s/%s">%s</a>
commit_repo=push update naar <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a commit_repo=push update naar <a href="%s/%s/src/%s">%s</a> in <a href="%s/%s">%s</a
create_issue=opende issue in <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=reactie op issue <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`opende issue in <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`reactie op issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=repositorie verplaatst naar <code>%s</code> naar <a href="/%s%s">%s</a> transfer_repo=repositorie verplaatst naar <code>%s</code> naar <a href="/%s%s">%s</a>
push_tag=geduwd label <a href="%s/%s/src/%s"> %s</a> naar <a href="%s/%s"> %s</a> push_tag=geduwd label <a href="%s/%s/src/%s"> %s</a> naar <a href="%s/%s"> %s</a>
compare_2_commits=Weergave vergelijking voor deze 2 commits compare_2_commits=Weergave vergelijking voor deze 2 commits

+ 11
- 17
conf/locale/locale_ru-RU.ini View File

run_user_helper=У пользователя должен быть доступ к пути к корню репозитория и к запуску Gogs. run_user_helper=У пользователя должен быть доступ к пути к корню репозитория и к запуску Gogs.
domain=Домен domain=Домен
domain_helper=This affects SSH clone URLs. domain_helper=This affects SSH clone URLs.
http_port=HTTP Port
http_port_helper=Port number which application will listen on.
app_url=URL приложения app_url=URL приложения
app_url_helper=This affects HTTP/HTTPS clone URL and somewhere in e-mail. app_url_helper=This affects HTTP/HTTPS clone URL and somewhere in e-mail.
email_title=Настройки службы электронной почты (опционально) email_title=Настройки службы электронной почты (опционально)
init_readme=Создать репозиторий с файлом README.md init_readme=Создать репозиторий с файлом README.md
create_repo=Создание репозитория create_repo=Создание репозитория
default_branch=Ветка по умолчанию default_branch=Ветка по умолчанию
mirror_interval=Mirror Interval(hour)
mirror_interval=Mirror Interval (hour)
goget_meta=Go-Get Meta goget_meta=Go-Get Meta
goget_meta_helper=This repository will be <span class="label label-blue label-radius">Go-Getable</span> goget_meta_helper=This repository will be <span class="label label-blue label-radius">Go-Getable</span>
dashboard.delete_repo_archives_success=Все архивы репозиториев были успешно удалены. dashboard.delete_repo_archives_success=Все архивы репозиториев были успешно удалены.
dashboard.git_gc_repos=Выполнить сборку мусора на репозиториях dashboard.git_gc_repos=Выполнить сборку мусора на репозиториях
dashboard.git_gc_repos_success=Сборка мусора на всех репозиториях успешно выполнена. dashboard.git_gc_repos_success=Сборка мусора на всех репозиториях успешно выполнена.
dashboard.resync_all_sshkeys=Rewrite '.ssh/autorized_key' file (caution: non-Gogs keys will be lost)
dashboard.resync_all_sshkeys_success=All public keys have been rewritten successfully.
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=Время непрерывной работы сервера dashboard.server_uptime=Время непрерывной работы сервера
dashboard.current_goroutine=Current Goroutines dashboard.current_goroutine=Current Goroutines
dashboard.current_memory_usage=Текущее использование памяти dashboard.current_memory_usage=Текущее использование памяти
config.service_config=Service Configuration config.service_config=Service Configuration
config.register_email_confirm=Require E-mail Confirmation config.register_email_confirm=Require E-mail Confirmation
config.disable_register=Отключить регистрацию config.disable_register=Отключить регистрацию
config.show_registration_button = Показать Регистрация Кнопка
config.show_registration_button=Show Register Button
config.require_sign_in_view=Для просмотра необходима авторизация config.require_sign_in_view=Для просмотра необходима авторизация
config.mail_notify=Почтовые уведомления config.mail_notify=Почтовые уведомления
config.enable_cache_avatar=Кешировать аватар config.enable_cache_avatar=Кешировать аватар
[action] [action]
create_repo=создан репозиторий <a href="%s/%s"> %s</a> create_repo=создан репозиторий <a href="%s/%s"> %s</a>
commit_repo=pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a> commit_repo=pushed to <a href="%s/%s/src/%s">%s</a> at <a href="%s/%s">%s</a>
create_issue=opened issue <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=commented on issue <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`opened issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`commented on issue <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=transfered repository <code>%s</code> to <a href="/%s%s">%s</a> transfer_repo=transfered repository <code>%s</code> to <a href="/%s%s">%s</a>
push_tag=pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a> push_tag=pushed tag <a href="%s/%s/src/%s">%s</a> to <a href="%s/%s">%s</a>
compare_2_commits=View comparison for these 2 commits compare_2_commits=View comparison for these 2 commits
raw_seconds=seconds raw_seconds=seconds
raw_minutes=minutes raw_minutes=minutes

+ 5
- 2
conf/locale/locale_zh-CN.ini View File

dashboard.git_gc_repos_success=所有仓库垃圾回收成功! dashboard.git_gc_repos_success=所有仓库垃圾回收成功!
dashboard.resync_all_sshkeys=重新生成 '.ssh/autorized_key' 文件(警告:不是 Gogs 的密钥也会被删除) dashboard.resync_all_sshkeys=重新生成 '.ssh/autorized_key' 文件(警告:不是 Gogs 的密钥也会被删除)
dashboard.resync_all_sshkeys_success=所有公钥重新生成成功! dashboard.resync_all_sshkeys_success=所有公钥重新生成成功!
dashboard.resync_all_update_hooks=重新生成所有仓库的 Update 钩子(用于自定义配置文件被修改)
dashboard.resync_all_update_hooks_success=所有仓库的 Update 钩子重新生成成功!
dashboard.server_uptime=服务运行时间 dashboard.server_uptime=服务运行时间
dashboard.current_goroutine=当前 Goroutines 数量 dashboard.current_goroutine=当前 Goroutines 数量
dashboard.current_memory_usage=当前内存使用量 dashboard.current_memory_usage=当前内存使用量
[action] [action]
create_repo=创建了仓库 <a href="%s/%s">%s</a> create_repo=创建了仓库 <a href="%s/%s">%s</a>
commit_repo=推送了 <a href="%s/%s/src/%s">%s</a> 分支的代码到 <a href="%s/%s">%s</a> commit_repo=推送了 <a href="%s/%s/src/%s">%s</a> 分支的代码到 <a href="%s/%s">%s</a>
create_issue=创建了工单 <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=评论了工单 <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`创建了工单 <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`评论了工单 <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=将仓库 <code>%s</code> 转移至 <a href="/%s%s">%s</a> transfer_repo=将仓库 <code>%s</code> 转移至 <a href="/%s%s">%s</a>
push_tag=推送了标签 <a href="%s/%s/src/%s">%s</a> 到 <a href="%s/%s">%s</a> push_tag=推送了标签 <a href="%s/%s/src/%s">%s</a> 到 <a href="%s/%s">%s</a>
compare_2_commits=查看 2 次提交的内容对比 compare_2_commits=查看 2 次提交的内容对比

+ 5
- 2
conf/locale/locale_zh-HK.ini View File

dashboard.git_gc_repos_success=所有倉庫的垃圾回收已成功完成! dashboard.git_gc_repos_success=所有倉庫的垃圾回收已成功完成!
dashboard.resync_all_sshkeys=重新生成 '.ssh/autorized_key' 文件(警告:不是 Gogs 的密鑰也會被刪除) dashboard.resync_all_sshkeys=重新生成 '.ssh/autorized_key' 文件(警告:不是 Gogs 的密鑰也會被刪除)
dashboard.resync_all_sshkeys_success=所有公鑰重新生成成功! dashboard.resync_all_sshkeys_success=所有公鑰重新生成成功!
dashboard.resync_all_update_hooks=Rewrite all update hook of repositories (needed when custom config path is changed)
dashboard.resync_all_update_hooks_success=All repositories' update hook have been rewritten successfully.
dashboard.server_uptime=服務執行時間 dashboard.server_uptime=服務執行時間
dashboard.current_goroutine=當前 Goroutines 數量 dashboard.current_goroutine=當前 Goroutines 數量
dashboard.current_memory_usage=當前內存使用量 dashboard.current_memory_usage=當前內存使用量
[action] [action]
create_repo=創建了倉庫 <a href="%s/%s">%s</a> create_repo=創建了倉庫 <a href="%s/%s">%s</a>
commit_repo=推送了 <a href="%s/%s/src/%s">%s</a> 分支的代碼到 <a href="%s/%s">%s</a> commit_repo=推送了 <a href="%s/%s/src/%s">%s</a> 分支的代碼到 <a href="%s/%s">%s</a>
create_issue=創建了問題 <a href="%s/%s/issues/%s">%s#%s</a>
comment_issue=評論了問題 <a href="%s/%s/issues/%s">%s#%s</a>
create_issue=`創建了問題 <a href="%s/issues/%s">%[1]s#%[2]s</a>`
comment_issue=`評論了問題 <a href="%s/issues/%s">%[1]s#%[2]s</a>`
transfer_repo=將倉庫 <code>%s</code> 轉移至 <a href="/%s%s">%s</a> transfer_repo=將倉庫 <code>%s</code> 轉移至 <a href="/%s%s">%s</a>
push_tag=推送了標籤 <a href="%s/%s/src/%s">%s</a> 到 <a href="%s/%s">%s</a> push_tag=推送了標籤 <a href="%s/%s/src/%s">%s</a> 到 <a href="%s/%s">%s</a>
compare_2_commits=查看 2 次提交的內容對比 compare_2_commits=查看 2 次提交的內容對比

+ 1
- 2
gogs.go View File

"github.com/gogits/gogs/modules/setting" "github.com/gogits/gogs/modules/setting"
) )


const APP_VER = "0.5.13.0207 Beta"
const APP_VER = "0.5.13.0208 Beta"


func init() { func init() {
runtime.GOMAXPROCS(runtime.NumCPU()) runtime.GOMAXPROCS(runtime.NumCPU())
cmd.CmdWeb, cmd.CmdWeb,
cmd.CmdServ, cmd.CmdServ,
cmd.CmdUpdate, cmd.CmdUpdate,
cmd.CmdFix,
cmd.CmdDump, cmd.CmdDump,
cmd.CmdCert, cmd.CmdCert,
} }

+ 1
- 1
models/action.go View File

} }


func (a Action) GetRepoLink() string { func (a Action) GetRepoLink() string {
return path.Join(a.RepoUserName, a.RepoName)
return path.Join(setting.AppSubUrl, a.RepoUserName, a.RepoName)
} }


func (a Action) GetBranch() string { func (a Action) GetBranch() string {

+ 1
- 1
models/publickey.go View File



const ( const (
// "### autogenerated by gitgos, DO NOT EDIT\n" // "### autogenerated by gitgos, DO NOT EDIT\n"
_TPL_PUBLICK_KEY = `command="%s serv --config=%s key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
_TPL_PUBLICK_KEY = `command="%s serv --config='%s' key-%d",no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty %s` + "\n"
) )


var ( var (

+ 17
- 12
models/repo.go View File

) )


const ( const (
TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update --config=%s $1 $2 $3\n"
_TPL_UPDATE_HOOK = "#!/usr/bin/env %s\n%s update --config='%s' $1 $2 $3\n"
) )


var ( var (
return nil return nil
} }


func createHookUpdate(hookPath, content string) error {
pu, err := os.OpenFile(hookPath, os.O_CREATE|os.O_WRONLY, 0777)
if err != nil {
return err
}
defer pu.Close()

_, err = pu.WriteString(content)
return err
func createHookUpdate(repoPath string) error {
return ioutil.WriteFile(path.Join(repoPath, "hooks/update"),
[]byte(fmt.Sprintf(_TPL_UPDATE_HOOK, setting.ScriptType, "\""+appPath+"\"", setting.CustomConf)), 0777)
} }


// InitRepository initializes README and .gitignore if needed. // InitRepository initializes README and .gitignore if needed.
} }


// hook/post-update // hook/post-update
if err := createHookUpdate(filepath.Join(repoPath, "hooks", "update"),
fmt.Sprintf(TPL_UPDATE_HOOK, setting.ScriptType, "\""+appPath+"\"", setting.CustomConf)); err != nil {
if err := createHookUpdate(repoPath); err != nil {
return err return err
} }


}) })
} }


// RewriteRepositoryUpdateHook rewrites all repositories' update hook.
func RewriteRepositoryUpdateHook() error {
return x.Where("id > 0").Iterate(new(Repository),
func(idx int, bean interface{}) error {
repo := bean.(*Repository)
if err := repo.GetOwner(); err != nil {
return err
}
return createHookUpdate(RepoPath(repo.Owner.Name, repo.Name))
})
}

var ( var (
// Prevent duplicate tasks. // Prevent duplicate tasks.
isMirrorUpdating = false isMirrorUpdating = false

+ 4
- 0
routers/admin/admin.go View File

CLEAN_REPO_ARCHIVES CLEAN_REPO_ARCHIVES
GIT_GC_REPOS GIT_GC_REPOS
SYNC_SSH_AUTHORIZED_KEY SYNC_SSH_AUTHORIZED_KEY
SYNC_REPOSITORY_UPDATE_HOOK
) )


func Dashboard(ctx *middleware.Context) { func Dashboard(ctx *middleware.Context) {
case SYNC_SSH_AUTHORIZED_KEY: case SYNC_SSH_AUTHORIZED_KEY:
success = ctx.Tr("admin.dashboard.resync_all_sshkeys_success") success = ctx.Tr("admin.dashboard.resync_all_sshkeys_success")
err = models.RewriteAllPublicKeys() err = models.RewriteAllPublicKeys()
case SYNC_REPOSITORY_UPDATE_HOOK:
success = ctx.Tr("admin.dashboard.resync_all_update_hooks_success")
err = models.RewriteRepositoryUpdateHook()
} }


if err != nil { if err != nil {

+ 1
- 1
templates/.VERSION View File

0.5.13.0207 Beta
0.5.13.0208 Beta

+ 4
- 1
templates/admin/dashboard.tmpl View File

<td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}</td> <td>{{.i18n.Tr "admin.dashboard.resync_all_sshkeys"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=5">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td> <td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=5">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr> </tr>

<tr>
<td>{{.i18n.Tr "admin.dashboard.resync_all_update_hooks"}}</td>
<td><i class="fa fa-caret-square-o-right"></i> <a href="{{AppSubUrl}}/admin?op=6">{{.i18n.Tr "admin.dashboard.operation_run"}}</a></td>
</tr>
</tbody> </tbody>
</table> </table>
</div> </div>

+ 2
- 2
templates/user/dashboard/feeds.tmpl View File

{{$.i18n.Tr "action.commit_repo" AppSubUrl .GetRepoLink .GetBranch .GetBranch AppSubUrl .GetRepoLink .GetRepoLink | Str2html}} {{$.i18n.Tr "action.commit_repo" AppSubUrl .GetRepoLink .GetBranch .GetBranch AppSubUrl .GetRepoLink .GetRepoLink | Str2html}}
{{else if eq .GetOpType 6}} {{else if eq .GetOpType 6}}
{{ $index := index .GetIssueInfos 0}} {{ $index := index .GetIssueInfos 0}}
{{$.i18n.Tr "action.create_issue" AppSubUrl .GetRepoLink $index .GetRepoLink $index | Str2html}}
{{$.i18n.Tr "action.create_issue" .GetRepoLink $index | Str2html}}
{{else if eq .GetOpType 8}} {{else if eq .GetOpType 8}}
{{$.i18n.Tr "action.transfer_repo" .GetContent AppSubUrl .GetRepoLink .GetRepoLink | Str2html}} {{$.i18n.Tr "action.transfer_repo" .GetContent AppSubUrl .GetRepoLink .GetRepoLink | Str2html}}
{{else if eq .GetOpType 9}} {{else if eq .GetOpType 9}}
{{$.i18n.Tr "action.push_tag" AppSubUrl .GetRepoLink .GetBranch .GetBranch AppSubUrl .GetRepoLink .GetRepoLink | Str2html}} {{$.i18n.Tr "action.push_tag" AppSubUrl .GetRepoLink .GetBranch .GetBranch AppSubUrl .GetRepoLink .GetRepoLink | Str2html}}
{{else if eq .GetOpType 10}} {{else if eq .GetOpType 10}}
{{ $index := index .GetIssueInfos 0}} {{ $index := index .GetIssueInfos 0}}
{{$.i18n.Tr "action.comment_issue" AppSubUrl .GetRepoLink $index .GetRepoLink $index | Str2html}}
{{$.i18n.Tr "action.comment_issue" .GetRepoLink $index | Str2html}}
{{end}} {{end}}
</p> </p>
{{if eq .GetOpType 5}} {{if eq .GetOpType 5}}

Loading…
Cancel
Save