From 4837a1bdf5312457f53051965f078e6d9da82fad Mon Sep 17 00:00:00 2001 From: Stanislaw Adaszewski Date: Sat, 2 May 2020 16:55:11 +0200 Subject: [PATCH] Disabled Issues, Releases and Wiki for non-admin. --- example/gitea-disable/Fockerfile | 11 +++++++++++ example/gitea-disable/files/403.html | 13 +++++++++++++ example/gitea-disable/files/nginx.conf | 27 ++++++++++++++++++++++++++ example/gitea/focker-compose.yml | 3 ++- 4 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 example/gitea-disable/Fockerfile create mode 100644 example/gitea-disable/files/403.html create mode 100644 example/gitea-disable/files/nginx.conf diff --git a/example/gitea-disable/Fockerfile b/example/gitea-disable/Fockerfile new file mode 100644 index 0000000..6aa3108 --- /dev/null +++ b/example/gitea-disable/Fockerfile @@ -0,0 +1,11 @@ +base: gitea-custom + +steps: + - run: + - ASSUME_ALWAYS_YES=yes IGNORE_OSVERSION=yes pkg install nginx + - sysrc nginx_enable=YES + - copy: + - [ files/nginx.conf, + /usr/local/etc/nginx/nginx.conf ] + - [ files/403.html, + /usr/local/share/gitea/public/403.html ] diff --git a/example/gitea-disable/files/403.html b/example/gitea-disable/files/403.html new file mode 100644 index 0000000..64b7b14 --- /dev/null +++ b/example/gitea-disable/files/403.html @@ -0,0 +1,13 @@ + + + + + + +
+

403 Forbidden

+

Issues, Releases and Wiki are disabled for forked repositories. Please use the source repository for those.

+

Go Back

+
+ + diff --git a/example/gitea-disable/files/nginx.conf b/example/gitea-disable/files/nginx.conf new file mode 100644 index 0000000..0d6a92a --- /dev/null +++ b/example/gitea-disable/files/nginx.conf @@ -0,0 +1,27 @@ +worker_processes 1; + +events { + worker_connections 1024; +} + +http { + include mime.types; + default_type application/octet-stream; + + server { + listen 80; + + location / { + rewrite ^/admin1/ $uri break; + if ($uri ~ ^/([^/]*)/([^/]*)/(wiki|releases|issues)) { + return 403; + } + + root /usr/local/share/gitea/public; + + error_page 403 /403.html; + + proxy_pass http://localhost:3000/; + } + } +} diff --git a/example/gitea/focker-compose.yml b/example/gitea/focker-compose.yml index 0722952..0bbd671 100644 --- a/example/gitea/focker-compose.yml +++ b/example/gitea/focker-compose.yml @@ -2,6 +2,7 @@ images: gitea: . gitea-logo: ../gitea-logo gitea-custom: ../gitea-custom + gitea-disable: ../gitea-disable certbot-latest: ../certbot volumes: @@ -15,7 +16,7 @@ jails: domains: - xyz.com - www.xyz.com - image: gitea-custom + image: gitea-disable mounts: gitea-data: /var/db/gitea ip4.addr: 127.0.8.1