Skip to content

Commit 36fc363

Browse files
committed
Merge tag 'v1.10.0-rc1'
* BREAKING * Remove legacy handling of drone token (go-gitea#8191) * Change repo search to use exact match for topic search. (go-gitea#7941) * Add pagination for admin api get orgs and fix only list public orgs bug (go-gitea#7742) * Implement the ability to change the ssh port to match what is in the gitea config (go-gitea#7286) * FEATURE * Org/Members: display 2FA members states + optimize sql requests (go-gitea#7621) * SetDefaultBranch on pushing to empty repository (go-gitea#7610) * Adds side-by-side diff for images (go-gitea#6784) * API method to list all commits of a repository (go-gitea#6408) * Password Complexity Checks (go-gitea#6230) * Add option to initialize repository with labels (go-gitea#6061) * Add additional password hash algorithms (go-gitea#6023) * BUGFIXES * Fix errors in create org UI regarding team access permission (go-gitea#8506) * Fix bug on FindExternalUsersByProvider (go-gitea#8504) * Create .ssh dir as necessary (go-gitea#8486) * IsBranchExist: return false if provided name is empty (go-gitea#8485) * Making openssh listen on SSH_LISTEN_PORT not SSH_PORT (go-gitea#8477) * Add check for empty set when dropping indexes during migration (go-gitea#8471) * LFS files are relative to LFS content path, ensure that when deleting they are made relative to this (go-gitea#8455) * Ensure Request Body Readers are closed in LFS server (go-gitea#8454) * Fix template bug on mirror repository setting page (go-gitea#8438) * Fix migration v96 to keep issue attachments (go-gitea#8435) * Update strk.kbt.io/projects/go/libravatar to latest (go-gitea#8429) * Singular form for files that has only one line (go-gitea#8416) * Check for either escaped or unescaped wiki filenames (go-gitea#8408) * Allow users with explicit read access to give approvals (go-gitea#8382) * Fix editor commit to new branch if PR disabled (go-gitea#8375) * readd .markdown class to all markup renderers (go-gitea#8357) * Upgrade xorm to v0.7.9 to fix some bugs (go-gitea#8354) * Fix column name ambiguity in GetUserIssueStats() (go-gitea#8347) * Change general form binding to gogs form (go-gitea#8334) * Fix pull request commit status in user dashboard list (go-gitea#8321) * Fix repo_admin_change_team_access always checked in org settings (go-gitea#8319) * Update to github.com/lafriks/xormstore@v1.3.0 (go-gitea#8317) * Show correct commit status in PR list (go-gitea#8316) * Bugfix for image compare and minor improvements to image compare (go-gitea#8289) * Update xorm (go-gitea#8286) * Fix API for edit and delete release attachment (go-gitea#8285) * Fix nil object access in some conditions when parsing cross references (go-gitea#8281) * Fix label count (go-gitea#8267) * Only show teams access for organization repositories on collaboration setting page (go-gitea#8265) * Test more reserved usernames (go-gitea#8263) * Rewrite reference processing code in preparation for opening/closing from comment references (go-gitea#8261) * Fix assets key on release webhook (go-gitea#8253) * Allow registration when button is hidden (go-gitea#8237) * Fix release API URL generation (go-gitea#8234) * Fix milestone num_issues (go-gitea#8221) * MS Teams webhook misses commit messages (go-gitea#8209) * Fix data race (go-gitea#8204) * Fix team user api (go-gitea#8172) * Fix pull merge 500 error caused by git-fetch breaking behaviors (go-gitea#8161) * Make show private icon when repo avatar set (go-gitea#8144) * Add reviewers as participants (go-gitea#8121) * Fix Go 1.13 private repository go get issue (go-gitea#8112) * feat: highlight issue references with : (go-gitea#8101) * Make AllowedUsers configurable in sshd_config (go-gitea#8094) * Strict name matching for Repository.GetTagID() (go-gitea#8074) * Avoid ambiguity of branch/directory names for the git-diff-tree command (go-gitea#8066) * Add change title notification for issues (go-gitea#8061) * [ssh] fix the config specification in the authorized_keys template (go-gitea#8031) * Fix reading git notes from nested trees (go-gitea#8026) * Fixes synchronize tags to releases for repository - makes sure we are only getting tag refs (go-gitea#7990) * Fix adding default Telegram webhook (go-gitea#7972) * Run CORS handler first for /api routes (go-gitea#7967) * Abort synchronization from LDAP source if there is some error. (go-gitea#7960) * Fix wrong sender when send slack webhook (go-gitea#7918) * Fix bug when migrating a private repository (go-gitea#7917) * Evaluate emojis in commit messages in list view (go-gitea#7906) * Fix upload file type check (go-gitea#7890) * lfs/lock: round locked_at timestamp to second (go-gitea#7872) * fix non existent milestone with 500 error instead of 404 (go-gitea#7867) * gpg/bugfix: Use .ExpiredUnix.IsZero to display green color of forever valid gpg key (go-gitea#7846) * Fix duplicate call of webhook (go-gitea#7821) * Enable switching to a different source branch when PR already exists (go-gitea#7819) * Convert files to utf-8 for indexing (go-gitea#7814) * Do not fetch all refs in pull-request compare (go-gitea#7797) * Fix multiple bugs with statuses endpoints at API (go-gitea#7785) * Restore functionality for early gits (go-gitea#7775) * Fix Slack webhook fork message (go-gitea#7774) * Rewrite existing repo units if setting is not included in api body (go-gitea#7763) * Fix rename failed when rewrite public keys (go-gitea#7761) * Fix approvals counting (go-gitea#7757) * Add migration step to remove old repo_indexer_status orphaned records (go-gitea#7746) * Fix repo_index_status lingering when deleting a repository (go-gitea#7734) * Remove camel case tokenization from repo indexer (go-gitea#7733) * Fix milestone completness calculation when migrating (go-gitea#7725) * Regression: Include "executable" files in the index, as they are not necessarily … (go-gitea#7718) * Fixes indexed repos keeping outdated indexes when files grow too large (go-gitea#7712) * Skip non-regular files (e.g. submodules) on repo indexing (go-gitea#7711) * Fix dropTableColumns sqlite implementation (go-gitea#7710) * Update gopkg.in/src-d/go-git.v4 to v4.13.1 (go-gitea#7705) * improve branches list performance and fix protected branch icon when no-login (go-gitea#7695) * Correct wrong datetime format for git (go-gitea#7689) * Move add to hook queue for created repo to outside xorm session. (go-gitea#7675) * sugestion to use range .Branches (go-gitea#7674) * Fix bug on migrating milestone from github (go-gitea#7665) * hide delete/restore button on archived repos (go-gitea#7658) * css: use flex to fix floating paginate (go-gitea#7656) * Fix syntax highlight initialization (go-gitea#7617) * Fix panic on push at - Merging pull request causes 500 error (go-gitea#7615) * Make PKCS8, PEM and SSH2 keys work (go-gitea#7600) * Fix mistake in arc-green.less split-diff css code. (go-gitea#7587) * Handle ErrUserProhibitLogin in http git (go-gitea#7586) * Fix bug create/edit wiki pages when code master branch protected (go-gitea#7580) * Fixes Malformed URLs in API git/commits response (go-gitea#7565) * Fix file header overflow in file and blame views (go-gitea#7562) * Improve SSH key parser to handle newlines in keys (go-gitea#7522) * Fix empty commits now showing in repo overview (go-gitea#7521) * Fix repository's pull request count error (go-gitea#7518) * Fix markdown invoke sequence (go-gitea#7513) * Remove duplicated webhook trigger (go-gitea#7511) * Update User.NumRepos atomically in createRepository (go-gitea#7493) * Fix settings page of repo you aren't admin print error - Settings pages giving UnitType error message (go-gitea#7482) * Fix redirection after file edit - Handles all redirects for Web UI File CRUD (go-gitea#7478) * cmd/serv: actually exit after fatal errors (go-gitea#7458) * Fix an issue with some pages throwing 'not defined' js exceptions (go-gitea#7450) * fix Dropzone.js integration (go-gitea#7445) * Fix regex for issues in commit messages (go-gitea#7444) * Diff: Fix indentation on unhighlighted code (go-gitea#7435) * Only show "New Pull Request" button if repo allows pulls (go-gitea#7426) * Upgrade macaron/captcha to fix random error problem (go-gitea#7407) * create class for inline positioned lists (go-gitea#7393) * Fetch refs for successful testing for tag (go-gitea#7388) * add missing template variable on organisation settings (go-gitea#7385) * fix post parameter - on issue list - unset assignee (go-gitea#7380) * fix/define autochecked checkboxes on issue list in firefox (go-gitea#7320) * only return head: null if source branch was deleted (go-gitea#6705) * ENHANCEMENT * Add nofollow to sign in links (go-gitea#8509) * vendor: update mvdan.cc/xurls/v2 to v2.1.0 (go-gitea#8495) * Update milestone issues numbers when save milestone and other code improvements (go-gitea#8411) * Add extra user information when migrating release (go-gitea#8331) * Require overall success if no context is given for status check (go-gitea#8318) * Transaction-aware retry create issue to cope with duplicate keys (go-gitea#8307) * Change link on issue milestone (go-gitea#8246) * Alwaywas return local url for users avatar (go-gitea#8245) * Move some milestone functions to a standalone package (go-gitea#8213) * Move create issue comment to comments package (go-gitea#8212) * Disable max height property of comment textarea (go-gitea#8203) * Add 'Mentioning you' group to /issues page (go-gitea#8201) * oauth2 with remote Gitea (go-gitea#8149) * Reference issues from pull requests and other issues (go-gitea#8137) * Fix webhooks to use proxy from environment (go-gitea#8116) * Add merged commit id on pull view when it's merged (go-gitea#8062) * Add teams to repo on collaboration page. (go-gitea#8045) * Update swagger to 0.20.1 (go-gitea#8010) * Make link last commit massages in repository home page and commit tables (go-gitea#8006) * Add API endpoint for accessing repo topics (go-gitea#7963) * Include description in repository search (go-gitea#7942) * Use gitea forked macaron (go-gitea#7933) * Fix pull creation with empty changes (go-gitea#7920) * Allow token as authorization for accessing attachments (go-gitea#7909) * Retry create issue to cope with duplicate keys (go-gitea#7898) * Move git diff codes from models to services/gitdiff (go-gitea#7889) * migrate gplus to google oauth2 provider (go-gitea#7885) * Remove unique filter from repo indexer analyzer. (go-gitea#7878) * Detect delimiter in CSV rendering (go-gitea#7869) * Import topics during migration (go-gitea#7851) * Move CreateReview to modules/pull (go-gitea#7841) * vendor: update pdf.js to v2.1.266 (go-gitea#7834) * Support SSH_LISTEN_PORT env var in docker app.ini template (go-gitea#7829) * Add Ability for User to Customize Email Notification Frequency (go-gitea#7813) * Move database settings from models to setting (go-gitea#7806) * Display ui time with customize time location (go-gitea#7792) * Implement webhook branch filter (go-gitea#7791) * Restrict repository indexing by glob match (go-gitea#7767) * Api: advanced settings for repository (external wiki, issue tracker etc.) (go-gitea#7756) * Update migrated repositories' issues/comments/prs poster id if user has a github external user saved (go-gitea#7751) * deps: Upgrade gopkg.in/editorconfig/editorconfig-core-go.v1 (go-gitea#7749) * Apply emoji on commit graph page (go-gitea#7743) * Add a lot of extension to language mappings for syntax highlights (go-gitea#7741) * Add SQL execution on log and indexes on table repository and comment (go-gitea#7740) * Set DB connection error level to error (go-gitea#7724) * Check commit message hashes before making links (go-gitea#7713) * remove unnecessary fmt on generate bindata (go-gitea#7706) * Fix specific highlighting (CMakeLists.txt ...) (go-gitea#7686) * Add file status on API (go-gitea#7671) * Add support for DEFAULT_ORG_MEMBER_VISIBLE (go-gitea#7669) * Provide links in commit summaries in commits table/view list (go-gitea#7659) * Change length of some repository's columns (go-gitea#7652) * Move commit repo action from models to repofiles package (go-gitea#7645) * fix wrong email when use gitea as OAuth2 provider (go-gitea#7640) * [Branch View] add download button (go-gitea#7604) * Update to xorm@v0.7.4 (go-gitea#7596) * use 403 instead of 401 for ErrUserProhibitLogin (go-gitea#7591) * Removed unnecessary conversions (go-gitea#7557) * Un-lambda base.FileSize (go-gitea#7556) * Added missing error checks in tests (go-gitea#7554) * Move create release from models to a standalone package (go-gitea#7539) * Make default branch name link to default branch (go-gitea#7519) * Added total count of contributions to heatmap (go-gitea#7517) * Move mirror to a standalone package from models (go-gitea#7486) * Move models.PushUpdate to repofiles.PushUpdate (go-gitea#7485) * Include thread related headers in issue/coment mail (go-gitea#7484) * Refuse merge until all required status checks success (go-gitea#7481) * convert all js var to let/const (go-gitea#7464) * Only create branches for opened pull requestes when migrating from github (go-gitea#7463) * jQuery 3 (go-gitea#7425) * Add notification placeholder (go-gitea#7409) * Search Commits via Commit Hash (go-gitea#7400) * Move status table to cron package (go-gitea#7370) * wiki - page revisions list (go-gitea#7369) * Display original author and URL information when showing migrated issues/comments (go-gitea#7352) * Refactor filetype is not allowed errors (go-gitea#7309) * switch to use gliderlabs/ssh for builtin server (go-gitea#7250) * Remove settting dependency on modules/session (go-gitea#7237) * Move all mail related codes from models to services/mailer (go-gitea#7200) * Support git.PATH entry in app.ini (go-gitea#6772) * Support setting cookie domain (go-gitea#6288) * Move migrating repository from frontend to backend (go-gitea#6200) * Delete releases attachments if release is deleted (go-gitea#6068) * SECURITY * Ignore mentions for users with no access (go-gitea#8395) * Be more strict with git arguments (go-gitea#7715) * reserve .well-known username (go-gitea#7637) * TRANSLATION * Latvian translation for home page (go-gitea#8468) * Add home template italian translation (go-gitea#8352) * fix misprint (go-gitea#7452) * BUILD * use go 1.13 (go-gitea#8088) * MISC * add file line count info on UI (go-gitea#8396) * Make issues page left menu 100% width and add reponame as title attribute (go-gitea#8359) * [arc-green] white on hover for active menu items (go-gitea#8344) * Move ref (branch or tag) location on issue list page (go-gitea#8157) * apply emoji on dashboard issue list labels (go-gitea#8156) * 1148: Take up the full width when viewing the diff in split view. (go-gitea#8114) * Display description of 'make this repo private' as help text, not as tooltip (go-gitea#8097) * Fixes deformed emoji in pull request reviews (go-gitea#8047) * Add strike to old header on comment (go-gitea#8046) * Add tooltip for the visibility checkbox in /repo/create (go-gitea#8025) * Update github.com/lafriks/xormstore and tidy up mod.go (go-gitea#8020) * keep blame view buttons sequence consistent with normal view when view a file (go-gitea#8007) * Use "Pull Request" instead of "Merge Request" (go-gitea#8003) * Move line number to :before attr to hide from search on browser (go-gitea#8002) * Changed black color to white for (read) number label on issue list page (go-gitea#8000) * [Branch View] show "New Pull Request" Button only if posible (go-gitea#7977) * Fix hook problem by only setting the git environment variables if we are passed them (go-gitea#7854) * Prevent Commit Status and Message From Overflowing On Branch Page (go-gitea#7800) * Fix global search result CSS, misc CSS tweaks (go-gitea#7789) * Tweak label border CSS (go-gitea#7739) * Fix create menu item widths (go-gitea#7708) * Extract the username and password from the mirror url (go-gitea#7651) * [Branch View] Delete duplicate protection symbol (go-gitea#7624) * [Branch View] Delete Table Header (go-gitea#7622) * [Branch View] icons to buttons (go-gitea#7602) * update js dependencies (go-gitea#7462) * Add Extra Info to Branches Page (go-gitea#7461) * Bump lodash from 4.17.11 to 4.17.14 (go-gitea#7459) * wiki history improvements (go-gitea#7391) * ui fixes - compare view and archieved repo issues (go-gitea#7345) * dark theme scrollbars (go-gitea#7269) * wiki - editor - add buttons 'inline code', 'empty checkbox', 'checked checkbox' (go-gitea#7243) * Fix Statuses API only shows first 10 statuses: Add paging and extend API GetCommitStatuses (go-gitea#7141)
2 parents 4320cba + db0d4ff commit 36fc363

File tree

138 files changed

+4646
-1196
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

138 files changed

+4646
-1196
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,4 @@ prime/
7979
*.snap
8080
*.snap-build
8181
*_source.tar.bz2
82+
.DS_Store

.golangci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ linters:
1919
disable-all: true
2020
fast: false
2121

22+
run:
23+
timeout: 3m
24+
2225
linters-settings:
2326
gocritic:
2427
disabled-checks:

CHANGELOG.md

+292-7
Large diffs are not rendered by default.

MAINTAINERS

+1
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,4 @@ silverwind <me@silverwind.io> (@silverwind)
3333
Gary Kim <gary@garykim.dev> (@gary-kim)
3434
Guillermo Prandi <gitea.maint@mailfilter.com.ar> (@guillep2k)
3535
Mura Li <typeless@ctli.io> (@typeless)
36+
6543 <6543@obermui.de> (@6543)

Makefile

+2-2
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,6 @@ pr:
518518
golangci-lint:
519519
@hash golangci-lint > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
520520
export BINARY="golangci-lint"; \
521-
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.18.0; \
521+
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin v1.20.0; \
522522
fi
523-
golangci-lint run --deadline=3m
523+
golangci-lint run

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
1111
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)
1212
[![Help Contribute to Open Source](https://www.codetriage.com/go-gitea/gitea/badges/users.svg)](https://www.codetriage.com/go-gitea/gitea)
13-
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/gitea)
13+
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea)
1414
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
15+
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)
1516

