Commit Graph

456 Commits

Author SHA1 Message Date
zeripath 1853131d42
Use keys.openpgp.org instead of pgp.mit.edu (#11249)
The SKS Keyserver network has been under attack with poisoned
certificates since at least 2019. Downloading a poisoned certificate has
the awful side-effect of completely breaking your keyring and most
software has now moved off the network and uses the keys.openpgp.org
which has a different protocol instead - in fact one whereby emails are
verified.

For more details regarding the attack see: https://gist.github.com/rjhansen/67ab921ffb4084c865b3618d6955275f

See: https://keys.openpgp.org/about and https://keys.openpgp.org/about/faq

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-04-30 12:08:43 +03: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
Lunny Xiao 7c8e116987
Add translation head on docs site (#11063)
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-15 01:42:09 -03: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
maxm123 9b7737df2d
Add charset handling to backup/restore doc (#11062)
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-04-13 23:55:20 -03: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
Bagas Sanjaya 8592fb7121
[Docs] Cross Build Gitea from Source (#10999)
* Add cross-build docs

Note that C cross compiler is required for building Gitea with `TAGS`.

* Apply suggestion from @mrsdizzie

Co-Authored-By: mrsdizzie <info@mrsdizzie.com>

* Apply suggestion from @guillep2k

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

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-04-11 00:13:31 -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
zeripath 856030c530
Add docs for gmail (#10995)
Fix #10971

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

Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-06 16:18:42 -04:00
techknowlogick 4af7c47b38
Update docs to 1.11.4 (#10941) 2020-04-03 13:08:40 -04:00
Bagas Sanjaya 51140a970f
[Docs] Database Preparation - Connection over TLS (#10889)
* Database Preparation - Connection over TLS

* Step 6 MySQL edit

- have been created [before -> earlier]
- recreate user, [and this time]

* Apply suggestions from @guillep2k

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

* certificat[e] typo

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-04-01 12:30:25 -03:00
zeripath 5c3be56f7b
Add IIS Reverse Proxy documentation (#10881)
* Add IIS Reverse Proxy documentation

@mahdiit in #10748 described how to set up IIS as a reverse proxy. This
PR adds these to our documentation.

Close #10748

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

* Update docs/content/doc/usage/reverse-proxies.en-us.md

Co-Authored-By: mrsdizzie <info@mrsdizzie.com>

Co-authored-by: mrsdizzie <info@mrsdizzie.com>
2020-03-30 00:11:15 +03:00
John Olheiser 3f0cb8b33a
Remove test from installation directions (#10873)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-03-29 11:07:40 +01: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
techknowlogick 2fa1078911
go 1.14 (#10467) 2020-03-20 10:29:31 -04:00
John Olheiser 7225453d5f
Update Gitea version in docs (#10772) 2020-03-19 16:05:19 -04:00
Simon Legner a2809b391d
doc(authentication.en-us): remove superflous line (#10758) 2020-03-18 09:52:51 -05:00
8ctopus 2e5d37463e
Documentation - updated email setup (#10695)
* Updated email setup documentation to include sendmail option

* Update docs/content/doc/usage/email-setup.en-us.md

full path to sendmail

Co-Authored-By: mrsdizzie <info@mrsdizzie.com>

* Update docs/content/doc/usage/email-setup.en-us.md

docker image does not have sendmail

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

* Update docs/content/doc/usage/email-setup.en-us.md

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

* Update docs/content/doc/usage/email-setup.en-us.md

Co-Authored-By: James Lakin <jamesorlakin@users.noreply.github.com>

* Update docs/content/doc/usage/email-setup.en-us.md

Co-Authored-By: James Lakin <jamesorlakin@users.noreply.github.com>

Co-authored-by: 8ctopus <hello@octopuslabs.io>
Co-authored-by: mrsdizzie <info@mrsdizzie.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: James Lakin <jamesorlakin@users.noreply.github.com>
2020-03-13 16:20:14 +01: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
silverwind d6657644a9
Modernize docs/assets/js/search.js (#10621)
- reformated file with eslint's --fix
- did some minor rule adjustments
- removed unneccesary console debug
- fixed a typo
2020-03-08 21:41:52 -03:00
James Lakin a9f4489bbc
System-wide webhooks (#10546)
* Create system webhook column (and migration)

* Create system webhook DB methods

Based on the default webhook ones

* Modify router to handle system webhooks and default ones

* Remove old unused admin nav template

* Adjust orgRepoCtx to differentiate system and default webhook URLs

* Assign IsSystemWebhook when creating webhooks

* Correctly use booleans for IsSystemWebhook

* Use system webhooks when preparing webhooks for payload

* Add UI and locale changes

* Use router params to differentiate admin hook pages

* Fix deleting admin webhooks and rename method

* Add clarity to webhook docs

* Revert "Remove old unused admin nav template"

This reverts commit 191a20a738.

* Rename WebHooksNewPost to GiteaHooksNewPost for clarity

* Reintroduce blank line lost during merge conflict

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-03-09 00:08:05 +02: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
zeripath f7a6763c58
Changelog for v1.11.2 (#10627) (#10634)
Forward port Changelog for v1.11.2 (#10627)

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
2020-03-06 14:26:30 +00: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
John Olheiser 10081f88ed
Add FAQ for markdown (#10611)
* Add FAQ for markdown

* Expand explanation @guillep2k

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-03-05 09:05:18 -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
Lauris BH 37c3db7be6
Add restricted user filter to LDAP authentication (#10600)
* Add restricted user filter to LDAP authentification

* Fix unit test cases
2020-03-05 08:30:33 +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
zeripath 90919bb37e
Show Signer in commit lists and add basic trust (#10425)
* Show Signer in commit lists and add basic trust

Show the avatar of the signer in the commit list pages as we do not
enforce that the signer is an author or committer. This makes it
clearer who has signed the commit.

Also display commits signed by non-members differently from
members and in particular make it clear when a non-member signer
is different from the committer to help reduce the risk of
spoofing.

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

* ensure orange text and background is available

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

* Update gpg_key.go

* Update models/gpg_key.go

* Apply suggestions from code review

* Require team collaborators to have access to UnitTypeCode

* as per @6543

* fix position of sha as per @silverwind

* as per @guillep2k
2020-02-27 16:20:55 -03:00
Karsten Lehmann 17581252e4
Fixed formatting (#10485)
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
2020-02-26 13:28:39 -05:00
Ask Bjørn Hansen b098cc24c5
Use documentation IPs for example IPs (#10434)
See https://tools.ietf.org/html/rfc5737

Co-authored-by: John Olheiser <john.olheiser@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-02-25 13:25:17 -05:00
6543 fa3381610c
update discord link (#10455) 2020-02-25 12:36:45 -05:00
Ask Bjørn Hansen c97433d07d
docs: Fix MySQL create database syntax (#10436)
Signed-off-by: Ask Bjørn Hansen <ask@develooper.com>
2020-02-24 14:15:15 +02:00
silverwind 2ed9ead6de
Add frontend/backend make targets, fix source release (#10325)
* Add frontend/backend make targets, fix source release

- Add 'make backend' and 'make frontend' make targets which are used to
  build go and js/css/svg files respectively.

- The 'backend' target can be invoked without requiring Node.js to be
  present on the system if pre-built frontend assets are present like
  in the release source tarballs.

- Fix source releases missing 'dist' folders inside 'node_modules' which
  were erronously excluded from tar.

- Store VERSION in file VERSION for the release tarballs and prefer that
  file over git-derived version.

* fix release task

* fix typo

* fix another typo
2020-02-22 17:15:11 +08: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
Andres Mazzo 194ef0b590
fix typo of english content page (#10370) 2020-02-19 15:48:33 -06: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
Bagas Sanjaya 530f8963f3
[Docs] Database Preparation (#9826)
* Database Preparation

* Apply suggestions from @guillep2k

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

* Repeat strong password notice on PostgreSQL

* Add prerequisite note

* Use utf8mb4 instead of utf8

* Use utf8mb4 if complete character coverage wanted

* utf8mb4 recommended

* Reword utf8mb4 recommendation

* Set InnoDB global variables may be needed

* Reorder step number

* Whoops, bump year date

* Remove `SET GLOBAL`s and step number reorder

It is assumed that such global variables value are already as default on MySQL 5.7 and later, so those are redundant.

* Syntax edit on MySQL GRANT PRIVILEGEs

* DB engine uniformity intro edit

Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-02-18 16:51:24 -05: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
Gary Kim 5563d56a32
Update static resources documentation (#10270)
Signed-off-by: Gary Kim <gary@garykim.dev>

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
2020-02-16 01:00:40 +02:00
John Olheiser 41d61d470e
Update discord link (#10263) 2020-02-13 22:07:10 -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
John Olheiser b5418a6443
Changelog 1.11.0 (#10204) (#10211)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: guillep2k <18600385+guillep2k@users.noreply.github.com>
2020-02-10 11:16:31 -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
guillep2k d816f7018b
Remove migration support from versions earlier than 1.6.0 (#10026)
* Remove migration support from versions earlier than 1.6.0

* Remove unused functions

* Update gogs upgrade instructions

* Improve "latest" link as per @jolheiser

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2020-01-31 21:42:45 +08: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
John Olheiser 28216bde46 More expansions in template repositories (#10021)
* Super expansion
* Explain which features are in 1.11 vs 1.12
* Move imports

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-01-28 13:57:15 +00: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
John Olheiser 514be723b2 Update migration instructions (#9955)
Signed-off-by: jolheiser <john.olheiser@gmail.com>
2020-01-24 14:23:38 +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
David Svantesson aac8250b47 Explicitly refer to PR in squash-merge commit message in case of external tracker (#9844)
* Explicitly refer to PR in squash-merge commit message in case of external tracker

* documentation

Co-authored-by: zeripath <art27@cantab.net>
2020-01-18 12:40:43 +08:00
6543 fec1095f17 [Docs] add usefull info to REQUIRE_SIGNIN_VIEW (#9848) 2020-01-17 18:34:55 -05:00
6543 3ae5f8ef11 [Docs] Update Feature 'Reject unsigned commits' (#9793)
* update docs

* add link to feature
2020-01-16 01:43:02 -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
Manush Dodunekov 1751d5fcf2 Restricted users (#6274)
* Restricted users (#4334): initial implementation

* Add User.IsRestricted & UI to edit it

* Pass user object instead of user id to places where IsRestricted flag matters

* Restricted users: maintain access rows for all referenced repos (incl public)

* Take logged in user & IsRestricted flag into account in org/repo listings, searches and accesses

* Add basic repo access tests for restricted users

Signed-off-by: Manush Dodunekov <manush@stendahls.se>

* Mention restricted users in the faq

Signed-off-by: Manush Dodunekov <manush@stendahls.se>

* Revert unnecessary change `.isUserPartOfOrg` -> `.IsUserPartOfOrg`

Signed-off-by: Manush Dodunekov <manush@stendahls.se>

* Remove unnecessary `org.IsOrganization()` call

Signed-off-by: Manush Dodunekov <manush@stendahls.se>

* Revert to an `int64` keyed `accessMap`

* Add type `userAccess`
* Add convenience func updateUserAccess()
* Turn accessMap into a `map[int64]userAccess`

Signed-off-by: Manush Dodunekov <manush@stendahls.se>

* or even better: `map[int64]*userAccess`

* updateUserAccess(): use tighter syntax as suggested by lafriks

* even tighter

* Avoid extra loop

* Don't disclose limited orgs to unauthenticated users

* Don't assume block only applies to orgs

* Use an array of `VisibleType` for filtering

* fix yet another thinko

* Ok - no need for u

* Revert "Ok - no need for u"

This reverts commit 5c3e886aab.

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2020-01-13 18:33:46 +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
Lunny Xiao f69f5a9f10 Add a new command doctor to check if some wrong configurations on gitea instance (#9095)
* add doctor

* Add a new command doctor to check if some wrong configurations on gitea instance

* fix import

* use regex match authorized_keys on doctor

* Add documentation
2020-01-11 15:24:57 +01:00
Bagas Sanjaya b822518e39 [Docs] Linux Service Edit (#9633)
* Rename h3 title

* Add intro

Should work on Ubuntu Xenial, but should work on any Linux distros.

* Indirect edit files

Instead of providing `sudo vim`, invite to edit files.

* enable now instead of enable and start

* Re-add systemctl enable && systemctl start

* Revert service enablement back to status quo

* Add enable now counterpart for systemd > v220

* Apply suggestions from @sapk

Strip `vim` from editor usage

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

Co-authored-by: Antoine GIRARD <sapk@users.noreply.github.com>
2020-01-08 17:33:13 +01:00
Bagas Sanjaya 74d6ec6807 [Docs] Grammar Edit on Enabling HTTPS Using Reverse Proxy (#9649)
* Use infinitives for accept and pass

* Close parentheeses for proxy exposed
2020-01-08 10:20:15 +01: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
John Olheiser b3c5b4b0d1 Update version in docs (#9588) 2020-01-02 17:53:08 +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
Erwan Colin 2401779aac Correct a language error in reverse proxy doc (#9455)
* Correct a language error in reverse proxy doc

* Apply suggestions from code review

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

Co-authored-by: zeripath <art27@cantab.net>
2019-12-27 14:17:26 +02:00
Bagas Sanjaya 114d474f02 [Docs] Clarify HTTPS Termination Proxy on Using Reverse Proxy to Enable HTTPS (#9491)
* Clarification note for HTTPS termination proxy method

* Textual grammar edit

* Mention ROOT_URL

* Apply suggestion by mrsdizzie

Co-authored-by: techknowlogick <matti@mdranta.net>
2019-12-26 13:05:05 +08: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
NZTim f8a6eb8f32 Apache configuration for Let's Encrypt webroot validation (#9438) 2019-12-20 19:58:26 +02: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
zeripath d1a49977b0 AuthorizedKeysCommand should not query db directly (#9371)
* AuthorizedKeysCommand should not query db directly

* Update routers/private/internal.go

* Fix import order
2019-12-16 20:49:07 -05: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
John Olheiser 8f16a2c37b Update _headers (#9349) 2019-12-13 22:03:09 +02:00
Matthew Bramer 39db99a595 Supports both CMD and PowerShell (#9344)
sc is aliased to Set-Content in PowerShell and these commands will not work without the `.exe` extension.
2019-12-13 00:13:38 -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
Justin R. Cutler 2d8a89563d Correct port range for cap_net_bind_service (#9306) 2019-12-09 14:20:09 -05:00
silverwind 3f42934b9a Remove explicit 'generate' calls, fix release task (#9288)
* Remove more explicit 'generate' calls

`generate` is now implicit during `build` since #9114, it is no longer
necessary or desired to specify it explicitely.

* add js,css,generate dependencies to release task

* remove generate warning as per @lunny
2019-12-08 18:56:59 +02:00