Commit Graph

197 Commits

Author SHA1 Message Date
Lauris BH 3c45cf8494
Add detected file language to code search (#10256)
Move langauge detection to separate module to be more reusable

Add option to disable vendored file exclusion from file search

Allways show all language stats for search
2020-02-20 16:53:55 -03:00
John Olheiser dc822d5291
Re-order GPG signing docs and fix code blocks (#10349)
* Move chunk and format

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* word

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-02-19 02:23:45 +01:00
Mike Gerber a67630deb2
Fix cron.repo_health_check schedule example in config cheat sheet (#10324)
Fixes #10274.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-02-17 22:14:11 -05:00
Lunny Xiao 5dbf36f356
Issue search support elasticsearch (#9428)
* Issue search support elasticsearch

* Fix lint

* Add indexer name on app.ini

* add a warnning on SearchIssuesByKeyword

* improve code
2020-02-13 14:06:17 +08:00
techknowlogick 7791d904b4
Add note about which version embedded tool is implemented (#10255) 2020-02-12 14:30:48 -05:00
zeripath 2c903383b5
Add Unique Queue infrastructure and move TestPullRequests to this (#9856)
* Upgrade levelqueue to version 0.2.0

This adds functionality for Unique Queues

* Add UniqueQueue interface and functions to create them

* Add UniqueQueue implementations

* Move TestPullRequests over to use UniqueQueue

* Reduce code duplication

* Add bytefifos

* Ensure invalid types are logged

* Fix close race in PersistableChannelQueue Shutdown
2020-02-02 23:19:58 +00:00
guillep2k bcb52aef09
Implement "embedded" command to extract static resources (#9982)
* draft

* Implement extract command

* Fix nits and force args on extract

* Add !bindata stub, support Windows, fmt

* fix vendored flag

* Remove leading slash for matching

* Add docs

* Fix typos

* Add embedded view command

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-02-02 10:17:44 +08:00
Lunny Xiao ce7062a422
Cache last commit to accelerate the repository directory page visit (#10069)
* Cache last commit to accelerate the repository directory page visit

* Default use default cache configuration

* add tests for last commit cache

* Simplify last commit cache

* Revert Enabled back

* Change the last commit cache default ttl to 8760h

* Fix test
2020-02-01 19:11:32 +00:00
6543 159732dcb7
update (#10079) 2020-01-31 07:01:32 +02:00
zeripath 82a979707a
Update documentation for the go module era (#9751)
* Update documentation for the go module era

use go env instead of $GOPATH

Update instructions to just use git clone

Slight update to readme

Signed-off-by: Andrew Thornton <art27@cantab.net>

* fixup

* Apply suggestions from code review

Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com>
Co-Authored-By: Bagas Sanjaya <bagasdotme@gmail.com>

* Apply suggestions from code review

* Fix GOPATH settings

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Bagas Sanjaya <bagasdotme@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-01-28 21:30:02 -05:00
silverwind 1019913eab move CSS build to webpack (#9983)
- added new 'make webpack' target
- deprecated 'make js' and 'make css'
- extend webpack config to load the less files
- updated docs

I had to rename the source file of `arc-green.less` to avoid generating
a useless JS entrypoint via webpack-fix-style-only-entries which would
not work with different source/destination filenames. I hear that there
should be cleaner solutions possible once we upgrade to Webpack 5.

Co-authored-by: zeripath <art27@cantab.net>
2020-01-28 07:30:39 +00:00
zeripath c8d7ae1ee3
Make archive prefixing configurable with a global setting (#9943)
* Allow archive prefix setting

* Update copyright

* Update copyright
2020-01-22 23:46:46 +00:00
David Svantesson 9bc8413534 Add documentation how to render PlantUML in code blocks. (#9894)
* Add documentation how to render plantuml in code blocks.

* Review comments

* Apply suggestions from code review

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
2020-01-21 00:34:23 +01:00
zeripath d730725e5c fix broken link (#9901)
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-20 15:45:16 -05:00
zeripath 27c6b8fc07 Add documentation to add Mermaid.js to Gitea (#9872)
* Add documentation to add mermaid to Gitea

* Update documentation

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-01-20 11:14:03 -05:00
guillep2k ad1b6d439f Add support for database schema in PostgreSQL (#8819)
* Add support for database schema

* Require setting search_path for the db user

* Add schema setting to admin/config.tmpl

* Use a schema different from default for psql tests

* Update postgres scripts to use custom schema

* Update to xorm/core 0.7.3 and xorm/xorm c37aff9b3a

* Fix migration test

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-20 16:45:14 +01:00
zeripath 1d7b7504d0
Make CertFile and KeyFile relative to CustomPath (#9868)
* Make CertFile and KeyFile relative to CustomPath

The current code will absolute CertFile and KeyFile against the current working directory. This is quite unexpected for users. This code makes relative paths absolute against the CustomPath.

Fix #4196

* Improve error reporting when reading certificates

* Apply suggestions from code review

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-01-19 19:07:44 +00:00
6543 fec1095f17 [Docs] add usefull info to REQUIRE_SIGNIN_VIEW (#9848) 2020-01-17 18:34:55 -05:00
Bagas Sanjaya ce274d652f Add Privacy Policy and Terms of Service Page (#9513)
* Add privacy policy page and link

* Add TOS page and link

* Add update date

* [Docs] Add customizing PP and TOS

* Separate h2 user-generated content with its paragraph

* Reimplement Privacy Policy

The document is inspired from GitHub.

* Refactor to contrib

* [Docs] Mention how to add legal pages

* Reimplement Terms of Service

Adapted from GitHub

* Update revision date

* Rename to mark as sample file

* Apply suggestion from @sapk

Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com>

* Apply suggestion from @sapk

Use absolute link instead

Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com>

* Apply suggestion from @zeripath

Change `Last Updated` element to `<h4>`

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Close this `<li>` element instance

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Intentionally grammar fix

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Information grammar

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Cannot guarantee absolute security...

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Use `<h4>` element for last updated date

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Remove trailing `</p>` at the end of API clause

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Migrate privacy email domain to Your Gitea Instance

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestions from @zeripath

Remove `<p>` container for `<ol>` definitions

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestions from @zeripath

Remove `<p>` container that contain `<ol>` user-generated content

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestions from @zeripath

Remove `<p>` container for private repositories `<ol>` listing

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestions from @zeripath

Migrate remaining email domains to Your Gitea Instance

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Offer support

Co-Authored-By: zeripath <art27@cantab.net>

* Apply suggestion from @zeripath

Change "Your Gitea Instance" references to match your situation and Gitea project disclaimer

Co-Authored-By: zeripath <art27@cantab.net>

* Reword transmission data to reflect hosting on third-party provider

* Reword Analytics clause to reflects that not all Gitea instances deploy analytics OOTB

* Remove `<p>` container from account terms

* Migrate support email on tos to your-gitea-instance

* Reword Tracking and Analytics clause for OOTB case

* [Docs] Append privacy.html to cp destination

* Apply suggestion from @6543

Create or append to footer template

Co-Authored-By: 6543 <6543@obermui.de>

* Apply suggestion from myself

@6543 suggest replacing this `cp` line (which assumed that Gitea sources are available) with `wget` to GitHub raw link. At the time of writing this, this returned 404, but when this PR has been merged, this should get the actual page.

* Apply suggestions from @6543

1. Add gpg key to profile information
2. Add Git repos to list of User Personal Information
3. Comment out responsibility for sensitive information

Co-Authored-By: 6543 <6543@obermui.de>

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2020-01-14 14:34:40 +01:00
zeripath 65baacf227
Make hook status printing configurable with delay (#9641)
* Delay printing hook statuses until after 1 second

* Move to a 5s delay, wrapped writer structure and add config

* Update cmd/hook.go

* Apply suggestions from code review

* Update cmd/hook.go

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-01-12 08:46:03 +00:00
zeripath 62eb1b0f25 Graceful Queues: Issue Indexing and Tasks (#9363)
* Queue: Add generic graceful queues with settings

* Queue & Setting: Add worker pool implementation

* Queue: Add worker settings

* Queue: Make resizing worker pools

* Queue: Add name variable to queues

* Queue: Add monitoring

* Queue: Improve logging

* Issues: Gracefulise the issues indexer

Remove the old now unused specific queues

* Task: Move to generic queue and gracefulise

* Issues: Standardise the issues indexer queue settings

* Fix test

* Queue: Allow Redis to connect to unix

* Prevent deadlock during early shutdown of issue indexer

* Add MaxWorker settings to queues

* Merge branch 'master' into graceful-queues

* Update modules/indexer/issues/indexer.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Update modules/indexer/issues/indexer.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Update modules/queue/queue_channel.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Update modules/queue/queue_disk.go

* Update modules/queue/queue_disk_channel.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Rename queue.Description to queue.ManagedQueue as per @guillep2k

* Cancel pool workers when removed

* Remove dependency on queue from setting

* Update modules/queue/queue_redis.go

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>

* As per @guillep2k add mutex locks on shutdown/terminate

* move unlocking out of setInternal

* Add warning if number of workers < 0

* Small changes as per @guillep2k

* No redis host specified not found

* Clean up documentation for queues

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

* Update modules/indexer/issues/indexer_test.go

* Ensure that persistable channel queue is added to manager

* Rename QUEUE_NAME REDIS_QUEUE_NAME

* Revert "Rename QUEUE_NAME REDIS_QUEUE_NAME"

This reverts commit 1f83b4fc9b.

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-07 12:23:09 +01:00
8ctopus 143f88d975 More extensive robots.txt docs (#9566) 2020-01-07 07:38:22 +00:00
Timon Engelke abc0f53539 Add a /user/login landing page option (#9622)
* Add a /user/login landing page option

* Add test case for login landing page
2020-01-06 17:50:44 +01:00
Bagas Sanjaya 34c5eee703 Add footer extra links template (#9576)
* Add footer extra links template

* [Docs] Update to mention extra links footer template

* Commit suggestion from @davidsvantesson

Co-Authored-By: David Svantesson <davidsvantesson@gmail.com>

* Move template placement to right side of footer

Co-authored-by: David Svantesson <davidsvantesson@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-03 20:41:56 +02:00
zeripath 0c07f1de5b Provide Default messages for merges (#9393)
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
2019-12-30 18:34:11 -05:00
zeripath 017f314b5a
Use Req.URL.RequestURI() to cope with FCGI urls (#9473)
* Use Req.URL.RequestURI() to cope with FCGI urls

* Add debug logging statement when forbidden in internal API.
2019-12-24 00:11:12 +00:00
pseudocoder 1b8a9197b3 Add warning to docs in order to avoid template mismatches (#9411)
* DOCS: add mention of swagger api reference

It's(swagger api link) mentioned vaguely in the FAQ but IMHO missing from API usage page.

* Add warning to avoid template mismatches 

Related to https://github.com/go-gitea/gitea/issues/9320
2019-12-18 16:48:33 +01:00
ZHOU Cheng 412679fd8b 登陆 to 登录 (#9382) 2019-12-17 13:06:54 +00:00
Brad Albright f6b29012e0 Add /milestones endpoint (#8733)
Create a /milestones endpoint which basically serves as a dashboard view for milestones, very similar to the /issues or /pulls page.

Closes #8232
2019-12-15 14:20:08 +00:00
zeripath 3abe17f9e0
Sign protected branches (#8993)
* Move SignMerge to PullRequest

* Add approved signing mode

* As per @guillep2k comment
2019-12-15 11:06:31 +00:00
John Olheiser 6715677b2b Push to create repo (#8419)
* Refactor

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Add push-create to SSH serv

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Cannot push for another user unless admin

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Get owner in case admin pushes for another user

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Set new repo ID in result

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Update to service and use new org perms

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Move pushCreateRepo to services

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Fix import order

Signed-off-by: jolheiser <john.olheiser@gmail.com>

* Changes for @guillep2k

* Check owner (not user) in SSH
* Add basic tests for created repos (private, not empty)

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2019-12-15 10:49:52 +08:00
zeripath f6ba912cd6 Default NO_REPLY_ADDRESS to DOMAIN (#9325)
* Default NO_REPLY_ADDRESS to DOMAIN

The default NO_REPLY_ADDRESS was previously noreply.example.org
This PR changes this to default to the default DOMAIN for gitea.

* Change default to noreply.%(DOMAIN)s

* Change default to "noreply" + Domain
2019-12-13 23:14:43 -05:00
techknowlogick 6442e003c5
Youtrack now supports Gitea (#9343)
* Youtrack now supports Gitea

* Update third-party-tools.en-us.md
2019-12-12 23:28:54 -05:00
zeripath 2c83dac5d4 FCGI: Allow FCGI over unix sockets (#9298)
* FCGI: Allow FCGI over unix sockets

* fixup! FCGI: Allow FCGI over unix sockets
2019-12-10 13:23:26 +01:00
Alexander Scheel ee7df7ba8c Markdown: Sanitizier Configuration (#9075)
* Support custom sanitization policy

Allowing the gitea administrator to configure sanitization policy allows
them to couple external renders and custom templates to support more
markup. In particular, the `pandoc` renderer allows generating KaTeX
annotations, wrapping them in `<span>` elements with class `math` and
either `inline` or `display` (depending on whether or not inline or
block mode was requested).

This iteration gives the administrator whitelisting powers; carefully
crafted regexes will thus let through only the desired attributes
necessary to support their custom markup.

Resolves: #9054

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>

* Document new sanitization configuration

 - Adds basic documentation to app.ini.sample,
 - Adds an example to the Configuration Cheat Sheet, and
 - Adds extended information to External Renderers section.

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>

* Drop extraneous length check in newMarkupSanitizer(...)

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>

* Fix plural ELEMENT and ALLOW_ATTR in docs

These were left over from their initial names. Make them singular to
conform with the current expectations.

Signed-off-by: Alexander Scheel <alexander.m.scheel@gmail.com>
2019-12-07 14:49:04 -05:00
Lunny Xiao e3081c667a
Only show part of members on orgnization dashboard and add paging for orgnization members page (#9092)
* Only show part of members on orgnization dashboard and add paging for orgnization members page

* fix test

* fix typo
2019-12-06 13:34:54 +08:00
silverwind d9c67a8c90 Add Node.js build dep, remove built js/css files (#9114)
- Added Node.js as build dependency and removes build files from git.
- Added version checks for both Go and Node.js.
- Overhauled the js/css make target to only run when needed.
- Merged the `generate` make target into `build` as per suggestion.

Fixes: https://github.com/go-gitea/gitea/issues/6782
Fixes: https://github.com/go-gitea/gitea/issues/9216
2019-12-05 11:41:38 +08:00
6543 668eaf95d5 [Feature] Custom Reactions (#8886)
* add [ui] Reactions

* move contend check from form to go functions

* use else if

* check if reaction is allowed only on react
(so previous custom reaction can be still removed)

* use $.AllowedReactions in templates

* use ctx.Flash.Error

* use it there too

* add redirection

* back to server error
because a wrong reaction is a template issue ...

* add emoji list link

* add docs entry

* small wording nit
suggestions from @jolheiser - thx

* same reactions as github

* fix PR reactions

* handle error so template JS could check

* Add Integrations Test

* add REACTIONS setting to cheat-sheet doc page
2019-12-01 17:57:24 -05:00
silverwind f0aaffeedc Add USE_SERVICE_WORKER setting (#9110)
* Add USE_SERVICE_WORKER setting

This will be very useful setting for anyone doing frontend work.

Fixes: https://github.com/go-gitea/gitea/issues/9044

* prevent potential syntax error on old browsers
2019-11-21 15:06:23 -05:00
zeripath cbaa1de9ec Add Graceful shutdown for Windows and hooks for shutdown of goroutines (#8964)
* Graceful Shutdown for windows and others

Restructures modules/graceful, adding shutdown for windows, removing and
replacing the old minwinsvc code.

Creates a new waitGroup - terminate which allows for goroutines to
finish up after the shutdown of the servers.

Shutdown and terminate hooks are added for goroutines.

* Remove unused functions - these can be added in a different PR

* Add startup timeout functionality

* Document STARTUP_TIMEOUT
2019-11-21 13:32:02 -05:00
maicss 51ed4cc063 [fix] typo (#9104) 2019-11-21 21:27:05 +08:00
guillep2k a85d916d3e Fix doc example for asciidoc (#9072)
* Fix doc example for asciidoc

* Update config-cheat-sheet.en-us.md

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

Co-Authored-By: Lauris BH <lauris@nix.lv>
2019-11-20 01:17:14 -05:00
Lunny Xiao 1b7182e5ec
Add retry for migration http/https requests (#9019)
* Add retry for migration http/https requests

* give the more suitable name for retry configuraion items

* fix docs and lint

* Only use retryDownloader when setting > 1
2019-11-16 16:30:06 +08:00
guillep2k 9930d47be2 Add review comments to mail notifications (#8996) 2019-11-15 12:59:21 +00:00
zeripath dd1beee2ef
Enforce Gitea environment for pushes (#8982)
* Enforce Gitea environment for pushes

* Update custom/conf/app.ini.sample

Co-Authored-By: Antoine GIRARD <sapk@users.noreply.github.com>
2019-11-14 22:39:48 +00:00
zeripath 856a9f8181
Add ALLOW_ONLY_EXTERNAL_REGISTRATION to config cheat sheet (#8986)
ALLOW_ONLY_EXTERNAL_REGISTRATION was missed off the cheat sheet. This PR adds it.

Fix #8180
2019-11-14 16:58:34 +00:00
zeripath 722a7c902d
Add Close() method to gogitRepository (#8901)
In investigating #7947 it has become clear that the storage component of go-git repositories needs closing.

This PR adds this Close function and adds the Close functions as necessary.

In TransferOwnership the ctx.Repo.GitRepo is closed if it is open to help prevent the risk of multiple open files.

Fixes #7947
2019-11-13 07:01:19 +00:00
guillep2k 01a4a7cb14 Auto-subscribe user to repository when they commit/tag to it (#7657)
* Add support for AUTO_WATCH_ON_CHANGES and AUTO_WATCH_ON_CLONE

* Update models/repo_watch.go

Co-Authored-By: Lauris BH <lauris@nix.lv>

* Round up changes suggested by lafriks

* Added changes suggested from automated tests

* Updated deleteUser to take RepoWatchModeDont into account, corrected inverted DefaultWatchOnClone and DefaultWatchOnChanges behaviour, updated and added tests.

* Reinsert import "github.com/Unknwon/com" on http.go

* Add migration for new column `watch`.`mode`

* Remove serv code

* Remove WATCH_ON_CLONE; use hooks, add integrations

* Renamed watch_test.go to repo_watch_test.go

* Correct fmt

* Add missing EOL

* Correct name of test function

* Reword cheat and ini descriptions

* Add update to migration to ensure column value

* Clarify comment

Co-Authored-By: zeripath <art27@cantab.net>

* Simplify if condition
2019-11-10 09:22:19 +00:00
MysticBoy d2aee2a3e2 Create third-party-tools.zh-cn.md (#6303)
* Create third-party-tools.zh-cn.md

* Update third-party-tools.zh-cn.md

* Update third-party-tools.zh-cn.md
2019-11-08 17:32:30 -05:00
Lunny Xiao 55bdc9aa38 Webhook support custom proxy (#8760)
* Webhook support custom proxy

* Add glob support on webhook proxy host rules

* fix app.ini.sample

* improve code and app.ini.sample

* update cheetsheet about added webhook options
2019-11-08 16:25:53 -05:00