Compare commits

..

10 Commits

Author SHA1 Message Date
silverwind a838901a06
Fall back to esbuild for css minify (#26445)
Fixes https://github.com/go-gitea/gitea/issues/26439.

The minification result is not ideal with esbuild, but it's better than
failing competely.

Co-authored-by: Giteabot <teabot@gitea.io>
2023-08-11 06:13:25 +02:00
silverwind 88479e0dfc
Update JS dependencies (#26449)
- Update all JS dependencies
- Tested Monaco and Swagger
2023-08-11 00:29:15 +00:00
wxiaoguang f42cd4561b
Call git.InitSimple for runRepoSyncReleases (#26396)
Fix #26394

Otherwise, the git module is not initialized and it doesn't respect the
"timeout" config in app.ini
2023-08-10 22:42:48 +00:00
techknowlogick bfef7d4735
Target specific OS for devcontainer base image (#26422)
fixes #25842

credit to philippbeckmann for discovering this
2023-08-10 21:57:29 +00:00
silverwind 1772814605
Lock go to 1.21 on CI (#26433)
To prevent unwanted surprises with new minor versions of go, lock the
version to minor version using [semver tilde
syntax](https://github.com/npm/node-semver#tilde-ranges-123-12-1). We
were already getting 1.21.0 since yesterday, so use that version now as
minimum.
2023-08-10 21:53:44 +00:00
Panagiotis "Ivory" Vasilopoulos 2cbd377e1f
Always show usernames in reaction tooltips (#26444)
Even if GetDisplayName() is normally preferred elsewhere, this change
provides more consistency, as usernames are also always being shown
when participating in a conversation taking place in an issue or
a pull request. This change makes conversations easier to follow, as
you would not have to have a mental association between someone's
username and someone's real name in order to follow what is happening.

This behavior matches GitHub's. Optimally, both the username and the
full name (if applicable) could be shown, but such an effort is a
much bigger task that needs to be thought out well.
2023-08-10 21:20:01 +00:00
CaiCandong 7a69d71733
Fix incorrect redirection in new issue using references (#26440)
fix #26427
related https://github.com/go-gitea/gitea/pull/25258

---

Before:

![gitea](https://github.com/go-gitea/gitea/assets/50507092/ed8d3a17-1f63-42f2-a698-3b684e70dc91)

--- 

After:

![After](https://github.com/go-gitea/gitea/assets/50507092/b8e1338f-c520-4abc-b0df-b812c021ac7e)
2023-08-10 20:04:08 +00:00
yp05327 918d0f033d
Fix the display of orgs listed in user profile (#26424)
Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/55759aad-cbf7-4d91-8559-b7781d184911)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/9de5136b-d0a0-4756-9426-125fd4b603d3)

In #26214, we changed each row's display into `flex` which caused this
problem.

![image](https://github.com/go-gitea/gitea/assets/18380374/66546e7e-a224-45e7-9008-224f0f2952c6)

![image](https://github.com/go-gitea/gitea/assets/18380374/e5190f88-e561-4361-894a-86c5fe88837e)
In old version:

![image](https://github.com/go-gitea/gitea/assets/18380374/36e58e98-7d75-4a63-844a-2beee460997a)

Maybe we can add paddings here?

![image](https://github.com/go-gitea/gitea/assets/18380374/dc61acd2-8995-46d4-b606-eb10c77dd877)
In old version;

![image](https://github.com/go-gitea/gitea/assets/18380374/478acba7-0bbc-4852-b208-3ae43fcea976)
2023-08-11 03:28:36 +08:00
nekrondev 3c91b09c19
minio: add missing region on client initialization (#26412)
The MinIO client isn't redirecting to the correct AWS endpoint if a
non-default data center is used.

In my use case I created an AWS bucket at `eu-central-1` region. Because
of the missing region initialization of the client the default
`us-east-1` API endpoint is used returning a `301 Moved Permanently`
response that's not handled properly by MinIO client. This in return
aborts using S3 storage on AWS as the `BucketExists()` call will fail
with the http moved error.

MinIO client trace shows the issue:

```text
---------START-HTTP---------
HEAD / HTTP/1.1
Host: xxxxxxxxxxx-prod-gitea-data.s3.dualstack.us-east-1.amazonaws.com
User-Agent: MinIO (windows; amd64) minio-go/v7.0.61
Authorization: AWS4-HMAC-SHA256 Credential=**REDACTED**/20230809/accesspoint.eu-central-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=**REDACTED**
X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
X-Amz-Date: 20230809T141143Z

HTTP/1.1 301 Moved Permanently
Connection: close
Content-Type: application/xml
Date: Wed, 09 Aug 2023 14:11:43 GMT
Server: AmazonS3
X-Amz-Bucket-Region: eu-central-1
X-Amz-Id-2: UK7wfeYi0HcTcytNvQ3wTAZ5ZP1mOSMnvRZ9Fz4xXzeNsS47NB/KfFx2unFxo3L7XckHpMNPPVo=
X-Amz-Request-Id: S1V2MJV8SZ11GEVN
---------END-HTTP---------
```

Co-authored-by: Heiko Besemann <heiko.besemann@qbeyond.de>
2023-08-10 11:21:09 +00:00
Lunny Xiao e7cbb0e7c9
Fix wrong middleware sequence (#26428) 2023-08-10 12:51:46 +02:00
16 changed files with 576 additions and 520 deletions

View File

@ -1,6 +1,6 @@
{
"name": "Gitea DevContainer",
"image": "mcr.microsoft.com/devcontainers/go:1.20",
"image": "mcr.microsoft.com/devcontainers/go:1.20-bullseye",
"features": {
// installs nodejs into container
"ghcr.io/devcontainers/features/node:1": {

View File

@ -13,7 +13,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- run: make generate-license generate-gitignore
timeout-minutes: 40

View File

@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-backend
@ -59,7 +59,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-go-windows lint-go-vet
@ -76,7 +76,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make lint-go
@ -91,7 +91,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- run: make deps-backend deps-tools
- run: make --always-make checks-backend # ensure the "go-licenses" make target runs
@ -119,7 +119,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
# no frontend build here as backend should be able to build
# even without any frontend files

View File

@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 pgsql ldap minio" | sudo tee -a /etc/hosts'
@ -66,7 +66,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- run: make deps-backend
- run: make backend
@ -131,7 +131,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch meilisearch smtpimap" | sudo tee -a /etc/hosts'
@ -181,7 +181,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql elasticsearch smtpimap" | sudo tee -a /etc/hosts'
@ -213,7 +213,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mysql8" | sudo tee -a /etc/hosts'
@ -244,7 +244,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- name: Add hosts to /etc/hosts
run: '[ -e "/.dockerenv" ] || [ -e "/run/.containerenv" ] || echo "127.0.0.1 mssql" | sudo tee -a /etc/hosts'

View File

@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- uses: actions/setup-node@v3
with:

View File

@ -14,7 +14,7 @@ jobs:
- run: git fetch --unshallow --quiet --tags --force
- uses: actions/setup-go@v4
with:
go-version: ">=1.20"
go-version: "~1.21"
check-latest: true
- uses: actions/setup-node@v3
with:

View File

@ -355,6 +355,10 @@ func runRepoSyncReleases(_ *cli.Context) error {
return err
}
if err := git.InitSimple(ctx); err != nil {
return err
}
log.Trace("Synchronizing repository releases (this may take a while)")
for page := 1; ; page++ {
repos, count, err := repo_model.SearchRepositoryByName(ctx, &repo_model.SearchRepoOptions{

View File

@ -377,7 +377,7 @@ func (list ReactionList) GetFirstUsers() string {
if buffer.Len() > 0 {
buffer.WriteString(", ")
}
buffer.WriteString(reaction.User.DisplayName())
buffer.WriteString(reaction.User.Name)
if rem--; rem == 0 {
break
}

View File

@ -109,7 +109,7 @@ func TestIssueReactionCount(t *testing.T) {
reactions := reactionsList.GroupByType()
assert.Len(t, reactions["heart"], 4)
assert.Equal(t, 2, reactions["heart"].GetMoreUserCount())
assert.Equal(t, user1.DisplayName()+", "+user2.DisplayName(), reactions["heart"].GetFirstUsers())
assert.Equal(t, user1.Name+", "+user2.Name, reactions["heart"].GetFirstUsers())
assert.True(t, reactions["heart"].HasUser(1))
assert.False(t, reactions["heart"].HasUser(5))
assert.False(t, reactions["heart"].HasUser(0))

View File

@ -84,6 +84,7 @@ func NewMinioStorage(ctx context.Context, cfg *setting.Storage) (ObjectStorage,
Creds: credentials.NewStaticV4(config.AccessKeyID, config.SecretAccessKey, ""),
Secure: config.UseSSL,
Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: config.InsecureSkipVerify}},
Region: config.Location,
})
if err != nil {
return nil, convertMinioErr(err)

1021
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -22,7 +22,7 @@
"css-loader": "6.8.1",
"dropzone": "6.0.0-beta.2",
"easymde": "2.18.0",
"esbuild-loader": "3.0.1",
"esbuild-loader": "4.0.0",
"escape-goat": "4.0.0",
"fast-glob": "3.3.1",
"jquery": "3.7.0",
@ -33,12 +33,12 @@
"mermaid": "10.3.0",
"mini-css-extract-plugin": "2.7.6",
"minimatch": "9.0.3",
"monaco-editor": "0.40.0",
"monaco-editor": "0.41.0",
"monaco-editor-webpack-plugin": "7.1.0",
"pdfobject": "2.2.12",
"pretty-ms": "8.0.0",
"sortablejs": "1.15.0",
"swagger-ui-dist": "5.2.0",
"swagger-ui-dist": "5.3.1",
"throttle-debounce": "5.0.0",
"tinycolor2": "1.6.0",
"tippy.js": "6.3.7",
@ -54,9 +54,9 @@
"wrap-ansi": "8.1.0"
},
"devDependencies": {
"@eslint-community/eslint-plugin-eslint-comments": "3.2.1",
"@eslint-community/eslint-plugin-eslint-comments": "4.1.0",
"@playwright/test": "1.36.2",
"@stoplight/spectral-cli": "6.10.0",
"@stoplight/spectral-cli": "6.10.1",
"@vitejs/plugin-vue": "4.2.3",
"eslint": "8.46.0",
"eslint-plugin-array-func": "3.1.8",
@ -66,9 +66,9 @@
"eslint-plugin-no-jquery": "2.7.0",
"eslint-plugin-no-use-extend-native": "0.5.0",
"eslint-plugin-regexp": "1.15.0",
"eslint-plugin-sonarjs": "0.19.0",
"eslint-plugin-sonarjs": "0.20.0",
"eslint-plugin-unicorn": "48.0.1",
"eslint-plugin-vue": "9.16.0",
"eslint-plugin-vue": "9.17.0",
"eslint-plugin-wc": "1.5.0",
"jsdom": "22.1.0",
"markdownlint-cli": "0.35.0",
@ -78,9 +78,9 @@
"stylelint-declaration-strict-value": "1.9.2",
"stylelint-stylistic": "0.4.3",
"svgo": "3.0.2",
"updates": "14.3.4",
"updates": "14.3.5",
"vite-string-plugin": "1.1.2",
"vitest": "0.33.0"
"vitest": "0.34.1"
},
"browserslist": [
"defaults",

View File

@ -1131,7 +1131,7 @@ func registerRoutes(m *web.Route) {
m.Get(".atom", feedEnabled, repo.ReleasesFeedAtom)
}, ctxDataSet("EnableFeed", setting.Other.EnableFeed),
repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true))
m.Get("/releases/attachments/{uuid}", repo.GetAttachment, repo.MustBeNotEmpty, reqRepoReleaseReader)
m.Get("/releases/attachments/{uuid}", repo.MustBeNotEmpty, reqRepoReleaseReader, repo.GetAttachment)
m.Group("/releases", func() {
m.Get("/new", repo.NewRelease)
m.Post("/new", web.Bind(forms.NewReleaseForm{}), repo.NewReleasePost)

View File

@ -3,7 +3,7 @@
{{.locale.Tr "repo.issues.context.reference_issue"}}
</div>
<div class="content" style="text-align:left">
<form class="ui form" action="{{printf "%s/issues/new" .Repository.Link}}" method="post">
<form class="ui form form-fetch-action" action="{{printf "%s/issues/new" .Repository.Link}}" method="post">
{{.CsrfTokenHtml}}
<div class="ui segment content">
<div class="field">

View File

@ -96,7 +96,6 @@
display: flex;
border-bottom: 0 !important;
padding: 3px !important;
width: 20%;
max-width: 60px;
}

View File

@ -11,7 +11,6 @@ import webpack from 'webpack';
import {fileURLToPath} from 'node:url';
import {readFileSync} from 'node:fs';
import {env} from 'node:process';
import {LightningCssMinifyPlugin} from 'lightningcss-loader';
const {EsbuildPlugin} = EsBuildLoader;
const {SourceMapDevToolPlugin, DefinePlugin} = webpack;
@ -52,6 +51,12 @@ const filterCssImport = (url, ...args) => {
return true;
};
// in case lightningcss fails to load, fall back to esbuild for css minify
let LightningCssMinifyPlugin;
try {
({LightningCssMinifyPlugin} = await import('lightningcss-loader'));
} catch {}
/** @type {import("webpack").Configuration} */
export default {
mode: isProduction ? 'production' : 'development',
@ -97,10 +102,10 @@ export default {
new EsbuildPlugin({
target: 'es2015',
minify: true,
css: false,
css: !LightningCssMinifyPlugin,
legalComments: 'none',
}),
new LightningCssMinifyPlugin(),
LightningCssMinifyPlugin && new LightningCssMinifyPlugin(),
],
splitChunks: {
chunks: 'async',