Skip to content

Commit 3569321

Browse files
committed
Merge remote-tracking branch 'upstream/main'
* upstream/main: Update docs comparison.zh-cn.md (go-gitea#21035) Use form for admin purge user (go-gitea#21070) Make labels clickable in the comments section. (go-gitea#21137) Remove fomantic image module (go-gitea#21145) [skip ci] Updated translations via Crowdin Show .editorconfig errors in frontend (go-gitea#21088) Update JS dependencies and lint (go-gitea#21144) Fix PlantUML example in document (go-gitea#21142) chore(security): Support Go Vulnerability Management (go-gitea#21139) [skip ci] Updated licenses and gitignores [skip ci] Updated translations via Crowdin Improve commit status icons (go-gitea#21124) Center-aligning content of WebAuthN page (go-gitea#21127) Allow poster to choose reviewers (go-gitea#21084) Generate go-licenses during tidy again (go-gitea#21108)
2 parents 6d0fc62 + eaa5611 commit 3569321

40 files changed

+1703
-1913
lines changed

.drone.yml

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,16 @@ steps:
3939
- make lint-frontend
4040
depends_on: [deps-frontend]
4141

42+
- name: security-check
43+
image: golang:1.19
44+
pull: always
45+
commands:
46+
- make security-check
47+
depends_on: [deps-backend]
48+
volumes:
49+
- name: deps
50+
path: /go
51+
4252
- name: lint-backend
4353
image: gitea/test_env:linux-amd64 # https://gitea.com/gitea/test-env
4454
pull: always
@@ -102,11 +112,16 @@ steps:
102112
- make test-frontend
103113
depends_on: [lint-frontend]
104114

115+
- name: generate-frontend
116+
image: golang:1.19
117+
commands:
118+
- make generate-frontend
119+
105120
- name: build-frontend
106121
image: node:18
107122
commands:
108123
- make frontend
109-
depends_on: [test-frontend]
124+
depends_on: [deps-frontend, generate-frontend]
110125

111126
- name: build-backend-no-gcc
112127
image: golang:1.18 # this step is kept as the lowest version of golang that we support
@@ -529,16 +544,21 @@ services:
529544

530545
steps:
531546
- name: deps-frontend
532-
image: node:16
547+
image: node:18
533548
pull: always
534549
commands:
535550
- make deps-frontend
536551

552+
- name: generate-frontend
553+
image: golang:1.18
554+
commands:
555+
- make generate-frontend
556+
537557
- name: build-frontend
538-
image: node:16
558+
image: node:18
539559
commands:
540560
- make frontend
541-
depends_on: [deps-frontend]
561+
depends_on: [deps-frontend, generate-frontend]
542562

543563
- name: deps-backend
544564
image: golang:1.18

.eslintrc.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ rules:
4646
accessor-pairs: [2]
4747
array-bracket-newline: [0]
4848
array-bracket-spacing: [2, never]
49-
array-callback-return: [0]
49+
array-callback-return: [2, {checkForEach: true}]
5050
array-element-newline: [0]
5151
arrow-body-style: [0]
5252
arrow-parens: [2, always]

Makefile

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ MISSPELL_PACKAGE ?= github.com/client9/misspell/cmd/misspell@v0.3.4
3535
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.30.0
3636
XGO_PACKAGE ?= src.techknowlogick.com/xgo@latest
3737
GO_LICENSES_PACKAGE ?= github.com/google/go-licenses@v1.3.0
38+
GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@latest
3839

3940
DOCKER_IMAGE ?= gitea/gitea
4041
DOCKER_TAG ?= latest
@@ -210,7 +211,7 @@ help:
210211
@echo " - golangci-lint run golangci-lint linter"
211212
@echo " - go-licenses regenerate go licenses"
212213
@echo " - vet examines Go source code and reports suspicious constructs"
213-
@echo " - tidy run go mod tidy and regenerate go licenses"
214+
@echo " - tidy run go mod tidy"
214215
@echo " - test[\#TestSpecificName] run unit test"
215216
@echo " - test-sqlite[\#TestSpecificName] run integration test for sqlite"
216217
@echo " - pr#<index> build and start gitea from a PR with integration test data loaded"
@@ -406,9 +407,9 @@ tidy:
406407
$(eval MIN_GO_VERSION := $(shell grep -Eo '^go\s+[0-9]+\.[0-9.]+' go.mod | cut -d' ' -f2))
407408
$(GO) mod tidy -compat=$(MIN_GO_VERSION)
408409

409-
.PHONY: vendor
410-
vendor: tidy
410+
vendor: go.mod go.sum
411411
$(GO) mod vendor
412+
@touch vendor
412413

413414
.PHONY: tidy-check
414415
tidy-check: tidy
@@ -420,9 +421,9 @@ tidy-check: tidy
420421
fi
421422

422423
.PHONY: go-licenses
423-
go-licenses: assets/go-licenses.json
424+
go-licenses: $(GO_LICENSE_FILE)
424425

425-
assets/go-licenses.json: go.mod go.sum
426+
$(GO_LICENSE_FILE): go.mod go.sum
426427
-$(GO) run $(GO_LICENSES_PACKAGE) save . --force --save_path=$(GO_LICENSE_TMP_DIR) 2>/dev/null
427428
$(GO) run build/generate-go-licenses.go $(GO_LICENSE_TMP_DIR) $(GO_LICENSE_FILE)
428429
@rm -rf $(GO_LICENSE_TMP_DIR)
@@ -717,15 +718,20 @@ backend: go-check generate-backend $(EXECUTABLE)
717718
.PHONY: generate
718719
generate: generate-backend generate-frontend
719720

721+
.PHONY: generate-frontend
722+
generate-frontend: $(GO_LICENSE_FILE)
723+
720724
.PHONY: generate-backend
721725
generate-backend: $(TAGS_PREREQ) generate-go
722726

727+
.PHONY: generate-go
723728
generate-go: $(TAGS_PREREQ)
724729
@echo "Running go generate..."
725730
@CC= GOOS= GOARCH= $(GO) generate -tags '$(TAGS)' $(GO_PACKAGES)
726731

727-
.PHONY: generate-frontend
728-
generate-frontend: $(TAGS_PREREQ) go-licenses
732+
.PHONY: security-check
733+
security-check:
734+
govulncheck -v ./...
729735

730736
$(EXECUTABLE): $(GO_SOURCES) $(TAGS_PREREQ)
731737
CGO_CFLAGS="$(CGO_CFLAGS)" $(GO) build $(GOFLAGS) $(EXTRA_GOFLAGS) -tags '$(TAGS)' -ldflags '-s -w $(LDFLAGS)' -o $@
@@ -812,6 +818,7 @@ deps-backend:
812818
$(GO) install $(SWAGGER_PACKAGE)
813819
$(GO) install $(XGO_PACKAGE)
814820
$(GO) install $(GO_LICENSES_PACKAGE)
821+
$(GO) install $(GOVULNCHECK_PACKAGE)
815822

816823
node_modules: package-lock.json
817824
npm install --no-save

assets/go-licenses.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@
44
"path": "cloud.google.com/go/compute/metadata/LICENSE",
55
"licenseText": "\n Apache License\n Version 2.0, January 2004\n http://www.apache.org/licenses/\n\n TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\n\n 1. Definitions.\n\n \"License\" shall mean the terms and conditions for use, reproduction,\n and distribution as defined by Sections 1 through 9 of this document.\n\n \"Licensor\" shall mean the copyright owner or entity authorized by\n the copyright owner that is granting the License.\n\n \"Legal Entity\" shall mean the union of the acting entity and all\n other entities that control, are controlled by, or are under common\n control with that entity. For the purposes of this definition,\n \"control\" means (i) the power, direct or indirect, to cause the\n direction or management of such entity, whether by contract or\n otherwise, or (ii) ownership of fifty percent (50%) or more of the\n outstanding shares, or (iii) beneficial ownership of such entity.\n\n \"You\" (or \"Your\") shall mean an individual or Legal Entity\n exercising permissions granted by this License.\n\n \"Source\" form shall mean the preferred form for making modifications,\n including but not limited to software source code, documentation\n source, and configuration files.\n\n \"Object\" form shall mean any form resulting from mechanical\n transformation or translation of a Source form, including but\n not limited to compiled object code, generated documentation,\n and conversions to other media types.\n\n \"Work\" shall mean the work of authorship, whether in Source or\n Object form, made available under the License, as indicated by a\n copyright notice that is included in or attached to the work\n (an example is provided in the Appendix below).\n\n \"Derivative Works\" shall mean any work, whether in Source or Object\n form, that is based on (or derived from) the Work and for which the\n editorial revisions, annotations, elaborations, or other modifications\n represent, as a whole, an original work of authorship. For the purposes\n of this License, Derivative Works shall not include works that remain\n separable from, or merely link (or bind by name) to the interfaces of,\n the Work and Derivative Works thereof.\n\n \"Contribution\" shall mean any work of authorship, including\n the original version of the Work and any modifications or additions\n to that Work or Derivative Works thereof, that is intentionally\n submitted to Licensor for inclusion in the Work by the copyright owner\n or by an individual or Legal Entity authorized to submit on behalf of\n the copyright owner. For the purposes of this definition, \"submitted\"\n means any form of electronic, verbal, or written communication sent\n to the Licensor or its representatives, including but not limited to\n communication on electronic mailing lists, source code control systems,\n and issue tracking systems that are managed by, or on behalf of, the\n Licensor for the purpose of discussing and improving the Work, but\n excluding communication that is conspicuously marked or otherwise\n designated in writing by the copyright owner as \"Not a Contribution.\"\n\n \"Contributor\" shall mean Licensor and any individual or Legal Entity\n on behalf of whom a Contribution has been received by Licensor and\n subsequently incorporated within the Work.\n\n 2. Grant of Copyright License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n copyright license to reproduce, prepare Derivative Works of,\n publicly display, publicly perform, sublicense, and distribute the\n Work and such Derivative Works in Source or Object form.\n\n 3. Grant of Patent License. Subject to the terms and conditions of\n this License, each Contributor hereby grants to You a perpetual,\n worldwide, non-exclusive, no-charge, royalty-free, irrevocable\n (except as stated in this section) patent license to make, have made,\n use, offer to sell, sell, import, and otherwise transfer the Work,\n where such license applies only to those patent claims licensable\n by such Contributor that are necessarily infringed by their\n Contribution(s) alone or by combination of their Contribution(s)\n with the Work to which such Contribution(s) was submitted. If You\n institute patent litigation against any entity (including a\n cross-claim or counterclaim in a lawsuit) alleging that the Work\n or a Contribution incorporated within the Work constitutes direct\n or contributory patent infringement, then any patent licenses\n granted to You under this License for that Work shall terminate\n as of the date such litigation is filed.\n\n 4. Redistribution. You may reproduce and distribute copies of the\n Work or Derivative Works thereof in any medium, with or without\n modifications, and in Source or Object form, provided that You\n meet the following conditions:\n\n (a) You must give any other recipients of the Work or\n Derivative Works a copy of this License; and\n\n (b) You must cause any modified files to carry prominent notices\n stating that You changed the files; and\n\n (c) You must retain, in the Source form of any Derivative Works\n that You distribute, all copyright, patent, trademark, and\n attribution notices from the Source form of the Work,\n excluding those notices that do not pertain to any part of\n the Derivative Works; and\n\n (d) If the Work includes a \"NOTICE\" text file as part of its\n distribution, then any Derivative Works that You distribute must\n include a readable copy of the attribution notices contained\n within such NOTICE file, excluding those notices that do not\n pertain to any part of the Derivative Works, in at least one\n of the following places: within a NOTICE text file distributed\n as part of the Derivative Works; within the Source form or\n documentation, if provided along with the Derivative Works; or,\n within a display generated by the Derivative Works, if and\n wherever such third-party notices normally appear. The contents\n of the NOTICE file are for informational purposes only and\n do not modify the License. You may add Your own attribution\n notices within Derivative Works that You distribute, alongside\n or as an addendum to the NOTICE text from the Work, provided\n that such additional attribution notices cannot be construed\n as modifying the License.\n\n You may add Your own copyright statement to Your modifications and\n may provide additional or different license terms and conditions\n for use, reproduction, or distribution of Your modifications, or\n for any such Derivative Works as a whole, provided Your use,\n reproduction, and distribution of the Work otherwise complies with\n the conditions stated in this License.\n\n 5. Submission of Contributions. Unless You explicitly state otherwise,\n any Contribution intentionally submitted for inclusion in the Work\n by You to the Licensor shall be under the terms and conditions of\n this License, without any additional terms or conditions.\n Notwithstanding the above, nothing herein shall supersede or modify\n the terms of any separate license agreement you may have executed\n with Licensor regarding such Contributions.\n\n 6. Trademarks. This License does not grant permission to use the trade\n names, trademarks, service marks, or product names of the Licensor,\n except as required for reasonable and customary use in describing the\n origin of the Work and reproducing the content of the NOTICE file.\n\n 7. Disclaimer of Warranty. Unless required by applicable law or\n agreed to in writing, Licensor provides the Work (and each\n Contributor provides its Contributions) on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n implied, including, without limitation, any warranties or conditions\n of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A\n PARTICULAR PURPOSE. You are solely responsible for determining the\n appropriateness of using or redistributing the Work and assume any\n risks associated with Your exercise of permissions under this License.\n\n 8. Limitation of Liability. In no event and under no legal theory,\n whether in tort (including negligence), contract, or otherwise,\n unless required by applicable law (such as deliberate and grossly\n negligent acts) or agreed to in writing, shall any Contributor be\n liable to You for damages, including any direct, indirect, special,\n incidental, or consequential damages of any character arising as a\n result of this License or out of the use or inability to use the\n Work (including but not limited to damages for loss of goodwill,\n work stoppage, computer failure or malfunction, or any and all\n other commercial damages or losses), even if such Contributor\n has been advised of the possibility of such damages.\n\n 9. Accepting Warranty or Additional Liability. While redistributing\n the Work or Derivative Works thereof, You may choose to offer,\n and charge a fee for, acceptance of support, warranty, indemnity,\n or other liability obligations and/or rights consistent with this\n License. However, in accepting such obligations, You may act only\n on Your own behalf and on Your sole responsibility, not on behalf\n of any other Contributor, and only if You agree to indemnify,\n defend, and hold each Contributor harmless for any liability\n incurred by, or claims asserted against, such Contributor by reason\n of your accepting any such warranty or additional liability.\n\n END OF TERMS AND CONDITIONS\n\n APPENDIX: How to apply the Apache License to your work.\n\n To apply the Apache License to your work, attach the following\n boilerplate notice, with the fields enclosed by brackets \"[]\"\n replaced with your own identifying information. (Don't include\n the brackets!) The text should be enclosed in the appropriate\n comment syntax for the file format. We also recommend that a\n file or class name and description of purpose be included on the\n same \"printed page\" as the copyright notice for easier\n identification within third-party archives.\n\n Copyright [yyyy] [name of copyright owner]\n\n Licensed under the Apache License, Version 2.0 (the \"License\");\n you may not use this file except in compliance with the License.\n You may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\n Unless required by applicable law or agreed to in writing, software\n distributed under the License is distributed on an \"AS IS\" BASIS,\n WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n See the License for the specific language governing permissions and\n limitations under the License.\n"
66
},
7-
{
8-
"name": "code.gitea.io/gitea",
9-
"path": "code.gitea.io/gitea/LICENSE",
10-
"licenseText": "Copyright (c) 2016 The Gitea Authors\nCopyright (c) 2015 The Gogs Authors\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
11-
},
127
{
138
"name": "code.gitea.io/gitea/modules/lfs",
149
"path": "code.gitea.io/gitea/modules/lfs/LICENSE",

build/generate-go-licenses.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,17 @@ func main() {
5454
}
5555

5656
path := strings.Replace(path, base+string(os.PathSeparator), "", 1)
57+
name := filepath.Dir(path)
58+
59+
// There might be a bug somewhere in go-licenses that sometimes interprets the
60+
// root package as "." and sometimes as "code.gitea.io/gitea". Workaround by
61+
// removing both of them for the sake of stable output.
62+
if name == "." || name == "code.gitea.io/gitea" {
63+
continue
64+
}
5765

5866
entries = append(entries, LicenseEntry{
59-
Name: filepath.Dir(path),
67+
Name: name,
6068
Path: path,
6169
LicenseText: string(licenseText),
6270
})

docs/content/doc/advanced/customizing-gitea.en-us.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -121,25 +121,25 @@ Apart from `extra_links.tmpl` and `extra_tabs.tmpl`, there are other useful temp
121121
- `body_inner_pre.tmpl`, before the top navigation bar, but already inside the main container `<div class="full height">`.
122122
- `body_inner_post.tmpl`, before the end of the main container.
123123
- `body_outer_post.tmpl`, before the bottom `<footer>` element.
124-
- `footer.tmpl`, right before the end of the `<body>` tag, a good place for additional Javascript.
124+
- `footer.tmpl`, right before the end of the `<body>` tag, a good place for additional JavaScript.
125125

126126
#### Example: PlantUML
127127

128128
You can add [PlantUML](https://plantuml.com/) support to Gitea's markdown by using a PlantUML server.
129129
The data is encoded and sent to the PlantUML server which generates the picture. There is an online
130130
demo server at http://www.plantuml.com/plantuml, but if you (or your users) have sensitive data you
131131
can set up your own [PlantUML server](https://plantuml.com/server) instead. To set up PlantUML rendering,
132-
copy javascript files from https://gitea.com/davidsvantesson/plantuml-code-highlight and put them in your
132+
copy JavaScript files from https://gitea.com/davidsvantesson/plantuml-code-highlight and put them in your
133133
`$GITEA_CUSTOM/public` folder. Then add the following to `custom/footer.tmpl`:
134134

135135
```html
136136
<script>
137137
$(async () => {
138138
if (!$('.language-plantuml').length) return;
139139
await Promise.all([
140-
$.getScript('https://your-server.com/deflate.js'),
141-
$.getScript('https://your-server.com/encode.js'),
142-
$.getScript('https://your-server.com/plantuml_codeblock_parse.js'),
140+
$.getScript('https://your-gitea-server.com/assets/deflate.js'),
141+
$.getScript('https://your-gitea-server.com/assets/encode.js'),
142+
$.getScript('https://your-gitea-server.com/assets/plantuml_codeblock_parse.js'),
143143
]);
144144
// Replace call with address to your plantuml server
145145
parsePlantumlCodeBlocks("https://www.plantuml.com/plantuml");

0 commit comments

Comments
 (0)