Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-12-01 22:36:10 +01:00
Commit graph

1553 commits

Author SHA1 Message Date
Lunny Xiao 95e682f104
Cache repository default branch commit status to reduce query on commit status table (#29444)
After repository commit status has been introduced on dashaboard, the
most top SQL comes from `GetLatestCommitStatusForPairs`.

This PR adds a cache for the repository's default branch's latest
combined commit status. When a new commit status updated, the cache will
be marked as invalid.

<img width="998" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/76759de7-3a83-4d54-8571-278f5422aed3">

(cherry picked from commit e308d25f1b2fe24b4735432b05e5e221879a2705)
2024-03-11 23:36:58 +07:00
Zettat123 e7afba21ce
Skip email domain check when admins edit user emails (#29609)
Follow #29522

Administrators should be able to set a user's email address even if the
email address is not in `EMAIL_DOMAIN_ALLOWLIST`

(cherry picked from commit 136dd99e86eea9c8bfe61b972a12b395655171e8)
2024-03-11 23:36:58 +07:00
Zettat123 b6057a34db
Skip email domain check when admin users adds user manually (#29522)
Fix #27457

Administrators should be able to manually create any user even if the
user's email address is not in `EMAIL_DOMAIN_ALLOWLIST`.

(cherry picked from commit 4fd9c56ed09b31e2f6164a5f534a31c6624d0478)
2024-03-11 23:36:58 +07:00
Lunny Xiao bb09ad2b63
Allow options to disable user ssh keys configuration from the interface on app.ini (#29447)
Follow #29275
Extract from #20549
Fix #24716

---------

Co-authored-by: delvh <dev.lh@web.de>
(cherry picked from commit 8e12ba34bab7e728ac93ccfaecbe91e053ef1c89)

Conflicts:
	custom/conf/app.example.ini
	trivial context conflict
2024-03-11 23:36:57 +07:00
KN4CK3R 8f55cf199d
Port "Fix wrong test usage of AppSubURL"
- Port of https://github.com/go-gitea/gitea/pull/29459
- The tests use an invalid `setting.AppSubURL`. The wrong behaviour
disturbs other PRs like https://github.com/go-gitea/gitea/pull/29222
and https://github.com/go-gitea/gitea/pull/29427.
2024-03-06 21:47:44 +01:00
Nanguan Lin c69a0bb506
Fix 500 when pushing release to an empty repo (#29554)
As title.
The former code directly used `ctx.Repo.GitRepo`, causing 500.

22b4f0c09f/routers/api/v1/repo/release.go (L241)
(cherry picked from commit 6e2aafd5130cb9436f02209ae90bf79a58cc13ae)
2024-03-06 12:10:47 +08:00
wxiaoguang 12441d7c5c
Fix incorrect relative/absolute URL usages (#29531)
Add two "HTMLURL" methods for PackageDescriptor.
And rename "FullWebLink" to "VersionWebLink"

(cherry picked from commit bf6502a8f7a2e9a2b64b43b7733316d863c9a768)
2024-03-06 12:10:46 +08:00
KN4CK3R 47a913d40d
Add support for API blob upload of release attachments (#29507)
Fixes #29502

Our endpoint is not Github compatible.

https://docs.github.com/en/rest/releases/assets?apiVersion=2022-11-28#upload-a-release-asset

---------

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 70c126e6184872a6ac63cae2f327fc745b25d1d7)
2024-03-06 12:10:46 +08:00
6543 e2371743d5
remove util.OptionalBool and related functions (#29513)
and migrate affected code

_last refactoring bits to replace **util.OptionalBool** with
**optional.Option[bool]**_

(cherry picked from commit a3f05d0d98408bb47333b19f505b21afcefa9e7c)

Conflicts:
	services/repository/branch.go
	trivial context conflict
2024-03-06 12:10:46 +08:00
ChristopherHX 66632c4958
Actions Artifacts v4 backend (#28965)
Fixes #28853

Needs both https://gitea.com/gitea/act_runner/pulls/473 and
https://gitea.com/gitea/act_runner/pulls/471 on the runner side and
patched `actions/upload-artifact@v4` / `actions/download-artifact@v4`,
like `christopherhx/gitea-upload-artifact@v4` and
`christopherhx/gitea-download-artifact@v4`, to not return errors due to
GHES not beeing supported yet.

(cherry picked from commit a53d268aca87a281aadc2246541f8749eddcebed)
2024-03-06 12:10:45 +08:00
Lunny Xiao ee6ff937c0
Allow options to disable user gpg keys configuration from the interface on app.ini (#29486)
Follow #29447
Fix #29454
Extract from #20549

(cherry picked from commit 9de5e39e25009bacc5ca201ed97e9cbb623e56e9)

Conflicts:
	custom/conf/app.example.ini
	docs/content/administration/config-cheat-sheet.en-us.md
	docs/content/administration/config-cheat-sheet.zh-cn.md
	trivial context conflict
2024-03-06 12:10:45 +08:00
6543 d3d70198b0
migrate some more "OptionalBool" to "Option[bool]" (#29479)
just some refactoring bits towards replacing **util.OptionalBool** with
**optional.Option[bool]**

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
(cherry picked from commit f6656181e4a07d6c415927220efa2077d509f7c6)

Conflicts:
	models/repo/repo_list_test.go
	trivial shared fixture count conflicts
2024-03-06 12:10:44 +08:00
Lunny Xiao 46fca90cfc
Move generate from module to service (#29465)
(cherry picked from commit b5188cd55c535a588492fb4e153d646ec4f3232a)
2024-03-06 12:10:44 +08:00
Lunny Xiao c498c07adf
Fix missed return (#29450)
(cherry picked from commit e9f4c2db8291c54044345aebd9381ac820ed9687)
2024-03-06 12:10:43 +08:00
Lunny Xiao 894d9b2836
Move context from modules to services (#29440)
Since `modules/context` has to depend on `models` and many other
packages, it should be moved from `modules/context` to
`services/context` according to design principles. There is no logic
code change on this PR, only move packages.

- Move `code.gitea.io/gitea/modules/context` to
`code.gitea.io/gitea/services/context`
- Move `code.gitea.io/gitea/modules/contexttest` to
`code.gitea.io/gitea/services/contexttest` because of depending on
context
- Move `code.gitea.io/gitea/modules/upload` to
`code.gitea.io/gitea/services/context/upload` because of depending on
context

(cherry picked from commit 29f149bd9f517225a3c9f1ca3fb0a7b5325af696)

Conflicts:
	routers/api/packages/alpine/alpine.go
	routers/api/v1/repo/issue_reaction.go
	routers/install/install.go
	routers/web/admin/config.go
	routers/web/passkey.go
	routers/web/repo/search.go
	routers/web/repo/setting/default_branch.go
	routers/web/user/home.go
	routers/web/user/profile.go
	tests/integration/editor_test.go
	tests/integration/integration_test.go
	tests/integration/mirror_push_test.go
	trivial context conflicts
	also modified all other occurrences in Forgejo specific files
2024-03-06 12:10:43 +08:00
Gusted 42ae3d3d81
[BUG] Fix header name in swagger response
- This was incorrectly copied from the `swaggerCommitList` struct, which
on the other hand does set `X-Total`, but the API handler that uses this
response only sets `X-Total-Count`.
2024-02-29 14:08:10 +01:00
Earl Warren 7584ed6a4e Merge pull request '[CHORE] Update connect-go to maintained fork' (#2417) from gusted/forgejo-move-dep into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2417
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-02-28 11:11:26 +00:00
Gusted 0c4872f839
[CHORE] Update connect-go to maintained fork
- Update github.com/bufbuild/connect-go to
https://github.com/connectrpc/connect-go.
- This is a fork that's actively maintained and is recommend by the
original library. Looking at the recent release notes, it looks like
going in the right direction what one would expect of a library, no
strange features being added, lots of improvements.
- There's still an indirect dependency by
`code.gitea.io/actions-proto-go` on a old version of `connect-go`.
2024-02-28 09:40:56 +01:00
Earl Warren 2855727c85 Merge pull request 'Disabling Stars should disable the routes too' (#2471) from algernon/forgejo:stars/disable-routes into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2471
Reviewed-by: Otto <otto@codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-02-27 21:24:25 +00:00
oliverpool e154655c87 fix missing argument 2024-02-27 18:35:43 +00:00
Jimmy Praet f95fb8cc44 Add attachment support for code review comments (#29220)
Fixes #27960, #24411, #12183

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2024-02-27 18:35:43 +00:00
qwerty287 1608ef0ce9
Add API to get merged PR of a commit (#29243)
Adds a new API `/repos/{owner}/{repo}/commits/{sha}/pull` that allows
you to get the merged PR associated to a commit.

---------

Co-authored-by: 6543 <6543@obermui.de>
(cherry picked from commit 0a426cc575734e5eff410d6a790f40473117f753)
2024-02-26 22:30:26 +01:00
Lunny Xiao 6905540088
Use the database object format name but not read from git repoisitory everytime and fix possible migration wrong objectformat when migrating a sha256 repository (#29294)
Now we can get object format name from git command line or from the
database repository table. Assume the column is right, we don't need to
read from git command line every time.

This also fixed a possible bug that the object format is wrong when
migrating a sha256 repository from external.

<img width="658" alt="image"
src="https://github.com/go-gitea/gitea/assets/81045/6e9a9dcf-13bf-4267-928b-6bf2c2560423">

(cherry picked from commit b79c30435f439af8243ee281310258cdf141e27b)

Conflicts:
	routers/web/repo/blame.go
	services/agit/agit.go
	context
2024-02-26 22:30:26 +01:00
6543 8ff858b94b
Start to migrate from util.OptionalBool to optional.Option[bool] (#29329)
just create transition helper and migrate two structs

(cherry picked from commit 7fbdb60fc1152acc9a040dc04b1b0f5a3475b081)
2024-02-26 22:30:26 +01:00
vincent fb137d1e49
Fix content size does not match error when uploading lfs file (#29259)
![image](https://github.com/go-gitea/gitea/assets/38434877/cd726b4d-4771-4547-8aee-ae4e4b56b1d1)
When we update an lfs file by API
`api/v1/repos/{owner}/{repo}/contents/{filepath}`, there will show an
error

```json
{
  "message": "Put \"05904d6c7b\": readfrom tcp [::1]:57300->[::1]:9000: content size does not match",
  "url": "http://localhost:3000/api/swagger"
}
```

The reason of this error is
https://github.com/go-gitea/gitea/blob/main/services/repository/files/update.go,
in this file, the `file.ContentReader` been used twice. So when use
`file.ContentReader` in the second time, the `i` of this Reader has been
updated to the length of the content. it will return 0 and an `io.EOF`
error when we try to read cotent from this Reader.

(cherry picked from commit 35d5e4aea4bb02a0b4c7b38ecb2acf612151e891)
2024-02-26 21:42:14 +01:00
Gergely Nagy 0b4a9c4ec2
Disabling Stars should disable the routes too
Similarly to how `[repository].DISABLE_FORKS` works, lets make
`[repository].DISABLE_STARS` disable the routes too, not just hide the
functionality from the UI.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-26 20:50:32 +01:00
qwerty287 feb189554e
Add API to get PR by base/head (#29242)
Closes https://github.com/go-gitea/gitea/issues/16289

Add a new API `/repos/{owner}/{repo}/pulls/{base}/{head}` to get a PR by
its base and head branch.
2024-02-26 03:41:42 +01:00
Gergely Nagy 0ea021c8c9
Allow instance-wide disabling of forking
For small, personal self-hosted instances with no user signups, the fork
button is just a noise. This patch allows disabling them like stars can
be disabled too.

Disabling forks does not only remove the buttons from the web UI, it
also disables the routes that could be used to create forks.

Fixes #2441.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-02-25 12:00:17 +01:00
wxiaoguang 81925ebb0c
Refactor more code in templates (#29236)
Follow #29165.

* Introduce JSONTemplate to help to render JSON templates
* Introduce JSEscapeSafe for templates. Now only use `{{ ... |
JSEscape}}` instead of `{{ ... | JSEscape | Safe}}`
* Simplify "UserLocationMapURL" useage

(cherry picked from commit 31bb9f3247388b993c61a10190cfd512408ce57e)
2024-02-19 22:58:32 +01:00
KN4CK3R 1f8ad34e43
Add support for action artifact serve direct (#29120)
Fixes #29093

(cherry picked from commit 07597c71a4b6642beae7589c678603f4846f7920)
2024-02-17 23:24:31 +01:00
wxiaoguang 65248945c9
Refactor locale&string&template related code (#29165)
Clarify when "string" should be used (and be escaped), and when
"template.HTML" should be used (no need to escape)

And help PRs like  #29059 , to render the error messages correctly.

(cherry picked from commit f3eb835886031df7a562abc123c3f6011c81eca8)

Conflicts:
	modules/web/middleware/binding.go
	routers/web/feed/convert.go
	tests/integration/branches_test.go
	tests/integration/repo_branch_test.go
	trivial context conflicts
2024-02-16 15:20:52 +01:00
Chris Copeland 83123b493f
Add merge style fast-forward-only (#28954)
With this option, it is possible to require a linear commit history with
the following benefits over the next best option `Rebase+fast-forward`:
The original commits continue existing, with the original signatures
continuing to stay valid instead of being rewritten, there is no merge
commit, and reverting commits becomes easier.

Closes #24906
2024-02-14 17:19:19 +01:00
Clemens 2e41fe0a46 fix import 2024-02-12 13:00:47 +01:00
Alexandre Oliveira 29007c09bd Fix Alpine Registry packages with noarch not being found (#2285)
Fixes #2173
~~Still requires a bit of work to do, I'm not 100% happy with this solution.~~

The idea is to copy the noarch package to the architectures available in the package repository.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/2285
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Alexandre Oliveira <me+codeberg@aoalmeida.com>
Co-committed-by: Alexandre Oliveira <me+codeberg@aoalmeida.com>
2024-02-11 18:02:56 +00:00
Michael Jerger 6e6813a88b make operatorid unique 2024-02-10 15:23:04 +01:00
Michael Jerger eecb9b8040 fmt fix 2024-02-10 15:22:30 +01:00
Michael Jerger 5fa62287d6 undo rebase conflicts 2024-02-10 15:21:45 +01:00
Michael Jerger 3ef57385ec fix linting 2024-02-10 15:21:22 +01:00
Michael Jerger b2cc848e7d clean up aliases 2024-02-10 15:20:48 +01:00
Michael Jerger 91f7541add refactor for semantic and cycle free deps 2024-02-10 15:20:17 +01:00
Michael Jerger 66bc7a9a0c Search federatedUser instead of loginName 2024-02-10 15:20:09 +01:00
Michael Jerger edf7f61b83 mv federated_user_creation to user package 2024-02-10 15:19:55 +01:00
Michael Jerger a702da69cc added test for federated user 2024-02-10 15:19:40 +01:00
Michael Jerger a1ca7e958a use local fqdn for generated user email 2024-02-10 15:19:09 +01:00
Michael Jerger c58a995fb2 refactor FederationInfo -> FederationHost 2024-02-10 15:18:56 +01:00
Michael Jerger 1b35bd2911 lint fix 2024-02-10 15:18:46 +01:00
Michael Jerger c4eb763f4a lint fix 2024-02-10 15:18:45 +01:00
Michael Jerger ca5eaa8c6b introduce FI Factory 2024-02-10 15:18:43 +01:00
Michael Jerger dabd773f6b Fix error handling & add timestamp check 2024-02-10 15:18:43 +01:00
Michael Jerger 40ec049013 add the next todo 2024-02-10 15:18:42 +01:00
Clemens 1f989f2ecd Added FederationInfo Create function 2024-02-10 15:18:41 +01:00
Michael Jerger 380d3db0bf integrate federation info in api call 2024-02-10 15:18:40 +01:00
bom 87bfa79f71 Configure client against DOS 2024-02-10 15:18:25 +01:00
Michael Jerger ecf391dcbf add some user creation unittests 2024-02-10 15:17:24 +01:00
Michael Jerger de2569618c fix: wmail should start with char 2024-02-10 15:17:23 +01:00
Michael Jerger 6e46739090 validate person 2024-02-10 15:17:14 +01:00
Michael Jerger 0505baab2b ad validation for like activity 2024-02-10 15:17:13 +01:00
Michael Jerger 3ab2d9a449 rename star -> ForgeLike 2024-02-10 15:17:12 +01:00
Michael Jerger 4473fb788a start refactoring star->like 2024-02-10 15:17:11 +01:00
Michael Jerger b2a9b53041 use nodeInfo.Source instead of startActivity.Source 2024-02-10 15:17:07 +01:00
Michael Jerger 8116214727 introduce nodeinfo 2024-02-10 15:17:07 +01:00
bom 310d740cee Start NodeInfo implementation 2024-02-10 15:17:05 +01:00
Michael Jerger e704e5adcc adjust to ugly linting 2024-02-10 15:17:04 +01:00
erik 1e40b814a1 Linting 2024-02-10 15:17:03 +01:00
erik 8585edc47a Linting 2024-02-10 15:17:03 +01:00
Michael Jerger 7d78fb8adc adjust to ugly linting 2024-02-10 15:17:02 +01:00
erik 15775ad891 Fix import 2024-02-10 15:16:57 +01:00
erik 715afb2468 Add newlines for readability 2024-02-10 15:16:56 +01:00
erik 4d1492831d Move char_limiter to utils and rename 2024-02-10 15:16:47 +01:00
erik afc9acd925 Limit number of characters on body log 2024-02-10 15:16:45 +01:00
erik 3363b3bf0c Validate response before further processing 2024-02-10 15:16:44 +01:00
erik ff146a9430 Add review todos 2024-02-10 15:16:40 +01:00
erik 071b47b8d0 Catch edge case: remote user does not exist on remote repo 2024-02-10 15:16:36 +01:00
erik 3327fbc39a Fix typos, small rewordings 2024-02-10 15:16:32 +01:00
Michael Jerger 1704ac5bc2 fix most of the tests 2024-02-10 15:14:35 +01:00
Michael Jerger e1d7db178c unify logging & minor improvements 2024-02-10 15:14:31 +01:00
Michael Jerger 42854c9003 remove global actionUser 2024-02-10 15:14:30 +01:00
Michael Jerger a0c008b880 cleand up user creation from ap 2024-02-10 15:14:29 +01:00
Michael Jerger 6de8fba14d minor refactorings 2024-02-10 15:14:26 +01:00
Michael Jerger c2a42587d2 remove panics - that is not a exception replacement 2024-02-10 15:14:23 +01:00
Michael Jerger b27460d3fe minor refactorings & reviews 2024-02-10 15:14:20 +01:00
Michael Jerger bad8e04c3c cleanup & minor refactorings 2024-02-10 15:14:15 +01:00
Michael Jerger 1fe35e14a5 mv our actor code to forgefed 2024-02-10 15:14:07 +01:00
Michael Jerger abdf56dde1 move forgefed to models 2024-02-10 15:14:06 +01:00
Michael Jerger b5a467e94d remove unused & implement webfinger 2024-02-10 15:10:38 +01:00
Michael Jerger 73a38ea0d1 use new factory function 2024-02-10 15:10:38 +01:00
Michael Jerger e8371ca94c ActorId -> PersonId 2024-02-10 15:10:37 +01:00
Michael Jerger be4d3544ae Refactor ActorID -> ActorId 2024-02-10 15:10:36 +01:00
Michael Jerger 7c86f13728 make route more compact 2024-02-10 15:10:36 +01:00
erik a10a9141f8 Remove useless call to repo, add todos 2024-02-10 15:10:34 +01:00
erik 3c515c2614 Add review todos 2024-02-10 15:10:33 +01:00
erik 22d71e6b30 Update ToDo 2024-02-10 15:10:33 +01:00
erik afe659f9f4 Implement 5s waiting 2024-02-10 15:10:32 +01:00
erik 745598bba4 Implement starring 2024-02-10 15:10:29 +01:00
erik 976256bf3d Refactor if conditional to switch, use split up functions 2024-02-10 15:10:28 +01:00
erik 75ee273f40 Split user creation and saving user to db 2024-02-10 15:10:27 +01:00
erik 7f4667696f Cleanup imports 2024-02-10 15:10:25 +01:00
erik f84e0b27e1 Use ValidateAndParseIRI, pass this to ParseActorID 2024-02-10 15:10:21 +01:00
erik 54ef78034e Don't parse received repoID 2024-02-10 15:10:15 +01:00
erik e3defaa212 Split getPersonByRest function
This leaves us with two easier to read functions, encapsulating
two different functionalities.
2024-02-10 15:10:14 +01:00