1617
## Purpose
1718

README_ZH.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
[![Go Report Card](https://goreportcard.com/badge/code.gitea.io/gitea)](https://goreportcard.com/report/code.gitea.io/gitea)
1010
[![GoDoc](https://godoc.org/code.gitea.io/gitea?status.svg)](https://godoc.org/code.gitea.io/gitea)
1111
[![GitHub release](https://img.shields.io/github/release/go-gitea/gitea.svg)](https://github.com/go-gitea/gitea/releases/latest)
12-
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backer&color=brightgreen)](https://opencollective.com/gitea)
12+
[![Become a backer/sponsor of gitea](https://opencollective.com/gitea/tiers/backers/badge.svg?label=backers&color=brightgreen)](https://opencollective.com/gitea)
1313
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
14+
[![Crowdin](https://badges.crowdin.net/gitea/localized.svg)](https://crowdin.com/project/gitea)
1415

1516
## 目标
1617

cmd/admin.go

+10-9
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import (
1313

1414
"code.gitea.io/gitea/models"
1515
"code.gitea.io/gitea/modules/auth/oauth2"
16-
"code.gitea.io/gitea/modules/generate"
1716
"code.gitea.io/gitea/modules/git"
1817
"code.gitea.io/gitea/modules/log"
18+
pwd "code.gitea.io/gitea/modules/password"
1919
"code.gitea.io/gitea/modules/setting"
2020

2121
"github.com/urfave/cli"
@@ -233,7 +233,9 @@ func runChangePassword(c *cli.Context) error {
233233
if err := initDB(); err != nil {
234234
return err
235235
}
236-
236+
if !pwd.IsComplexEnough(c.String("password")) {
237+
return errors.New("Password does not meet complexity requirements")
238+
}
237239
uname := c.String("username")
238240
user, err := models.GetUserByName(uname)
239241
if err != nil {
@@ -243,6 +245,7 @@ func runChangePassword(c *cli.Context) error {
243245
return err
244246
}
245247
user.HashPassword(c.String("password"))
248+
246249
if err := models.UpdateUserCols(user, "passwd", "salt"); err != nil {
247250
return err
248251
}
@@ -275,26 +278,24 @@ func runCreateUser(c *cli.Context) error {
275278
fmt.Fprintf(os.Stderr, "--name flag is deprecated. Use --username instead.\n")
276279
}
277280

278-
var password string
281+
if err := initDB(); err != nil {
282+
return err
283+
}
279284

285+
var password string
280286
if c.IsSet("password") {
281287
password = c.String("password")
282288
} else if c.IsSet("random-password") {
283289
var err error
284-
password, err = generate.GetRandomString(c.Int("random-password-length"))
290+
password, err = pwd.Generate(c.Int("random-password-length"))
285291
if err != nil {
286292
return err
287293
}
288-
289294
fmt.Printf("generated random password is '%s'\n", password)
290295
} else {
291296
return errors.New("must set either password or random-password flag")
292297
}
293298

294-
if err := initDB(); err != nil {
295-
return err
296-
}
297-
298299
// always default to true
299300
var changePassword = true
300301

custom/conf/app.ini.sample

+18-1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ MIN_PASSWORD_LENGTH = 6
332332
IMPORT_LOCAL_PATHS = false
333333
; Set to true to prevent all users (including admin) from creating custom git hooks
334334
DISABLE_GIT_HOOKS = false
335+
;Comma separated list of character classes required to pass minimum complexity.
336+
;If left empty or no valid values are specified, the default values (`lower,upper,digit,spec`) will be used.
337+
PASSWORD_COMPLEXITY = lower,upper,digit,spec
335338
; Password Hash algorithm, either "pbkdf2", "argon2", "scrypt" or "bcrypt"
336339
PASSWORD_HASH_ALGO = pbkdf2
337340
; Set false to allow JavaScript to read CSRF cookie
@@ -415,7 +418,7 @@ DEFAULT_ALLOW_CREATE_ORGANIZATION = true
415418
; Public is for everyone
416419
DEFAULT_ORG_VISIBILITY = public
417420
; Default value for DefaultOrgMemberVisible
418-
; True will make the membership of the users visible when added to the organisation
421+
; True will make the membership of the users visible when added to the organisation
419422
DEFAULT_ORG_MEMBER_VISIBLE = false
420423
; Default value for EnableDependencies
421424
; Repositories will use dependencies by default depending on this setting
@@ -692,6 +695,11 @@ SCHEDULE = @every 24h
692695
; or only create new users if UPDATE_EXISTING is set to false
693696
UPDATE_EXISTING = true
694697

698+
; Update migrated repositories' issues and comments' posterid, it will always attempt synchronization when the instance starts.
699+
[cron.update_migration_post_id]
700+
; Interval as a duration between each synchronization. (default every 24h)
701+
SCHEDULE = @every 24h
702+
695703
[git]
696704
; The path of git executable. If empty, Gitea searches through the PATH environment.
697705
PATH =
@@ -810,3 +818,12 @@ IS_INPUT_FILE = false
810818
ENABLED = false
811819
; If you want to add authorization, specify a token here
812820
TOKEN =
821+
822+
[task]
823+
; Task queue type, could be `channel` or `redis`.
824+
QUEUE_TYPE = channel
825+
; Task queue length, available only when `QUEUE_TYPE` is `channel`.
826+
QUEUE_LENGTH = 1000
827+
; Task queue connction string, available only when `QUEUE_TYPE` is `redis`.
828+
; If there is a password of redis, use `addrs=127.0.0.1:6379 password=123 db=0`.
829+
QUEUE_CONN_STR = "addrs=127.0.0.1:6379 db=0"

docker/root/etc/s6/openssh/setup

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ fi
2626

2727
if [ -d /etc/ssh ]; then
2828
SSH_PORT=${SSH_PORT:-"22"} \
29+
SSH_LISTEN_PORT=${SSH_LISTEN_PORT:-"${SSH_PORT}"} \
2930
envsubst < /etc/templates/sshd_config > /etc/ssh/sshd_config
3031

3132
chmod 0644 /etc/ssh/sshd_config

docker/root/etc/templates/sshd_config

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Port ${SSH_PORT}
1+
Port ${SSH_LISTEN_PORT}
22
Protocol 2
33

44
AddressFamily any
@@ -30,4 +30,4 @@ AllowUsers ${USER}
3030
Banner none
3131
Subsystem sftp /usr/lib/ssh/sftp-server
3232

33-
AcceptEnv GIT_PROTOCOL
33+
AcceptEnv GIT_PROTOCOL

docs/content/doc/advanced/api-usage.en-us.md

+8
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,14 @@ curl -X POST "http://localhost:4000/api/v1/repos/test1/test1/issues" \
6868
As mentioned above, the token used is the same one you would use in
6969
the `token=` string in a GET request.
7070

71+
## API Guide:
72+
73+
API Reference guide is auto-generated by swagger and available on:
74+
`https://gitea.your.host/api/swagger`
75+
or on
76+
[gitea demo instance](https://try.gitea.io/api/swagger)
77+
78+
7179
## Listing your issued tokens via the API
7280

7381
As mentioned in

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+16
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,11 @@ Values containing `#` or `;` must be quoted using `` ` `` or `"""`.
208208
- `INTERNAL_TOKEN_URI`: **<empty>**: Instead of defining internal token in the configuration, this configuration option can be used to give Gitea a path to a file that contains the internal token (example value: `file:/etc/gitea/internal_token`)
209209
- `PASSWORD_HASH_ALGO`: **pbkdf2**: The hash algorithm to use \[pbkdf2, argon2, scrypt, bcrypt\].
210210
- `CSRF_COOKIE_HTTP_ONLY`: **true**: Set false to allow JavaScript to read CSRF cookie.
211+
- `PASSWORD_COMPLEXITY`: **lower,upper,digit,spec**: Comma separated list of character classes required to pass minimum complexity. If left empty or no valid values are specified, the default values will be used. Possible values are:
212+
- lower - use one or more lower latin characters
213+
- upper - use one or more upper latin characters
214+
- digit - use one or more digits
215+
- spec - use one or more special characters as ``][!"#$%&'()*+,./:;<=>?@\^_{|}~`-`` and space symbol.
211216

212217
## OpenID (`openid`)
213218

@@ -420,6 +425,10 @@ NB: You must `REDIRECT_MACARON_LOG` and have `DISABLE_ROUTER_LOG` set to `false`
420425
- `RUN_AT_START`: **true**: Run repository statistics check at start time.
421426
- `SCHEDULE`: **@every 24h**: Cron syntax for scheduling repository statistics check.
422427

428+
### Cron - Update Migration Poster ID (`cron.update_migration_post_id`)
429+
430+
- `SCHEDULE`: **@every 24h** : Interval as a duration between each synchronization, it will always attempt synchronization when the instance starts.
431+
423432
## Git (`git`)
424433

425434
- `PATH`: **""**: The path of git executable. If empty, Gitea searches through the PATH environment.
@@ -515,9 +524,16 @@ Two special environment variables are passed to the render command:
515524
- `GITEA_PREFIX_RAW`, which contains the current URL prefix in the `raw` path tree. To be used as prefix for image paths.
516525

517526
## Time (`time`)
527+
518528
- `FORMAT`: Time format to diplay on UI. i.e. RFC1123 or 2006-01-02 15:04:05
519529
- `DEFAULT_UI_LOCATION`: Default location of time on the UI, so that we can display correct user's time on UI. i.e. Shanghai/Asia
520530

531+
## Task (`task`)
532+
533+
- `QUEUE_TYPE`: **channel**: Task queue type, could be `channel` or `redis`.
534+
- `QUEUE_LENGTH`: **1000**: Task queue length, available only when `QUEUE_TYPE` is `channel`.
535+
- `QUEUE_CONN_STR`: **addrs=127.0.0.1:6379 db=0**: Task queue connection string, available only when `QUEUE_TYPE` is `redis`. If there redis needs a password, use `addrs=127.0.0.1:6379 password=123 db=0`.
536+
521537
## Other (`other`)
522538

523539
- `SHOW_FOOTER_BRANDING`: **false**: Show Gitea branding in the footer.

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

+12-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,11 @@ menu:
196196
### Cron - Repository Statistics Check (`cron.check_repo_stats`)
197197

198198
- `RUN_AT_START`: 是否启动时自动运行仓库统计。
199-
- `SCHEDULE`: 藏亏统计时的Cron 语法,比如:`@every 24h`.
199+
- `SCHEDULE`: 仓库统计时的Cron 语法,比如:`@every 24h`.
200+
201+
### Cron - Update Migration Poster ID (`cron.update_migration_post_id`)
202+
203+
- `SCHEDULE`: **@every 24h** : 每次同步的间隔时间。此任务总是在启动时自动进行。
200204

201205
## Git (`git`)
202206

@@ -241,9 +245,16 @@ IS_INPUT_FILE = false
241245
- IS_INPUT_FILE: 输入方式是最后一个参数为文件路径还是从标准输入读取。
242246

243247
## Time (`time`)
248+
244249
- `FORMAT`: 显示在界面上的时间格式。比如: RFC1123 或者 2006-01-02 15:04:05
245250
- `DEFAULT_UI_LOCATION`: 默认显示在界面上的时区,默认为本地时区。比如: Asia/Shanghai
246251

252+
## Task (`task`)
253+
254+
- `QUEUE_TYPE`: **channel**: 任务队列类型,可以为 `channel``redis`
255+
- `QUEUE_LENGTH`: **1000**: 任务队列长度,当 `QUEUE_TYPE``channel` 时有效。
256+
- `QUEUE_CONN_STR`: **addrs=127.0.0.1:6379 db=0**: 任务队列连接字符串,当 `QUEUE_TYPE``redis` 时有效。如果redis有密码,则可以 `addrs=127.0.0.1:6379 password=123 db=0`
257+
247258
## Other (`other`)
248259

249260
- `SHOW_FOOTER_BRANDING`: 为真则在页面底部显示Gitea的字样。

docs/content/doc/features/webhooks.en-us.md

+81-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@ menu:
1717

1818
Gitea supports web hooks for repository events. This can be found in the settings
1919
page `/:username/:reponame/settings/hooks`. All event pushes are POST requests.
20-
The two methods currently supported are Gitea and Slack.
20+
The methods currently supported are:
21+
22+
- Gitea
23+
- Gogs
24+
- Slack
25+
- Discord
26+
- Dingtalk
27+
- Telegram
28+
- Microsoft Teams
2129

2230
### Event information
2331

@@ -104,3 +112,75 @@ X-Gitea-Event: push
104112
}
105113
}
106114
```
115+
116+
### Example
117+
118+
This is an example of how to use webhooks to run a php script upon push requests to the repository.
119+
In your repository Settings, under Webhooks, Setup a Gitea webhook as follows:
120+
121+
- Target URL: http://mydomain.com/webhook.php
122+
- HTTP Method: POST
123+
- POST Content Type: application/json
124+
- Secret: 123
125+
- Trigger On: Push Events
126+
- Active: Checked
127+
128+
Now on your server create the php file webhook.php
129+
130+
```
131+
<?php
132+
133+
$secret_key = '123';
134+
135+
// check for POST request
136+
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
137+
error_log('FAILED - not POST - '. $_SERVER['REQUEST_METHOD']);
138+
exit();
139+
}
140+
141+
// get content type
142+
$content_type = isset($_SERVER['CONTENT_TYPE']) ? strtolower(trim($_SERVER['CONTENT_TYPE'])) : '';
143+
144+
if ($content_type != 'application/json') {
145+
error_log('FAILED - not application/json - '. $content_type);
146+
exit();
147+
}
148+
149+
// get payload
150+
$payload = trim(file_get_contents("php://input"));
151+
152+
if (empty($payload)) {
153+
error_log('FAILED - no payload');
154+
exit();
155+
}
156+
157+
// get header signature
158+
$header_signature = isset($_SERVER['HTTP_X_GITEA_SIGNATURE']) ? $_SERVER['HTTP_X_GITEA_SIGNATURE'] : '';
159+
160+
if (empty($header_signature)) {
161+
error_log('FAILED - header signature missing');
162+
exit();
163+
}
164+
165+
// calculate payload signature
166+
$payload_signature = hash_hmac('sha256', $payload, $secret_key, false);
167+
168+
// check payload signature against header signature
169+
if ($header_signature != $payload_signature) {
170+
error_log('FAILED - payload signature');
171+
exit();
172+
}
173+
174+
// convert json to array
175+
$decoded = json_decode($payload, true);
176+
177+
// check for json decode errors
178+
if (json_last_error() !== JSON_ERROR_NONE) {
179+
error_log('FAILED - json decode - '. json_last_error());
180+
exit();
181+
}
182+
183+
// success, do something
184+
```
185+
186+
There is a Test Delivery button in the webhook settings that allows to test the configuration as well as a list of the most Recent Deliveries.

docs/content/doc/help/seek-help.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ If you found a bug, please create an [issue on GitHub](https://github.com/go-git
3333

3434
## Chinese Support
3535

36-
Support for the Chinese language is provided at [gocn.io](https://gocn.io/topic/Gitea).
36+
Support for the Chinese language is provided at [gocn.vip](https://gocn.vip/topic/gitea).

docs/content/doc/help/seek-help.zh-cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ menu:
1818
如果您在使用或者开发过程中遇到问题,请到以下渠道咨询:
1919

2020
-[Github issue](https://github.com/go-gitea/gitea/issues)提问(因为项目维护人员来自世界各地,为保证沟通顺畅,请使用英文提问)
21-
- 中文问题到[gocn.io](https://gocn.io/topic/Gitea)提问
21+
- 中文问题到[gocn.vip](https://gocn.vip/topic/gitea)提问
2222
- 访问 [Discord server - 英文](https://discord.gg/NsatcWJ)
2323
- 加入 QQ群 328432459 获得进一步的支持

docs/content/doc/usage/https-support.md

+2
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ menu:
2020
Before you enable HTTPS, make sure that you have valid SSL/TLS certificates.
2121
You could use self-generated certificates for evaluation and testing. Please run `gitea cert --host [HOST]` to generate a self signed certificate.
2222

23+
If you are using Apache or nginx on the server, it's recommended to check the [reverse proxy guide]({{< relref "doc/usage/reverse-proxies.en-us.md" >}}).
24+
2325
To use Gitea's built-in HTTPS support, you must change your `app.ini` file:
2426

2527
```ini

go.mod

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ require (
120120
gopkg.in/src-d/go-git.v4 v4.13.1
121121
gopkg.in/stretchr/testify.v1 v1.2.2 // indirect
122122
gopkg.in/testfixtures.v2 v2.5.0
123-
mvdan.cc/xurls/v2 v2.0.0
124-
strk.kbt.io/projects/go/libravatar v0.0.0-20160628055650-5eed7bff870a
123+
mvdan.cc/xurls/v2 v2.1.0
124+
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
125125
xorm.io/builder v0.3.6
126126
xorm.io/core v0.7.2
127127
)

0 commit comments

Comments
 (0)