]> source.dussan.org Git - gitea.git/log
gitea.git
13 months agofetch emails of currently displayed user on admin page (#26918)
techknowlogick [Tue, 5 Sep 2023 17:56:21 +0000 (13:56 -0400)]
fetch emails of currently displayed user on admin page (#26918)

Currently, this fetches the emails from the user viewing the page. This
PR changes it to show the emails from the user whose page it is.

13 months agoImprove LDAP group config documentation, fixes #21159 (#21227)
Sven Seeberg [Tue, 5 Sep 2023 17:18:53 +0000 (19:18 +0200)]
Improve LDAP group config documentation, fixes #21159 (#21227)

Improve the wording of the LDAP group attributes documentation and
expand the examples.

13 months agoupdate footer link to new landing page (#26916)
techknowlogick [Tue, 5 Sep 2023 16:44:07 +0000 (12:44 -0400)]
update footer link to new landing page (#26916)

as title

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoRemove `Named` interface (#26913)
KN4CK3R [Tue, 5 Sep 2023 15:58:30 +0000 (17:58 +0200)]
Remove `Named` interface (#26913)

`Named` is implemented by every `Method` and future implementations
should implement the method too.

13 months agoRefactor secrets modification logic (#26873)
KN4CK3R [Tue, 5 Sep 2023 15:21:02 +0000 (17:21 +0200)]
Refactor secrets modification logic (#26873)

- Share code between web and api
- Add some tests

13 months agoAdd missing `reqToken()` to notifications endpoints (#26914)
JakobDev [Tue, 5 Sep 2023 14:43:34 +0000 (16:43 +0200)]
Add missing `reqToken()` to notifications endpoints (#26914)

They currently throw a Internal Server Error when you use them without a
token. Now they correctly return a `token is required` error.

This is no security issue. If you use this endpoints with a token that
don't have the correct permission, you get the correct error. This is
not affected by this PR.

13 months agofeat(API): add routes and functions for managing user's secrets (#26909)
Bo-Yi Wu [Tue, 5 Sep 2023 14:02:50 +0000 (22:02 +0800)]
feat(API): add routes and functions for managing user's secrets (#26909)

- Add routes for creating or updating a user's actions secrets in
`routers/api/v1/api.go`
- Add a new file `routers/api/v1/user/action.go` with functions for
creating or updating a user's secrets and deleting a user's secret
- Modify the `templates/swagger/v1_json.tmpl` file to include the routes
for creating or updating a user's secrets and deleting a user's secret

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
13 months agoMove feed notification service layer (#26908)
Lunny Xiao [Tue, 5 Sep 2023 13:00:52 +0000 (21:00 +0800)]
Move feed notification service layer (#26908)

Extract from #22266

13 months agoExtract common code to new template (#26903)
Kerwin Bryant [Tue, 5 Sep 2023 12:00:28 +0000 (20:00 +0800)]
Extract common code to new template (#26903)

I noticed that the code of several new webhook pages is highly
repetitive, so I pulled out the common parts to a new template, unified
reference, unified maintenance

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
13 months agoMove ui notification to service layer (#26907)
Lunny Xiao [Tue, 5 Sep 2023 11:15:42 +0000 (19:15 +0800)]
Move ui notification to service layer (#26907)

Extract from #22266

13 months agoRemove duplicated notify mail configuration on tests (#26912)
Lunny Xiao [Tue, 5 Sep 2023 10:34:36 +0000 (18:34 +0800)]
Remove duplicated notify mail configuration on tests (#26912)

Extract from #22266

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoMove indexer notification to service layer (#26906)
Lunny Xiao [Tue, 5 Sep 2023 10:07:57 +0000 (18:07 +0800)]
Move indexer notification to service layer (#26906)

Extract from #22266

13 months agoMove mail notification logic to service layer (#26905)
Lunny Xiao [Tue, 5 Sep 2023 09:26:59 +0000 (17:26 +0800)]
Move mail notification logic to service layer (#26905)

Extract from #22266

13 months agoImprove DeleteByID (#26904)
Lunny Xiao [Tue, 5 Sep 2023 06:11:35 +0000 (14:11 +0800)]
Improve DeleteByID (#26904)

13 months agoUpdate backup instructions to align with archive structure (#26902)
JonRB [Tue, 5 Sep 2023 01:26:12 +0000 (02:26 +0100)]
Update backup instructions to align with archive structure (#26902)

Signed-off-by: JonRB <jon.roadleybattin@gmail.com>
fixes https://github.com/go-gitea/gitea/issues/25878

13 months agoMore fixes for the "commit-body" (#26898) 26050/head
wxiaoguang [Mon, 4 Sep 2023 13:38:59 +0000 (21:38 +0800)]
More fixes for the "commit-body" (#26898)

The changes for "commit-body" in #26877 are not ideal.

The reason is: the "commit-body" is usually a `<pre>`, it has default
margins. In most cases, we do not need that large margin. So, this PR
introduces a general but small margin for all "commit-body" elements.
Then these `gt-m-0` could be removed.

The `:not` selector is not needed, because the `.timeline-item` selector
is already clear enough.

13 months agoShow queue's active worker number (#26896)
wxiaoguang [Mon, 4 Sep 2023 13:07:32 +0000 (21:07 +0800)]
Show queue's active worker number (#26896)

13 months agoRemove CSS `has` selector and improve various styles (#26891)
wxiaoguang [Mon, 4 Sep 2023 10:22:46 +0000 (18:22 +0800)]
Remove CSS `has` selector and improve various styles (#26891)

Replace  #26850

Major changes:

1. Remove all `has` selectors, it is still not supported by firefox.
Actually there could be some more general and clearer approaches
2. Remove `two-toggle-buttons`, the `.ui.buttons` just works well
3. Rewrite the `.ui.buttons` border styles, see the screenshots
4. Remove the "fine-tuning" paddings from the the flex children, they
could layout themselves well.

![image](https://github.com/go-gitea/gitea/assets/2114189/a32ed6f3-60f7-43d5-9492-62c45d2397f6)

![image](https://github.com/go-gitea/gitea/assets/2114189/5cb173c5-c942-4237-8cb4-2697220b3f06)

![image](https://github.com/go-gitea/gitea/assets/2114189/8a1c12b3-a632-48ff-b1a7-a01a4417f821)

![image](https://github.com/go-gitea/gitea/assets/2114189/46bde1bd-9113-4231-965d-6ec9076f6a3b)

13 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 4 Sep 2023 00:23:31 +0000 (00:23 +0000)]
[skip ci] Updated licenses and gitignores

13 months agoUpdate documents to fix some links (#26885)
Lunny Xiao [Sun, 3 Sep 2023 18:45:20 +0000 (02:45 +0800)]
Update documents to fix some links (#26885)

13 months agoclarify aspects of the dump command (#26887)
JonRB [Sun, 3 Sep 2023 18:44:01 +0000 (19:44 +0100)]
clarify aspects of the dump command (#26887)

clarify aspects of the dump command

Possibly closes #26862

---------

Co-authored-by: delvh <dev.lh@web.de>
13 months agoRelocate the `RSS user feed` button (#26882)
BeYonme [Sun, 3 Sep 2023 11:06:59 +0000 (19:06 +0800)]
Relocate the `RSS user feed` button (#26882)

before:

![before](https://github.com/go-gitea/gitea/assets/38558065/e33e0809-91cd-451a-9c36-ab20b9296038)

after:

![after](https://github.com/go-gitea/gitea/assets/38558065/9dbfb0ce-1d0e-4bc8-8502-6b4af0fba220)

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
13 months agoUse Go 1.21 and update dependencies (#26878)
wxiaoguang [Sun, 3 Sep 2023 10:34:57 +0000 (18:34 +0800)]
Use Go 1.21 and update dependencies (#26878)

To make sure Gitea's next release's lifecycle could have active Golang
support.

And min/max are builtin now.

13 months agoUpdate docs about attachment path (#26883)
CaiCandong [Sun, 3 Sep 2023 09:40:10 +0000 (17:40 +0800)]
Update docs about attachment path (#26883)

This change was caused by #26271, for configuration as below:
```
[attachment]
ENABLE = true
PATH = data/attachments
MAX_SIZE = 100
MAX_FILES = 5
```
Before #26271, the resolved path is ${AppWorkPath}/${attachments.PATH}
(such as `/var/lib/gitea/data/attachments`)
After #26271, the resolved path is ${AppDataPath}/${attachments.PATH}
(such as `/var/lib/gitea/data/data/attachments`)

Fix  https://github.com/go-gitea/gitea/issues/26864
Follow https://github.com/go-gitea/gitea/pull/26271

13 months agoRefactor "shortsha" (#26877)
wxiaoguang [Sun, 3 Sep 2023 02:58:52 +0000 (10:58 +0800)]
Refactor "shortsha" (#26877)

The old code used complex `if` blocks and strange HTML layouts.

<details>

![image](https://github.com/go-gitea/gitea/assets/2114189/7fbee2b8-d150-4e6b-b67e-83400fa290eb)

</details>

This PR refactors the template code and remove legacy CSS styles. The UI
doesn't change much.

![image](https://github.com/go-gitea/gitea/assets/2114189/3e195df9-0ab5-4182-bcb2-bb20cad823f2)

![image](https://github.com/go-gitea/gitea/assets/2114189/f707a49f-be41-4dfe-871f-2869f2230380)

13 months agoFix wrong review requested number (#26784)
Nanguan Lin [Sun, 3 Sep 2023 02:12:38 +0000 (10:12 +0800)]
Fix wrong review requested number (#26784)

Fix the wrong review requested number mentioned by #18808 .
Fix #18808
Before:

![ksnip_20230829-140750](https://github.com/go-gitea/gitea/assets/70063547/0af2055b-6f16-4699-a944-c7186831d7f9)
After:

![ksnip_20230829-141817](https://github.com/go-gitea/gitea/assets/70063547/16633264-20ba-45e3-bfbb-a495ed76a45b)

13 months agoRefactor `og:description` to limit the max length (#26876)
wxiaoguang [Sun, 3 Sep 2023 01:43:29 +0000 (09:43 +0800)]
Refactor `og:description` to limit the max length (#26876)

1. The `og:description` should be "a one to two sentence description of
your object"
* It shouldn't output all the user inputted content -- it would be
pretty huge.
    * Maybe it only needs at most 300 bytes.
2. Do not render commit message as HTML

13 months agoReorder blocks in vue SFCs (#26874)
silverwind [Sat, 2 Sep 2023 14:59:07 +0000 (16:59 +0200)]
Reorder blocks in vue SFCs (#26874)

The [recommended order](https://vuejs.org/guide/scaling-up/sfc.html) for
SFC blocks is script -> template -> style, which we were violating
because template and script were swapped. I do find script first also
easier to read because the imports are on top, letting me immideatly see
a component's dependencies.

This is a pure cut-paste refactor with some removal of some empty lines.

---------

Co-authored-by: Lauris BH <lauris@nix.lv>
13 months agoMake it posible to customize nav text color via css var (#26807)
6543 [Sat, 2 Sep 2023 03:10:41 +0000 (05:10 +0200)]
Make it posible to customize nav text color via css var (#26807)

---
*Sponsored by Kithara Software GmbH*

13 months agoEnable djlint H008 and fix issues (#26869)
silverwind [Fri, 1 Sep 2023 17:32:39 +0000 (19:32 +0200)]
Enable djlint H008 and fix issues (#26869)

Enable `H008 | Attributes should be double quoted` and fix issues.

13 months agoImprove opengraph previews (#26851)
Linus Groh [Fri, 1 Sep 2023 16:59:24 +0000 (18:59 +0200)]
Improve opengraph previews (#26851)

Add more useful Open Graph metadata for commit and file URLs:

- Set `og:title` to the page title, which is a concise summary in both
cases (`<commit message> ยท <commit hash>` and `<filename> at <branch>`,
respectively)
- Set `og:description` to the commit message body, if available
- Set `og:url` to the relevant URLs instead of the repo URL

Also move the relevant meta tags into a separate template as they now
take up the majority of the base head template.

13 months agoAdd more descriptive error on forgot password page (#26848)
Jack Hay [Fri, 1 Sep 2023 16:15:39 +0000 (12:15 -0400)]
Add more descriptive error on forgot password page (#26848)

## Changes
- Forces flashed error to render immediately when forgot password code
is incorrect or has expired.
- Adds a link back to the `forgot_password` page so that the user can
restart the process (in the event that their link has expired)

13 months agoAllow users with write permissions for issues to add attachments with API (#26837)
Zettat123 [Fri, 1 Sep 2023 15:35:38 +0000 (23:35 +0800)]
Allow users with write permissions for issues to add attachments with API (#26837)

Fixes #24944

Since a user with write permissions for issues can add attachments to an
issue via the the web interface, the user should also be able to add
attachments via the API

13 months agoMove licenses.txt to /assets directory (#26866)
silverwind [Fri, 1 Sep 2023 14:42:33 +0000 (16:42 +0200)]
Move licenses.txt to /assets directory (#26866)

Now that we have the `/assets` directory, we can put`licenses.txt`
directly into it instead of incorrect `/js` path which was previously
only done to avoid reserving a username.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoUse case-insensitive regex for all webpack assets (#26867)
silverwind [Fri, 1 Sep 2023 14:07:37 +0000 (16:07 +0200)]
Use case-insensitive regex for all webpack assets (#26867)

Previously, only some of these regex had the `i` flag and while we can
likely ensure case for our files, these regexes are also used for
third-party files, so it's better to always match insensitively.

13 months agorestrict certificate type for builtin SSH server (#26789)
Earl Warren [Fri, 1 Sep 2023 13:45:22 +0000 (15:45 +0200)]
restrict certificate type for builtin SSH server (#26789)

- While doing some sanity checks over OpenSSH's code for how they handle
certificates authentication. I stumbled on an condition that checks the
certificate type is really an user certificate on the server-side
authentication. This checks seems to be a formality and just for the
sake of good domain seperation, because an user and host certificate
don't differ in their generation, verification or flags that can be
included.
- Add this check to the builtin SSH server to stay close to the
unwritten SSH specification.
- This is an breaking change for setups where the builtin SSH server is
being used and for some reason host certificates were being used for
authentication.
-
(cherry picked from commit de35b141b79a3d6efe2127ed2c73fd481515e481)

Refs: https://codeberg.org/forgejo/forgejo/pulls/1172

## :warning: BREAKING :warning:

Like OpenSSH, the built-in SSH server will now only accept SSH user
certificates, not server certificates.

Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-authored-by: Giteabot <teabot@gitea.io>
13 months agofeat(API): add secret deletion functionality for repository (#26808)
Bo-Yi Wu [Fri, 1 Sep 2023 13:02:49 +0000 (21:02 +0800)]
feat(API): add secret deletion functionality for repository (#26808)

- Modify the `CreateOrUpdateSecret` function in `api.go` to include a
`Delete` operation for the secret
- Modify the `DeleteOrgSecret` function in `action.go` to include a
`DeleteSecret` operation for the organization
- Modify the `DeleteSecret` function in `action.go` to include a
`DeleteSecret` operation for the repository
- Modify the `v1_json.tmpl` template file to update the `operationId`
and `summary` for the `deleteSecret` operation in both the organization
and repository sections

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
13 months agoAvoid double-unescaping of form value (#26853)
wxiaoguang [Fri, 1 Sep 2023 12:01:36 +0000 (20:01 +0800)]
Avoid double-unescaping of form value (#26853)

1. The old `prepareQueryArg` did double-unescaping of form value.
2. By the way, remove the unnecessary `ctx.Flash = ...` in
`MockContext`.

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoMove web/api context related testing function into a separate package (#26859)
wxiaoguang [Fri, 1 Sep 2023 11:26:07 +0000 (19:26 +0800)]
Move web/api context related testing function into a separate package (#26859)

Just like `models/unittest`, the testing helper functions should be in a
separate package: `contexttest`

And complete the TODO:

> // TODO: move this function to other packages, because it depends on
"models" package

13 months agoRemove some unused CSS styles (#26852)
wxiaoguang [Fri, 1 Sep 2023 06:59:38 +0000 (14:59 +0800)]
Remove some unused CSS styles (#26852)

1. `icons`: globally searched, no use in templates.
2. toast's `display: inline-block;`: there is a `display: flex` below.

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 1 Sep 2023 00:24:05 +0000 (00:24 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoMinor dashboard tweaks, fix flex-list margins (#26829)
silverwind [Thu, 31 Aug 2023 21:28:45 +0000 (23:28 +0200)]
Minor dashboard tweaks, fix flex-list margins (#26829)

Some small dashboard tweaks:

- Remove margin-bottom from divider so first item does not appear to
have un-equal margins
- Restore previous icon color
- Add slight margin-right to icon

Before:
<img width="783" alt="Screenshot 2023-08-31 at 00 10 28"
src="https://github.com/go-gitea/gitea/assets/115237/b75f70d7-8704-4afb-866d-fea0484c52d4">

After:
<img width="783" alt="Screenshot 2023-08-31 at 00 10 08"
src="https://github.com/go-gitea/gitea/assets/115237/50ed0c47-6f7c-449e-a054-13091369d43f">

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoUpdate team invitation email link (#26550)
Jack Hay [Thu, 31 Aug 2023 16:26:13 +0000 (12:26 -0400)]
Update team invitation email link (#26550)

Co-authored-by: Kyle D <kdumontnu@gmail.com>
Co-authored-by: Jonathan Tran <jonnytran@gmail.com>
13 months agoRedirect from `{repo}/issues/new` to `{repo}/issues/new/choose` when blank issues...
JakobDev [Thu, 31 Aug 2023 15:36:25 +0000 (17:36 +0200)]
Redirect from `{repo}/issues/new` to `{repo}/issues/new/choose` when blank issues are disabled (#26813)

You can currently visit `{repo}/issues/new` and create a blank issue,
even if it's disabled. This PR fixes this,

Fixes https://codeberg.org/forgejo/forgejo/issues/1356

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoRemove "TODO" tasks from CSS file (#26835)
wxiaoguang [Thu, 31 Aug 2023 10:49:53 +0000 (18:49 +0800)]
Remove "TODO" tasks from CSS file (#26835)

1. Use `gt-invisible` instead of `invisible`.
2. Use `gt-word-break` instead of `dont-break-out` (there is a slight
different "hyphens", but I think it won't affect too much since it is
only used for the "full name").
3. Remove `.small.button:has(svg)` , now our buttons could layout SVG
correctly, and actually I didn't see this CSS class is used in code.

13 months agoUser details page (#26713)
Denys Konovalov [Thu, 31 Aug 2023 09:21:18 +0000 (11:21 +0200)]
User details page (#26713)

This PR implements a proposal to clean up the admin users table by
moving some information out to a separate user details page (which also
displays some additional information).

Other changes:
- move edit user page from `/admin/users/{id}` to
`/admin/users/{id}/edit` -> `/admin/users/{id}` now shows the user
details page
- show if user is instance administrator as a label instead of a
separate column
- separate explore users template into a page- and a shared one, to make
it possible to use it on the user details page
- fix issue where there was no margin between alert message and
following content on admin pages

<details>

<summary>Screenshots</summary>

![grafik](https://github.com/go-gitea/gitea/assets/47871822/1ad57ac9-f20a-45a4-8477-ffe572a41e9e)

![grafik](https://github.com/go-gitea/gitea/assets/47871822/25786ecd-cb9d-4c92-90f4-e7f4292c073b)

</details>

Partially resolves #25939

---------

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoRender code blocks in repo description (#26830)
silverwind [Thu, 31 Aug 2023 05:01:01 +0000 (07:01 +0200)]
Render code blocks in repo description (#26830)

Backtick syntax now works in repo description too. Also, I replaced the
CSS for this was a new single class, making it more flexible and not
dependent on a parent. Also, very slightly reduced font size from 16.8px
to 16px.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoRemove joinPaths function (#26833)
silverwind [Thu, 31 Aug 2023 02:46:44 +0000 (04:46 +0200)]
Remove joinPaths function (#26833)

Extract from https://github.com/go-gitea/gitea/pull/25940.

`assetUrlPrefix` is guaranteed to not contain trailing slashes, making
this function unneeded.

13 months agoRemove polluted `.ui.right` (#26825)
wxiaoguang [Thu, 31 Aug 2023 02:29:59 +0000 (10:29 +0800)]
Remove polluted `.ui.right` (#26825)

Each change is tested manually line by line. There are too many changes
so I can't share dozens of screenshots.

In short:

1. `ui right` could be still used in `ui top attached header`, because
there is a special case.
2. A lot of `ui right` are just no-op, so they can be removed safely.
3. Some of the `ui right` should be replaced by `gt-float-right` (to
avoid breaking, leave them to the future).
4. A few of the `ui right` could be rewritten by flex.

13 months agoSync tags when adopting repos (#26816)
Zettat123 [Thu, 31 Aug 2023 01:42:42 +0000 (09:42 +0800)]
Sync tags when adopting repos (#26816)

Fixes #26138

Sync the tags into database when adopting repos

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
13 months agorm comment about hugo (#26832)
techknowlogick [Thu, 31 Aug 2023 01:09:11 +0000 (21:09 -0400)]
rm comment about hugo (#26832)

13 months agoFix filename for .spectral.yaml (#26828)
silverwind [Thu, 31 Aug 2023 00:41:37 +0000 (02:41 +0200)]
Fix filename for .spectral.yaml (#26828)

Mixed up yml vs. yaml previously.

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 31 Aug 2023 00:22:07 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoCheck blocklist for emails when adding them to account (#26812)
techknowlogick [Wed, 30 Aug 2023 15:46:49 +0000 (11:46 -0400)]
Check blocklist for emails when adding them to account (#26812)

13 months agoRemove polluted ".ui.left" style (#26809)
wxiaoguang [Wed, 30 Aug 2023 13:46:24 +0000 (21:46 +0800)]
Remove polluted ".ui.left" style (#26809)

13 months agoRemove fomantic `text` module (#26777)
delvh [Wed, 30 Aug 2023 10:37:17 +0000 (12:37 +0200)]
Remove fomantic `text` module (#26777)

Corollary to #26775:
All selectors I found that are actually used and not necessarily present
in the current code have been copied to `web_src/css/base.css`.
Everything else should be a clean removal.

13 months agoUse `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804)
KN4CK3R [Wed, 30 Aug 2023 06:55:25 +0000 (08:55 +0200)]
Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804)

13 months agoFix verifyCommits error when push a new branch (#26664)
CaiCandong [Wed, 30 Aug 2023 02:27:53 +0000 (10:27 +0800)]
Fix verifyCommits error when push a new branch (#26664)

> ### Description
> If a new branch is pushed, and the repository has a rule that would
require signed commits for the new branch, the commit is rejected with a
500 error regardless of whether it's signed.
>
> When pushing a new branch, the "old" commit is the empty ID
(0000000000000000000000000000000000000000). verifyCommits has no
provision for this and passes an invalid commit range to git rev-list.
Prior to 1.19 this wasn't an issue because only pre-existing individual
branches could be protected.
>
> I was able to reproduce with
[try.gitea.io/CraigTest/test](https://try.gitea.io/CraigTest/test),
which is set up with a blanket rule to require commits on all branches.

Fix #25565
Very thanks to @Craig-Holmquist-NTI for reporting the bug and suggesting
an valid solution!

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
13 months agoFix Uint8Array comparisons and update vitest (#26805)
silverwind [Wed, 30 Aug 2023 01:56:44 +0000 (03:56 +0200)]
Fix Uint8Array comparisons and update vitest (#26805)

Compare those `Uint8Array` via conversion to Array which are properly
comparable, so that we don't have to worry about whether `TextEncoder`
and `UInt8Array` from the environment are compatible or not.

---------

Co-authored-by: delvh <dev.lh@web.de>
13 months agoAdd various missing files-changed dependencies (#26799)
silverwind [Wed, 30 Aug 2023 01:40:13 +0000 (03:40 +0200)]
Add various missing files-changed dependencies (#26799)

We were missing a number of config files like `.golangci.yml` in the
dependencies for the pull request pipelines, which resulted in the
linting not running for https://github.com/go-gitea/gitea/pull/26786
because only `.golangci.yml` had changed.

13 months agoImprove flex list item padding (#26779)
wxiaoguang [Tue, 29 Aug 2023 23:13:30 +0000 (07:13 +0800)]
Improve flex list item padding (#26779)

Replace #26761

It's better to keep children elements simple, and let parent containers
layout the necessary padding/margin.

The old `not(:last-child)` and `.flex-item + .flex-item` are not easy to
maintain (for example, what if the developer would like to use a "tiny
height" item?)

The old approach also makes some UI look strange because the first item
doesn't have proper padding-top.

In this PR, we just simply use `.flex-item { padding: ... }`:

* Developers could manually set the item height they want easily
* It's easier to make it work with various containers -- with padding
(`ui segment`) and without padding (`div`)

And added more samples/examples.

![image](https://github.com/go-gitea/gitea/assets/2114189/719ea712-0241-4426-b67f-5723993c4ed7)

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoInclude the GITHUB_TOKEN/GITEA_TOKEN secret for fork pull requests (#26759)
js6pak [Tue, 29 Aug 2023 22:13:16 +0000 (00:13 +0200)]
Include the GITHUB_TOKEN/GITEA_TOKEN secret for fork pull requests (#26759)

Include `GITHUB_TOKEN`/`GITEA_TOKEN` secrets for actions triggered by
pull requests

This makes it consistent with the environment variables which you can
already access

```shell
echo env: $GITHUB_TOKEN
echo expression: ${{ secrets.GITHUB_TOKEN }}
```
before

![image](https://github.com/go-gitea/gitea/assets/35262707/b6f750f6-3995-40f0-b8aa-df01e7997c37)
after

![image](https://github.com/go-gitea/gitea/assets/35262707/ab74464b-7638-458a-afd5-f39e6101d2cf)

---------

Co-authored-by: Jason Song <i@wolfogre.com>
Co-authored-by: Giteabot <teabot@gitea.io>
13 months agofeat(API): add route and implementation for creating/updating repository secret ...
Bo-Yi Wu [Tue, 29 Aug 2023 20:54:49 +0000 (04:54 +0800)]
feat(API): add route and implementation for creating/updating repository secret (#26766)

spec:
https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-a-repository-secret

- Add a new route for creating or updating a secret value in a
repository
- Create a new file `routers/api/v1/repo/action.go` with the
implementation of the `CreateOrUpdateSecret` function
- Update the Swagger documentation for the `updateRepoSecret` operation
in the `v1_json.tmpl` template file

---------

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoReplace deprecated `elliptic.Marshal` (#26800)
Chongyi Zheng [Tue, 29 Aug 2023 20:19:40 +0000 (16:19 -0400)]
Replace deprecated `elliptic.Marshal` (#26800)

In PR #26786, the Go version for golangci-lint is bumped to 1.21. This
causes the following error:

```
models/migrations/v1_16/v210.go:132:23: SA1019: elliptic.Marshal has been deprecated since Go 1.21: for ECDH, use the crypto/ecdh package. This function returns an encoding equivalent to that of PublicKey.Bytes in crypto/ecdh. (staticcheck)
                                        PublicKey:       elliptic.Marshal(elliptic.P256(), parsed.PubKey.X, parsed.PubKey.Y),
```

The change now uses [func (*PublicKey)
ECDH](https://pkg.go.dev/crypto/ecdsa#PublicKey.ECDH), which is added in
Go 1.20.

13 months agoUpdating the js libraries to latest version. (#26795)
puni9869 [Tue, 29 Aug 2023 18:29:13 +0000 (23:59 +0530)]
Updating the js libraries to latest version. (#26795)

As title.

<img width="657" alt="image"
src="https://github.com/go-gitea/gitea/assets/80308335/db8f6c80-78b5-4992-800c-802ee7b9ba6d">

13 months agoFix some slice append usages (#26778)
Chongyi Zheng [Tue, 29 Aug 2023 15:47:26 +0000 (11:47 -0400)]
Fix some slice append usages (#26778)

Co-authored-by: delvh <dev.lh@web.de>
13 months agoUse Go 1.21 for golangci-lint (#26786)
Chongyi Zheng [Tue, 29 Aug 2023 14:25:24 +0000 (10:25 -0400)]
Use Go 1.21 for golangci-lint (#26786)

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoFix notification circle (border-radius) (#26794)
wxiaoguang [Tue, 29 Aug 2023 14:03:34 +0000 (22:03 +0800)]
Fix notification circle (border-radius) (#26794)

`border-radius` means `radius`, not `diameter`, so it should be `50%` and `boxHeight / 2`

13 months agoFix context filter has no effect in dashboard (#26695)
yp05327 [Tue, 29 Aug 2023 12:46:52 +0000 (21:46 +0900)]
Fix context filter has no effect in dashboard (#26695)

Fix #26686

13 months agoAdd default label in branch select list (#26697)
yp05327 [Tue, 29 Aug 2023 12:15:19 +0000 (21:15 +0900)]
Add default label in branch select list (#26697)

13 months agoRemove redundant nil check in `WalkGitLog` (#26773)
Eng Zer Jun [Tue, 29 Aug 2023 11:03:43 +0000 (19:03 +0800)]
Remove redundant nil check in `WalkGitLog` (#26773)

From the Go specification:

> "1. For a nil slice, the number of iterations is 0."
https://go.dev/ref/spec#For_range

Therefore, an additional nil check for before the loop is unnecessary.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
13 months agoRemove fomantic `item` module (#26775)
silverwind [Tue, 29 Aug 2023 10:14:33 +0000 (12:14 +0200)]
Remove fomantic `item` module (#26775)

All selectors had `.ui.items` prefix and I did not find it in any of the
templates or JS, so this is a pretty safe removal.

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoUpdate info regarding internet connection for build (#26776)
silverwind [Tue, 29 Aug 2023 09:09:44 +0000 (11:09 +0200)]
Update info regarding internet connection for build (#26776)

This build info was outdated since we no longer vendor go modules.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoFix being unable to use a repo that prohibits accepting PRs as a PR source. (#26785)
CaiCandong [Tue, 29 Aug 2023 09:07:15 +0000 (17:07 +0800)]
Fix being unable to use a repo that prohibits accepting PRs as a PR source. (#26785)

## Description
Sometimes, we need to use an upstream mirror repository to update the
current development repository, but mirror repositories are prohibited
from PR. It should not appear in `merge to,` but it can appear in `pull
from.`
Fix #24585 #26193 #26781
Related #24183

Many thanks to @apnote  for assisting me in reproducing this bug!

## ScreenShot
---
### Before

<img
src="https://github.com/go-gitea/gitea/assets/50507092/3d76c376-1f54-45b9-80c9-6ba8319d6a9a"
width="400px">

<img
src="https://github.com/go-gitea/gitea/assets/50507092/fbfd9f7f-421f-4a2e-9a3e-f2958bbf3312"
width="400px">

### After

<img
src="https://github.com/go-gitea/gitea/assets/50507092/e6984524-4f61-4310-b795-4d8598bd8963"
width="400px">

<img
src="https://github.com/go-gitea/gitea/assets/50507092/04065b44-78d7-4721-bf31-0f1674150727"
width="400px">

13 months agoAdd fix incorrect can_create_org_repo for org owner team (#26683)
yp05327 [Tue, 29 Aug 2023 01:11:23 +0000 (10:11 +0900)]
Add fix incorrect can_create_org_repo for org owner team (#26683)

Related to: #8312 #26491

In migration v109, we only added a new column `CanCreateOrgRepo` in Team
table, but not initial the value of it.
This may cause bug like #26491.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 29 Aug 2023 00:22:17 +0000 (00:22 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoImprove modal dialog UI (#26764)
wxiaoguang [Mon, 28 Aug 2023 23:49:21 +0000 (07:49 +0800)]
Improve modal dialog UI (#26764)

1. Fine tune the CSS styles, and add more examples
2. Add necessary "dimmer" animation for modal dialogs, otherwise the UI
seems flicking (follow #26469)

13 months agoImprove the "bug report" template and "support options" document (#26753)
wxiaoguang [Mon, 28 Aug 2023 22:37:39 +0000 (06:37 +0800)]
Improve the "bug report" template and "support options" document (#26753)

* `/help/support` is a better document than
`/administration/logging-config` for bug reporting
* Improve `support.en-us.md`
    * Move/add detailed contents into `Advanced Bug Report Tips` section
    * Merge `Chinese Support` section into `Support Options`

13 months agoUnify `border-radius` behavior (#26770)
delvh [Mon, 28 Aug 2023 19:43:59 +0000 (21:43 +0200)]
Unify `border-radius` behavior (#26770)

## Changes
- no more hardcoded `border-radius`es (apart from `0`)
- no more value inconsistencies
- no more guessing what pixel value you should use
- two new variables:
- `--border-radius-medium` (for elements where the normal border radius
does not suffice)
  - `--border-radius-circle` (for displaying circles)

---------

Co-authored-by: silverwind <me@silverwind.io>
13 months agoReduce some allocations in type conversion (#26772)
Chongyi Zheng [Mon, 28 Aug 2023 16:43:16 +0000 (12:43 -0400)]
Reduce some allocations in type conversion (#26772)

13 months agoRefactor some CSS styles and simplify code (#26771)
wxiaoguang [Mon, 28 Aug 2023 14:14:51 +0000 (22:14 +0800)]
Refactor some CSS styles and simplify code (#26771)

Refactor some CSS styles and simplify code.

Some styles are not in use, remove them.

13 months agoAdd auth-required to config.json for Cargo http registry (#26729)
merlleu [Mon, 28 Aug 2023 07:05:39 +0000 (09:05 +0200)]
Add auth-required to config.json for Cargo http registry (#26729)

Cargo registry-auth feature requires config.json to have a property
auth-required set to true in order to send token to all registry
requests.
This is ok for git index because you can manually edit the config.json
file to add the auth-required, but when using sparse
(setting index url to
"sparse+https://git.example.com/api/packages/{owner}/cargo/"), the
config.json is dynamically rendered, and does not reflect changes to the
config.json file in the repo.

I see two approaches:
- Serve the real config.json file when fetching the config.json on the
cargo service.
- Automatically detect if the registry requires authorization. (This is
what I implemented in this PR).

What the PR does:
- When a cargo index repository is created, on the config.json, set
auth-required to wether or not the repository is private.
- When the cargo/config.json endpoint is called, set auth-required to
wether or not the request was authorized using an API token.

13 months agorefactor(API): refactor secret creation and update functionality (#26751)
Bo-Yi Wu [Mon, 28 Aug 2023 05:08:19 +0000 (13:08 +0800)]
refactor(API): refactor secret creation and update functionality (#26751)

According to the GitHub API Spec:
https://docs.github.com/en/rest/actions/secrets?apiVersion=2022-11-28#create-or-update-an-organization-secret

Merge the Create and Update secret into a single API.

- Remove the `CreateSecretOption` struct and replace it with
`CreateOrUpdateSecretOption` in `modules/structs/secret.go`
- Update the `CreateOrUpdateOrgSecret` function in
`routers/api/v1/org/action.go` to use `CreateOrUpdateSecretOption`
instead of `UpdateSecretOption`
- Remove the `CreateOrgSecret` function in
`routers/api/v1/org/action.go` and replace it with
`CreateOrUpdateOrgSecret`
- Update the Swagger documentation in
`routers/api/v1/swagger/options.go` and `templates/swagger/v1_json.tmpl`
to reflect the changes in the struct names and function names

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
13 months agoFix bug for ctx usage (#26762)
Lunny Xiao [Mon, 28 Aug 2023 04:06:47 +0000 (12:06 +0800)]
Fix bug for ctx usage (#26762)

Regression from #26158

Fix #26684

13 months agoRemove some transition related code (#26755)
wxiaoguang [Mon, 28 Aug 2023 01:26:23 +0000 (09:26 +0800)]
Remove some transition related code (#26755)

Remove transition related code because the transition module has been
removed by #26469

13 months agoExpanded minimum RSA Keylength to 3072 (#26604)
mainboarder [Mon, 28 Aug 2023 00:53:16 +0000 (02:53 +0200)]
Expanded minimum RSA Keylength to 3072 (#26604)

German Federal Office for Information Security requests in its technical
guideline BSI TR-02102-1 RSA Keylength not shorter than 3000bits
starting 2024, in the year 2023 3000bits as a recommendation. Gitea
should request longer RSA Keys by default in favor of security and drop
old clients which do not support longer keys.

https://www.bsi.bund.de/SharedDocs/Downloads/DE/BSI/Publikationen/TechnischeRichtlinien/TR02102/BSI-TR-02102.pdf?__blob=publicationFile&v=9
- Page 19, Table 1.2

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 28 Aug 2023 00:22:48 +0000 (00:22 +0000)]
[skip ci] Updated licenses and gitignores

13 months agoUse docs.gitea.com instead of docs.gitea.io (#26739)
Lunny Xiao [Sun, 27 Aug 2023 11:59:12 +0000 (19:59 +0800)]
Use docs.gitea.com instead of docs.gitea.io (#26739)

13 months agoAdding hint `Archived` to archive label. (#26741)
puni9869 [Sun, 27 Aug 2023 09:32:54 +0000 (15:02 +0530)]
Adding hint `Archived` to archive label. (#26741)

Followup  https://github.com/go-gitea/gitea/pull/26478
## Archived labels UI

Changed:
* Enhanced the Filtered UI page to seamlessly incorporate a list of
archived labels.

Outsourced:
* Defer the implementation of specialized handling for archived labels
to upcoming pull requests. This step will be undertaken subsequent to
the successful merge of this pull request.

Screenshots

![image](https://github.com/go-gitea/gitea/assets/80308335/1f33cfb2-2bac-46f0-9103-9e62d235b1d2)

![image](https://github.com/go-gitea/gitea/assets/80308335/3609acd0-b1ba-4ee9-8c4e-1a34dbc37dd7)

![image](https://github.com/go-gitea/gitea/assets/80308335/9860196d-2391-409b-a9a0-1205ab4b412b)

---

Part of https://github.com/go-gitea/gitea/issues/25237

---------

Co-authored-by: Giteabot <teabot@gitea.io>
Co-authored-by: silverwind <me@silverwind.io>
13 months agoMove `modules/mirror` to `services` (#26737)
Chongyi Zheng [Sun, 27 Aug 2023 02:24:45 +0000 (22:24 -0400)]
Move `modules/mirror` to `services` (#26737)

To solve the cyclic imports in a better way

Closes #20261

13 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 27 Aug 2023 00:27:26 +0000 (00:27 +0000)]
[skip ci] Updated translations via Crowdin

13 months agoFix template bugs in recently_pushed_new_branches.tmpl (#26744)
wxiaoguang [Sun, 27 Aug 2023 00:16:02 +0000 (08:16 +0800)]
Fix template bugs in recently_pushed_new_branches.tmpl (#26744)

Fix some bugs from #25715, fix #25830

1. `$.locale.Tr ... Safe` needs `Escape`, but not `PathEscapeSegments`
2. The attribute should be `role`
3. The `ComposeBranchCompareURL` already does escaping correctly

13 months agoFix incorrect "tabindex" attributes (#26733)
wxiaoguang [Sat, 26 Aug 2023 02:44:00 +0000 (10:44 +0800)]
Fix incorrect "tabindex" attributes (#26733)

Fix #26731

Almost all "tabindex" in code are incorrect.

1. All "input/button" by default are focusable, so no need to use "tabindex=0"
2. All "div/span" by default are not focusable, so no need to use "tabindex=-1"
3. All "dropdown" are focusable by framework, so no need to use "tabindex"
4. Some tabindex values are incorrect (eg: `new_form.tmpl`), so remove them

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoSimplify helper CSS classes and avoid abuse (#26728)
wxiaoguang [Fri, 25 Aug 2023 23:35:10 +0000 (07:35 +0800)]
Simplify helper CSS classes and avoid abuse (#26728)

Removed CSS helper classes (some of them are not useful while some of
them are abused often)

* `gt-db`: in most cases it could be replaced by `gt-df` and the flex
layout should be encouraged. Other cases: either it does need the
`gt-df` (eg: by using `div` directly) or it is an abuse (eg: the warning
message in a form)
* `gt-di`: it doesn't seem useful, or it could be replaced by `gt-dib`
in most cases.
* `gt-dif`: not useful, it could be replaced by `flex-text-inline` or
`gt-df`
* `gt-js`: never used
* All `<i class="icon gt-df gt-ac gt-jc">` could be written as `<i
class="icon">`

## Some UI samples

### Admin Notice

![image](https://github.com/go-gitea/gitea/assets/2114189/d02010d4-dc7d-463f-bc99-dcc9b6e2e2ac)

### Admin Stacktrace

![image](https://github.com/go-gitea/gitea/assets/2114189/4045695c-a8c4-4e37-b720-e77a61b1e965)

### Org Home

![image](https://github.com/go-gitea/gitea/assets/2114189/069f02d0-76ad-4052-8a80-700d7e501d40)

### Org Team Repo

![image](https://github.com/go-gitea/gitea/assets/2114189/dc8d6106-bb6b-4f60-83ac-06cb28df3ab5)

### Release List

![image](https://github.com/go-gitea/gitea/assets/2114189/0845e8a5-d1a9-487a-9d25-3c200ad54c17)

### User Setting Application Token Scope

![image](https://github.com/go-gitea/gitea/assets/2114189/fffbde27-432b-49c6-827e-17b8cd3457ff)

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoRemove fomantic loader module (#26670)
silverwind [Fri, 25 Aug 2023 16:03:14 +0000 (18:03 +0200)]
Remove fomantic loader module (#26670)

Replace Fomantic `loader` CSS module with our existing `is-loading`
spinner. Only three places in the UI used this module, which are
pictured here:

imagediff:
<img width="1237" alt="Screenshot 2023-08-22 at 22 18 01"
src="https://github.com/go-gitea/gitea/assets/115237/b0d82531-f05e-43c6-9e5b-1bfc268c056d">

webauthn:
<img width="894" alt="Screenshot 2023-08-22 at 22 05 05"
src="https://github.com/go-gitea/gitea/assets/115237/7b583425-d944-474a-a57a-22a65bbd8b29">

heatmap (I removed the previous loading text, it was unreadable because
it was tiny and on fast machines only visible for a fraction of a
second):
<img width="764" alt="Screenshot 2023-08-22 at 22 18 44"
src="https://github.com/go-gitea/gitea/assets/115237/1c7472d6-3e17-4224-a992-d8c0b380cc73">

Also, heatmap container does not resize any more after loading now and
previous duplicate id `user-heatmap` is gone.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
13 months agoFix link in mirror docs (#26719)
silverwind [Fri, 25 Aug 2023 15:13:07 +0000 (17:13 +0200)]
Fix link in mirror docs (#26719)

Fix hash fragment in this link

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoAdd `eslint-plugin-vue-scoped-css` (#26720)
silverwind [Fri, 25 Aug 2023 13:47:27 +0000 (15:47 +0200)]
Add `eslint-plugin-vue-scoped-css` (#26720)

Adds
[eslint-plugin-vue-scoped-css](https://github.com/future-architect/eslint-plugin-vue-scoped-css)
and fixes discovered issues which are:

- 1 unused selector
- 3 selectors with `.full.height` parent in a `<style scoped>` block so
the rule could not find the parent. Move these into the unscoped block
instead. They worked before and after.

13 months agoFixed text overflow in dropdown menu (#26694)
Viktor Suprun [Fri, 25 Aug 2023 11:15:21 +0000 (22:15 +1100)]
Fixed text overflow in dropdown menu (#26694)

Fixes #26622

![image](https://github.com/go-gitea/gitea/assets/683358/168b7e4d-97ba-4b5f-a5f5-33ee67e8b4be)

Co-authored-by: Giteabot <teabot@gitea.io>
13 months agoMake web context initialize correctly for different cases (#26726)
wxiaoguang [Fri, 25 Aug 2023 11:07:42 +0000 (19:07 +0800)]
Make web context initialize correctly for different cases (#26726)

The web context (modules/context.Context) is quite complex, it's
difficult for the callers to initialize correctly.

This PR introduces a `NewWebContext` function, to make sure the web
context have the same behavior for different cases.

13 months agoRemove incorrect CSS helper classes (#26712)
wxiaoguang [Fri, 25 Aug 2023 06:47:59 +0000 (14:47 +0800)]
Remove incorrect CSS helper classes (#26712)