Skip to content

Send tag create and push webhook when release created on UI #8325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 177 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
177 commits
Select commit Hold shift + click to select a range
70532b8
'update'
Sep 19, 2019
632f267
Merge branch 'master' of https://github.com/go-gitea/gitea
Sep 19, 2019
b2cfbe1
Send push tag event when release created
blueworrybear Sep 30, 2019
7bae9f3
Merge branch 'master' of https://github.com/go-gitea/gitea
blueworrybear Sep 30, 2019
b15aabd
send tag create event while release created in UI
blueworrybear Sep 30, 2019
15e5ac6
update to go v1.13
blueworrybear Oct 1, 2019
3f74da0
Merge with master, resolve service/release/release.go conflict
blueworrybear Oct 1, 2019
57146dc
fix gofmt error
blueworrybear Oct 1, 2019
cd1c960
typo fix (#8345)
helix84 Oct 1, 2019
3a7e3db
[skip ci] Updated translations via Crowdin
GiteaBot Oct 1, 2019
149758c
Update to github.com/lafriks/[email protected] (#8317)
sapk Oct 2, 2019
f889967
[arc-green] white on hover for active menu items (#8344)
spaeps Oct 2, 2019
90ab305
Api: advanced settings for repository (external wiki, issue tracker e…
davidsvantesson Oct 2, 2019
bcd4af4
Change general form binding to gogs form (#8334)
aamsur Oct 2, 2019
0d93430
[skip ci] Updated translations via Crowdin
GiteaBot Oct 2, 2019
e3eb9fa
Fix a comment typo (#8358)
Tekaoh Oct 2, 2019
3be43dc
[skip ci] Updated translations via Crowdin
GiteaBot Oct 2, 2019
c9f819e
Upgrade xorm to v0.7.9 to fix some bugs (#8354)
lunny Oct 2, 2019
cd13f27
Transaction-aware retry create issue to cope with duplicate keys (#8307)
guillep2k Oct 2, 2019
740a0c4
Fix column name ambiguity in GetUserIssueStats() (#8347)
guillep2k Oct 3, 2019
0bda876
Fix lfs locks (#8361)
guillep2k Oct 3, 2019
9543aea
readd .markdown class to all markup renderers (#8357)
noerw Oct 3, 2019
6ea7752
Cleanup https support code snippet (#8370)
8ctopus Oct 4, 2019
1a2d720
Make 100% width issues page left menu and add reponame as title attri…
Oct 4, 2019
ae93965
[skip ci] Updated translations via Crowdin
GiteaBot Oct 4, 2019
de8a0a3
Add buildbot CI (#8378)
camlafit Oct 4, 2019
f92a0b6
Bugfix for image compare and minor improvements to image compare (#8289)
saitho Oct 4, 2019
fb7c23f
Fix editor commit to new branch if PR disabled (#8375)
guillep2k Oct 5, 2019
bd41a04
Add extra user information when migrating release (#8331)
lunny Oct 5, 2019
8a82850
Doc config file should not be readable by others as it contains sensi…
8ctopus Oct 5, 2019
93e2ce6
Doc added instructions for Git LFS support (#8391)
8ctopus Oct 6, 2019
bc5a479
Add unix socket help (#8377)
thomas-mc-work Oct 6, 2019
51fade4
Fix milestone num_issues (#8221)
lunny Oct 6, 2019
08896cd
add file line count info on UI (#8396)
silverwind Oct 7, 2019
356e1a7
Reduce test sensibility (#8393)
guillep2k Oct 7, 2019
249dbbe
Update golangci to v1.19.1 (#8414)
kolaente Oct 7, 2019
af6cc5b
[skip ci] Updated translations via Crowdin
GiteaBot Oct 7, 2019
1b96c4a
Fix backers badge (#8399)
guillep2k Oct 7, 2019
662a40e
Update milestone issues numbers when save milestone and other code im…
lunny Oct 7, 2019
28d5347
Singular form for files that has only one line (#8416)
lafriks Oct 7, 2019
1a269f7
add 6543 to maintainers (#8417)
6543 Oct 8, 2019
78438d3
Fix issues/pr list broken when there are many repositories (#8409)
lunny Oct 8, 2019
170743c
Revert "Fix issues/pr list broken when there are many repositories (#…
lunny Oct 8, 2019
736ad8f
[skip ci] Updated translations via Crowdin
GiteaBot Oct 8, 2019
4843723
Allow users with explicit read access to give approvals (#8382)
guillep2k Oct 8, 2019
4fe04f1
[skip ci] Updated translations via Crowdin
GiteaBot Oct 8, 2019
f05a335
Update strk.kbt.io/projects/go/libravatar to latest; closes #7860 (#8…
guillep2k Oct 8, 2019
7408942
Update golangci to v1.20 (#8432)
kolaente Oct 8, 2019
a3612f9
Changelog for v1.9.4 (#8422) (#8433)
guillep2k Oct 9, 2019
3810fa4
[skip ci] Updated translations via Crowdin
GiteaBot Oct 9, 2019
dd611c9
Fix migration v96 to keep issue attachments (#8435)
guillep2k Oct 9, 2019
7ad46cc
fix template bug on mirror repository setting page (#8438)
lunny Oct 9, 2019
b661659
Check for either escaped or unescaped wiki filenames (#8408)
Tekaoh Oct 9, 2019
5109d18
[skip ci] Updated translations via Crowdin
GiteaBot Oct 9, 2019
e270896
Doc updated list of supported webhooks and added example (#8388)
8ctopus Oct 9, 2019
628f9da
Doc recommend to use reverse proxy if Apache/nginx is also running on…
8ctopus Oct 9, 2019
1fe81bc
add crowdin badge (#8447)
6543 Oct 10, 2019
eac5a8b
DOCS: add mention of swagger api reference (#8452)
borisovano Oct 10, 2019
7c1ddd5
[skip ci] Updated translations via Crowdin
GiteaBot Oct 10, 2019
57b0d9a
Add @yasarciv67 to TRANSLATORS file (#8451)
yasarciv Oct 10, 2019
df2c11a
Ignore mentions for users with no access (#8395)
guillep2k Oct 10, 2019
6551a9d
Ensure Request Body Readers are closed in LFS server (#8454)
zeripath Oct 10, 2019
9ff9f5a
Ensure that LFS files are relative to the LFS content path (#8455)
zeripath Oct 10, 2019
46a12f1
Move change issue title from models to issue service package (#8456)
lunny Oct 11, 2019
633cd7f
Add home template italian translation (#8352)
spaeps Oct 11, 2019
772241b
Latvian translation for home page (#8468)
lafriks Oct 11, 2019
ac3613b
[skip ci] Updated translations via Crowdin
GiteaBot Oct 11, 2019
5e759b6
Restore functionality for early gits (#7775)
zeripath Oct 12, 2019
f1fdd78
Add check for empty set when dropping indexes during migration (#8471)
guillep2k Oct 12, 2019
0a96e59
Fix #8453 by making openssh listen on SSH_LISTEN_PORT not SSH_PORT (#…
zeripath Oct 12, 2019
f2a3abc
Move migrating repository from frontend to backend (#6200)
lunny Oct 13, 2019
300d9a1
Fixes #8369: Create .ssh dir as necessary (#8486)
zeripath Oct 13, 2019
f858b89
[skip ci] Updated translations via Crowdin
GiteaBot Oct 13, 2019
c888ebf
IsBranchExist: return false if provided name is empty (#8485)
zeripath Oct 13, 2019
c23cf4c
[skip ci] Updated translations via Crowdin
GiteaBot Oct 13, 2019
ba71670
Update seek-help.en-us.md (#8487)
bkmgit Oct 13, 2019
0c680f3
[skip ci] Updated translations via Crowdin
GiteaBot Oct 13, 2019
6e3f510
Update seek-help.zh-cn.md (#8488)
bkmgit Oct 13, 2019
15809d8
Rewrite reference processing code in preparation for opening/closing …
guillep2k Oct 13, 2019
ba201aa
vendor: update mvdan.cc/xurls/v2 to v2.1.0 (#8495)
sapk Oct 14, 2019
e3e44a5
Update migrated repositories' issues/comments/prs poster id if user h…
lunny Oct 14, 2019
f9aba9b
fix bug on FindExternalUsersByProvider (#8504)
lunny Oct 14, 2019
db65719
Password Complexity Checks (#6230)
T-M-A Oct 14, 2019
8c8a93c
[skip ci] Updated translations via Crowdin
GiteaBot Oct 14, 2019
eb8975d
Add nofollow to sign in links (#8509)
guillep2k Oct 14, 2019
54c137b
[skip ci] Updated translations via Crowdin
GiteaBot Oct 14, 2019
366806d
Fix errors in create org UI regarding team access permission. (#8506)
davidsvantesson Oct 14, 2019
db0d4ff
Changelog for 1.10.0-RC1 (#8510)
6543 Oct 14, 2019
3083522
Starting v1.11.0 development
lafriks Oct 14, 2019
086bfb8
Add pagination to commit graph page (#8360)
Oct 14, 2019
b6ef539
[skip ci] Updated translations via Crowdin
GiteaBot Oct 14, 2019
0be992a
Make static resouces web browser cache time customized on app.ini (#8…
lunny Oct 14, 2019
733c898
[Branch View] Add Included TAG (#8449)
6543 Oct 14, 2019
8ad2697
Recalculate repository access only for specific user (#8481)
davidsvantesson Oct 15, 2019
cea8ea5
Support inline rendering of CUSTOM_URL_SCHEMES (#8496)
guillep2k Oct 15, 2019
ebe8ff7
Update config-cheat-sheet.en-us.md (#8497)
bkmgit Oct 15, 2019
34fb9d6
Move AddTestPullRequestTask to pull service package from models (#8324)
lunny Oct 15, 2019
20477a6
Move clearlabels from models to issue service (#8326)
lunny Oct 15, 2019
6fa14ac
Update app.ini.sample (#8498)
bkmgit Oct 15, 2019
1e9b330
Update CodeMirror to version 5.49.0 (#8381)
oscarlofwenhamn Oct 15, 2019
d7d348e
[UI] Pull Request Download diff Button (#8470)
6543 Oct 15, 2019
8c90982
Enable Uploading/Removing Attachments When Editing an Issue/Comment (…
blueworrybear Oct 15, 2019
4a290bd
[skip ci] Updated translations via Crowdin
GiteaBot Oct 15, 2019
167e8f1
Restore Graceful Restarting & Socket Activation (#7274)
zeripath Oct 15, 2019
9b9b67c
[skip ci] Updated translations via Crowdin
GiteaBot Oct 15, 2019
8065502
upgrade gopkg.in/ini.v1 (#8500)
carnott-snap Oct 15, 2019
66e99d7
upgrade gopkg.in/editorconfig/editorconfig-core-go.v1 (#8501)
carnott-snap Oct 15, 2019
31655aa
Fix password complexity regex for special characters (on master) (#8525)
guillep2k Oct 16, 2019
e1505d6
Add missed close in ServeBlobLFS (#8527)
zeripath Oct 16, 2019
0b44f0c
Update the provided gitea.service to mention socket activation (#8531)
zeripath Oct 16, 2019
1d9a1a0
Fix migrate mirror 500 bug (#8526)
lunny Oct 16, 2019
8edf3d5
Move sync mirror actions to mirror service package (#8518)
lunny Oct 16, 2019
50b66b6
[skip ci] Updated translations via Crowdin
GiteaBot Oct 16, 2019
8f0e63c
Doc added how to setup email (#8520)
8ctopus Oct 16, 2019
1b72690
Ensure that GitRepo is set on Empty repositories (#8539)
zeripath Oct 16, 2019
fcb535c
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#…
zeripath Oct 16, 2019
d4cd4ed
Restrict modules/graceful to non-windows build and shim the IsChild m…
zeripath Oct 16, 2019
de4f10b
Allow committing / adding empty files using the web ui (#8420) (#8532)
lukbukkit Oct 16, 2019
c748dee
don't ignore error message (#8550)
sapk Oct 17, 2019
c43feed
[skip ci] Updated translations via Crowdin
GiteaBot Oct 17, 2019
cf42cb0
Allow externalID to be UUID (#8551)
vizv Oct 17, 2019
ae13263
[skip ci] Updated translations via Crowdin
GiteaBot Oct 17, 2019
d151503
Upgrade xorm to v0.8.0 (#8536)
lunny Oct 17, 2019
115a1cc
Fix building from source docs to ref AppWorkPath (#8567)
zeripath Oct 17, 2019
37028f0
[skip ci] Updated translations via Crowdin
GiteaBot Oct 17, 2019
17c96ee
Allow more than 255 characters for tokens in external_login_user tabl…
vizv Oct 18, 2019
d44053e
[skip ci] Updated translations via Crowdin
GiteaBot Oct 18, 2019
7c4c01c
Fix review webhooks (#8570)
jolheiser Oct 18, 2019
fecd8f9
[skip ci] Updated translations via Crowdin
GiteaBot Oct 18, 2019
945f121
Fix bug on pull requests when transfer head repository (#8564)
lunny Oct 18, 2019
23045c7
[skip ci] Updated translations via Crowdin
GiteaBot Oct 18, 2019
05e437f
Remove arrows on numeric inputs (#8516)
FullofQuarks Oct 18, 2019
0a004a6
Improve webhooks (#8583)
jolheiser Oct 18, 2019
240f46a
Fix template error on account page (#8562)
jolheiser Oct 19, 2019
280f4be
Move issue label operations to issue service package (#8553)
lunny Oct 19, 2019
5a62ae5
Add setting to disable BASIC authentication (#8586)
zeripath Oct 19, 2019
b2b9bda
Fix #8582 by handling empty repos (#8587)
jonasfranz Oct 19, 2019
85609ef
Display Gitea logo in Readme (#8592)
sapk Oct 19, 2019
f37b87f
Improve german translation of homepage (#8549)
connyduck Oct 20, 2019
3b37969
move translation to crowdin (#8596)
6543 Oct 20, 2019
bcd9642
webhook: set Content-Type for application/x-www-form-urlencoded (#8599)
vszakats Oct 20, 2019
85e4190
[skip ci] Updated translations via Crowdin
GiteaBot Oct 20, 2019
2657e71
Basic Design guidelines (describing different parts of the code) (#8601)
davidsvantesson Oct 20, 2019
c8f3146
[skip ci] Updated translations via Crowdin
GiteaBot Oct 20, 2019
28f60bb
Ensure default gpg settings not nil and found commits have reference …
zeripath Oct 20, 2019
481c66a
Allows external rendering of other filetypes 2 (#8300)
HarvsG Oct 21, 2019
b539a6e
[skip ci] Updated translations via Crowdin
GiteaBot Oct 21, 2019
b1c1e15
Ensure that diff stats can scroll independently of the diff (#8581)
6543 Oct 21, 2019
0bfe5eb
Allow Protected Branches to Whitelist Deploy Keys (#8483)
zeripath Oct 21, 2019
bfdcedf
fix emoji panel be removed bug in issue page, when the sub issue summ…
palytoxin Oct 21, 2019
969a540
Add id references on all events to allow linking to it (#8608)
davidsvantesson Oct 21, 2019
41c7aa5
[skip ci] Updated translations via Crowdin
GiteaBot Oct 21, 2019
b59a905
Update heatmap fixtures to restore tests (#8615)
zeripath Oct 21, 2019
73f8069
[skip ci] Updated translations via Crowdin
GiteaBot Oct 21, 2019
d8161ee
Expose db.SetMaxOpenConns and allow non MySQL dbs to set conn pool pa…
zeripath Oct 21, 2019
2f9a66a
Prevent .code-view from overriding font on icon fonts (#8614)
zeripath Oct 21, 2019
d0c7a08
Correct some outdated statements in the contributing guidelines (#8612)
lukbukkit Oct 21, 2019
00629fe
[assets] configurable URL for static resources (#7911)
das7pad Oct 22, 2019
a41a965
[skip ci] Updated translations via Crowdin
GiteaBot Oct 22, 2019
fe41f71
Add SubURL to redirect path (#8632)
jolheiser Oct 22, 2019
3fe9646
Enabling and disabling the commit button to prevent empty commits (we…
lukbukkit Oct 23, 2019
2f10bfa
Fix extra columns from `label` table (#8633)
guillep2k Oct 23, 2019
b4b0e22
[skip ci] Updated translations via Crowdin
GiteaBot Oct 23, 2019
c2fca23
Docs: Added instructions for Docker fail2ban configuration. (#8642)
gnat Oct 23, 2019
7d1a7c0
[skip ci] Updated translations via Crowdin
GiteaBot Oct 23, 2019
f067e12
Graceful fixes (#8645)
zeripath Oct 23, 2019
637e321
[skip ci] Updated translations via Crowdin
GiteaBot Oct 23, 2019
dbd9d8d
Add 'Alt + click' feature to exclude labels (#8199)
Oct 23, 2019
3e61a96
Improve OGP (#8637)
jolheiser Oct 23, 2019
ace0346
[skip ci] Updated translations via Crowdin
GiteaBot Oct 23, 2019
22272fe
Make /users/{username}/repos list private repos the current user has …
7FM Oct 23, 2019
c84174b
Use AppSubUrl for more redirections (#8647)
zeripath Oct 23, 2019
ee7b153
Fix 500 when getting user as unauthenticated user (#8653)
emonty Oct 24, 2019
ab791fe
[skip ci] Updated translations via Crowdin
GiteaBot Oct 24, 2019
bd7709a
Hide some user information via API if user have no enough permission …
lunny Oct 24, 2019
3c63c3a
API should follow RequireSignInView (#8654)
lunny Oct 24, 2019
13bf498
Merge branch 'master' of https://github.com/blueworrybear/gitea
blueworrybear Oct 24, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,4 @@ prime/
*.snap
*.snap-build
*_source.tar.bz2
.DS_Store
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ linters:
disable-all: true
fast: false

run:
timeout: 3m

linters-settings:
gocritic:
disabled-checks:
Expand Down
299 changes: 292 additions & 7 deletions CHANGELOG.md

Large diffs are not rendered by default.

25 changes: 23 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
- [Translation](#translation)
- [Code review](#code-review)
- [Styleguide](#styleguide)
- [Design guideline](#design-guideline)
- [Developer Certificate of Origin (DCO)](#developer-certificate-of-origin-dco)
- [Release Cycle](#release-cycle)
- [Maintainers](#maintainers)
Expand Down Expand Up @@ -71,13 +72,15 @@ Here's how to run the test suite:

- Install the correct version of the drone-cli package. As of this
writing, the correct drone-cli version is
[1.1.0](https://docs.drone.io/cli/install/).
[1.2.0](https://docs.drone.io/cli/install/).
- Ensure you have enough free disk space. You will need at least
15-20 Gb of free disk space to hold all of the containers drone
creates (a default AWS or GCE disk size won't work -- see
[#6243](https://github.com/go-gitea/gitea/issues/6243)).
- Change into the base directory of your copy of the gitea repository,
and run `drone exec --event pull_request`.
- At the moment `drone exec` doesn't support the Docker Toolbox on Windows 10
(see [drone-cli#135](https://github.com/drone/drone-cli/issues/135))

The drone version, command line, and disk requirements do change over
time (see [#4053](https://github.com/go-gitea/gitea/issues/4053) and
Expand Down Expand Up @@ -118,6 +121,8 @@ An exception are the tools to build the CSS and images.
- To build Images: ImageMagick, inkscape and zopflipng binaries must be
available in your `PATH` to run `make generate-images`.

For more details on how to generate files, build and test Gitea, see the [hacking instructions](https://docs.gitea.io/en-us/hacking-on-gitea/)

## Code review

Changes to Gitea must be reviewed before they are accepted—no matter who
Expand Down Expand Up @@ -157,6 +162,22 @@ import (
)
```

## Design guideline

To maintain understandable code and avoid circular dependencies it is important to have a good structure of the code. The gitea code is divided into the following parts:

- **integration:** Integrations tests
- **models:** Contains the data structures used by xorm to construct database tables. It also contains supporting functions to query and update the database. Dependecies to other code in Gitea should be avoided although some modules might be needed (for example for logging).
- **models/fixtures:** Sample model data used in integration tests.
- **models/migrations:** Handling of database migrations between versions. PRs that changes a database structure shall also have a migration step.
- **modules:** Different modules to handle specific functionality in Gitea.
- **public:** Frontend files (javascript, images, css, etc.)
- **routers:** Handling of server requests. As it uses other Gitea packages to serve the request, other packages (models, modules or services) shall not depend on routers
- **services:** Support functions for common routing operations. Uses models and modules to handle the request.
- **templates:** Golang templates for generating the html output.
- **vendor:** External code that Gitea depends on.


## Developer Certificate of Origin (DCO)

We consider the act of contributing to the code by submitting a Pull
Expand Down Expand Up @@ -283,7 +304,7 @@ be reviewed by two maintainers and must pass the automatic tests.
* Add a tag as `git tag -s -F release.notes v$vmaj.$vmin.$`, release.notes file could be a temporary file to only include the changelog this version which you added to `CHANGELOG.md`.
* And then push the tag as `git push origin v$vmaj.$vmin.$`. Drone CI will automatically created a release and upload all the compiled binary. (But currently it didn't add the release notes automatically. Maybe we should fix that.)
* If needed send PR for changelog on branch `master`.
* Send PR to [blog repository](https://github.com/go-gitea/blog) announcing the release.
* Send PR to [blog repository](https://gitea.com/gitea/blog) announcing the release.

## Copyright

Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,4 @@ silverwind <[email protected]> (@silverwind)
Gary Kim <[email protected]> (@gary-kim)
Guillermo Prandi <[email protected]> (@guillep2k)
Mura Li <[email protected]> (@typeless)
6543 <[email protected]> (@6543)
8 changes: 6 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ fmt-check:
test:
GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' $(PACKAGES)

.PHONY: test\#%
test\#%:
GO111MODULE=on $(GO) test -mod=vendor -tags='sqlite sqlite_unlock_notify' -run $* $(PACKAGES)

.PHONY: coverage
coverage:
@hash gocovmerge > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
Expand Down Expand Up @@ -515,6 +519,6 @@ pr:
golangci-lint:
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
export BINARY="golangci-lint"; \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.18.0; \
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.20.0; \
fi
golangci-lint run --deadline=3m
golangci-lint run
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[简体中文](https://github.com/go-gitea/gitea/blob/master/README_ZH.md)

# Gitea - Git with a cup of tea
<h1> <img src="https://raw.githubusercontent.com/go-gitea/gitea/master/public/img/gitea-192.png" alt="logo" width="30" height="30"> Gitea - Git with a cup of tea</h1>

[![Build Status](https://drone.gitea.io/api/badges/go-gitea/gitea/status.svg)](https://drone.gitea.io/go-gitea/gitea)
[![Join the Discord chat at https://discord.gg/NsatcWJ](https://img.shields.io/discord/322538954119184384.svg)](https://discord.gg/NsatcWJ)
Expand All @@ -10,8 +10,9 @@
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)
[![Help Contribute to Open Source](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea)
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/gitea)
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)

## Purpose

Expand Down
3 changes: 2 additions & 1 deletion README_ZH.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/gitea)
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)

## 目标

Expand Down
19 changes: 10 additions & 9 deletions cmd/admin.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import (

"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth/oauth2"
"code.gitea.io/gitea/modules/generate"
"code.gitea.io/gitea/modules/git"
"code.gitea.io/gitea/modules/log"
pwd "code.gitea.io/gitea/modules/password"
"code.gitea.io/gitea/modules/setting"

"github.com/urfave/cli"
Expand Down Expand Up @@ -233,7 +233,9 @@ func runChangePassword(c *cli.Context) error {
if err := initDB(); err != nil {
return err
}

if !pwd.IsComplexEnough(c.String("password")) {
return errors.New("Password does not meet complexity requirements")
}
uname := c.String("username")
user, err := models.GetUserByName(uname)
if err != nil {
Expand All @@ -243,6 +245,7 @@ func runChangePassword(c *cli.Context) error {
return err
}
user.HashPassword(c.String("password"))

if err := models.UpdateUserCols(user, "passwd", "salt"); err != nil {
return err
}
Expand Down Expand Up @@ -275,26 +278,24 @@ func runCreateUser(c *cli.Context) error {
fmt.Fprintf(os.Stderr, "--name flag is deprecated. Use --username instead.\n")
}

var password string
if err := initDB(); err != nil {
return err
}

var password string
if c.IsSet("password") {
password = c.String("password")
} else if c.IsSet("random-password") {
var err error
password, err = generate.GetRandomString(c.Int("random-password-length"))
password, err = pwd.Generate(c.Int("random-password-length"))
if err != nil {
return err
}

fmt.Printf("generated random password is '%s'\n", password)
} else {
return errors.New("must set either password or random-password flag")
}

if err := initDB(); err != nil {
return err
}

// always default to true
var changePassword = true

Expand Down
2 changes: 2 additions & 0 deletions cmd/hook.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ func runHookPreReceive(c *cli.Context) error {
reponame := os.Getenv(models.EnvRepoName)
userID, _ := strconv.ParseInt(os.Getenv(models.EnvPusherID), 10, 64)
prID, _ := strconv.ParseInt(os.Getenv(models.ProtectedBranchPRID), 10, 64)
isDeployKey, _ := strconv.ParseBool(os.Getenv(models.EnvIsDeployKey))

buf := bytes.NewBuffer(nil)
scanner := bufio.NewScanner(os.Stdin)
Expand Down Expand Up @@ -98,6 +99,7 @@ func runHookPreReceive(c *cli.Context) error {
GitObjectDirectory: os.Getenv(private.GitObjectDirectory),
GitQuarantinePath: os.Getenv(private.GitQuarantinePath),
ProtectedBranchID: prID,
IsDeployKey: isDeployKey,
})
switch statusCode {
case http.StatusInternalServerError:
Expand Down
2 changes: 2 additions & 0 deletions cmd/serv.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,8 @@ func runServ(c *cli.Context) error {
os.Setenv(models.EnvPusherID, strconv.FormatInt(results.UserID, 10))
os.Setenv(models.ProtectedBranchRepoID, strconv.FormatInt(results.RepoID, 10))
os.Setenv(models.ProtectedBranchPRID, fmt.Sprintf("%d", 0))
os.Setenv(models.EnvIsDeployKey, fmt.Sprintf("%t", results.IsDeployKey))
os.Setenv(models.EnvKeyID, fmt.Sprintf("%d", results.KeyID))

//LFS token authentication
if verb == lfsAuthenticateVerb {
Expand Down
37 changes: 28 additions & 9 deletions cmd/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"os"
"strings"

"code.gitea.io/gitea/modules/graceful"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/routers"
Expand Down Expand Up @@ -75,17 +76,13 @@ func runLetsEncrypt(listenAddr, domain, directory, email string, m http.Handler)
}
go func() {
log.Info("Running Let's Encrypt handler on %s", setting.HTTPAddr+":"+setting.PortToRedirect)
var err = http.ListenAndServe(setting.HTTPAddr+":"+setting.PortToRedirect, certManager.HTTPHandler(http.HandlerFunc(runLetsEncryptFallbackHandler))) // all traffic coming into HTTP will be redirect to HTTPS automatically (LE HTTP-01 validation happens here)
// all traffic coming into HTTP will be redirect to HTTPS automatically (LE HTTP-01 validation happens here)
var err = runHTTP(setting.HTTPAddr+":"+setting.PortToRedirect, certManager.HTTPHandler(http.HandlerFunc(runLetsEncryptFallbackHandler)))
if err != nil {
log.Fatal("Failed to start the Let's Encrypt handler on port %s: %v", setting.PortToRedirect, err)
}
}()
server := &http.Server{
Addr: listenAddr,
Handler: m,
TLSConfig: certManager.TLSConfig(),
}
return server.ListenAndServeTLS("", "")
return runHTTPSWithTLSConfig(listenAddr, certManager.TLSConfig(), context2.ClearHandler(m))
}

func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {
Expand All @@ -101,12 +98,21 @@ func runLetsEncryptFallbackHandler(w http.ResponseWriter, r *http.Request) {
}

func runWeb(ctx *cli.Context) error {
if os.Getppid() > 1 && len(os.Getenv("LISTEN_FDS")) > 0 {
log.Info("Restarting Gitea on PID: %d from parent PID: %d", os.Getpid(), os.Getppid())
} else {
log.Info("Starting Gitea on PID: %d", os.Getpid())
}

// Set pid file setting
if ctx.IsSet("pid") {
setting.CustomPID = ctx.String("pid")
}

// Perform global initialization
routers.GlobalInit()

// Set up Macaron
m := routes.NewMacaron()
routes.RegisterRoutes(m)

Expand Down Expand Up @@ -164,6 +170,7 @@ func runWeb(ctx *cli.Context) error {
var err error
switch setting.Protocol {
case setting.HTTP:
NoHTTPRedirector()
err = runHTTP(listenAddr, context2.ClearHandler(m))
case setting.HTTPS:
if setting.EnableLetsEncrypt {
Expand All @@ -172,9 +179,15 @@ func runWeb(ctx *cli.Context) error {
}
if setting.RedirectOtherPort {
go runHTTPRedirector()
} else {
NoHTTPRedirector()
}
err = runHTTPS(listenAddr, setting.CertFile, setting.KeyFile, context2.ClearHandler(m))
case setting.FCGI:
NoHTTPRedirector()
// FCGI listeners are provided as stdin - this is orthogonal to the LISTEN_FDS approach
// in graceful and systemD
NoMainListener()
var listener net.Listener
listener, err = net.Listen("tcp", listenAddr)
if err != nil {
Expand All @@ -187,6 +200,10 @@ func runWeb(ctx *cli.Context) error {
}()
err = fcgi.Serve(listener, context2.ClearHandler(m))
case setting.UnixSocket:
// This could potentially be inherited using LISTEN_FDS but currently
// these cannot be inherited
NoHTTPRedirector()
NoMainListener()
if err := os.Remove(listenAddr); err != nil && !os.IsNotExist(err) {
log.Fatal("Failed to remove unix socket directory %s: %v", listenAddr, err)
}
Expand All @@ -207,8 +224,10 @@ func runWeb(ctx *cli.Context) error {
}

if err != nil {
log.Fatal("Failed to start server: %v", err)
log.Critical("Failed to start server: %v", err)
}

log.Info("HTTP Listener: %s Closed", listenAddr)
graceful.WaitForServers()
log.Close()
return nil
}
44 changes: 18 additions & 26 deletions cmd/web_graceful.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,36 +10,28 @@ import (
"crypto/tls"
"net/http"

"code.gitea.io/gitea/modules/log"

"github.com/facebookgo/grace/gracehttp"
"code.gitea.io/gitea/modules/graceful"
)

func runHTTP(listenAddr string, m http.Handler) error {
return gracehttp.Serve(&http.Server{
Addr: listenAddr,
Handler: m,
})
return graceful.HTTPListenAndServe("tcp", listenAddr, m)
}

func runHTTPS(listenAddr, certFile, keyFile string, m http.Handler) error {
config := &tls.Config{
MinVersion: tls.VersionTLS10,
}
if config.NextProtos == nil {
config.NextProtos = []string{"http/1.1"}
}

config.Certificates = make([]tls.Certificate, 1)
var err error
config.Certificates[0], err = tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
log.Fatal("Failed to load https cert file %s: %v", listenAddr, err)
}

return gracehttp.Serve(&http.Server{
Addr: listenAddr,
Handler: m,
TLSConfig: config,
})
return graceful.HTTPListenAndServeTLS("tcp", listenAddr, certFile, keyFile, m)
}

func runHTTPSWithTLSConfig(listenAddr string, tlsConfig *tls.Config, m http.Handler) error {
return graceful.HTTPListenAndServeTLSConfig("tcp", listenAddr, tlsConfig, m)
}

// NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
func NoHTTPRedirector() {
graceful.InformCleanup()
}

// NoMainListener tells our cleanup routine that we will not be using a possibly provided listener
// for our main HTTP/HTTPS service
func NoMainListener() {
graceful.InformCleanup()
}
Loading