Commit Graph

18987 Commits (d64c849d16a9ae435cd47f8b9afaab31cd3f65d0)
 

Author SHA1 Message Date
silverwind d64c849d16
Update JS dependencies ()
Fixes: https://github.com/go-gitea/gitea/security/dependabot/88
Fixes: https://github.com/go-gitea/gitea/security/dependabot/87

Tested Katex, works as expected.
silverwind c7f4ca2653
Enable Typescript `noImplicitAny` ()
Enable `noImplicitAny` and fix all issues.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
wxiaoguang 6fe4d1c038
Remove duplicate "ResponseWriter.Status" method ()
silverwind abe743df79
Fix code button alignment ()
Fixes: https://github.com/go-gitea/gitea/issues/33344

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
GiteaBot 3682231f17 [skip ci] Updated translations via Crowdin
wxiaoguang 7069369e03
Support performance trace ()
1. Add a OpenTelemetry-like shim-layer to collect traces
2. Add a simple builtin trace collector and exporter, end users could
download the diagnosis report to get the traces.

This PR's design is quite lightweight, no hard-dependency, and it is
easy to improve or remove. We can try it on gitea.com first to see
whether it works well, and fine tune the details.

---------

Co-authored-by: silverwind <me@silverwind.io>
wxiaoguang 2cb3946496
Make issue suggestion work for all editors ()
And do not handle special keys when the text-expander popup exists
wxiaoguang 46d1e91aed
Fix issue count ()
Fix 
GiteaBot 2e42e96ce2 [skip ci] Updated translations via Crowdin
wxiaoguang 6cc1067884
Fix incorrect ref commit ID usage ()
After the RefName refactoring, the `ctx.Repo.CommitID` is only set when
there is a `RepoRefByType` middleware.

Many handlers do not use that middleware and they only use "default
branch"
wxiaoguang 39de2955fd
Improve sync fork behavior ()
Fix 

Suppose there is a `branch-a` in fork repo:

1. if `branch-a` exists in base repo: try to sync `base:branch-a` to `fork:branch-a`
2. if `branch-a` doesn't exist in base repo: try to sync `base:main` to `fork:branch-a`
wxiaoguang 6073e2f1bb
Refactor response writer & access logger ()
And add comments & tests
GiteaBot 13dbd260b7 [skip ci] Updated licenses and gitignores
Michael Vetter 076d122f34
Fix typo in documentation of GetBranchNames() ()
CrimsonEdgeHope 1928918c35
Fix Account linking page ()
Fix password form missing whilst linking account even with
`ENABLE_PASSWORD_SIGNIN_FORM = true`.

Remove redundant empty box in account linking sign up page when
`LinkAccountMode` is true.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
hiifong b7614e2d2f
Fix parentCommit invalid memory address or nil pointer dereference. ()
When the parent Commit does not exist on gitea, an error will be
reported when opening the Commit details page: invalid memory address or
nil pointer dereference.

