1
1
mirror of https://github.com/go-gitea/gitea synced 2024-06-16 08:15:47 +00:00
Commit Graph

15790 Commits

Author SHA1 Message Date
Jason Song
6daf21c9b7
Fix content holes in Actions task logs file (#25560)
Fix #25451.

Bugfixes:
- When stopping the zombie or endless tasks, set `LogInStorage` to true
after transferring the file to storage. It was missing, it could write
to a nonexistent file in DBFS because `LogInStorage` was false.
- Always update `ActionTask.Updated` when there's a new state reported
by the runner, even if there's no change. This is to avoid the task
being judged as a zombie task.

Enhancement:
- Support `Stat()` for DBFS file.
- `WriteLogs` refuses to write if it could result in content holes.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-28 19:07:29 +02:00
wxiaoguang
b6693a2c9a
Align language menu icon and fit the footer area (#25556)
Close #25551
2023-06-28 14:57:50 +00:00
Zettat123
defd807073
Fix bugs related to notification endpoints (#25548) 2023-06-28 10:26:56 -04:00
silverwind
fdab4e3d84
Add custom ansi colors and CSS variables for them (#25546)
Use our existing color palette to map to the 16 basic ansi colors. This
is backwards-compatible because it aliases the existing color names.

Side note: I think the colors in `console.css` for console file
rendering are incomplete, but fixing those is out of scope here imo.

Before and after:

<img width="542" alt="Screenshot 2023-06-28 at 00 26 12"
src="https://github.com/go-gitea/gitea/assets/115237/86d41884-bc47-4e85-8aec-621eb7320f0b">

<img width="546" alt="Screenshot 2023-06-28 at 00 28 24"
src="https://github.com/go-gitea/gitea/assets/115237/39fa3b37-d49e-49b1-b6bc-390ac8ca24b2">

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-28 15:38:55 +02:00
HesterG
c082689471
Use flex instead of float for sort button and search input (#25519)
Right now some sort buttons beside search input are unclickable because
#25338 removed `max-width` and the sort button is using float, sort
button is then covered by the `input`.

The way to fix this in this PR is changing the layout to `flex` and put
`input form` and sort `button` into `secondary menu`.

After:

<img width="1411" alt="Screen Shot 2023-06-26 at 16 40 52"
src="https://github.com/go-gitea/gitea/assets/17645053/63c12b17-793a-4ae7-bbda-f67b13b87212">

<img width="1428" alt="Screen Shot 2023-06-26 at 16 34 06"
src="https://github.com/go-gitea/gitea/assets/17645053/cb7d967e-355d-4cb0-955c-6139580fc17a">
<img width="716" alt="Screen Shot 2023-06-26 at 16 34 22"
src="https://github.com/go-gitea/gitea/assets/17645053/c74b5ef2-d46e-4487-8794-28bec984bb36">
<img width="1424" alt="Screen Shot 2023-06-26 at 16 34 32"
src="https://github.com/go-gitea/gitea/assets/17645053/8a5fdc05-a2c5-4ec4-979d-15a21501fe14">
<img width="1425" alt="Screen Shot 2023-06-26 at 16 35 21"
src="https://github.com/go-gitea/gitea/assets/17645053/eb73cd31-3914-4bc9-92ab-aba56f25128b">
<img width="1437" alt="Screen Shot 2023-06-26 at 16 36 14"
src="https://github.com/go-gitea/gitea/assets/17645053/1c3b4595-bb26-491f-aa68-60dc9ab22b84">
2023-06-28 20:10:36 +08:00
wxiaoguang
65d3e1161b
Fix sub-command log level (#25537)
More fix for #24981

* #24981


Close #22361

* #22361

There were many patches for Gitea's sub-commands to satisfy the facts:

* Some sub-commands shouldn't output any log, otherwise the git protocol
would be broken
* Sometimes the users want to see "verbose" or "quiet" outputs

That's a longstanding problem, and very fragile. This PR is only a quick
patch for the problem.

In the future, the sub-command system should be refactored to a clear
solution.

----

Other changes:

* Use `ReplaceAllWriters` to replace
`RemoveAllWriters().AddWriters(writer)`, then it's an atomic operation.
* Remove unnecessary `syncLevelInternal` calls, because
`AddWriters/addWritersInternal` already calls it.

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-28 08:02:06 +02:00
silverwind
b943318617
Update JS dependencies and misc tweaks (#25540)
- Update all JS dependencies
- Enable `declaration-property-unit-disallowed-list` to forbid `em` on
`line-height`
- Rename dependency update targets to `update-js` and `update-py` and
document them
- Remove margin on Asciicast viewer
- Tested Swagger, Katex, Asciicast

<img width="1243" alt="Screenshot 2023-06-27 at 19 51 05"
src="https://github.com/go-gitea/gitea/assets/115237/2d2722a0-2aa7-4f4c-b8bd-17e1f3637b78">
2023-06-27 21:44:17 +02:00
KN4CK3R
426a49d481
Change Regenerate Secret button display (#25534)
Fixes #25527

Preview:

![grafik](https://github.com/go-gitea/gitea/assets/1666336/a84ad1ba-43e6-42e5-a0e2-585fb226875d)
2023-06-27 15:20:52 +00:00
HesterG
00b98bc8e0
Fix rerun icon on action view component (#25531)
Right now rerun icon on action view component will not be seen when
duration text length is long, because the wrapper `job-brief-info` has a
fixed width, and the svg is squeezed. The way to fix this in this PR is
to change width to `fit-content` and exchange position of duration text
and rerun svg.

Before (rerun svg not shown on hover):

<img width="1401" alt="Screen Shot 2023-06-27 at 12 53 41"
src="https://github.com/go-gitea/gitea/assets/17645053/bb3f62ec-8c56-4dbc-96f1-718b50426d91">

After:

<img width="1409" alt="Screen Shot 2023-06-27 at 12 50 59"
src="https://github.com/go-gitea/gitea/assets/17645053/620aa02c-2326-408d-a763-453f48f42c40">
2023-06-27 16:34:33 +02:00
wxiaoguang
6dbcf6fbc5
Fix admin-dl-horizontal (#25512)
![image](https://github.com/go-gitea/gitea/assets/2114189/fb731e07-da30-4470-8200-73b5ca8b78f1)


![image](https://github.com/go-gitea/gitea/assets/2114189/85930b6f-5df7-437f-863f-423f3b81dd26)

---------

Co-authored-by: HesterG <hestergong@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2023-06-27 09:14:45 +00:00
hiifong
1069472c0c
Fix input line-height cutting off g (#25334)
Fix the incomplete display of input text
Before:

![image](https://github.com/go-gitea/gitea/assets/89133723/6bd8ca29-a096-46a8-bd23-fb833f45186f)

![image](https://github.com/go-gitea/gitea/assets/89133723/27e51e62-7150-45cd-8606-09317d462d70)
After:

![image](https://github.com/go-gitea/gitea/assets/89133723/8d0db5d3-d768-42b4-9a75-0b8816f0a299)

![image](https://github.com/go-gitea/gitea/assets/89133723/4193adc9-b635-4ed6-8e11-715ec5150563)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-27 08:45:43 +00:00
silverwind
c71e8abbc3
Add toasts to UI (#25449)
Fixes https://github.com/go-gitea/gitea/issues/24353

In some case like async success/error, it is useful to show toasts in UI.
2023-06-27 02:45:24 +00:00
GiteaBot
72c60f94c1 [skip ci] Updated translations via Crowdin 2023-06-27 00:29:26 +00:00
silverwind
02ef14bea2
Add make poetry-update, upgrade djlint (#25399)
[updates](https://github.com/silverwind/updates) now supports poetry as
well so we can use it for a new `make poetry-update` to update all
poetry dependencies.
2023-06-26 21:14:00 +00:00
wxiaoguang
ddf96f68cc
Use JSON response for "user/logout" (#25522)
The request sent to "user/logout" is from "link-action", it expects to
get JSON response.
2023-06-26 21:36:10 +02:00
silverwind
da6df0d063
Fix migrate page layout on mobile (#25507)
Fixes: https://github.com/go-gitea/gitea/issues/25462

On supporting browsers, text in description is [wrapped
equally](https://caniuse.com/css-text-wrap-balance).

<img width="488" alt="Screenshot 2023-06-26 at 00 17 21"
src="https://github.com/go-gitea/gitea/assets/115237/cb8e3a50-6225-4a8c-a6c0-f35a17d2af76">

<img width="1254" alt="Screenshot 2023-06-26 at 00 14 51"
src="https://github.com/go-gitea/gitea/assets/115237/0885404e-973e-45ce-b41e-5cb265a4cd1e">
2023-06-26 09:57:36 +00:00
Lunny Xiao
d44a415bf0
Add Adopt repository event and handler (#25497)
Fix #14304

---------

Co-authored-by: delvh <dev.lh@web.de>
2023-06-26 06:59:15 +00:00
Zettat123
48e5a74f21
Support pull_request_target event (#25229)
Fix #25088

This PR adds the support for
[`pull_request_target`](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#pull_request_target)
workflow trigger. `pull_request_target` is similar to `pull_request`,
but the workflow triggered by the `pull_request_target` event runs in
the context of the base branch of the pull request rather than the head
branch. Since the workflow from the base is considered trusted, it can
access the secrets and doesn't need approvals to run.
2023-06-26 14:33:18 +08:00
wxiaoguang
e409e14bdf
Fix CLI sub-command handling (#25501)
A regression of #25330 : The nil "Action" should be treated as "help"

In old releases: `./gitea admin` show helps

After #25330: `./gitea admin` panics (although the code returned `nil`
if action is nil, but Golang's quirk is: nil in interface is not nil)

With this PR: `./gitea admin` shows helps as the old releases.
2023-06-26 13:45:27 +08:00
techknowlogick
50dc2d5f5f
Document creating an API key from the CLI (#25504) (#25510)
Frontport of #25504

Credit to @lonix1

Co-authored-by: lonix1 <40320097+lonix1@users.noreply.github.com>
Co-authored-by: delvh <dev.lh@web.de>
2023-06-26 05:13:20 +00:00
wxiaoguang
d5f007539a
Clarify the reason why the user can't add a new email if there is a pending activation (#25509)
![image](https://github.com/go-gitea/gitea/assets/2114189/cff20df0-ad0c-4140-b8e2-5782cad8a53a)
2023-06-26 04:52:49 +00:00
HesterG
457946d595
Allow change line of admin-dl-horizontal dt (#25508)
Close #25389

After:

<img width="915" alt="Screen Shot 2023-06-26 at 11 00 12"
src="https://github.com/go-gitea/gitea/assets/17645053/45026447-cf50-4603-ade3-7b80a9023c20">


admin/dashboard:

<img width="957" alt="Screen Shot 2023-06-26 at 10 59 51"
src="https://github.com/go-gitea/gitea/assets/17645053/f4f95bbe-f747-46f1-8fbd-5778a19ebef7">
2023-06-26 11:49:14 +08:00
GiteaBot
2a6e2afab9 [skip ci] Updated translations via Crowdin 2023-06-26 00:31:01 +00:00
sebastian-sauer
7609f2f27e
Link to existing PR when trying to open a new PR on the same branches (#25494)
when trying to create a PR for an existing PRs branch combination link
to the PR directly and not just to the repo.

Before:

![image](https://github.com/go-gitea/gitea/assets/1135157/b6c71323-29c8-4024-afa5-420eed145e91)

After:

![image](https://github.com/go-gitea/gitea/assets/1135157/837665f5-7459-46c6-86d4-c2dbedabc262)
2023-06-25 10:03:36 +00:00
wxiaoguang
323c6cba20
Fine tune "dropdown button" icon (#25442)
![image](https://github.com/go-gitea/gitea/assets/2114189/143e043d-85c9-43a4-85ae-ca55f507f738)

----

![image](https://github.com/go-gitea/gitea/assets/2114189/bcba03a5-732e-4139-bc35-96a7f8bfcb88)
2023-06-25 02:40:41 +00:00
wxiaoguang
b8253607fe
Revert "Make buttons in a modal form have proper type. (#25446)" (#25485)
There is a side effect because some modal doesn't have a proper "ok"
button.

This reverts commit a954c93a68.
2023-06-25 10:03:09 +08:00
sebastian-sauer
77e449f0be
Highlight viewed files differently in the PR filetree (#24956)
![image](https://github.com/go-gitea/gitea/assets/1135157/009d8026-15a1-4d18-8548-1c3642978f57)

fixes #24566

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2023-06-25 08:46:30 +08:00
Lunny Xiao
083818cb85
Improve loadprojects for issue list (#25468) 2023-06-24 15:31:28 +00:00
Panagiotis "Ivory" Vasilopoulos
5eeddfde10
Only show 'Manage Account Links' when necessary (#25311)
If it is not possible to add or manage an account link, the menu
will not be shown to the user.
2023-06-24 13:00:52 +00:00
hiifong
8e6a114317
fix tags line no margin see #25255 (#25280)
This is my first pr, there are many things I don't understand very well,
I am very sorry, I rearranged the code and opened this new pr.
Now:

![image](https://github.com/go-gitea/gitea/assets/89133723/5acd9d81-2152-4966-9372-1fbf902ed073)
2023-06-24 20:30:46 +08:00
wxiaoguang
cc1d61f1f5
Use InitWorkPathAndCfgProvider for environment-to-ini to avoid unnecessary checks (#25480)
Fix #25481

The `InitWorkPathAndCommonConfig` calls `LoadCommonSettings` which does
many checks like "current user is root or not".

Some commands like "environment-to-ini" shouldn't do such check, because
it might be run with "root" user at the moment (eg: the docker's setup
script)

ps: in the future, the docker's setup script should be improved to avoid
Gitea's command running with "root"
2023-06-24 09:13:35 +00:00
Lunny Xiao
71446eee99
Fix wrong warn messages in migration steps (#25475)
The recent change on xorm for `Sync` is it will not warn when database
have columns which is not listed on struct. So we just need this warn
logs when `Sync` the whole database but not in the migrations Sync.

This PR will remove almost unnecessary warning logs on migrations.

Now below logs in CI will disappear.
```log
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column creator_id but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column is_closed but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column board_type but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column type but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column closed_date_unix but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column created_unix but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column updated_unix but struct has not related field
2023/06/23 17:51:32 models/db/engine.go:191:InitEngineWithMigration() [W] Table gtestschema.project has column card_type but struct has not related field
```
2023-06-24 08:20:08 +00:00
silverwind
be47015229
Navbar fixes (#25402)
Fixes: https://github.com/go-gitea/gitea/issues/25444

Followup for some regressions from
https://github.com/go-gitea/gitea/pull/25343. Before and after:

<img width="219" alt="Screenshot 2023-06-21 at 00 25 20"
src="https://github.com/go-gitea/gitea/assets/115237/08fe8e01-0a16-4cdf-ad4d-0a9048408e9e">
<img width="220" alt="Screenshot 2023-06-21 at 00 25 32"
src="https://github.com/go-gitea/gitea/assets/115237/be25ae69-6ed0-4af5-8eeb-d7b210e7c124">

Fixes mobile button background and margins:

<img width="836" alt="Screenshot 2023-06-21 at 00 39 58"
src="https://github.com/go-gitea/gitea/assets/115237/d76ac1e9-747f-477c-9a42-b73e129b72ee">
2023-06-24 04:31:39 +00:00
Lunny Xiao
9c62ca5689
Fix default value for LocalURL (#25426)
Fix #23769
2023-06-24 11:56:29 +08:00
GiteaBot
326df0f6ed [skip ci] Updated translations via Crowdin 2023-06-24 00:30:41 +00:00
delvh
65ba2f32ca
Do not publish docker release images on -dev tags (#25471)
Try to prevent what happened with tag `v1.21.0-dev` as outlined in
#25193.
Unfortunately, we cannot really test if it works as intended as we would
need to release a new `dev` tag for that.
Fixes #25193 (or at least attempts to).

---------

Co-authored-by: jolheiser <john.olheiser@gmail.com>
2023-06-23 19:52:24 +00:00
wxiaoguang
62ab55bacc
Improve wiki sidebar and TOC (#25460)
Close #20976
Close #20975

1. Fix the bug: the TOC in footer was incorrectly rendered as main
content's TOC
2. Fix the layout: on mobile, the TOC is put above the main content,
while the sidebar is put below the main content
3. Auto collapse the TOC on mobile

ps: many styles of "wiki.css" are moved from old css files, so leave
nits to following PRs.
2023-06-23 15:51:43 -04:00
Jason Song
3c7f5ed7b5
Fix Init of db indexer (#25470)
Fix regression of #25174.

The `Init` of the db indexer should return true to indicate that the
index was opened/existed, or the indexer will try to populate the index
(not really populate, just fill the queue, `Index` method of the db
indexer is a dummy).
2023-06-23 14:39:52 +00:00
silverwind
e441a5d751
Add Makefile to files-changed (#25463)
When only `Makefile` changes, nothing currently runs. Add it to a few
categories.

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-23 13:56:18 +00:00
Lunny Xiao
fab63cf565
Fix repo search broken because of profile page added (#25455)
Fix #25433 
Caused by #23260
2023-06-23 13:11:12 +00:00
Jason Song
375fd15fbf
Refactor indexer (#25174)
Refactor `modules/indexer` to make it more maintainable. And it can be
easier to support more features. I'm trying to solve some of issue
searching, this is a precursor to making functional changes.

Current supported engines and the index versions:

| engines | issues | code |
| - | - | - |
| db | Just a wrapper for database queries, doesn't need version | - |
| bleve | The version of index is **2** | The version of index is **6**
|
| elasticsearch | The old index has no version, will be treated as
version **0** in this PR | The version of index is **1** |
| meilisearch | The old index has no version, will be treated as version
**0** in this PR | - |


## Changes

### Split

Splited it into mutiple packages

```text
indexer
├── internal
│   ├── bleve
│   ├── db
│   ├── elasticsearch
│   └── meilisearch
├── code
│   ├── bleve
│   ├── elasticsearch
│   └── internal
└── issues
    ├── bleve
    ├── db
    ├── elasticsearch
    ├── internal
    └── meilisearch
```

- `indexer/interanal`: Internal shared package for indexer.
- `indexer/interanal/[engine]`: Internal shared package for each engine
(bleve/db/elasticsearch/meilisearch).
- `indexer/code`: Implementations for code indexer.
- `indexer/code/internal`: Internal shared package for code indexer.
- `indexer/code/[engine]`: Implementation via each engine for code
indexer.
- `indexer/issues`: Implementations for issues indexer.

### Deduplication

- Combine `Init/Ping/Close` for code indexer and issues indexer.
- ~Combine `issues.indexerHolder` and `code.wrappedIndexer` to
`internal.IndexHolder`.~ Remove it, use dummy indexer instead when the
indexer is not ready.
- Duplicate two copies of creating ES clients.
- Duplicate two copies of `indexerID()`.


### Enhancement

- [x] Support index version for elasticsearch issues indexer, the old
index without version will be treated as version 0.
- [x] Fix spell of `elastic_search/ElasticSearch`, it should be
`Elasticsearch`.
- [x] Improve versioning of ES index. We don't need `Aliases`:
- Gitea does't need aliases for "Zero Downtime" because it never delete
old indexes.
- The old code of issues indexer uses the orignal name to create issue
index, so it's tricky to convert it to an alias.
- [x] Support index version for meilisearch issues indexer, the old
index without version will be treated as version 0.
- [x] Do "ping" only when `Ping` has been called, don't ping
periodically and cache the status.
- [x] Support the context parameter whenever possible.
- [x] Fix outdated example config.
- [x] Give up the requeue logic of issues indexer: When indexing fails,
call Ping to check if it was caused by the engine being unavailable, and
only requeue the task if the engine is unavailable.
- It is fragile and tricky, could cause data losing (It did happen when
I was doing some tests for this PR). And it works for ES only.
- Just always requeue the failed task, if it caused by bad data, it's a
bug of Gitea which should be fixed.

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-23 12:37:56 +00:00
6543
b0215c40cd
Store and use seconds for timeline time comments (#25392)
this will allow us to fully localize it later

PS: we can not migrate back as the old value was a one-way conversion


prepare for  #25213

---
*Sponsored by Kithara Software GmbH*
2023-06-23 12:12:39 +00:00
wxiaoguang
a954c93a68
Make buttons in a modal form have proper type. (#25446)
Fix  #25438

All non-"ok" buttons which do not have "type" should not submit the
form, should not be triggered by "Enter".

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-23 12:57:01 +02:00
wxiaoguang
17965c8e79
Make "dismiss" content shown correctly (#25461)
Close #25127


![image](https://github.com/go-gitea/gitea/assets/2114189/7d6be811-8e4a-4982-a5e4-857d171758d4)

Co-authored-by: Giteabot <teabot@gitea.io>
2023-06-23 12:33:20 +02:00
John Olheiser
2e65c223dc
Gitea version in Makefile (#25456)
As title, this is how it was inferred before

e24f651c86/Makefile (L83-L84)

We moved to actions, however `GITEA_VERSION` should still work to use
`VERSION`

Signed-off-by: jolheiser <john.olheiser@gmail.com>
2023-06-23 09:52:15 +02:00
techknowlogick
c0fc53e226
Import additional secrets via file uri (#25408) 2023-06-23 00:16:12 +00:00
silverwind
478f33030e
Remove deps-tools from backend job (#25454) 2023-06-22 23:24:55 +00:00
silverwind
d2142ba3c3
Update octicons and use octicon-file-directory-symlink (#25453)
Make use of the [new
octicon](https://github.com/primer/octicons/issues/945) that indicates a
symlink to a directory:

<img width="189" alt="Screenshot 2023-06-22 at 22 50 57"
src="https://github.com/go-gitea/gitea/assets/115237/a70690ea-ebfc-48fe-af23-cdc33bcb2098">
2023-06-22 22:05:52 +00:00
silverwind
6281ebfec3
add test-frontend back to actions (#25452)
Apparently we were not running `test-frontend` on actions, this adds it
back.
2023-06-22 23:37:50 +02:00
Denys Konovalov
bb31f36415
Remove test string (#25447)
Remove test string on delete project button, I overlooked it in a
previous PR 😄
2023-06-22 10:29:57 -05:00