1
1
mirror of https://github.com/go-gitea/gitea synced 2024-06-03 01:45:47 +00:00
Commit Graph

399 Commits

Author SHA1 Message Date
John Olheiser
c6e4bc53aa
Check passwords against HaveIBeenPwned (#12716)
* Implement pwn

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

* Update module

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

* Apply suggestions mrsdizzie

Co-authored-by: mrsdizzie <info@mrsdizzie.com>

* Add link to HIBP

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

* Add more details to admin command

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

* Add context to pwn

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

* Consistency and making some noise ;)

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

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: zeripath <art27@cantab.net>
2020-09-08 17:06:39 -05:00
Lunny Xiao
7a5465fc56
LFS support to be stored on minio (#12518)
* LFS support to be stored on minio

* Fix test

* Fix lint

* Fix lint

* Fix check

* Fix test

* Update documents and add migration for LFS

* Fix some bugs
2020-09-08 23:45:10 +08:00
silverwind
e1535c74cc
Add 'make watch' (#12636)
* Add 'make watch'

This combines frontend and backend watch into a single command that runs
them in parallel on on SIGINT terminates both.

Termination is not super-clean but I guess it does not have to.

* move to tools/, trap more signals, remove gnu-specific flag

* simplify

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-09-04 20:55:06 -04:00
zeripath
5c0697ad1e
Use argon as default password hash algorithm (#12688)
* Restrict TLS connections to 1.2 minimum

* Set Argon2 as the default KDF

* Fix user.yml

* Remove TLS minversion changes

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

* Add migration as per @techknowlogick

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

* set the password algo in the fixtures

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

* Remove the v148 migration - it needs recreate table to change the defaults

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

Co-authored-by: Nadim Kobeissi <nadim@symbolic.software>
2020-09-03 14:58:31 -04:00
Lunny Xiao
f1a7cd6757
Remove GOPATH set up on hacking (#12698) 2020-09-03 11:11:23 +01:00
Martin
a0c4c1ce0d
Fixes cli error for Asciidoctor (#12677)
The original fix for #8676 introduced illegal arguments for Asciidoctor, causing no rendering at all. This PR fixes the command line arguments so that Asciidoctor properly renders the text. See https://asciidoctor.org/docs/user-manual/#piping-content-through-the-cli as reference.
2020-09-02 11:01:28 -04:00
Lunny Xiao
9bc69ff26e
Support elastic search for code search (#10273)
* Support elastic search for code search

* Finished elastic search implementation and add some tests

* Enable test on drone and added docs

* Add new fields to elastic search

* Fix bug

* remove unused changes

* Use indexer alias to keep the gitea indexer version

* Improve codes

* Some code improvements

* The real indexer name changed to xxx.v1

Co-authored-by: zeripath <art27@cantab.net>
2020-08-30 19:08:01 +03:00
zeripath
9abc16a280
fix documentation for REFRESH_TOKEN_EXPIRATION_TIME (#12642)
REFRESH_TOKEN_EXPIRATION_TIME refers to the refresh token not the access token

Fix #12641

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-08-29 23:02:38 +03:00
mrsdizzie
fb70b5d207
Disable password complexity check default (#12557)
* Disable password complexity check default

These features enourange bad passwords/are annoying for people using better password methods, and at minimum we shouldn't force that as a default for obvious reasons. Disable any default check to avoid regular complaints.

* fix copy paste format
2020-08-21 18:42:23 -04:00
Lunny Xiao
62e6c9bc6c
Add a storage layer for attachments (#11387)
* Add a storage layer for attachments

* Fix some bug

* fix test

* Fix copyright head and lint

* Fix bug

* Add setting for minio and flags for migrate-storage

* Add documents

* fix lint

* Add test for minio store type on attachments

* fix test

* fix test

* Apply suggestions from code review

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Add warning when storage migrated successfully

* Fix drone

* fix test

* rebase

* Fix test

* display the error on console

* Move minio test to amd64 since minio docker don't support arm64

* refactor the codes

* add trace

* Fix test

* remove log on xorm

* Fi download bug

* Add a storage layer for attachments

* Add setting for minio and flags for migrate-storage

* fix lint

* Add test for minio store type on attachments

* Apply suggestions from code review

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Fix drone

* fix test

* Fix test

* display the error on console

* Move minio test to amd64 since minio docker don't support arm64

* refactor the codes

* add trace

* Fix test

* Add URL function to serve attachments directly from S3/Minio

* Add ability to enable/disable redirection in attachment configuration

* Fix typo

* Add a storage layer for attachments

* Add setting for minio and flags for migrate-storage

* fix lint

* Add test for minio store type on attachments

* Apply suggestions from code review

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>

* Fix drone

* fix test

* Fix test

* display the error on console

* Move minio test to amd64 since minio docker don't support arm64

* don't change unrelated files

* Fix lint

* Fix build

* update go.mod and go.sum

* Use github.com/minio/minio-go/v6

* Remove unused function

* Upgrade minio to v7 and some other improvements

* fix lint

* Fix go mod

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Tyler <tystuyfzand@gmail.com>
2020-08-18 12:23:45 +08:00
techknowlogick
22c952ac7a
Make dashboard newsfeed list length a configurable item (#12469)
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-08-11 10:48:13 -04:00
silverwind
e67c042511
Add 'watch-backend' (#12330)
* Add 'watch-backend'

This leverages `air` to watch the backend files and trigger `make
backend` automatically when they change. It seems to work rather well
together with `watch-frontend`.

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

* rework docs to a new section for continuous build

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-07-27 14:05:42 -04:00
silverwind
4315e313d1
Add mermaid JS renderer (#12334)
* Add mermaid JS renderer

For feature parity with GitLab. Tested in files, issues, wiki, editor.
arc-green only does an inversion because the renderer seems to like to
render white backgrounds on boxes.

Ref: https://github.com/go-gitea/gitea/issues/3340
Fixes: https://github.com/go-gitea/gitea/issues/12307

* add feature entry, switch to neutral theme, remove border

* add bindFunctions support

* remove unnecessary border-radius

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-07-27 02:24:09 -04:00
silverwind
7cf23399a0
Rework 'make generate-images' (#12316)
* Rework 'make generate-images'

- Remove external dependencies and replace it with a node script that
  does does the same.
- Move detail removal from gitea-sm.png to favicon.png
- Remove favicon.ico and its generation, it is unused and we already serve
  favicon.png in its place.

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

* use proper centering value for preserveAspectRatio

* fix lint

* use fabric

* better linting fix

* fix typo

* mention detail-remove class in docs
2020-07-26 17:47:51 +08:00
Alexander Scheel
8e20daaede
Clarify documentation of SKIP_VERIFY (#12203)
* Clarify documentation of SKIP_VERIFY

The documentation clearly documents the empty value as the default,
however at least one user reported this as being unclear. Mark values
explicitly so it is clear what values it can take. This clarifies that
an empty value in fact leaves certificate verification enabled, whereas
it has to be explicitly set to true to disable certificate verification.

Resolves: #12117

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

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

Co-authored-by: mrsdizzie <info@mrsdizzie.com>

* Update custom/conf/app.example.ini

Co-authored-by: mrsdizzie <info@mrsdizzie.com>

* Update custom/conf/app.example.ini

Co-authored-by: mrsdizzie <info@mrsdizzie.com>

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-07-21 19:50:25 -04:00
Bagas Sanjaya
07c4ed4cda
[Docs] Logging Configuration - Use logrotate Instead (#9930)
* Logging Configuration - Add logrotate

* Delete instead duplicate

* Apply suggestions from @jolheiser

Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>

* Quote false

* Replace program with utility

* Whoops, use --debug switch instead

* Optional immediate reload by --force switch

* Update docs/content/doc/advanced/logging-documentation.en-us.md

Co-authored-by: John Olheiser <42128690+jolheiser@users.noreply.github.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: zeripath <art27@cantab.net>
2020-07-16 12:02:29 -04:00
silverwind
8188176b58
Direct SVG rendering (#12157)
Introduce 'make svg' which calls a node script that compiles svg files
to `public/img/svg`. These files are vendored to not create a dependency
on Node for the backend build.

On the frontend side, configure webpack using `raw-loader` so SVGs can
be imported as string.

Also moved our existing SVGs to web_src/svg for consistency.

Fixes: https://github.com/go-gitea/gitea/issues/11618
2020-07-12 12:10:56 +03:00
zeripath
c5b08f6d5a
Pause, Resume, Release&Reopen, Add and Remove Logging from command line (#11777)
* Make LogDescriptions race safe

* Add manager commands for pausing, resuming, adding and removing loggers

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

* Placate lint

* Ensure that file logger is run!

* Add support for smtp and conn

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

* Add release-and-reopen

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-07-05 20:07:07 -04:00
zeripath
ae56411e9f
Move EventSource to SharedWorker (#12095)
Move EventSource to use a SharedWorker. This prevents issues with HTTP/1.1
open browser connections from preventing gitea from opening multiple tabs.

Also allow setting EVENT_SOURCE_UPDATE_TIME to disable EventSource updating

Fix #11978

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

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-07-03 10:55:36 +01:00
silverwind
98ddf87b03
Update docs to specify utf8mb4 default (#11962)
Install tool already sets it as the default so we can just update
example ini and docs to it.

Fixes: https://github.com/go-gitea/gitea/issues/11081
2020-06-18 15:36:59 -04:00
Lunny Xiao
03ba974481
Rename custom/conf/app.ini.sample to custom/conf/app.example.ini for better syntax light on editor (#11926)
* Rename custom/conf/app.ini.sample to custom/conf/app.sample.ini for better syntax light on editor

* rename to app.example.ini

* per @6543 's comment, update all references on docs

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-17 23:16:59 -04:00
techknowlogick
6bf78d2b57
Global default branch setting (#11918)
* Global default branch setting

* add to app.ini example per @silverwind

* update per @lunny

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-06-17 16:53:55 -04:00
silverwind
628ee1d82e
Replace jquery-datetimepicker with native date input (#11684)
This removes the jQuery plugin as well as the associated config options.
Native input[type=date] does not require a language attribute as it is
localized by default, except for the placeholder attribute for which I
currently piggy-back the repo.issues.due_date_form localization option.

Implementation should pretty much match GH. Of note is that Safari does
not provide a UI for this input type, but I don't think providing one is
neccessary and GH did not bother either.

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-10 14:35:27 -04:00
Emanuel Angelo
a39557f8fb
European Portuguese translation (#11568)
This PR includes the modifications necessary to make use of the European Portuguese translation from the default setting.
2020-06-05 09:07:56 +01:00
John Olheiser
a6fd2f23f7
Allow site admin to disable mirrors (#11740)
* Allow site admin to disable mirrors

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

* No need to run through Safe

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

* Clarify only disabling NEW mirrors

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

* Apply suggestions from @guillep2k

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-06-02 21:21:38 -04:00
zeripath
a1ad188326
Fix chardet test and add ordering option (#11621)
* Fix chardet test and add ordering option

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

* minor fixes

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

* remove log

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

* remove log2

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

* only iterate through top results

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

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

* slight restructure of for loop

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-06-02 19:20:19 -03:00
zeripath
02a52d683b
Add warning to mailer documentation about authentication (#11563)
* Add warning to mailer documentation about authentication

References #7966

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

* As per @guillep2k and @mrsdizzie

* as per @mrsdizzie

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

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-05-24 23:56:18 +01:00
zeripath
814ca9ffea
Allow different HardBreaks settings for documents and comments (#11515)
GH has different HardBreaks behaviour for markdown comments and documents.

Comments have hard breaks and documents have soft breaks - therefore Gitea's rendering will always be different from GH's if we only provide one setting.

Here we split the setting in to two - one for documents and one for comments and other things.

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

Changes to index.js as per @silverwind 
Co-authored-by: silverwind <me@silverwind.io>

Changes to docs as per @guillep2k 
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-05-24 09:14:26 +01:00
zeripath
0052d788da
Allow log.xxx.default to set logging settings for the default logger only (#11292)
* Allow log.xxx.default to set logging settings for the default logger only

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

* Update modules/setting/log.go

* as per @silverwind add some documentation

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-05-15 22:38:52 -04:00
Leo
da5e3fa299
Changed image of openid-connect logo for better look on arc-green theme (#11312)
* Set background of openIDConnect logo to white in arc-green theme

* Fixed linting off arc-green theme

Signed-off-by: Leo Maroni <git@em0lar.de>

* Revert changes of first commit (white background) and replaced the image

* Updated openid_connect (part 2)

* Update public/img/auth/openid_connect.svg

Now in one line

Co-authored-by: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-05-10 17:55:22 +03:00
silverwind
a44854c287
Few tweaks in the hacking guide (#11345)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-05-09 18:11:30 -04:00
zeripath
791353c03b
Add EventSource support (#11235)
If the browser supports EventSource switch to use this instead of
polling notifications.

Signed-off-by: Andrew Thornton art27@cantab.net
2020-05-07 22:49:00 +01:00
zeripath
4f9d59be17
Sendmail should create a process on the gitea system and have a default timeout (#11256)
* Make sure that sendmail processes register with the process manager
* Provide a timeout for these (initially of 5 minutes)
* Add configurable value and tie in to documentation
* Tie in to the admin config page.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2020-05-03 00:04:31 +01:00
Alexander Scheel
1bf9e44bda
Fix sanitizer config - multiple rules (#11133)
In #9888, it was reported that my earlier pull request #9075 didn't quite function as expected. I was quite hopeful the `ValuesWithShadow()` worked as expected (and, I thought my testing showed it did) but I guess not. @zeripath proposed an alternative syntax which I like:

```ini
[markup.sanitizer.1]
ELEMENT=a
ALLOW_ATTR=target
REGEXP=something
[markup.sanitizer.2]
ELEMENT=a
ALLOW_ATTR=target
REGEXP=something
```

This was quite easy to adopt into the existing code. I've done so in a semi-backwards-compatible manner:

 - The value from `.Value()` is used for each element.
 - We parse `[markup.sanitizer]` and all `[markup.sanitizer.*]` sections and add them as rules.

This means that existing configs will load one rule (not all rules). It also means people can use string identifiers (`[markup.sanitiser.KaTeX]`) if they prefer, instead of numbered ones.

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-29 12:34:59 +01:00
mrsdizzie
4563eb873d
Support unicode emojis and remove emojify.js (#11032)
* Support unicode emojis and remove emojify.js

This PR replaces all use of emojify.js and adds unicode emoji support to various areas of gitea.

This works in a few ways:

First it adds emoji parsing support into gitea itself. This allows us to

 * Render emojis from valid alias (😄)
 * Detect unicode emojis and let us put them in their own class with proper aria-labels and styling
 * Easily allow for custom "emoji"
 * Support all emoji rendering and features without javascript
 * Uses plain unicode and lets the system render in appropriate emoji font
 * Doesn't leave us relying on external sources for updates/fixes/features

That same list of emoji is also used to create a json file which replaces the part of emojify.js that populates the emoji search tribute. This file is about 35KB with GZIP turned on and I've set it to load after the page renders to not hinder page load time (and this removes loading emojify.js also)

For custom "emoji" it uses a pretty simple scheme of just looking for /emojis/img/name.png where name is something a user has put in the "allowed reactions" setting we already have. The gitea reaction that was previously hard coded into a forked copy of emojify.js is included and works as a custom reaction under this method.

The emoji data sourced here is from https://github.com/github/gemoji which is the gem library Github uses for their emoji rendering (and a data source for other sites). So we should be able to easily render any emoji and :alias: that Github can, removing any errors from migrated content. They also update it as well, so we can sync when there are new unicode emoji lists released.

I've included a slimmed down and slightly modified forked copy of https://github.com/knq/emoji to make up our own emoji module. The code is pretty straight forward and again allows us to have a lot of flexibility in what happens.

I had seen a few comments about performance in some of the other threads if we render this ourselves, but there doesn't seem to be any issue here. In a test it can parse, convert, and render 1,000 emojis inside of a large markdown table in about 100ms on my laptop (which is many more emojis than will ever be in any normal issue). This also prevents any flickering and other weirdness from using javascript to render some things while using go for others.

Not included here are image fall back URLS. I don't really think they are necessary for anything new being written in 2020. However, managing the emoji ourselves would allow us to add these as a feature later on if it seems necessary.

Fixes: https://github.com/go-gitea/gitea/issues/9182
Fixes: https://github.com/go-gitea/gitea/issues/8974
Fixes: https://github.com/go-gitea/gitea/issues/8953
Fixes: https://github.com/go-gitea/gitea/issues/6628
Fixes: https://github.com/go-gitea/gitea/issues/5130

* add new shared function emojiHTML

* don't increase emoji size in issue title

* Update templates/repo/issue/view_content/add_reaction.tmpl

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

* Support for emoji rendering in various templates

* Render code and review comments as they should be

* Better way to handle mail subjects

* insert unicode from tribute selection

* Add template helper for plain text when needed

* Use existing replace function I forgot about

* Don't include emoji greater than Unicode Version 12

Only include emoji and aliases in JSON

* Update build/generate-emoji.go

* Tweak regex slightly to really match everything including random invisible characters. Run tests for every emoji we have

* final updates

* code review

* code review

* hard code gitea custom emoji to match previous behavior

* Update .eslintrc

Co-Authored-By: silverwind <me@silverwind.io>

* disable preempt

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-28 15:05:39 -03:00
Bagas Sanjaya
b52ec4a19e
[Docs] Config Cheat Sheet - Task Edit (#9972)
* backwards compatibility typo

* Unlist description and separate from list by an empty line

* redis needs password edit

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

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

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-04-27 19:41:59 -04:00
zeripath
b10c416f9e
Use AJAX for notifications table (#10961)
* Use AJAX for notifications table

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

* move to separate js

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

* placate golangci-lint

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

* Add autoupdating notification count

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

* Fix wipeall

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

* placate tests

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

* Try hidden

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

* Try hide and hidden

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

* More auto-update improvements

Only run checker on pages that have a count
Change starting checker to 10s with a back-off to 60s if there is no change

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

* string comparison!

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

* as per @silverwind

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

* add configurability as per @6543

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

* Add documentation as per @6543

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

* Use CSRF header not query

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

* Further JS improvements

Fix @etzelia update notification table request
Fix @silverwind comments

Co-Authored-By: silverwind <me@silverwind.io>
Signed-off-by: Andrew Thornton <art27@cantab.net>

* Simplify the notification count fns

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

Co-authored-by: silverwind <me@silverwind.io>
2020-04-24 00:57:38 -03:00
zeripath
e74c4e1be9
Add option to increase provided OAuth2 token maximum size (#11180)
Some OAuth2 providers return quite large structured tokens >32767 bytes.
Gitea currently has a fixed maximum of 32767 bytes for these and
unfortunately due to the convoluted nature of the dependent libraries the
error returned is rather opaque.

Here we manage the error a little better - detecting the rather opaque
github.com/gorilla/securecookie.errEncodedValueTooLong and converting
it to a more readable error.

Further we provide a configurable option to increase the maximum size of
the provided OAuth2 tokens.

Fix #9907

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

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-23 00:47:23 +02:00
Antoine GIRARD
316db0fe79
Add documentation to display STL preview (#11181)
* Update customizing-gitea.en-us.md

* Update customizing-gitea.en-us.md

* only load assets when needed

* remove useless var

* fix missing 'i' modifier
2020-04-22 20:02:54 +03:00
silverwind
7e20f1cb5b
enable ENABLE_HARD_LINE_BREAK by default (#11162)
enable ENABLE_HARD_LINE_BREAK by default

This matches GitHub's rendering.

Fix #11155
2020-04-21 23:13:56 +01:00
Johan Van de Wauw
dfca884b15
doc: Fix package name in external renderer example (#11170)
The py3-zmq package does not exist in alpine linux 3.11, used in both master and 1.11.4 . The py3-pyzmq package exists however:
https://pkgs.alpinelinux.org/packages?name=py3-pyzmq&branch=v3.11
2020-04-21 16:36:27 -04:00
Kristian Antonsen
0e4e14d0f5
Replace references to cron.update_migration_post_id with cron.update_migration_poster_id in docs (#11068)
Across several files, references to cron.update_migration_post_id are made, although the actual setting is called cron.update_migration_poster_id according to modules/setting/cron.go (10e2f29144/modules/setting/cron.go (L54)).

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-04-15 02:44:08 +02:00
silverwind
cc4da79fb6
add 'make watch-frontend' and expand docs (#10931)
* add 'make watch-frontend' and expand docs

* add bindata note

* add .PHONY

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-12 00:50:59 -03:00
j.yao.SUSE
b252b23f16
[feature] provide OwnerName field for README template (#10981)
Co-Authored-By: 6543 <6543@obermui.de>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2020-04-06 21:40:38 -04:00
6543
17837986f0
[Docs] Add Note to Readme-Template about Variable Espansion (#10983)
* add note with Espansion VarNames

* add context of Name
2020-04-06 19:43:17 -04:00
Bagas Sanjaya
cac30abefc
[Docs] Config Cheat Sheet: SSL_MODE Value Description (#10834)
* Add description of SSL_MODE values

* Apply suggestions from @guillep2k

Rewording suggestions

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-03-28 00:24:12 -03:00
zeripath
9269b7f627
Multiple LFS improvements (#10667)
* Add more logging in the LFS server

Adds more logging in the LFS server and stops sending internal server
error information to the client

* Add LFS Lock cursor implementation

* Simplify Claims in LFS and remove the float64 casts

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

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-03-09 19:56:18 +00:00
John Olheiser
de63ac046e
Make PR message on pushes configurable (#10664)
* Make PR message on pushes configurable

* Make fmt

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-03-08 08:34:38 -05:00
John Olheiser
f5a20250ae
Add node version variable to docs (#10620)
Also adjusted other version mentions so go version is always mentioned
as major.minor and node only as major.

Co-authored-by: silverwind <me@silverwind.io>
2020-03-05 16:36:22 -06:00
Lauris BH
fb76136aec
Add notice for awesome-gitea (#10612)
Signed-off-by: jolheiser <john.olheiser@gmail.com>

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-03-05 11:55:28 +02:00
guillep2k
be544e8e6a
Versions (#10597)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-03-04 21:37:19 -03:00
zeripath
513b962c1d
Add max-file-size to LFS (#10463)
* Add max-file-size to LFS

* Update modules/lfs/server.go

* As per @silverwind

Co-Authored-By: silverwind <me@silverwind.io>

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-02-28 01:46:57 -03:00
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
guillep2k
1f90147f39 Use templates for issue e-mail subject and body (#8329)
* Add template capability for issue mail subject

* Remove test string

* Fix trim subject length

* Add comment to template and run make fmt

* Add information for the template

* Rename defaultMailSubject() to fallbackMailSubject()

* General rewrite of the mail template code

* Fix .Doer name

* Use text/template for subject instead of html

* Fix subject Re: prefix

* Fix mail tests

* Fix static templates

* [skip ci] Updated translations via Crowdin

* Expose db.SetMaxOpenConns and allow non MySQL dbs to set conn pool params (#8528)

* Expose db.SetMaxOpenConns and allow other dbs to set their connection params
* Add note about port exhaustion

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

* Prevent .code-view from overriding font on icon fonts (#8614)

* Correct some outdated statements in the contributing guidelines (#8612)

* More information for drone-cli in CONTRIBUTING.md

* Increases the version of drone-cli to 1.2.0
* Adds a note for the Docker Toolbox on Windows

Signed-off-by: LukBukkit <luk.bukkit@gmail.com>

* Fix the url for the blog repository (now on gitea.com)

Signed-off-by: LukBukkit <luk.bukkit@gmail.com>

* Remove TrN due to lack of lang context

* Redo templates to match previous code

* Fix extra character in template

* Unify PR & Issue tempaltes, fix format

* Remove default subject

* Add template tests

* Fix template

* Remove replaced function

* Provide User as models.User for better consistency

* Add docs

* Fix doc inaccuracies, improve examples

* Change mail footer to math AppName

* Add test for mail subject/body template separation

* Add support for code review comments

* Update docs/content/doc/advanced/mail-templates-us.md

Co-Authored-By: 6543 <24977596+6543@users.noreply.github.com>
2019-11-07 21:34:28 +08:00
cnphpbb
7cf56a16d2 doc:增加附件ALLOWED_TYPES取得MIME type的方法 (#8770) 2019-11-01 13:53:08 -04:00
Brad Albright
887a8fe242 Allow cross-repository dependencies on issues (#7901)
* in progress changes for #7405, added ability to add cross-repo dependencies

* removed unused repolink var

* fixed query that was breaking ci tests; fixed check in issue dependency add so that the id of the issue and dependency is checked rather than the indexes

* reverted removal of string in local files becasue these are done via crowdin, not updated manually

* removed 'Select("issue.*")' from getBlockedByDependencies and getBlockingDependencies based on comments in PR review

* changed getBlockedByDependencies and getBlockingDependencies to use a more xorm-like query, also updated the sidebar as a result

* simplified the getBlockingDependencies and getBlockedByDependencies methods; changed the sidebar to show the dependencies in a different format where you can see the name of the repository

* made some changes to the issue view in the dependencies (issue name on top, repo full name on separate line). Change view of issue in the dependency search results (also showing the full repo name on separate line)

* replace call to FindUserAccessibleRepoIDs with SearchRepositoryByName. The former was hardcoded to use isPrivate = false on the repo search, but this code needed it to be true. The SearchRepositoryByName method is used more in the code including on the user's dashboard

* some more tweaks to the layout of the issues when showing dependencies and in the search box when you add new dependencies

* added Name to the RepositoryMeta struct

* updated swagger doc

* fixed total count for link header on SearchIssues

* fixed indentation

* fixed aligment of remove icon on dependencies in issue sidebar

* removed unnecessary nil check (unnecessary because issue.loadRepo is called prior to this block)

* reverting .css change, somehow missed or forgot that less is used

* updated less file and generated css; updated sidebar template with styles to line up delete and issue index

* added ordering to the blocked by/depends on queries

* fixed sorting in issue dependency search and the depends on/blocks views to show issues from the current repo first, then by created date descending; added a "all cross repository dependencies" setting to allow this feature to be turned off, if turned off, the issue dependency search will work the way it did before (restricted to the current repository)

* re-applied my swagger changes after merge

* fixed split string condition in issue search

* changed ALLOW_CROSS_REPOSITORY_DEPENDENCIES description to sound more global than just the issue dependency search; returning 400 in the cross repo issue search api method if not enabled; fixed bug where the issue count did not respect the state parameter

* when adding a dependency to an issue, added a check to make sure the issue and dependency are in the same repo if cross repo dependencies is not enabled

* updated sortIssuesSession call in PullRequests, another commit moved this method from pull.go to pull_list.go so I had to re-apply my change here

* fixed incorrect setting of user id parameter in search repos call
2019-10-31 13:06:10 +08:00
guillep2k
f9944c0e69 Configurable close and reopen keywords for PRs (#8120)
* Add settings for CloseKeywords and ReopenKeywords

* Fix and improve tests

* Use sync.Once() for initialization

* Fix unintended exported function
2019-10-30 14:43:59 +02:00
6543
fd40c9d024 [Docs] add explicit info about customization of homepage (#8694)
* first draft

* Update docs/content/doc/advanced/customizing-gitea.en-us.md

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

* add notice to restart
2019-10-28 15:11:02 -04:00
Chris Sexton
560a511a35 Change external asciidoctor tool to embeded mode (#8677)
Ref #8676

* add the `-e` flag for embedded mode
* add a level offset to include the title of the document
2019-10-25 11:11:14 +01:00
Jakob Ackermann
00629fea95 [assets] configurable URL for static resources (#7911)
* static url

* add cors support for static resources

* [assets] work on the migration to configurable url for assets

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [misc] fix whitespace

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [assets] fix the loading of the manifest.json

It is generated dynamically, and as such can not be served by the cdn.

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* Revert "add cors support for static resources"

This reverts commit 42f964fd18

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [docs] add the STATIC_URL_PREFIX option

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [docs] reverse-proxy: nginx: add two setups for STATIC_URL_PREFIX

Signed-off-by: Jakob Ackermann <das7pad@outlook.com>

* [assets] migrate the url of a new asset to the static url prefix

REF: f2a3abc683
Signed-off-by: Jakob Ackermann <das7pad@outlook.com>
2019-10-22 20:11:01 +08:00
zeripath
d8161ee3fd
Expose db.SetMaxOpenConns and allow non MySQL dbs to set conn pool params (#8528)
* Expose db.SetMaxOpenConns and allow other dbs to set their connection params
* Add note about port exhaustion

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
2019-10-21 22:20:47 +01:00
zeripath
5a62ae5cbf
Add setting to disable BASIC authentication (#8586)
Closes #8561.
2019-10-19 15:27:15 +01:00
zeripath
fcb535c5c3
Sign merges, CRUD, Wiki and Repository initialisation with gpg key (#7631)
This PR fixes #7598 by providing a configurable way of signing commits across the Gitea instance. Per repository configurability and import/generation of trusted secure keys is not provided by this PR - from a security PoV that's probably impossible to do properly. Similarly web-signing, that is asking the user to sign something, is not implemented - this could be done at a later stage however.

## Features
- [x] If commit.gpgsign is set in .gitconfig sign commits and files created through repofiles. (merges should already have been signed.)
- [x] Verify commits signed with the default gpg as valid
- [x] Signer, Committer and Author can all be different
    - [x] Allow signer to be arbitrarily different - We still require the key to have an activated email on Gitea. A more complete implementation would be to use a keyserver and mark external-or-unactivated with an "unknown" trust level icon.
- [x] Add a signing-key.gpg endpoint to get the default gpg pub key if available
    - Rather than add a fake web-flow user I've added this as an endpoint on /api/v1/signing-key.gpg
    - [x] Try to match the default key with a user on gitea - this is done at verification time
- [x] Make things configurable?
    - app.ini configuration done
    - [x] when checking commits are signed need to check if they're actually verifiable too
- [x] Add documentation

I have decided that adjusting the docker to create a default gpg key is not the correct thing to do and therefore have not implemented this.
2019-10-16 14:42:42 +01:00
guillep2k
31655aabfc Fix password complexity regex for special characters (on master) (#8525)
* Fix extra space

* Fix regular expression

* Fix error template name

* Simplify check code, fix default values, add test

* Fix router tests

* Fix fmt

* Fix setting and lint

* Move cleaning up code to test, improve comments

* Tidy up variable declaration
2019-10-16 11:09:58 +08:00
zeripath
167e8f18da
Restore Graceful Restarting & Socket Activation (#7274)
* Prevent deadlock in indexer initialisation during graceful restart

* Move from gracehttp to our own service to add graceful ssh

* Add timeout for start of indexers and make hammer time configurable

* Fix issue with re-initialization in indexer during tests

* move the code to detect use of closed to graceful

* Handle logs gracefully - add a pid suffix just before restart

* Move to using a cond and a holder for indexers

* use time.Since

* Add some comments and attribution

* update modules.txt

* Use zero to disable timeout

* Move RestartProcess to its own file

* Add cleanup routine
2019-10-15 14:39:51 +01:00
Benson Muite
ebe8ff782f Update config-cheat-sheet.en-us.md (#8497)
* Update config-cheat-sheet.en-us.md

Add more information on configuring URI hyperlink rendering for Markdown.

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

Update description as suggested by @guillep2k

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

Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
2019-10-15 03:39:55 +01:00
Lunny Xiao
0be992a1e2 Make static resouces web browser cache time customized on app.ini (#8442)
* make static resouces web browser cache time customized on app.ini

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

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

* Update custom/conf/app.ini.sample

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

* fix docs
2019-10-14 23:05:57 +01:00
Maxim Tkachenko
db657192d0 Password Complexity Checks (#6230)
Add password complexity checks. The default settings require a lowercase, uppercase, number and a special character within passwords.

Co-Authored-By: T-M-A <maxim.tkachenko@gmail.com>
Co-Authored-By: Lanre Adelowo <adelowomailbox@gmail.com>
Co-Authored-By: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-Authored-By: Lauris BH <lauris@nix.lv>
2019-10-14 16:24:26 +01:00
Lunny Xiao
e3e44a59d0 Update migrated repositories' issues/comments/prs poster id if user has a github external user saved (#7751)
* update migrated issues/comments when login as github

* add get userid when migrating or login with github oauth2

* fix lint

* add migrations for repository service type

* fix build

* remove unnecessary dependencies on migrations

* add cron task to update migrations poster ids and fix posterid when migrating

* fix lint

* fix lint

* improve code

* fix lint

* improve code

* replace releases publish id to actual author id

* fix import

* fix bug

* fix lint

* fix rawdata definition

* fix some bugs

* fix error message
2019-10-14 09:10:42 +03:00
Lunny Xiao
f2a3abc683
Move migrating repository from frontend to backend (#6200)
* move migrating to backend

* add loading image when migrating and fix tests

* fix format

* fix lint

* add redis task queue support and improve docs

* add redis vendor

* fix vet

* add database migrations and fix app.ini sample

* add comments for task section on app.ini.sample

* Update models/migrations/v84.go

Co-Authored-By: lunny <xiaolunwen@gmail.com>

* Update models/repo.go

Co-Authored-By: lunny <xiaolunwen@gmail.com>

* move migrating to backend

* add loading image when migrating and fix tests

* fix fmt

* add redis task queue support and improve docs

* fix fixtures

* fix fixtures

* fix duplicate function on index.js

* fix tests

* rename repository statuses

* check if repository is being create when SSH request

* fix lint

* fix template

* some improvements

* fix template

* unified migrate options

* fix lint

* fix loading page

* refactor

* When gitea restart, don't restart the running tasks because we may have servel gitea instances, that may break the migration

* fix js

* Update models/repo.go

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

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

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

* fix tests

* rename ErrTaskIsNotExist to ErrTaskDoesNotExist

* delete release after add one on tests to make it run happy

* fix tests

* fix tests

* improve codes

* fix lint

* fix lint

* fix migrations
2019-10-13 21:23:14 +08:00
pseudocoder
eac5a8be75 DOCS: add mention of swagger api reference (#8452)
It's(swagger api link) mentioned vaguely in the FAQ but IMHO missing from API usage page.
2019-10-10 08:42:01 -04:00
Km
de8a0a3938 Add buildbot CI (#8378)
Buildbot can work with Gitea
2019-10-04 19:30:05 +02:00
helix84
cd1c960a2a typo fix (#8345) 2019-10-02 02:25:32 +03:00
David Svantesson
223b9d9a64 Add 'make revive' to instructions for checking code (#8314)
* Add 'make revive' to instructions for checking code

This is performed on drone, hacking instructions should contain the same to avoid unnecessary PR builds.

* lint is deprecated. Denote revive +vet as code analysis in continuous text.
2019-09-29 23:36:52 +03:00
Bill Wenrich
41dcdbf500 [docs] Docker build - ZeroMQ dependency for Jupyter (#8262)
* doc py3-zmq - ZeroMQ bindings for jupyter

#7970 https://github.com/go-gitea/gitea/issues/7970

* rebase Dockerfile to 1.9.x for jupyter

* [docs] external-renderers.en-us.md - use templated variable for version

Co-Authored-By: techknowlogick <matti@mdranta.net>
2019-09-26 09:04:53 +02:00
David Svantesson
b19db40eab Update hacking-on-gitea.en-us.md (#8275)
Fix spelling of misspell in command to validate swagger.
2019-09-24 14:29:11 -04:00
John Olheiser
73f7e82024 Remove unnecessary backslash (#8249) 2019-09-20 13:06:17 -04:00
Lunny Xiao
3c0e6d1126 update cache item_ttl docs (#8222) 2019-09-18 10:50:45 +03:00
guillep2k
72f6d5c882 Restrict repository indexing by glob match (#7767)
* Restrict repository indexing by file extension

* Use REPO_EXTENSIONS_LIST_INCLUDE instead of REPO_EXTENSIONS_LIST_EXCLUDE and have a more flexible extension pattern

* Corrected to pass lint gosimple

* Add wildcard support to REPO_INDEXER_EXTENSIONS

* This reverts commit 72a650c8e4.

* Add wildcard support to REPO_INDEXER_EXTENSIONS (no make vendor)

* Simplify isIndexable() for better clarity

* Add gobwas/glob to vendors

* manually set appengine new release

* Implement better REPO_INDEXER_INCLUDE and REPO_INDEXER_EXCLUDE

* Add unit and integration tests

* Update app.ini.sample and reword config-cheat-sheet

* Add doc page and correct app.ini.sample

* Some polish on the doc

* Simplify code as suggested by @lafriks
2019-09-11 20:26:28 +03:00
techknowlogick
3fd0eec900
Update third-party-tools.en-us.md (#8148) 2019-09-11 00:16:11 -04:00
Feodor Fitsner
79c8bc0e51 Added AppVeyor to the list of CI/CD working with Gitea (#8104) 2019-09-05 22:48:35 +02:00
nu_no
5fcef38f7f Fix broken link (#8091) 2019-09-05 00:31:43 +02:00
Km
18896d8df1 Propose some references about ci/cd solutions compatibles with gitea (#7996)
* Propose some references about ci/cd solutions compatibles with gitea

* No note about theirs integration level, only a starting point.

* Update docs/content/doc/advanced/ci-cd.en-us.md

Improve text

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

* Improve link to CI solutions

Update docs/content/doc/advanced/ci-cd.en-us.md

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

* Update docs/content/doc/advanced/ci-cd.en-us.md

Typo in name :/

Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>

* Remove redundant empty line

* Invite user to consult new CI/CD page

* Link target CI tools

* Jenkins and its plugin

* Update docs/content/doc/advanced/third-party-tools.en-us.md

Simplify link CI/CD

Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>

* Update docs/content/doc/advanced/ci-cd.en-us.md

Typo

Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>

* Provide gitea documentation about drone usage

    Co-Authored-By: John Olheiser <42128690+jolheiser@users.noreply.github.com>

* Update docs/content/doc/advanced/ci-cd.en-us.md

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

* Apply suggestions from code review

Co-Authored-By: Lauris BH <lauris@nix.lv>
2019-08-29 17:30:12 -04:00
Gary Kim
f1c414882c Add Ability for User to Customize Email Notification Frequency (#7813)
* Add Backend Logic for Toggling Email Notification

This commit adds the backend logic for
allowing users to enable or disable email
notifications. The implementation ensures
that only issue notification emails get disabled
and important emails are still sent regardless
of the setting.

The UI to toggle this setting has not yet been
implemented.

* Add UI and complete user email notification enable

This commit completes the functionality to allow
users to disable their own email notifications.

Signed-off-by: Gary Kim <gary@garykim.dev>

* Add Third Option for Only Email on Mention

Signed-off-by: Gary Kim <gary@garykim.dev>

* Readd NOT NULL to new preference string

Signed-off-by: Gary Kim <gary@garykim.dev>

* Add Tests and Rewrite Comment

Signed-off-by: Gary Kim <gary@garykim.dev>

* Allow admin to set default email frequency

Signed-off-by: Gary Kim <gary@garykim.dev>

* Add new config option to docs

Signed-off-by: Gary Kim <gary@garykim.dev>

* Fix a few mistakes

Signed-off-by: Gary Kim <gary@garykim.dev>

* Only update required columns

Signed-off-by: Gary Kim <gary@garykim.dev>

* Simplify an error check

Signed-off-by: Gary Kim <gary@garykim.dev>

* Make email_notification_preference column in DB be VARCHAR(20)

Signed-off-by: Gary Kim <gary@garykim.dev>

* Handle errors

Signed-off-by: Gary Kim <gary@garykim.dev>

* Update models/migrations/v93.go

Co-Authored-By: Lauris BH <lauris@nix.lv>
2019-08-29 17:05:42 +03:00
David Svantesson
c9546d4cdd Include description in repository search. (#7942)
* Add description in repository search.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Refactor SearchRepositoryByName with a general function SearchRepository

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Allow to specify if description shall be included in API repo search.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add new app.ini setting for whether to search within repo description.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Search keyword in description (if setting enabled) on:
 - Explore page
 - Organization profile page
 - User profile page
 - Admin repo page

Do not search keyword in description on:
 - Any non-keyword search (not relevant)
 - Incremental search (uses API)

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Put parameters related to keyword directly after it

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Add test cases for including (and not including) repository description in search.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Rename test function from TestSearchRepositoryByName to TestSearchRepository.

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>

* Make setting SEARCH_REPO_DESCRIPTION default to true

Signed-off-by: David Svantesson <davidsvantesson@gmail.com>
2019-08-25 20:06:36 +03:00
guillep2k
e3115cc019 Add support for DEFAULT_ORG_MEMBER_VISIBLE (#7669)
* Add support for DEFAULT_ORG_MEMBER_VISIBLE

* Correct formatting

* Improved description in cheat sheet.

* Add test for DefaultOrgMemberVisible

* Remove dead code
2019-08-24 15:28:59 +03:00
Lunny Xiao
f83db078f0 Move database settings from models to setting (#7806)
* move database settings from models to setting

* update docs

* fix checkout pr

* fix tests

* fix lint

* remove unsupported tidb options

* correct wrong variable name

* remove tidb totally
2019-08-24 11:24:45 +02:00
Lunny Xiao
85202d4784
Display ui time with customize time location (#7792)
* display ui time with customize time location

* fix lint

* rename UILocation to DefaultUILocation

* move time related functions to modules/timeutil

* fix tests

* fix tests

* fix build

* fix swagger
2019-08-15 22:46:21 +08:00
Antoine GIRARD
46d6b92ad0 Import topics during migration (#7851)
* add GetTopics interface

* CreateTopics

* remove un-needed comment
2019-08-14 14:16:12 +08:00
Antoine GIRARD
9692ebcc54 add details for db socket listening (#7830) 2019-08-12 17:52:11 -04:00
Mason
c534b7e211 Add SSH_LISTEN_HOST to the config cheatsheet (#7793)
This was missing before, and this commit adds it with the correct
default value and description
2019-08-08 18:40:31 +03:00
guillep2k
3b97b9efbf Correct formatting of bullet list (#7794) 2019-08-08 07:47:57 +03:00
Tamal Saha
2102f9d92d Support setting cookie domain (#6288)
Signed-off-by: Tamal Saha <tamal@appscode.com>
2019-07-12 09:57:31 -04:00
Sandro Santilli
a0820e09fb Add section about customizing mail (#7419)
See https://github.com/go-gitea/gitea/issues/6037
2019-07-11 01:27:57 -04:00
Mura Li
f88aa1d215 Support git.PATH entry in app.ini (#6772) 2019-07-07 03:26:56 -04:00
EpicCoder
8d9d6aa903 Add additional password hash algorithms (closes #5859) (#6023) 2019-07-07 02:01:01 -04:00
Lunny Xiao
87404d7c0b Use vendors when go generate (#7340)
* use vendors when go generate

* update docs about golang minimal requirement from 1.9 to 1.11

* fix build
2019-07-06 23:00:41 -04:00
AJ ONeal
62d6127f1b Make captcha and password optional for external accounts (#6606) 2019-07-06 15:48:02 -04:00
silverwind
a71cabbd53 add 'npm' and 'npm-update' make targets and lockfile (#7246)
* add 'npm' and 'npm-update' make targets and lockfile

- `make npm` installs and updates node_modules, triggered automatically
   on `make css` and `make js` as it completes reasonably fast and
   ensures consistent modules.
- `make npm-update` updates all dependencies to their latest version,
   regenerates `node_modules` from scratch and updates
   `package-lock.json`. It uses npm modules `updates` written by yours
   truly to find the latest version of each dependency.

* add suggested make dependencies

* remove package-lock.json during npm-update

* regenerate package-lock.json
2019-06-18 22:59:47 -04:00
Antoine GIRARD
2d097655a6 Fix relref link in docs (#7233) 2019-06-17 22:57:48 -04:00
techknowlogick
6d0f78542f
Add docs for INTERNAL_TOKEN_URI (#7234) 2019-06-17 22:52:03 -04:00
Mario Lubenka
8eba27c792 Repository avatar fallback configuration (#7087)
* Only show repository avatar in list when one was selected

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Adds fallback configuration option for repository avatar

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Implements repository avatar fallback

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Adds admin task for deleting generated repository avatars

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Solve linting issues

Signed-off-by: Mario Lubenka <mario.lubenka@googlemail.com>

* Save avatar before updating database

* Linting

* Update models/repo.go

Co-Authored-By: zeripath <art27@cantab.net>
2019-06-02 14:40:12 +08:00
zeripath
356854fc5f Move serv hook functionality & drop GitLogger (#6993)
* Move hook functionality internally

* Internalise serv logic

* Remove old internal paths

* finally remove the gitlogger

* Disallow push on archived repositories

* fix lint error

* Update modules/private/key.go

* Update routers/private/hook.go

* Update routers/private/hook.go

* Update routers/private/hook.go

* Updated routers/private/serv.go

* Fix LFS Locks over SSH

* rev-list needs to be run by the hook process

* fixup

* Improve git test

* Ensure that the lfs files are created with a different prefix

* Reduce the replication in git_test.go

* slight refactor

* Remove unnecessary "/"

* Restore ensureAnonymousClone

* Restore ensureAnonymousClone

* Run rev-list on server side

* Try passing in the alternative directories instead

* Mark test as skipped

* Improve git test

* Ensure that the lfs files are created with a different prefix
* Reduce the replication in git_test.go
* Remove unnecessary "/"
2019-06-01 23:00:21 +08:00
Sergey Dryabzhinsky
3fd18838aa Repository avatars (#6986)
* Repository avatars

- first variant of code from old work for gogs
- add migration 87
- add new option in app.ini
- add en-US locale string
- add new class in repository.less

* Add changed index.css, remove unused template name

* Update en-us doc about configuration options

* Add comments to new functions, add new option to docker app.ini

* Add comment for lint

* Remove variable, not needed

* Fix formatting

* Update swagger api template

* Check if avatar exists

* Fix avatar link/path checks

* Typo

* TEXT column can't have a default value

* Fixes:

- remove old avatar file on upload
- use ID in name of avatar file - users may upload same files
- add simple tests

* Fix fmt check

* Generate PNG instead of "static" GIF

* More informative comment

* Fix error message

* Update avatar upload checks:

- add file size check
- add new option
- update config docs
- add new string to en-us locale

* Fixes:

- use FileHEader field for check file size
- add new test - upload big image

* Fix formatting

* Update comments

* Update log message

* Removed wrong style - not needed

* Use Sync2 to migrate

* Update repos list view

- bigger avatar
- fix html blocks alignment

* A little adjust avatar size

* Use small icons for explore/repo list

* Use new cool avatar preparation func by @lafriks

* Missing changes for new function

* Remove unused import, move imports

* Missed new option definition in app.ini

Add file size check in user/profile avatar upload

* Use smaller field length for Avatar

* Use session to update repo DB data, update DeleteAvatar - use session too

* Fix err variable definition

* As suggested @lafriks - return as soon as possible, code readability
2019-05-29 22:22:26 -04:00
Lunny Xiao
063fa99159
when git version >= 2.18, git command could run with git wire protocol version 2 param if enabled (#7047) 2019-05-26 17:50:06 +08:00
Tekaoh
6c16febe4d Update config-cheat-sheet.en-us.md (#7046) 2019-05-26 06:23:30 +01:00
Lunny Xiao
d5a98a2969 Add support of utf8mb4 for mysql (#6992) 2019-05-24 00:15:26 -04:00
Monty Taylor
6eb53ac570 Fix documentation on Oauth2.Enable flag (#7011)
* Fix documentation on Oauth2.Enable flag

The docs list this as ENABLED, but in the source code it's
ENABLE, meaning following the docs leads to confusion.

* Update sample config for oauth2.ENABLE
2019-05-21 21:48:34 -04:00
silverwind
d9dcd09340 add make targets for js and css, add js linter (#6952)
* add make targets for js,css, add javascript linter

- add `make js`, deprecating `make javascripts`
- add `make css`, deprecating `make generate-stylesheets` and
  `make stylesheets-check`
- changed the unclean css check to only run on CI
- add JS linting via eslint with basic configuration and fixed
  discovered issues
- changed autoprefixer to use official `postcss-cli` avoiding the need
  to loop in the makefile
- moved browserslist to package.json so other future tools can use it
  too.
- update documentation for new make targets and added JS section

* fix indentation

* move functions used in html to 'exported' list

* Run lessc binary without having to install anything to node_modules

* use relative paths to node bin scripts, removing npx

* Revert "use relative paths to node bin scripts, removing npx"

This reverts commit 119b725525.

* fix lessc and postcss plugins

* check for node_modules and use actual bin names
2019-05-16 08:57:47 +03:00
zeripath
775a5a5b0f
Stop colorizing files by default (#6949) 2019-05-15 22:37:06 +01:00
Tamal Saha
34d06f4c6b Handle CORS requests (#6289) 2019-05-13 11:38:53 -04:00
zeripath
e3166744fe
Fix logging documentation (#6904)
* ENABLE_MACARON_REDIRECT should be REDIRECT_MACARON_LOG

* Allow DISABLE_ROUTER_LOG to be set in the [log] section
2019-05-11 10:13:57 +01:00
Wim
4508380cf7 Show full name if DefaultShowFullName setting activated (#6710)
Adds a new key DEFAULT_SHOW_FULL_NAME (default false) to the [ui] section.
If enabled the full name will be shown (unless it's empty, then
the default username will be used)
2019-05-08 11:41:35 +03:00
techknowlogick
36bde02841
Add documentation for OTP/2FA header in API for basic auth (#6872) 2019-05-07 16:53:45 -04:00
Lunny Xiao
08069dc465
Improve migrations to support migrating milestones/labels/issues/comments/pullrequests (#6290)
* add migrations

* fix package dependency

* fix lints

* implements migrations except pull requests

* add releases

* migrating releases

* fix bug

* fix lint

* fix migrate releases

* fix tests

* add rollback

* pull request migtations

* fix import

* fix go module vendor

* add tests for upload to gitea

* more migrate options

* fix swagger-check

* fix misspell

* add options on migration UI

* fix log error

* improve UI options on migrating

* add support for username password when migrating from github

* fix tests

* remove comments and fix migrate limitation

* improve error handles

* migrate API will also support migrate milestones/labels/issues/pulls/releases

* fix tests and remove unused codes

* add DownloaderFactory and docs about how to create a new Downloader

* fix misspell

* fix migration docs

* Add hints about migrate options on migration page

* fix tests
2019-05-07 09:12:51 +08:00
zeripath
ade88a877d Allow Recaptcha service url to be configured (#6820) 2019-05-02 16:09:39 +03:00
zeripath
8d0d7bc28d Make CustomPath, CustomConf and AppWorkPath configurable at build (#6631) 2019-04-29 14:08:21 -04:00
zeripath
be666b03ee Trace Logging on Permission Denied & ColorFormat (#6618)
* Add log.ColorFormat and log.ColorFormatted

Structs can now implement log.ColorFormatted to provide their own
colored format when logged with `%-v` or additional flags.

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

* Add basic ColorFormat to repository and user

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

* Add basic ColorFormat to access and unit

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

* Add ColorFormat to permission and on trace log it

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

* Add log.NewColoredIDValue to make ID value coloring consistent

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

* formatting changes

* Add some better tracing to permission denied for read issues/pulls

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

* Add Trace logging on permission denied

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

* Remove isTrace() check from deferred func

* Adjust repo and allow logging of team

* use FormatInt instead of Itoa

* Add blank line

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

* Update access.go
2019-04-22 23:40:51 +03:00
Richard Mahn
2262811e40 Fixes 4762 - Content API for Creating, Updating, Deleting Files (#6314) 2019-04-17 12:06:35 -04:00
zeripath
827ab6b75a Add SUBJECT_PREFIX mailer config option (#6605)
* Add SUBJECT_PREFIX mailer config option

* Add space between subject prefix and subject (Change from Gogs)

Signed-off-by: Andrew Thornton <art27@cantab.net>
2019-04-17 00:56:40 -04:00
Jonas Franz
79ce24bc6f
Add oauth2 documentation (#6604)
* Add oauth2 documentation

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Apply suggestions from code review

Co-Authored-By: jonasfranz <info@jonasfranz.software>

* Update docs/content/doc/advanced/oauth2-provider.md

Co-Authored-By: jonasfranz <info@jonasfranz.software>

* Update oauth2-provider.md
2019-04-14 10:42:11 +02:00
Jonas Franz
783cd64927 Add option to disable refresh token invalidation (#6584)
* Add option to disable refresh token invalidation

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Add integration tests and remove wrong todos

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix typo

Signed-off-by: Jonas Franz <info@jonasfranz.software>

* Fix tests and add documentation

Signed-off-by: Jonas Franz <info@jonasfranz.software>
2019-04-12 15:50:21 +08:00
Lunny Xiao
e7d7dcb090 Issue indexer queue redis support (#6218)
* add redis queue

* finished indexer redis queue

* add redis vendor

* fix vet

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

Co-Authored-By: lunny <xiaolunwen@gmail.com>

* switch to go mod

* Update required changes for new logging func signatures
2019-04-08 12:05:15 +03:00
zeripath
5422f23ed8 Quieter Integration Tests (#6513)
* Rename BaseLogger to WriterLogger to help the creation of other providers

* Don't export ColorBytes and ResetBytes from ColoredValues

* Make integration tests only print logs if they fail

* check can color before coloring

* I always forget about MSSQL

* Oh and use LEVEL in sqlite.ini

* Make the test logger log at info - as it means you see the router

* Remove empty expected changes

* Make the migrations quieter too

* Don't display SQL on error - it can be looked at in the file logs if necessary

* Fix skip when using onGiteaRun
2019-04-07 03:25:14 +03:00
zeripath
059b52759e
Some logging documentation (#6498) 2019-04-04 09:44:01 +01:00
zeripath
704da08fdc
Better logging (#6038) (#6095)
* Panic don't fatal on create new logger

Fixes #5854

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

* partial broken

* Update the logging infrastrcture

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

* Reset the skip levels for Fatal and Error

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

* broken ncsa

* More log.Error fixes

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

* Remove nal

* set log-levels to lowercase

* Make console_test test all levels

* switch to lowercased levels

* OK now working

* Fix vetting issues

* Fix lint

* Fix tests

* change default logging to match current gitea

* Improve log testing

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

* reset error skip levels to 0

* Update documentation and access logger configuration

* Redirect the router log back to gitea if redirect macaron log but also allow setting the log level - i.e. TRACE

* Fix broken level caching

* Refactor the router log

* Add Router logger

* Add colorizing options

* Adjust router colors

* Only create logger if they will be used

* update app.ini.sample

* rename Attribute ColorAttribute

* Change from white to green for function

* Set fatal/error levels

* Restore initial trace logger

* Fix Trace arguments in modules/auth/auth.go

* Properly handle XORMLogger

* Improve admin/config page

* fix fmt

* Add auto-compression of old logs

* Update error log levels

* Remove the unnecessary skip argument from Error, Fatal and Critical

* Add stacktrace support

* Fix tests

* Remove x/sync from vendors?

* Add stderr option to console logger

* Use filepath.ToSlash to protect against Windows in tests

* Remove prefixed underscores from names in colors.go

* Remove not implemented database logger

This was removed from Gogs on 4 Mar 2016 but left in the configuration
since then.

* Ensure that log paths are relative to ROOT_PATH

* use path.Join

* rename jsonConfig to logConfig

* Rename "config" to "jsonConfig" to make it clearer

* Requested changes

* Requested changes: XormLogger

* Try to color the windows terminal

If successful default to colorizing the console logs

* fixup

* Colorize initially too

* update vendor

* Colorize logs on default and remove if this is not a colorizing logger

* Fix documentation

* fix test

* Use go-isatty to detect if on windows we are on msys or cygwin

* Fix spelling mistake

* Add missing vendors

* More changes

* Rationalise the ANSI writer protection

* Adjust colors on advice from @0x5c

* Make Flags a comma separated list

* Move to use the windows constant for ENABLE_VIRTUAL_TERMINAL_PROCESSING

* Ensure matching is done on the non-colored message - to simpify EXPRESSION
2019-04-02 08:48:31 +01:00
Thomas McWork
b3ad5eb414 More specific declaration of search disk space (#6338)
Elaborate more on the code search storage space requirement
2019-03-16 22:47:04 -04:00
MysticBoy
f9627ede3c Update third-party-tools.en-us.md (#6301)
Add  Gitea Extension for Visual Studio
2019-03-11 19:35:18 +08:00
Aidan Fitzgerald
f5cf9a8355 Copyedit docs (#6275) 2019-03-09 16:15:45 -05:00
John Olheiser
bd4be434ff Third party docs (#6282) 2019-03-08 12:42:59 -05:00
Jonas Franz
e777c6bdc6 Integrate OAuth2 Provider (#5378) 2019-03-08 11:42:50 -05:00
John Olheiser
4b7237b63e Doc updates for customization and installation. (#6176)
* Doc updates and changing default sqlite DB path

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

* Update customizing locales and THEMES

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

* Add link to templates directory

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

* Add portion for final step of running Gitea

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

* Add recommended to service file usage

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

* Removed DB path change, moving to another PR
Updated doc sentence structure

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

* Revert change to template wording

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

* Move recommended run-type to top
2019-02-28 20:09:47 +08:00
Lunny Xiao
477ef46251
Add more tests and docs for issue indexer, add db indexer type for searching from database (#6144)
* add more tests and docs for issue indexer, add db indexer type for searching from database

* fix typo

* fix typo

* fix lint

* improve docs
2019-02-21 13:01:28 +08:00
John Olheiser
eaf9ded182 Makefile changes for Windows and easier development (#6103)
* Added Go Path and node_modules to PATH
* Uses npx now for generate-stylesheets
* Uses `go env GOPATH` to calculate adding GOPATH/bin to PATH
* Added note about installing Node 8.0+ to generate stylesheets
* Added preferred Node version to CONTRIBUTING.md
2019-02-20 19:56:40 +00:00
Lanre Adelowo
44114b38e6 Implement "conversation lock" for issue comments (#5073) 2019-02-18 22:55:04 +02:00
Rémy Boulanouar
64ce159a6e Allow to set organization visibility (public, internal, private) (#1763) 2019-02-18 18:00:27 +02:00
zeripath
7f38e2d0de
Update and expand information about building Gitea (#6019)
* Update and expand building information

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

* remove extraneous extra line

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

* Fix spelling mistake

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

* Note about documentation for the website

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

* More changes

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

* Clarified the automatic build dependency

* Update the from-source to match the hacking information

* Extend quotes

* Update required go and discord link

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

* Update hacking-on-gitea.en-us.md

Add in information about postcss
2019-02-12 16:22:01 +00:00
Lanre Adelowo
9d8178b3ac Add option to close issues via commit on a non master branch (#5992)
* fixes #5957

* add tests to make sure config option is respected

* use already defined struct

* - use migration to make the flag repo wide not for the entire gitea instance
Also note that the config value can still be set so as to be able to control the value for new repositories that are to be created

- fix copy/paste error in copyright header year and rearrange import

- use repo config instead of server config value to determine if a commit should close an issue

- update testsuite

* use global config only when creating a new repository

* allow repo admin toggle feature via UI

* fix typo and improve testcase

* fix fixtures

* add DEFAULT prefix to config value

* fix test
2019-02-10 21:27:19 +02:00
Lunny Xiao
9e8cc3b18d add default time out for git operations (#6015) 2019-02-09 22:44:24 +00:00
Richard Mahn
da1edbfb79 Feature - Pagination for git tree API (#5838)
* Feature - Pagination for git tree API

* Handles case when page is negative

* Does a for loop over the start and end rather than all entries

* Removed redundent logic

* Adds per_page as a query parameter

* Adds DEFAULT_GIT_TREES_PER_PAGE for settings, ran make fmt

* Fix typo in cheat-sheet en

* Makes page start at 1, generated swagger

* Use updates to SDK

* Updates to use latest sdk

* Updates swagger for tree api

* Adds test for GetTreeBySHA

* Updates per PR reviews

* Updates per PR reviews

* Remove file

* Formatting

* Fix to swagger file

* Fix to swagger

* Update v1_json.tmpl

* Fix to swagger file
2019-02-06 18:19:26 +00:00
zeripath
f286a5abb4 Allow Macaron to be set to log through to gitea.log (#5667)
* Allow Macaron to be set to log through gitea.log

Fix #4291
2019-02-05 22:06:41 -05:00
techknowlogick
9de871a0f8
add other session providers (#5963) 2019-02-05 11:52:51 -05:00
zeripath
3d91bb2f2d Make log mailer for testing (#5893)
* Create log mailer for testing email settings

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

* Switch on the log mailer for the integration tests

This ensures that the sending mail process works

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

* rename the from user for mysql/mssql

* rename log sender to dummy sender

* update the integration tests
2019-02-02 21:06:52 -05:00
sebastian-sauer
84076211b3 Config option to disable automatic repo watching (#5852)
Add a new config option to enable / disable the automatic watching of
repos for new repositories and if a user is added to a team.

Fixes #653

Signed-off-by: Sebastian Sauer <sauer.sebastian@gmail.com>
2019-01-27 09:25:21 +00:00
Lunny Xiao
892bfd0b19 improve the releases api paging (#5831)
* improve the releases api paging

* add max limit on API paging
2019-01-24 20:59:27 +02:00
Peter Colberg
904188ce9c Adapt documentation to renamed ENABLE_SWAGGER option (#5811)
Updates documentation to account for the renamed ENABLE_SWAGGER_ENDPOINT from  #3572 (commit a74426d631)

Signed-off-by: Peter Colberg <peter@colberg.org>
2019-01-23 20:09:18 +00:00
techknowlogick
71c832e043
Add documentation for SHOW_REGISTRATION_BUTTON (#5778)
* Fix #5737
2019-01-19 18:22:47 -05:00
Paul Brackin
1bb22b2b47 Make db connect more robust (#5738) 2019-01-19 16:17:08 -05:00
Lanre Adelowo
9edc829c17 update docs to include THEMES config value (#5752)
* update docs to include THEMES

* Update app.ini.sample

* Update config-cheat-sheet.en-us.md
2019-01-17 14:48:01 -05:00
Lunny Xiao
270fa6d63b Support CORS headers to git smart http protocol (#5719) 2019-01-14 16:05:27 -05:00
0x5c
0de57fd57c Documentation: Clarity for HTTPS setups (#5626)
[https-setup]
- Made it clearer that HTTP redirection is possible
[config-cheat-sheet]
- Clarified the behavihour of the redirection-related config keys
2019-01-03 16:46:07 +01:00