![image](https://github.com/user-attachments/assets/4c2a9802-935f-41e9-b5b9-a4f0d745f709)

![image](https://github.com/user-attachments/assets/7b0bc15e-7f5f-4d58-8d24-fee667a799fa)
Vladimir Sysoev dc2308a959
Make tracked time representation display as hours ()
Estimated time represented in hours it might be convenient to
have tracked time represented in the same way to be compared and
managed.

---------

Co-authored-by: Sysoev, Vladimir <i@vsysoev.ru>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
GiteaBot f250ee6360 [skip ci] Updated translations via Crowdin
GiteaBot fffc8550ab [skip ci] Updated translations via Crowdin
Chai-Shi 55e0756c68
Fix push message behavior ()
Fixes  by the logic from pr 

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
6543 1342d48433
Add golang back to nix dev environment and pin v1.23 ()
wxiaoguang 3b839f8dc0
Trivial fixes ()
1. the error check was added for go-git, it was caused by the empty `.keep` file in the test fixtures.
2. use `PostFormValue` instead of `PostForm.Get` (`Get` needs to parse the form ahead)
3. fix incorrect container text (it should show "Images" in the header but not "OS/Arch")
4. align maven xml
5. fix closed PR color&icon
GiteaBot 7582eb0419 [skip ci] Updated translations via Crowdin
wxiaoguang cfc6e21f06
Fix incorrect ref usages ()
Fix 

By the way, improve some locales
silverwind ab347fd0f7
Update JS and PY dependencies ()
- Update all JS and PY dependencies
- Tested affected dependencies
- Disabled `async-preventdefault` lint rule because it brought up new
false-positives.
Kemal Zebari 2483a93fbc
Only allow admins to rename default/protected branches ()
Currently, anyone with write permissions to a repo are able to rename
default or protected branches.

This change follows
[GitHub's](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch)
design by only allowing repo/site admins to change these branches.
However, it also follows are current design for protected branches and
only allows admins to modify branch names == branch protection rule
names. Glob-based rules cannot be renamed by anyone (as was already the
case, but we now catch `ErrBranchIsProtected` which we previously did
not catch, throwing a 500).
silverwind 4b21a6c792
Enable Typescript `noImplicitThis` ()
- Enable https://www.typescriptlang.org/tsconfig/#noImplicitThis
- Wrap Vue Template-Syntax SFCs in
[`defineComponent`](https://vuejs.org/api/general#definecomponent) which
makes type inference and linter work better
- Move `createApp` calls outside the SFCs into separate files
- Use [`PropType`](https://vuejs.org/api/utility-types#proptype-t) where
appropriate
- Some top-level component properties changed order as dictated by the
linter
- Fix all tsc and lint issues that popped up during these refactors
wxiaoguang b15d01b0ce
Prepare for support performance trace ()
For 
wxiaoguang 6659a381ea
Fix closed dependency title ()
Fix 
Zettat123 d0962ce3da
Move some Actions related functions from `routers` to `services` ()
Move the main logic of `generateTaskContext` and `findTaskNeeds` to the
`services` layer.

This is a part of , since we need the git context and `needs` to
parse the concurrency expressions.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
wxiaoguang f6dbf0e7b3
Fix incorrect TagName/BranchName usages ()
Add add a new test
wxiaoguang fcd096231a
Simplify context ref name ()
GiteaBot cbf933eb4e [skip ci] Updated translations via Crowdin
wxiaoguang 4d399e717d
Fix some broken route handlers ()
Some mistakes introduced by recent refactoring PRs (some sidebar
dropdowns doesn't work)
wxiaoguang 1299fdb084
Add a confirm dialog for "sync fork" ()
Try to quickly fix 
wxiaoguang 5eff19a77a
Fix sidebar milestone link ()
Fix  
Lunny Xiao 6410c34b7f
Refactor ref type ()
Major changes:

1. do not sync ".keep" file during tests
2. fix incorrect route handler and empty repo handling (backported as  with tests)
3. do not use `RepoRef`: most of the calls are abuses.
4. Use `git.RefType` instead of a new type definition `RepoRefType` on `context`.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
yp05327 3a749fc816
Fix 500 error when error occurred in migration page ()
The template should be `repo/migrate/{service type}`
But input element `service` is not in the form.

Related: 

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
yp05327 4672ddcdd7
Fix missing license when sync mirror ()
Fix 
wxiaoguang a98a836e76
Support public code/issue access for private repositories ()
Close , close  (will add "anonymous access" in following PRs)
Kemal Zebari ecd463c2f1
Validate that the tag doesn't exist when creating a tag via the web ()
Found while investigating .

This line no longer makes sense because the form field "TagName" is
required, so this would mean that this code path would never be covered.
Because it isn't covered, we end up going down the "update release"
logic where we eventually set `Release.IsTag` to false (meaning it will
now be treated as a release instead of a tag).

This snapshot rewrites the condition to ensure that we aren't trying to
create a tag that already exists.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
GiteaBot 58ac17c005 [skip ci] Updated translations via Crowdin
silverwind 98d7e04767
Switch back to `vue-tsc` ()
It supports Typescript 5.7 now, so we can switch back to the official
version.
Michael B. a90af22003
Let API create and edit system webhooks, attempt 2 ()
This PR fixes inconsistencies between system and default webhooks in the
Gitea API. (See also )
- A system webhook is a webhook that captures events for all
repositories.
- A default webhook is copied to a new repository when it is created. 

Before this PR `POST /api/v1/admin/hooks/` creates default webhooks (if
not configured otherwise) and `GET /api/v1/admin/hooks/` returns system
webhooks.

The PR introduces an optional query parameter to `GET
/api/v1/admin/hooks/` to enable selecting if either default, system or
both kind of webhooks should be retrieved. By default the flag is set to
return system webhooks keep current behaviour.

## Examples

### System Webhooks

#### Create

```
POST /api/v1/admin/hooks/

{
  "type": "gitea",
  "active": false,
  "branch_filter": "*",
  "events": [ "create", "..." ],
  "config": {
    "url": "http://...",
    "content_type": "json",
    "secret": "secret",
    "is_system_webhook": true // <-- controls hook type
  }
}
```

#### List
```
GET/api/v1/admin/hooks?type=system //type argument is optional here since it's the default
```

#### Others
The other relevant endpoints work as expected by referencing the hook by
id
```
GET /api/v1/admin/hooks/:id
PATCH /api/v1/admin/hooks/:id
DELETE /api/v1/admin/hooks/:id
```


### Default Webhooks

#### Create
```
POST /api/v1/admin/hooks/

{
  "type": "gitea",
  "active": false,
  "branch_filter": "*",
  "events": [ "create", "..." ],
  "config": {
    "url": "http://...",
    "content_type": "json",
    "secret": "secret",
    "is_system_webhook": false // optional, as false is the default value
  }
}
```

#### List
```
GET/api/v1/admin/hooks?type=default
```

#### Others
The other relevant endpoints work as expected by referencing the hook by
id
```
GET /api/v1/admin/hooks/:id
PATCH /api/v1/admin/hooks/:id
DELETE /api/v1/admin/hooks/:id
```
wxiaoguang 348b7074c8
Fix incorrect ref "blob" ()
1. "blob" is not a "ref", it shouldn't (and not unable to) be handled by
`RepoRefByType`
2. the `/blob/{sha}` handle should use the path param "sha" directly
wxiaoguang 2ea929a952
Refactor RefName ()
And fix some FIXMEs
wxiaoguang 81352542fd
Refactor context RefName and RepoAssignment ()
The `ctx.Repo.RefName` was used to be a "short name", it causes a lot of
ambiguity.

This PR does some refactoring and use `RefFullName` to replace the
legacy `RefName`, and simplify RepoAssignment
GiteaBot 604365efd7 [skip ci] Updated translations via Crowdin
wxiaoguang c0751ef116
Fix upload file form ()
Fix 
Lunny Xiao be4e961240
Fix mirror bug ()
Fix 

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>