aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Fix some lints (#17337)Lunny Xiao2021-10-176-12/+10
| | | Fix some linting problems.
* Move session to models/login (#17338)Lunny Xiao2021-10-171-8/+8
| | | Move model/session.go to models/login
* Make the Mirror Queue a queue (#17326)zeripath2021-10-174-38/+61
| | | | | | | | | Convert the old mirror syncing queue to the more modern queue format. Fix a bug in the from the repo-archive queue PR - the assumption was made that uniqueness could be enforced with by checking equality in a map in channel unique queues - however this only works for primitive types - which was the initial intention but is an imperfect. This is fixed by marshalling the data and placing the martialled data in the unique map instead. The documentation is also updated to add information about the deprecated configuration values. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add RSS/Atom feed support for user actions (#16002)65432021-10-161-1/+1
| | | Return rss/atom feed for user based on rss url suffix or Content-Type header.
* Add simple update checker to Gitea (#17212)techknowlogick2021-10-161-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add simple update checker to Gitea * update struct and remove comments * fix lint * Update custom/conf/app.example.ini * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: delvh <dev.lh@web.de> * Update custom/conf/app.example.ini Co-authored-by: delvh <dev.lh@web.de> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: delvh <dev.lh@web.de> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md Co-authored-by: Steven <61625851+justusbunsi@users.noreply.github.com> * Update docs/content/doc/advanced/config-cheat-sheet.en-us.md * Update modules/cron/tasks_extended.go Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> * Update custom/conf/app.example.ini Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> * take PR feedback into account and display banner on admin dashboard for alerts * Add more detailed message * placate lint * update per feedback Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Steven <61625851+justusbunsi@users.noreply.github.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Check for context exceeded in WalkGitLog (#17319)zeripath2021-10-151-0/+3
| | | | | | | | | | | There is a slight race in checking of a context deadline exceed in #16467 which leads to a 500 on the repository page. The solution is to check the error coming back from `*LogNameStatusRepoParser.Next()` and if it is the `ContextDeadlineExceeded` break from the loop. Fix #17314 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add buttons to allow loading of incomplete diffs (#16829)zeripath2021-10-151-8/+12
| | | | | | | | | | | | | | | | | This PR adds two buttons to the stats and the end of the diffs list to load the (some of) the remaining incomplete diff sections. Contains #16775 Signed-off-by: Andrew Thornton <art27@cantab.net> ## Screenshots ### Show more button at the end of the diff ![Screenshot from 2021-09-04 11-12-37](https://user-images.githubusercontent.com/1824502/132091009-b1f6113e-2c04-4be5-8a04-b8ecea56887b.png) ### Show more button at the end of the diff stats box ![Screenshot from 2021-09-04 11-14-54](https://user-images.githubusercontent.com/1824502/132091063-86da5a6d-6628-4b82-bea9-3655cd9f40f6.png)
* Multiple tokens support for migrating from github (#17134)Lunny Xiao2021-10-151-83/+129
| | | | | | | | | * multiple tokens support for migrating from github * improve code and token description * Fix bug * Add comment for get client
* Frontend refactor: move Vue related code from `index.js` to `components` ↵wxiaoguang2021-10-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dir, and remove unused codes. (#17301) * frontend refactor * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * Update templates/base/head.tmpl Co-authored-by: delvh <dev.lh@web.de> * Update docs/content/doc/developers/guidelines-frontend.md Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> * fix typo * fix typo * refactor PageData to pageData * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * Simply for the visual difference. Co-authored-by: delvh <dev.lh@web.de> * Revert "Apply suggestions from code review" This reverts commit 4d78ad9b0e96ca180e0823de17659a2e0814c099. Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: 6543 <6543@obermui.de>
* Upgrade chi to v5 (#17298)Lunny Xiao2021-10-135-5/+5
|
* Ensure that git daemon export ok is created for mirrors (#17243)zeripath2021-10-135-3/+40
| | | | | | | | | | | | | * Ensure that git daemon export ok is created for mirrors There is an issue with #16508 where it appears that create repo requires that the repo does not exist. This causes #17241 where an error is reported because of this. This PR fixes this and also runs update-server-info for mirrors and generated repos. Fix #17241 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Disable core.protectNTFS (#17300)zeripath2021-10-132-0/+7
| | | | | | | | | | | | | | core.protectNTFS protects NTFS from files which may be difficult to remove or interact with using the win32 api, however, it also appears to prevent such files from being entered into the git indexes - fundamentally causing breakages with PRs that affect these files. However, deliberately setting this to false may cause security issues due to the remain sparse checkout of files in the merge pipeline. The only sensible option therefore is to provide an optional setting which admins could set which would forcibly switch this off if they are affected by this issue. Fix #17092 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use pointer for wrappedConn methods (#17295)zeripath2021-10-121-3/+3
| | | | | Fix #17294 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add user status filter to admin user management page (#16770)wxiaoguang2021-10-124-7/+35
| | | | | | | | | | | | | | | | | | | | It makes Admin's life easier to filter users by various status. * introduce window.config.PageData to pass template data to javascript module and small refactor move legacy window.ActivityTopAuthors to window.config.PageData.ActivityTopAuthors make HTML structure more IDE-friendly in footer.tmpl and head.tmpl remove incorrect <style class="list-search-style"></style> in head.tmpl use log.Error instead of log.Critical in admin user search * use LEFT JOIN instead of SubQuery when admin filters users by 2fa. revert non-en locale. * use OptionalBool instead of status map * refactor SearchUserOptions.toConds to SearchUserOptions.toSearchQueryBase * add unit test for user search * only allow admin to use filters to search users
* [API] Add endpount to get user org permissions (#17232)Romain2021-10-121-0/+9
| | | | | | | | | | | | * Add endpoint * Add swagger response + generate swagger * Stop execution if user / org is not found * Add tests Co-authored-by: 6543 <6543@obermui.de>
* Open markdown image links in new window (#17287)wxiaoguang2021-10-112-4/+8
|
* Add a simple way to rename branch like gh (#15870)a10121127962021-10-082-1/+37
| | | | | | | | | | - Update default branch if needed - Update protected branch if needed - Update all not merged pull request base branch name - Rename git branch - Record this rename work and auto redirect for old branch on ui Signed-off-by: a1012112796 <1012112796@qq.com> Co-authored-by: delvh <dev.lh@web.de>
* Defer Last Commit Info (#16467)zeripath2021-10-088-69/+85
| | | | | | | | | | | One of the biggest reasons for slow repository browsing is that we wait until last commit information has been generated for all files in the repository. This PR proposes deferring this generation to a new POST endpoint that does the look up outside of the main page request. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Remove heads pointing to missing old refs (#17076)99rgosse2021-10-082-0/+22
| | | | | Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Add protection to disable Gitea when run as root (#17168)techknowlogick2021-10-071-0/+12
| | | | Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: 6543 <6543@obermui.de>
* API pull's head/base have correct permission (#17214)pricly-yellow2021-10-073-18/+30
| | | | | | | | | | close #17181 * for all pull requests API return permissions of caller * for all webhook return empty permissions Signed-off-by: Danila Kryukov <pricly_yellow@dismail.de> Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: 6543 <6543@obermui.de>
* Avatar refactor, move avatar code from `models` to `models.avatars`, remove ↵wxiaoguang2021-10-064-24/+43
| | | | | | | | | | | | | | | | duplicated code (#17123) Why this refactor The goal is to move most files from `models` package to `models.xxx` package. Many models depend on avatar model, so just move this first. And the existing logic is not clear, there are too many function like `AvatarLink`, `RelAvatarLink`, `SizedRelAvatarLink`, `SizedAvatarLink`, `MakeFinalAvatarURL`, `HashedAvatarLink`, etc. This refactor make everything clear: * user.AvatarLink() * user.AvatarLinkWithSize(size) * avatars.GenerateEmailAvatarFastLink(email, size) * avatars.GenerateEmailAvatarFinalLink(email, size) And many duplicated code are deleted in route handler, the handler and the model share the same avatar logic now.
* Add metrics to get issues by repository (#17225)Romain2021-10-052-33/+50
|
* Add metrics to get issues by label (#17201)Romain2021-10-032-5/+22
| | | | | | | | | | | | | | | | | | | | | * Add metrics to get issues by label * Add comment on IssueByLabelCount * Code review - Unify "AS" in SQL (#17201) * Code review - Remove useless join (#17201) * Code review - Disable issue_by_label by default in settings (#17201) * use e * restore empty line * update docs Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <matti@mdranta.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Add projects and project boards in exposed metrics (#17202)Romain2021-10-021-0/+24
| | | | | | | * Add projects and project boards in exposed metrics * Refactor db.GetEngine Co-authored-by: delvh <dev.lh@web.de>
* API: add html urls to notification subjects (#17178)Norwin2021-09-302-9/+19
| | | | | | | | * API: add html urls to notification subjects * add "Repository" Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Create pub/priv keypair for federation (#17071)techknowlogick2021-09-282-0/+111
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * add logic for creating pub/priv keypair for federation * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * make fmt * Update modules/activitypub/keypair.go Co-authored-by: delvh <dev.lh@web.de> * add tests * fix revert * more tests * Apply suggestions from code review Co-authored-by: delvh <dev.lh@web.de> * make fmt Co-authored-by: delvh <dev.lh@web.de> Co-authored-by: 6543 <6543@obermui.de>
* Fix bug of get context user (#17169)Lunny Xiao2021-09-281-0/+11
| | | Co-authored-by: 6543 <6543@obermui.de>
* Add nodeinfo endpoint for federation purposes (#16953)techknowlogick2021-09-283-0/+67
| | | | | | | | | | | | | | | | Nodeinfo is a way to expose certain metadata about a server for use of discovery regarding functionality of its federation capabilities. Two endpoints are required: 1. `/.well-known/nodeinfo` which informs client where it can find the location of the location of its metadata (including which version of the schema is used) 2. the endpoint which exposes the metadata in json format according to schema. Notes: * `openRegistrations` is a required field, but I propose to set to false as default in case someone writes a crawler to discover "open" gitea instances * to limit data leakage I also propose to not include the `usage` field (note it is required so it should be included, but left as empty). More info: https://github.com/jhass/nodeinfo https://github.com/jhass/nodeinfo/tree/main/schemas/2.1 http://nodeinfo.diaspora.software/protocol.html
* Don't return binary file changes in raw PR diffs by default (#17158)Norwin2021-09-271-6/+14
| | | | | | | | * return diffs without binary file content change * ?binary=true option to restore old behaviour Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: zeripath <art27@cantab.net>
* Nicely handle missing user in collaborations (#17049)zeripath2021-09-271-253/+138
| | | | | | | | | | | | | | | | * Nicely handle missing user in collaborations It is possible to have a collaboration in a repository which refers to a no-longer existing user. This causes the repository transfer to fail with an unusual error. This PR makes `repo.getCollaborators()` nicely handle the missing user by ghosting the collaboration but also adds consistency check. It also adds an Access consistency check. Fix #17044 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Create doctor command to fix repo_units broken by dumps from 1.14.3-1.14.6 ↵zeripath2021-09-272-0/+589
| | | | | | | | | | | | | | | | (#17136) There was a serious issue with the `gitea dump` command in 1.14.3-1.14.6 which led to corruption of the `config` field of the `repo_unit` table. This PR adds a doctor command to attempt to fix the broken repo_units. Users affected by #16961 should run: ``` gitea doctor --fix --run fix-broken-repo-units ``` Fix #16961 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Use light/dark theme based on system preference (#17051)Gwyneth Morgan2021-09-271-2/+2
| | | | | | | | Add a new default theme `auto`, which will automatically switch between `gitea` (light) and `arc-green` (dark) themes depending on the user's operating system settings. Closes: #8183
* Support direct comparison (git diff a..b) as well merge comparison (a...b) ↵zeripath2021-09-271-5/+17
| | | | | | | | | | | | (#16635) This PR changes the compare page to make the "..." in the between branches a clickable link. This changes the comparison type from "..." to "..". Similarly it makes the initial compare icon clickable to switch the head and base branches. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Fix bundle creation (#17079)Alexey 〒erentyev2021-09-261-7/+17
| | | | | | | Signed-off-by: Alexey Terentyev <axifnx@gmail.com> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Gwyneth Morgan <87623694+gwymor@users.noreply.github.com> Co-authored-by: Gwyneth Morgan <gwymor@tilde.club>
* Move twofactor to models/login (#17143)Lunny Xiao2021-09-252-5/+6
|
* Prevent panic in Org mode HighlightCodeBlock (#17140)zeripath2021-09-243-12/+46
| | | | | | | | | | | When rendering source in org mode there is a mistake in the highlight code that causes a panic. This PR fixes this. Fix #17139 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Move login related structs and functions to models/login (#17093)Lunny Xiao2021-09-246-21/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Move login related structs and functions to models/login * Fix test * Fix lint * Fix lint * Fix lint of windows * Fix lint * Fix test * Fix test * Only load necessary fixtures when preparing unit tests envs * Fix lint * Fix test * Fix test * Fix error log * Fix error log * Fix error log * remove unnecessary change * fix error log * merge main branch
* DBContext is just a Context (#17100)zeripath2021-09-2311-23/+27
| | | | | | | | | | | | | | | | | | | | | | | | | * DBContext is just a Context This PR removes some of the specialness from the DBContext and makes it context This allows us to simplify the GetEngine code to wrap around any context in future and means that we can change our loadRepo(e Engine) functions to simply take contexts. Signed-off-by: Andrew Thornton <art27@cantab.net> * fix unit tests Signed-off-by: Andrew Thornton <art27@cantab.net> * another place that needs to set the initial context Signed-off-by: Andrew Thornton <art27@cantab.net> * avoid race Signed-off-by: Andrew Thornton <art27@cantab.net> * change attachment error Signed-off-by: Andrew Thornton <art27@cantab.net>
* refactor: move from io/ioutil to io and os package (#17109)Eng Zer Jun2021-09-2254-167/+141
| | | | | | | | | The io/ioutil package has been deprecated as of Go 1.16, see https://golang.org/doc/go1.16#ioutil. This commit replaces the existing io/ioutil functions with their new definitions in io and os packages. Signed-off-by: Eng Zer Jun <engzerjun@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Ignore Sync errors on pipes when doing `CheckAttributeReader.CheckPath`, fix ↵wxiaoguang2021-09-2035-65/+960
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the hang of `git cat-file` (#17096) * Ignore Sync errors on pipes when doing `CheckAttributeReader.CheckPath` * apply env patch * Drop the Sync and fix a number of issues with the Close function Signed-off-by: Andrew Thornton <art27@cantab.net> * add logs for DBIndexer and CheckPath * Fix some more closing bugs Signed-off-by: Andrew Thornton <art27@cantab.net> * Add test case for language_stats Signed-off-by: Andrew Thornton <art27@cantab.net> * Update modules/indexer/stats/db.go Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: Andrew Thornton <art27@cantab.net> Co-authored-by: Lauris BH <lauris@nix.lv> Co-authored-by: 6543 <6543@obermui.de>
* Move db related basic functions to models/db (#17075)Lunny Xiao2021-09-1942-169/+198
| | | | | | | | | | | | | | | | | | | | | | | | | * Move db related basic functions to models/db * Fix lint * Fix lint * Fix test * Fix lint * Fix lint * revert unnecessary change * Fix test * Fix wrong replace string * Use *Context * Correct committer spelling and fix wrong replaced words Co-authored-by: zeripath <art27@cantab.net>
* Switch migration icon to svg (#15954)silverwind2021-09-181-3/+3
| | | | | | | | Followup on https://github.com/go-gitea/gitea/pull/15952, use SVG for migration icon. <img width="541" alt="Screen Shot 2021-05-23 at 00 26 12" src="https://user-images.githubusercontent.com/115237/119242417-c1a37600-bb5d-11eb-9f97-a80aa89741ee.png"> <img width="540" alt="Screen Shot 2021-05-23 at 00 25 39" src="https://user-images.githubusercontent.com/115237/119242419-c2d4a300-bb5d-11eb-9792-1e6e4092c9f9.png">
* Add caller to cat-file batch calls (#17082)zeripath2021-09-171-2/+21
| | | | | | | | Some people still appear to report unclosed cat-files. This PR simply adds the caller to the process descriptor for the CatFileBatch and CatFileBatchCheck calls. Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
* Make LDAP be able to skip local 2FA (#16954)zeripath2021-09-172-0/+7
| | | | | | This PR extends #16594 to allow LDAP to be able to be set to skip local 2FA too. The technique used here would be extensible to PAM and SMTP sources. Signed-off-by: Andrew Thornton <art27@cantab.net>
* Clean-up HookPreReceive and restore functionality for pushing non-standard ↵zeripath2021-09-161-0/+10
| | | | | | | | | | | | | | | | | | refs (#16705) * Clean-up HookPreReceive and restore functionality for pushing non-standard refs There was an inadvertent breaking change in #15629 meaning that notes refs and other git extension refs will be automatically rejected. Further following #14295 and #15629 the pre-recieve hook code is untenably long and too complex. This PR refactors the hook code and removes the incorrect forced rejection of non-standard refs. Fix #16688 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Fix bug of migrate comments which only fetch one page (#17055)Lunny Xiao2021-09-151-2/+7
| | | | | | | * Fix bug of migrate comments which only fetch one page * add next page to trace Co-authored-by: zeripath <art27@cantab.net>
* Do not show issue context popup on external issues (#17050)zeripath2021-09-153-4/+11
| | | | | | | | | The issues pop-up context cannot work for external issues - therefore do not show these. Fix #17047 Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add doctor dbconsistency check for release and attachment (#16978)Lunny Xiao2021-09-141-0/+36
|
* Decrement Fork Num when converting from Fork (#17035)zeripath2021-09-141-0/+31
| | | | | | | | When converting repositories from forks to normal the root NumFork needs to be decremented too. Fix #17026 Signed-off-by: Andrew Thornton <art27@cantab.net>