Browse Source

Merge branch 'develop' of github.com:gogits/gogs into feature/page_issues

pull/1393/head
Unknwon 9 years ago
parent
commit
54b58e988d
  1. 1
      cmd/cert.go
  2. 14
      cmd/serve.go
  3. 1
      conf/locale/locale_de-DE.ini
  4. 1
      conf/locale/locale_en-US.ini
  5. 1
      conf/locale/locale_es-ES.ini
  6. 1
      conf/locale/locale_fr-FR.ini
  7. 1
      conf/locale/locale_ja-JP.ini
  8. 1
      conf/locale/locale_lv-LV.ini
  9. 1
      conf/locale/locale_nl-NL.ini
  10. 1
      conf/locale/locale_pl-PL.ini
  11. 1
      conf/locale/locale_pt-BR.ini
  12. 1
      conf/locale/locale_ru-RU.ini
  13. 1
      conf/locale/locale_zh-CN.ini
  14. 1
      conf/locale/locale_zh-HK.ini
  15. 21
      docker/README.md
  16. 16
      docker/assemble_blocks.sh
  17. 15
      docker/blocks/docker_gogs/Dockerfile
  18. 20
      docker/blocks/docker_gogs_dev/Dockerfile
  19. 0
      docker/blocks/option_cache_memcache/docker-compose
  20. 0
      docker/blocks/option_cache_redis/docker-compose
  21. 0
      docker/blocks/option_db_mysql/docker-compose
  22. 0
      docker/blocks/option_db_postgresql/docker-compose
  23. 0
      docker/blocks/option_session_mysql/docker-compose
  24. 0
      docker/blocks/w_cache/docker-compose
  25. 0
      docker/blocks/w_cache_session/docker-compose
  26. 0
      docker/blocks/w_db/docker-compose
  27. 0
      docker/blocks/w_db_cache/docker-compose
  28. 0
      docker/blocks/w_db_cache_session/docker-compose
  29. 0
      docker/blocks/w_db_session/docker-compose
  30. 0
      docker/blocks/w_none/docker-compose
  31. 0
      docker/blocks/w_session/docker-compose
  32. 7
      models/access.go
  33. 1
      modules/auth/admin.go
  34. 2
      modules/auth/user_form.go
  35. 2
      modules/base/markdown.go
  36. 2
      packager/debian/postinst
  37. 1
      routers/admin/users.go
  38. 1
      routers/repo/download.go
  39. 1
      routers/user/home.go
  40. 10
      scripts/build.sh
  41. 6
      scripts/init/debian/gogs
  42. 2
      scripts/init/freebsd/gogs
  43. 2
      scripts/systemd/gogs.service
  44. 4
      templates/admin/user/edit.tmpl
  45. 1
      templates/base/head.tmpl
  46. 1
      templates/base/head_old.tmpl
  47. 4
      templates/install.tmpl
  48. 1
      templates/ng/base/head.tmpl
  49. 5
      templates/repo/view_file.tmpl

1
cmd/cert.go

