Updated Setup (markdown)

GilbN 2020-07-14 21:47:23 +02:00
parent 375c08c0bd
commit cd660b4346

104
Setup.md

@ -8,6 +8,8 @@
<li><a href="#nginx-variable">Nginx Variable</a></li> <li><a href="#nginx-variable">Nginx Variable</a></li>
<li><a href="#apache">Apache</a></li> <li><a href="#apache">Apache</a></li>
<li><a href="#caddy">Caddy</a></li> <li><a href="#caddy">Caddy</a></li>
<li><a href="#caddy-v2">Caddy V2</a></li>
</ul> </ul>
</li> </li>
<li><a href="#stylus-method">Stylus Method</a></li> <li><a href="#stylus-method">Stylus Method</a></li>
@ -208,6 +210,108 @@ $.getScript('https://archmonger.github.io/Blackberry-Themes/Extras/theme_install
}); });
``` ```
### Caddy v2
We rely on sjtug's [caddy2-filter](https://github.com/sjtug/caddy2-filter) as Caddy v2 does not have filtering as of now.
There are two ways to [extend Caddy](https://caddyserver.com/docs/extending-caddy):
- [Docker](https://hub.docker.com/_/caddy)
- [Bare metal](https://caddyserver.com/docs/download)
### Docker
You will have to create your own Caddy image that includes the `caddy2-filter`.
`Dockerfile`:
```
FROM caddy:2.0.0-builder AS builder
RUN caddy-builder \
github.com/sjtug/caddy2-filter
FROM caddy:2.0.0
COPY --from=builder /usr/bin/caddy /usr/bin/caddy
```
Then run `docker build -t caddy:latest .` to build the image. After we update the `Caddyfile` below, we can (re)start the container by running `docker run -d -p 80:80 -p 443:443 caddy:latest` as an example.
### Bare metal
Make sure you install [xcaddy](https://github.com/caddyserver/xcaddy) to add modules to Caddy.
Then install the `caddy2-filter` module by using:
```sh
xcaddy build \
--with github.com/sjtug/caddy2-filter
```
You can confirm the module is available by using `xcaddy list-modules`.
### Updating the `Caddyfile`
Almost like Caddy v1, here is an example `filter` we need to include in the all the services we want themed:
```
filter {
content_type text/html.*
search_pattern </head>
replacement "<link rel='stylesheet' type='text/css' href='https://gilbn.github.io/theme.park/CSS/themes/<APP_NAME>/<THEME>.css'></head>"
}
```
With `caddy2-filter`, we need to also add this option in the global option block:
```
{
order filter after encode
}
```
And if you're using a reverse proxy, you also need to include `header_up -Accept-Encoding` in the `reverse_proxy` directive body.
<details>
<summary>Full example of a Caddyfile</summary>
```
{
order filter after encode
}
radarr.example.com {
encode zstd gzip
reverse_proxy 127.0.0.1:7878 {
header_up -Accept-Encoding
}
filter {
content_type text/html.*
search_pattern </head>
replacement "<link rel='stylesheet' type='text/css' href='https://gilbn.github.io/theme.park/CSS/themes/radarr/space-gray.css'></head>"
}
}
```
</details>
> :point_right: If your service requires you to ignore a header, use the `header_down` subdirective in the `reverse_proxy` directive. For example, qBittorrent usage would look like this:
```
reverse_proxy 127.0.0.1:8080 {
header_up -Accept-Encoding
header_down -x-webkit-csp
header_down -content-security-policy
}
```
---
Feel free to make any adjustments! Thanks everyone for the help!
Also for reference: [Caddy v2 structure](https://caddyserver.com/docs/caddyfile/concepts#structure)
# Qbittorrent # Qbittorrent
As Qbittorrent will block the theme with its content security policy you need to change or remove the CSP header. As Qbittorrent will block the theme with its content security policy you need to change or remove the CSP header.