From 6243638c11b7082092eeece4180b4cc505b9e431 Mon Sep 17 00:00:00 2001 From: zeripath Date: Thu, 15 Jul 2021 21:28:07 +0100 Subject: [PATCH 01/51] Update documentation to reflect #15219 (#16442) (#16444) Backport #16442 The move to render custom/public as within /assets in #15219 missed updating several documentation pages. This PR updates this documentation. Signed-off-by: Andrew Thornton --- .../doc/advanced/adding-legal-pages.en-us.md | 2 +- .../doc/advanced/customizing-gitea.en-us.md | 14 +++++++------- .../doc/advanced/customizing-gitea.zh-cn.md | 2 +- .../doc/advanced/external-renderers.en-us.md | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/content/doc/advanced/adding-legal-pages.en-us.md b/docs/content/doc/advanced/adding-legal-pages.en-us.md index b13337a4ab00..8535a6e865a2 100644 --- a/docs/content/doc/advanced/adding-legal-pages.en-us.md +++ b/docs/content/doc/advanced/adding-legal-pages.en-us.md @@ -32,7 +32,7 @@ You absolutely must not place a general ToS or privacy statement that implies th Create or append to `/path/to/custom/templates/custom/extra_links_footer.tmpl`: ```go -Privacy Policy +Privacy Policy ``` Restart Gitea to see the changes. diff --git a/docs/content/doc/advanced/customizing-gitea.en-us.md b/docs/content/doc/advanced/customizing-gitea.en-us.md index cbb749412f03..8ea7a8d129ee 100644 --- a/docs/content/doc/advanced/customizing-gitea.en-us.md +++ b/docs/content/doc/advanced/customizing-gitea.en-us.md @@ -102,7 +102,7 @@ For instance, let's say you are in Germany and must add the famously legally-req just place it under your "$GITEA_CUSTOM/public/" directory (for instance `$GITEA_CUSTOM/public/impressum.html`) and put a link to it in either `$GITEA_CUSTOM/templates/custom/extra_links.tmpl` or `$GITEA_CUSTOM/templates/custom/extra_links_footer.tmpl`. To match the current style, the link should have the class name "item", and you can use `{{AppSubUrl}}` to get the base URL: -`Impressum` +`Impressum` For more information, see [Adding Legal Pages](https://docs.gitea.io/en-us/adding-legal-pages). @@ -174,13 +174,13 @@ You can display STL file directly in Gitea by adding: if ($('.view-raw>a[href$=".stl" i]').length) { $("body").append( - '' + '' ); Promise.all([ - lS("/Madeleine.js/src/lib/stats.js"), - lS("/Madeleine.js/src/lib/detector.js"), - lS("/Madeleine.js/src/lib/three.min.js"), - lS("/Madeleine.js/src/Madeleine.js"), + lS("/assets/Madeleine.js/src/lib/stats.js"), + lS("/assets/Madeleine.js/src/lib/detector.js"), + lS("/assets/Madeleine.js/src/lib/three.min.js"), + lS("/assets/Madeleine.js/src/Madeleine.js"), ]).then(function () { $(".view-raw") .attr("id", "view-raw") @@ -188,7 +188,7 @@ You can display STL file directly in Gitea by adding: new Madeleine({ target: "view-raw", data: $('.view-raw>a[href$=".stl" i]').attr("href"), - path: "/Madeleine.js/src", + path: "/assets/Madeleine.js/src", }); $('.view-raw>a[href$=".stl"]').remove(); }); diff --git a/docs/content/doc/advanced/customizing-gitea.zh-cn.md b/docs/content/doc/advanced/customizing-gitea.zh-cn.md index 4640f878ad0b..bb55f35e178f 100644 --- a/docs/content/doc/advanced/customizing-gitea.zh-cn.md +++ b/docs/content/doc/advanced/customizing-gitea.zh-cn.md @@ -61,7 +61,7 @@ Gitea 引用 `custom` 目录中的自定义配置文件来覆盖配置、模板 "custom/public/"目录下(比如 `custom/public/impressum.html`)并且将它与 `custom/templates/custom/extra_links.tmpl` 链接起来即可。 这个链接应当使用一个名为“item”的 class 来匹配当前样式,您可以使用 `{{AppSubUrl}}` 来获取 base URL: -`Impressum` +`Impressum` 同理,您可以将页签添加到 `extra_tabs.tmpl` 中,使用同样的方式来添加页签。它的具体样式需要与 `templates/repo/header.tmpl` 中已有的其他选项卡的样式匹配 diff --git a/docs/content/doc/advanced/external-renderers.en-us.md b/docs/content/doc/advanced/external-renderers.en-us.md index c0109b801409..e5de7e8efd7d 100644 --- a/docs/content/doc/advanced/external-renderers.en-us.md +++ b/docs/content/doc/advanced/external-renderers.en-us.md @@ -164,5 +164,5 @@ And so you could write some CSS: Add your stylesheet to your custom directory e.g `custom/public/css/my-style-XXXXX.css` and import it using a custom header file `custom/templates/custom/header.tmpl`: ```html - + ``` From e5fde7ef00db4b66b389b79219001a3e01963bb6 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 16 Jul 2021 01:17:44 +0100 Subject: [PATCH 02/51] Fix crash following ldap authentication update (#16447) (#16448) Backport #16447 Unfortunately #16268 contained a terrible error, whereby there was a double indirection taken when unmarshalling the source data. This fatally breaks authentication configuration reading. Fix #16342 Signed-off-by: Andrew Thornton --- models/login_source.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/login_source.go b/models/login_source.go index f9bd496b3add..bbd605bb41d7 100644 --- a/models/login_source.go +++ b/models/login_source.go @@ -74,9 +74,9 @@ var ( // possible that a Blob may gain an unwanted prefix of 0xff 0xfe. func jsonUnmarshalIgnoreErroneousBOM(bs []byte, v interface{}) error { json := jsoniter.ConfigCompatibleWithStandardLibrary - err := json.Unmarshal(bs, &v) + err := json.Unmarshal(bs, v) if err != nil && len(bs) > 2 && bs[0] == 0xff && bs[1] == 0xfe { - err = json.Unmarshal(bs[2:], &v) + err = json.Unmarshal(bs[2:], v) } return err } From 0877d497f3e11d4dadaed96aed654ac5a303bc03 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Thu, 15 Jul 2021 21:55:14 -0400 Subject: [PATCH 03/51] revert to use alpine 3.13 (#16452) Co-authored-by: zeripath --- .drone.yml | 2 +- Dockerfile | 4 ++-- Dockerfile.rootless | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.drone.yml b/.drone.yml index e766ba613424..62c448214fa8 100644 --- a/.drone.yml +++ b/.drone.yml @@ -404,7 +404,7 @@ steps: - name: update pull: default - image: alpine:3.14 + image: alpine:3.13 commands: - ./build/update-locales.sh diff --git a/Dockerfile b/Dockerfile index 9960e5b1e363..3445544a94c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ################################### #Build stage -FROM golang:1.16-alpine3.14 AS build-env +FROM golang:1.16-alpine3.13 AS build-env ARG GOPROXY ENV GOPROXY ${GOPROXY:-direct} @@ -25,7 +25,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ # Begin env-to-ini build RUN go build contrib/environment-to-ini/environment-to-ini.go -FROM alpine:3.14 +FROM alpine:3.13 LABEL maintainer="maintainers@gitea.io" EXPOSE 22 3000 diff --git a/Dockerfile.rootless b/Dockerfile.rootless index d3ba15f109da..a0cc20095c13 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -1,7 +1,7 @@ ################################### #Build stage -FROM golang:1.16-alpine3.14 AS build-env +FROM golang:1.16-alpine3.13 AS build-env ARG GOPROXY ENV GOPROXY ${GOPROXY:-direct} @@ -25,7 +25,7 @@ RUN if [ -n "${GITEA_VERSION}" ]; then git checkout "${GITEA_VERSION}"; fi \ # Begin env-to-ini build RUN go build contrib/environment-to-ini/environment-to-ini.go -FROM alpine:3.14 +FROM alpine:3.13 LABEL maintainer="maintainers@gitea.io" EXPOSE 2222 3000 From bae0e1d7731b46772523b1724e0a1574f78d2a39 Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 16 Jul 2021 16:17:16 +0100 Subject: [PATCH 04/51] Frontport v1.14.5 (#16453) Frontport the changelog from v1.14.5 Signed-off-by: Andrew Thornton Co-authored-by: Lauris BH --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 63a49e7f07dc..0fdfb72b0ec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -216,6 +216,18 @@ been added to each release, please refer to the [blog](https://blog.gitea.io). * Remove utf8 option from installation page (#16126) * Use Wants= over Requires= in systemd file (#15897) +## [1.14.5](https://github.com/go-gitea/gitea/releases/tag/v1.14.5) - 2021-07-16 + +* SECURITY + * Hide mirror passwords on repo settings page (#16022) (#16355) + * Update bluemonday to v1.0.15 (#16379) (#16380) +* BUGFIXES + * Retry rename on lock induced failures (#16435) (#16439) + * Validate issue index before querying DB (#16406) (#16410) + * Fix crash following ldap authentication update (#16447) (#16449) +* ENHANCEMENTS + * Redirect on bad CSRF instead of presenting bad page (#14937) (#16378) + ## [1.14.4](https://github.com/go-gitea/gitea/releases/tag/v1.14.4) - 2021-07-06 * BUGFIXES From 0f11c5f592dd32db71beb5bbbf996f33a1c50f0d Mon Sep 17 00:00:00 2001 From: zeripath Date: Fri, 16 Jul 2021 18:22:44 +0100 Subject: [PATCH 05/51] Retry rename on lock induced failures (re-fix) (#16461) (#16462) Backport #16461 Unfortunately #16435 asserts the wrong error and should use os.LinkError not os.PathError. Fix #16439 Signed-off-by: Andrew Thornton --- modules/util/remove.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/util/remove.go b/modules/util/remove.go index 23104365256f..754f3b7c1174 100644 --- a/modules/util/remove.go +++ b/modules/util/remove.go @@ -64,7 +64,7 @@ func Rename(oldpath, newpath string) error { if err == nil { break } - unwrapped := err.(*os.PathError).Err + unwrapped := err.(*os.LinkError).Err if unwrapped == syscall.EBUSY || unwrapped == syscall.ENOTEMPTY || unwrapped == syscall.EPERM || unwrapped == syscall.EMFILE || unwrapped == syscall.ENFILE { // try again <-time.After(100 * time.Millisecond) From 7f6019e492d50e4d07498b17dac0bf437fdd66ec Mon Sep 17 00:00:00 2001 From: zeripath Date: Sat, 17 Jul 2021 18:05:59 +0100 Subject: [PATCH 06/51] Update notification table with only latest data (#16445) (#16469) When marking notifications read the results may be returned out of order or be delayed. This PR sends a sequence number to gitea so that the browser can ensure that only the results of the latest notification change are shown. Signed-off-by: Andrew Thornton --- routers/web/user/notification.go | 2 ++ .../user/notification/notification_div.tmpl | 2 +- web_src/js/features/notification.js | 16 ++++++++++++---- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/routers/web/user/notification.go b/routers/web/user/notification.go index 523e945db9bb..851af5d64792 100644 --- a/routers/web/user/notification.go +++ b/routers/web/user/notification.go @@ -50,6 +50,7 @@ func Notifications(c *context.Context) { return } if c.QueryBool("div-only") { + c.Data["SequenceNumber"] = c.Query("sequence-number") c.HTML(http.StatusOK, tplNotificationDiv) return } @@ -175,6 +176,7 @@ func NotificationStatusPost(c *context.Context) { return } c.Data["Link"] = setting.AppURL + "notifications" + c.Data["SequenceNumber"] = c.Req.PostFormValue("sequence-number") c.HTML(http.StatusOK, tplNotificationDiv) } diff --git a/templates/user/notification/notification_div.tmpl b/templates/user/notification/notification_div.tmpl index e7327d34bbe9..8976e1fda4a0 100644 --- a/templates/user/notification/notification_div.tmpl +++ b/templates/user/notification/notification_div.tmpl @@ -1,4 +1,4 @@ -
+

{{.i18n.Tr "notification.notifications"}}