@ -114,6 +114,7 @@ func runCert(ctx *cli.Context) {
SerialNumber: serialNumber, SerialNumber: serialNumber,
Subject: pkix.Name{ Subject: pkix.Name{
Organization: []string{"Acme Co"}, Organization: []string{"Acme Co"},
CommonName: "Gogs",
}, },
NotBefore: notBefore, NotBefore: notBefore,
NotAfter: notAfter, NotAfter: notAfter,

14
cmd/serve.go

@ -82,7 +82,7 @@ func runServ(c *cli.Context) {
} }
if len(c.Args()) < 1 { if len(c.Args()) < 1 {
fail("Not enough arguments", "Not enough arugments") fail("Not enough arguments", "Not enough arguments")
} }
keys := strings.Split(c.Args()[0], "-") keys := strings.Split(c.Args()[0], "-")
@ -97,7 +97,7 @@ func runServ(c *cli.Context) {
user, err := models.GetUserByKeyId(keyId) user, err := models.GetUserByKeyId(keyId)
if err != nil { if err != nil {
fail("internal error", "Fail to get user by key ID(%d): %v", keyId, err) fail("internal error", "Failed to get user by key ID(%d): %v", keyId, err)
} }
cmd := os.Getenv("SSH_ORIGINAL_COMMAND") cmd := os.Getenv("SSH_ORIGINAL_COMMAND")
@ -113,7 +113,7 @@ func runServ(c *cli.Context) {
repoPath := strings.Trim(args, "'") repoPath := strings.Trim(args, "'")
rr := strings.SplitN(repoPath, "/", 2) rr := strings.SplitN(repoPath, "/", 2)
if len(rr) != 2 { if len(rr) != 2 {
fail("Invalid repository path", "Invalide repository path: %v", args) fail("Invalid repository path", "Invalid repository path: %v", args)
} }
repoUserName := rr[0] repoUserName := rr[0]
repoName := strings.TrimSuffix(rr[1], ".git") repoName := strings.TrimSuffix(rr[1], ".git")
@ -123,7 +123,7 @@ func runServ(c *cli.Context) {
if err == models.ErrUserNotExist { if err == models.ErrUserNotExist {
fail("Repository owner does not exist", "Unregistered owner: %s", repoUserName) fail("Repository owner does not exist", "Unregistered owner: %s", repoUserName)
} }
fail("Internal error", "Fail to get repository owner(%s): %v", repoUserName, err) fail("Internal error", "Failed to get repository owner(%s): %v", repoUserName, err)
} }
repo, err := models.GetRepositoryByName(repoUser.Id, repoName) repo, err := models.GetRepositoryByName(repoUser.Id, repoName)
@ -135,7 +135,7 @@ func runServ(c *cli.Context) {
fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, repoName) fail(_ACCESS_DENIED_MESSAGE, "Repository does not exist: %s/%s", repoUser.Name, repoName)
} }
} }
fail("Internal error", "Fail to get repository: %v", err) fail("Internal error", "Failed to get repository: %v", err)
} }
requestedMode, has := COMMANDS[verb] requestedMode, has := COMMANDS[verb]
@ -171,7 +171,7 @@ func runServ(c *cli.Context) {
gitcmd.Stdin = os.Stdin gitcmd.Stdin = os.Stdin
gitcmd.Stderr = os.Stderr gitcmd.Stderr = os.Stderr
if err = gitcmd.Run(); err != nil { if err = gitcmd.Run(); err != nil {
fail("Internal error", "Fail to execute git command: %v", err) fail("Internal error", "Failed to execute git command: %v", err)
} }
if requestedMode == models.ACCESS_MODE_WRITE { if requestedMode == models.ACCESS_MODE_WRITE {
@ -184,7 +184,7 @@ func runServ(c *cli.Context) {
err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId, err = models.Update(task.RefName, task.OldCommitId, task.NewCommitId,
user.Name, repoUserName, repoName, user.Id) user.Name, repoUserName, repoName, user.Id)
if err != nil { if err != nil {
log.GitLogger.Error(2, "Fail to update: %v", err) log.GitLogger.Error(2, "Failed to update: %v", err)
} }
} }

1
conf/locale/locale_de-DE.ini

@ -343,6 +343,7 @@ releases=Veröffentlichungen
file_raw=Roh file_raw=Roh
file_history=Verlauf file_history=Verlauf
file_view_raw=Ansicht Roh file_view_raw=Ansicht Roh
file_permalink=Permalink
commits.commits=Commits commits.commits=Commits
commits.search=Durchsuche Commits commits.search=Durchsuche Commits

1
conf/locale/locale_en-US.ini

@ -353,6 +353,7 @@ releases = Releases
file_raw = Raw file_raw = Raw
file_history = History file_history = History
file_view_raw = View Raw file_view_raw = View Raw
file_permalink = Permalink
commits.commits = Commits commits.commits = Commits
commits.search = Search commits commits.search = Search commits

1
conf/locale/locale_es-ES.ini

@ -343,6 +343,7 @@ releases=Releases
file_raw=Raw file_raw=Raw
file_history=Histórico file_history=Histórico
file_view_raw=Ver Raw file_view_raw=Ver Raw
file_permalink=Permalink
commits.commits=Commits commits.commits=Commits
commits.search=Buscar Commits commits.search=Buscar Commits

1
conf/locale/locale_fr-FR.ini

@ -343,6 +343,7 @@ releases=Publications
file_raw=Raw file_raw=Raw
file_history=Historique file_history=Historique
file_view_raw=Voir le Raw file_view_raw=Voir le Raw
file_permalink=Permalink
commits.commits=Commissions commits.commits=Commissions
commits.search=Rechercher des commissions commits.search=Rechercher des commissions

1
conf/locale/locale_ja-JP.ini

@ -343,6 +343,7 @@ releases=リリース
file_raw=生データ file_raw=生データ
file_history=履歴 file_history=履歴
file_view_raw=生データを見る file_view_raw=生データを見る
file_permalink=Permalink
commits.commits=コミット commits.commits=コミット
commits.search=コミットの検索 commits.search=コミットの検索

1
conf/locale/locale_lv-LV.ini

@ -341,6 +341,7 @@ releases=Laidieni
file_raw=Neapstrādāts file_raw=Neapstrādāts
file_history=Vēsture file_history=Vēsture
file_view_raw=Rādīt neapstrādātu file_view_raw=Rādīt neapstrādātu
file_permalink=Permalink
commits.commits=Revīzijas commits.commits=Revīzijas
commits.search=Meklēt revīzijas commits.search=Meklēt revīzijas

1
conf/locale/locale_nl-NL.ini

@ -343,6 +343,7 @@ releases=Publicaties
file_raw=Ruwe file_raw=Ruwe
file_history=Geschiedenis file_history=Geschiedenis
file_view_raw=Weergave ruwe file_view_raw=Weergave ruwe
file_permalink=Permalink
commits.commits=Commits commits.commits=Commits
commits.search=Zoeken commits.search=Zoeken

1
conf/locale/locale_pl-PL.ini

@ -343,6 +343,7 @@ releases=Wydania
file_raw=Czysty file_raw=Czysty
file_history=Historia file_history=Historia
file_view_raw=Zobacz czysty file_view_raw=Zobacz czysty
file_permalink=Permalink
commits.commits=Commity commits.commits=Commity
commits.search=Przeszukaj commity commits.search=Przeszukaj commity

1
conf/locale/locale_pt-BR.ini

@ -343,6 +343,7 @@ releases=Lançamentos
file_raw=Cru file_raw=Cru
file_history=Histórico file_history=Histórico
file_view_raw=Ver cru file_view_raw=Ver cru
file_permalink=Permalink
commits.commits=Commits commits.commits=Commits
commits.search=Pesquisar commits commits.search=Pesquisar commits

1
conf/locale/locale_ru-RU.ini

@ -343,6 +343,7 @@ releases=Релизы
file_raw=Исходник file_raw=Исходник
file_history=История file_history=История
file_view_raw=Посмотреть исходник file_view_raw=Посмотреть исходник
file_permalink=Permalink
commits.commits=Коммиты commits.commits=Коммиты
commits.search=Поиск коммитов commits.search=Поиск коммитов

1
conf/locale/locale_zh-CN.ini

@ -343,6 +343,7 @@ releases=版本发布
file_raw=原始文件 file_raw=原始文件
file_history=文件历史 file_history=文件历史
file_view_raw=查看原始文件 file_view_raw=查看原始文件
file_permalink=Permalink
commits.commits=次代码提交 commits.commits=次代码提交
commits.search=搜索提交历史 commits.search=搜索提交历史

1
conf/locale/locale_zh-HK.ini

@ -341,6 +341,7 @@ releases=版本發佈
file_raw=原始文件 file_raw=原始文件
file_history=文件歷史 file_history=文件歷史
file_view_raw=查看原始文件 file_view_raw=查看原始文件
file_permalink=Permalink
commits.commits=次代碼提交 commits.commits=次代碼提交
commits.search=搜索提交歷史 commits.search=搜索提交歷史

21
docker/README.md

@ -3,13 +3,13 @@ Docker
TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS! TOOLS ARE WRITTEN FOR TESTING AND TO SEE WHAT IT IS!
For this to work you will need the nifty docker tool [fig]. For this to work you will need the nifty docker tool [docker-compose].
The most simple setup will look like this: The most simple setup will look like this:
```sh ```sh
./assemble_blocks.sh docker_gogs w_db option_db_mysql ./assemble_blocks.sh docker_gogs w_db option_db_mysql
fig up docker-compose up
``` ```
@ -22,21 +22,21 @@ How does it work
---------------- ----------------
`./assemble_blocks.sh` will look in `blocks` for subdirectories. `./assemble_blocks.sh` will look in `blocks` for subdirectories.
In the subdirectories there are three relevant files: `Dockerfile`, `config` and `fig`. In the subdirectories there are three relevant files: `Dockerfile`, `config` and `docker-compose`.
`Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins). `Dockerfile` will be copied to `docker/` (also means last `Dockerfile` wins).
The `config` file contains lines which will in the gogs docker container end up in `$GOGS_PATH/custom/config/app.ini` and by this gogs will be configured. The `config` file contains lines which will in the gogs docker container end up in `$GOGS_PATH/custom/config/app.ini` and by this gogs will be configured.
Here you can define things like the MySQL server for your database block. Here you can define things like the MySQL server for your database block.
The `fig` file will just be added to `fig.yml`, which is used by fig to manage your containers. The `docker-compose` file will just be added to `docker-compose.yml`, which is used by docker-compose to manage your containers.
This includes container linking! This includes container linking!
Just have a look at them and it will be clear how to write your own blocks. Just have a look at them and it will be clear how to write your own blocks.
Just some things Just some things
- all files (`Dockerfile`, `fig` and `config`) are optional - all files (`Dockerfile`, `docker-compose` and `config`) are optional
- the gogs block should always be the first block - the gogs block should always be the first block
Currently the blocks are designed that, the blocks that start with `docker` pull in the base docker image. Currently the blocks are designed that, the blocks that start with `docker` pull in the base docker image.
@ -57,14 +57,11 @@ Here is a more elaborated example
```sh ```sh
./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql ./assemble_blocks.sh docker_gogs w_db_cache_session option_db_postgresql option_cache_redis option_session_mysql
fig up docker-compose up
``` ```
This will set up four containters and link them proberly. One for each of This will set up four containters and link them proberly. One for each of
docker-compose
- gogs
- database (postgresql)
- cache (redis)
- session (mysql) - session (mysql)
WARNING: This will not work at the Moment! MySQL session is broken! WARNING: This will not work at the Moment! MySQL session is broken!
@ -73,7 +70,7 @@ WARNING: This will not work at the Moment! MySQL session is broken!
Remark Remark
------ ------
After you execute `assemble_blocks.sh` you should always trigger `fig build` to inculde the the new init script `init_gogs.sh` in the docker image. After you execute `assemble_blocks.sh` you should always trigger `docker-compose build` to inculde the the new init script `init_gogs.sh` in the docker image.
If you want to use another GoGS docker file, but keep everything else the same, you can create a block, e.g. `docker_gogs_custom`, with only a `Dockerfile` and call If you want to use another GoGS docker file, but keep everything else the same, you can create a block, e.g. `docker_gogs_custom`, with only a `Dockerfile` and call
@ -86,4 +83,4 @@ This will pull in the `Dockerfile` from `docker_gogs` instead of the one from `d
`Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev` `Dockerfile`s for the `master` and `dev` branch are provided as `docker_gogs` and `docker_gogs_dev`
[fig]:http://www.fig.sh/ [docker-compose]:https://docs.docker.com/compose/

16
docker/assemble_blocks.sh

@ -10,8 +10,8 @@ gogs_config_file=conf.tmp
gogs_config=config gogs_config=config
gogs_init_file=$docker_dir/init_gogs.sh gogs_init_file=$docker_dir/init_gogs.sh
fig_file=fig.yml compose_file=docker-compose.yml
fig_config=fig compose_config=docker-compose
gogs_init_template=$template_dir/init_gogs.sh.tpl gogs_init_template=$template_dir/init_gogs.sh.tpl
@ -28,7 +28,7 @@ if [ "$#" == 0 ]; then
exit 0 exit 0
fi fi
for file in $gogs_config_file $fig_file; do for file in $gogs_config_file $compose_file; do
if [ -e $file ]; then if [ -e $file ]; then
echo "Deleting $file" echo "Deleting $file"
rm $file rm $file
@ -53,10 +53,10 @@ for dir in $@; do
echo "" >> $gogs_config_file echo "" >> $gogs_config_file
fi fi
if [ -e $current_dir/$fig_config ]; then if [ -e $current_dir/$compose_config ]; then
echo "Adding $current_dir/$fig_config to $fig_file" echo "Adding $current_dir/$compose_config to $compose_file"
cat $current_dir/fig >> $fig_file cat $current_dir/$compose_config >> $compose_file
echo "" >> $fig_file echo "" >> $compose_file
fi fi
done done
@ -69,4 +69,4 @@ d
if [ -e $gogs_config_file ]; then if [ -e $gogs_config_file ]; then
echo "Removing temporary GoGS config" echo "Removing temporary GoGS config"
rm $gogs_config_file rm $gogs_config_file
fi fi

15
docker/blocks/docker_gogs/Dockerfile

@ -1,23 +1,20 @@
FROM ubuntu:14.04 FROM buildpack-deps:trusty-scm
# This part is taken from the official docker image -------------------- # This part is taken from the official docker image --------------------
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
build-essential ca-certificates curl \ build-essential --no-install-recommends
bzr git mercurial openssh-client\
--no-install-recommends
ENV GOLANG_VERSION 1.3 ENV GOLANG_VERSION 1.3
RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
| tar -v -C /usr/src -xz | tar -v -C /usr/src -xz
WORKDIR /usr/src/go
RUN cd src && ./make.bash --no-clean 2>&1 RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
ENV PATH /usr/src/go/bin:$PATH ENV PATH /usr/src/go/bin:$PATH
RUN mkdir -p /go/src RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
ENV GOPATH /go ENV GOPATH /go
ENV PATH /go/bin:$PATH ENV PATH /go/bin:$PATH
WORKDIR /go WORKDIR /go

20
docker/blocks/docker_gogs_dev/Dockerfile

@ -1,24 +1,20 @@
FROM ubuntu:14.04 FROM buildpack-deps:trusty-scm
# This part is derived from the official docker image ------------------ # This part is taken from the official docker image --------------------
RUN DEBIAN_FRONTEND=noninteractive apt-get update && \ RUN apt-get update && apt-get install -y \
apt-get install -qy \ build-essential --no-install-recommends
build-essential ca-certificates curl \
bzr git mercurial openssh-client\
--no-install-recommends
ENV GOLANG_VERSION 1.3 ENV GOLANG_VERSION 1.3
RUN curl -sSL http://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \ RUN curl -sSL https://golang.org/dl/go$GOLANG_VERSION.src.tar.gz \
| tar -v -C /usr/src -xz | tar -v -C /usr/src -xz
WORKDIR /usr/src/go
RUN cd src && ./make.bash --no-clean 2>&1 RUN cd /usr/src/go/src && ./make.bash --no-clean 2>&1
ENV PATH /usr/src/go/bin:$PATH ENV PATH /usr/src/go/bin:$PATH
RUN mkdir -p /go/src RUN mkdir -p /go/src /go/bin && chmod -R 777 /go
ENV GOPATH /go ENV GOPATH /go
ENV PATH /go/bin:$PATH ENV PATH /go/bin:$PATH
WORKDIR /go WORKDIR /go

0
docker/blocks/option_cache_memcache/fig → docker/blocks/option_cache_memcache/docker-compose vendored

0
docker/blocks/option_cache_redis/fig → docker/blocks/option_cache_redis/docker-compose

0
docker/blocks/option_db_mysql/fig → docker/blocks/option_db_mysql/docker-compose

0
docker/blocks/option_db_postgresql/fig → docker/blocks/option_db_postgresql/docker-compose

0
docker/blocks/option_session_mysql/fig → docker/blocks/option_session_mysql/docker-compose

0
docker/blocks/w_cache/fig → docker/blocks/w_cache/docker-compose vendored

0
docker/blocks/w_cache_session/fig → docker/blocks/w_cache_session/docker-compose

0
docker/blocks/w_db/fig → docker/blocks/w_db/docker-compose

0
docker/blocks/w_db_cache/fig → docker/blocks/w_db_cache/docker-compose vendored

0
docker/blocks/w_db_cache_session/fig → docker/blocks/w_db_cache_session/docker-compose

0
docker/blocks/w_db_session/fig → docker/blocks/w_db_session/docker-compose

0
docker/blocks/w_none/fig → docker/blocks/w_none/docker-compose

0
docker/blocks/w_session/fig → docker/blocks/w_session/docker-compose

7
models/access.go

@ -173,13 +173,12 @@ func (repo *Repository) refreshCollaboratorAccesses(e Engine, accessMap map[int6
func (repo *Repository) recalculateTeamAccesses(e Engine, ignTeamID int64) (err error) { func (repo *Repository) recalculateTeamAccesses(e Engine, ignTeamID int64) (err error) {
accessMap := make(map[int64]AccessMode, 20) accessMap := make(map[int64]AccessMode, 20)
if err = repo.refreshCollaboratorAccesses(e, accessMap); err != nil {
return fmt.Errorf("refreshCollaboratorAccesses: %v", err)
}
if err = repo.getOwner(e); err != nil { if err = repo.getOwner(e); err != nil {
return err return err
} }
if err = repo.refreshCollaboratorAccesses(e, accessMap); err != nil {
return fmt.Errorf("refreshCollaboratorAccesses: %v", err)
}
if repo.Owner.IsOrganization() { if repo.Owner.IsOrganization() {
if err = repo.Owner.getTeams(e); err != nil { if err = repo.Owner.getTeams(e); err != nil {
return err return err

1
modules/auth/admin.go

@ -11,6 +11,7 @@ import (
) )
type AdminEditUserForm struct { type AdminEditUserForm struct {
FullName string `form:"fullname" binding:"MaxSize(100)"`
Email string `binding:"Required;Email;MaxSize(50)"` Email string `binding:"Required;Email;MaxSize(50)"`
Password string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"` Password string `binding:"OmitEmpty;MinSize(6);MaxSize(255)"`
Website string `binding:"MaxSize(50)"` Website string `binding:"MaxSize(50)"`

2
modules/auth/user_form.go

@ -116,7 +116,7 @@ func (f *AddEmailForm) Validate(ctx *macaron.Context, errs binding.Errors) bindi
} }
type ChangePasswordForm struct { type ChangePasswordForm struct {
OldPassword string `form:"old_password" binding:"Required;MinSize(6);MaxSize(255)"` OldPassword string `form:"old_password" binding:"Required;MinSize(1);MaxSize(255)"`
Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"` Password string `form:"password" binding:"Required;MinSize(6);MaxSize(255)"`
Retype string `form:"retype"` Retype string `form:"retype"`
} }

2
modules/base/markdown.go

@ -198,7 +198,7 @@ func RenderRawMarkdown(body []byte, urlPrefix string) []byte {
extensions |= blackfriday.EXTENSION_FENCED_CODE extensions |= blackfriday.EXTENSION_FENCED_CODE
extensions |= blackfriday.EXTENSION_AUTOLINK extensions |= blackfriday.EXTENSION_AUTOLINK
extensions |= blackfriday.EXTENSION_STRIKETHROUGH extensions |= blackfriday.EXTENSION_STRIKETHROUGH
extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK //extensions |= blackfriday.EXTENSION_HARD_LINE_BREAK
extensions |= blackfriday.EXTENSION_SPACE_HEADERS extensions |= blackfriday.EXTENSION_SPACE_HEADERS
extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK extensions |= blackfriday.EXTENSION_NO_EMPTY_LINE_BEFORE_BLOCK

2
packager/debian/postinst vendored

@ -18,8 +18,6 @@ case "$1" in
chown ${APP_USER}.${APP_GROUP} $(dirname ${APP_CONFIG}) chown ${APP_USER}.${APP_GROUP} $(dirname ${APP_CONFIG})
[ -f ${APP_CONFIG} ] || ${CLI} run cp conf/app.ini ${APP_CONFIG} [ -f ${APP_CONFIG} ] || ${CLI} run cp conf/app.ini ${APP_CONFIG}
${CLI} config:set USER=${APP_USER} ${CLI} config:set USER=${APP_USER}
PORT=$(${CLI} config:get PORT || echo "6000")
sed -i "s|HTTP_PORT = 3000|HTTP_PORT = ${PORT}|" ${APP_CONFIG}
sed -i "s|RUN_USER = git|RUN_USER = ${APP_USER}|" ${APP_CONFIG} sed -i "s|RUN_USER = git|RUN_USER = ${APP_USER}|" ${APP_CONFIG}
sed -i "s|RUN_MODE = dev|RUN_MODE = prod|" ${APP_CONFIG} sed -i "s|RUN_MODE = dev|RUN_MODE = prod|" ${APP_CONFIG}

1
routers/admin/users.go

@ -185,6 +185,7 @@ func EditUserPost(ctx *middleware.Context, form auth.AdminEditUserForm) {
u.EncodePasswd() u.EncodePasswd()
} }
u.FullName = form.FullName
u.Email = form.Email u.Email = form.Email
u.Website = form.Website u.Website = form.Website
u.Location = form.Location u.Location = form.Location

1
routers/repo/download.go

@ -27,7 +27,6 @@ func ServeBlob(ctx *middleware.Context, blob *git.Blob) error {
_, isTextFile := base.IsTextFile(buf) _, isTextFile := base.IsTextFile(buf)
_, isImageFile := base.IsImageFile(buf) _, isImageFile := base.IsImageFile(buf)
ctx.Resp.Header().Set("Content-Type", "text/plain")
if !isTextFile && !isImageFile { if !isTextFile && !isImageFile {
ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName)) ctx.Resp.Header().Set("Content-Disposition", "attachment; filename="+path.Base(ctx.Repo.TreeName))
ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary") ctx.Resp.Header().Set("Content-Transfer-Encoding", "binary")

1
routers/user/home.go

@ -152,6 +152,7 @@ func ShowSSHKeys(ctx *middleware.Context, uid int64) {
var buf bytes.Buffer var buf bytes.Buffer
for i := range keys { for i := range keys {
buf.WriteString(keys[i].OmitEmail()) buf.WriteString(keys[i].OmitEmail())
buf.WriteString("\n")
} }
ctx.RenderData(200, buf.Bytes()) ctx.RenderData(200, buf.Bytes())
} }

10
scripts/build.sh

@ -4,8 +4,14 @@ rm -rf $outPath
mkdir $outPath mkdir $outPath
go build ../gogs.go go build ../gogs.go
chmod +x gogs PLATFORM=`uname | cut -d _ -f 1`
mv gogs $outPath/ if [ $PLATFORM = "MINGW32" ] || [ $PLATFORM = "MINGW64" ] || [ $PLATFORM = "CYGWIN" ]; then
GOGS_EXE=gogs.exe
else
GOGS_EXE=gogs
fi
chmod +x $GOGS_EXE
mv $GOGS_EXE $outPath/
cp -r ../conf/ $outPath/conf/ cp -r ../conf/ $outPath/conf/
cp -r ../custom/ $outPath/custom/ cp -r ../custom/ $outPath/custom/

6
scripts/init/debian/gogs vendored

@ -49,10 +49,12 @@ do_start()
# 1 if daemon was already running # 1 if daemon was already running
# 2 if daemon could not be started # 2 if daemon could not be started
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\ sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
--exec $DAEMON -- $DAEMON_ARGS --test > /dev/null \\ --test --chdir $WORKINGDIR --chuid $USER \\
--exec $DAEMON -- $DAEMON_ARGS > /dev/null \\
|| return 1" || return 1"
sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\ sh -c "start-stop-daemon --start --quiet --pidfile $PIDFILE --make-pidfile \\
--background --exec /bin/su -- - $USER -c \"cd \\\"$WORKINGDIR\\\" && $DAEMON -- $DAEMON_ARGS\" \\ --background --chdir $WORKINGDIR --chuid $USER \\
--exec $DAEMON -- $DAEMON_ARGS \\
|| return 2" || return 2"
} }

2
scripts/init/freebsd/gogs

@ -21,7 +21,7 @@ load_rc_config $name
: ${gogs_enable:="NO"} : ${gogs_enable:="NO"}
: ${gogs_directory:="/home/git"} : ${gogs_directory:="/home/git"}
command="${gogs_directory}/scripts/start.sh" command="${gogs_directory}/gogs web"
pidfile="${gogs_directory}/${name}.pid" pidfile="${gogs_directory}/${name}.pid"

2
scripts/systemd/gogs.service

@ -14,7 +14,7 @@ Group=git
WorkingDirectory=/home/git/gogs WorkingDirectory=/home/git/gogs
ExecStart=/home/git/gogs/gogs web ExecStart=/home/git/gogs/gogs web
Restart=always Restart=always
Environment="USER=git","HOME=/home/git" Environment=USER=git HOME=/home/git
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

4
templates/admin/user/edit.tmpl

@ -32,6 +32,10 @@
<label>{{.i18n.Tr "username"}}</label> <label>{{.i18n.Tr "username"}}</label>
<label class="text-left">{{.User.Name}}</label> <label class="text-left">{{.User.Name}}</label>
</div> </div>
<div class="field">
<label for="full-name">{{.i18n.Tr "settings.full_name"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_FullName}}ipt-error{{end}}" id="full-name" name="fullname" type="text" value="{{.User.FullName}}" />
</div>
<div class="field"> <div class="field">
<label class="req" for="email">{{.i18n.Tr "email"}}</label> <label class="req" for="email">{{.i18n.Tr "email"}}</label>
<input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.User.Email}}" required/> <input class="ipt ipt-large ipt-radius {{if .Err_Email}}ipt-error{{end}}" id="email" name="email" type="email" value="{{.User.Email}}" required/>

1
templates/base/head.tmpl

@ -6,6 +6,7 @@
<meta name="author" content="Gogs - Go Git Service" /> <meta name="author" content="Gogs - Go Git Service" />
<meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" /> <meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" />
<meta name="keywords" content="go, git, self-hosted, gogs"> <meta name="keywords" content="go, git, self-hosted, gogs">
<meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="{{.CsrfToken}}" /> <meta name="_csrf" content="{{.CsrfToken}}" />
{{if .GoGetImport}} {{if .GoGetImport}}
<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}"> <meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">

1
templates/base/head_old.tmpl

@ -8,6 +8,7 @@
<meta name="author" content="Gogs - Go Git Service" /> <meta name="author" content="Gogs - Go Git Service" />
<meta name="description" content="Gogs(Go Git Service) is a GitHub-like clone in the Go Programming Language" /> <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="keywords" content="go, git">
<meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="{{.CsrfToken}}" /> <meta name="_csrf" content="{{.CsrfToken}}" />
{{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}} {{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}

4
templates/install.tmpl

@ -185,7 +185,7 @@
</div> </div>
<div class="inline field {{if .Err_AdminPasswd}}error{{end}}"> <div class="inline field {{if .Err_AdminPasswd}}error{{end}}">
<label for="admin_passwd">{{.i18n.Tr "install.admin_password"}}</label> <label for="admin_passwd">{{.i18n.Tr "install.admin_password"}}</label>
<input id="admin_passwd" name="admin_passwd" value="{{.admin_passwd}}"> <input id="admin_passwd" name="admin_passwd" type="password" value="{{.admin_passwd}}">
</div> </div>
<div class="inline field {{if .Err_AdminPasswd}}error{{end}}"> <div class="inline field {{if .Err_AdminPasswd}}error{{end}}">
<label for="admin_confirm_passwd">{{.i18n.Tr "install.confirm_password"}}</label> <label for="admin_confirm_passwd">{{.i18n.Tr "install.confirm_password"}}</label>
@ -208,4 +208,4 @@
</div> </div>
</div> </div>
</div> </div>
{{template "base/footer" .}} {{template "base/footer" .}}

1
templates/ng/base/head.tmpl

@ -6,6 +6,7 @@
<meta name="author" content="Gogs - Go Git Service" /> <meta name="author" content="Gogs - Go Git Service" />
<meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" /> <meta name="description" content="Gogs(Go Git Service) a painless self-hosted Git Service written in Go" />
<meta name="keywords" content="go, git, self-hosted, gogs"> <meta name="keywords" content="go, git, self-hosted, gogs">
<meta name="referrer" content="no-referrer" />
<meta name="_csrf" content="{{.CsrfToken}}" /> <meta name="_csrf" content="{{.CsrfToken}}" />
{{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}} {{if .GoGetImport}}<meta name="go-import" content="{{.GoGetImport}} git {{.CloneLink.HTTPS}}">{{end}}

5
templates/repo/view_file.tmpl

@ -12,6 +12,11 @@
<strong class="file-name">{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span> <strong class="file-name">{{.FileName}}</strong><span class="file-size">{{FileSize .FileSize}}</span>
{{end}} {{end}}
{{if not .ReadmeInList}} {{if not .ReadmeInList}}
{{if not .IsCommit}}
<a class="right" href="{{.RepoLink}}/src/{{.CommitId}}/{{.TreeName}}">
<button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_permalink"}}</button>
</a>
{{end}}
<a class="right" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{.TreeName}}"> <a class="right" href="{{.RepoLink}}/commits/{{EscapePound .BranchName}}/{{.TreeName}}">
<button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button> <button class="btn btn-medium btn-gray btn-right-radius btn-comb">{{.i18n.Tr "repo.file_history"}}</button>
</a> </a>

Loading…
Cancel
Save