add darkmode button

Signed-off-by: Zoey <zoey@z0ey.de>
This commit is contained in:
Zoey
2023-05-01 15:13:50 +02:00
parent 9f53ae7593
commit b180244edf
6 changed files with 34 additions and 1 deletions

View File

@@ -20,6 +20,7 @@ jobs:
yarn eslint . --fix yarn eslint . --fix
- name: update - name: update
run: | run: |
curl -L https://cdn.jsdelivr.net/npm/darkreader -o darkreader.js
curl -L https://unpkg.com/xregexp/xregexp-all.js -o rootfs/nftd/xregexp-all.js curl -L https://unpkg.com/xregexp/xregexp-all.js -o rootfs/nftd/xregexp-all.js
curl -L https://unpkg.com/showdown/dist/showdown.min.js -o rootfs/nftd/showdown.min.js curl -L https://unpkg.com/showdown/dist/showdown.min.js -o rootfs/nftd/showdown.min.js
curl -L https://code.jquery.com/jquery-"$(git ls-remote --tags https://github.com/jquery/jquery | cut -d/ -f3 | sort -V | tail -1 | sed -E "s/\^\{\}//")".min.js -o rootfs/nftd/jquery.min.js curl -L https://code.jquery.com/jquery-"$(git ls-remote --tags https://github.com/jquery/jquery | cut -d/ -f3 | sort -V | tail -1 | sed -E "s/\^\{\}//")".min.js -o rootfs/nftd/jquery.min.js

View File

@@ -9,6 +9,7 @@ RUN apk add --no-cache ca-certificates nodejs yarn git python3 build-base && \
yarn --no-lockfile install && \ yarn --no-lockfile install && \
yarn --no-lockfile build && \ yarn --no-lockfile build && \
yarn cache clean --all yarn cache clean --all
COPY darkreader.js /build/frontend/dist/js/darkreader.js
COPY security.txt /build/frontend/dist/.well-known/security.txt COPY security.txt /build/frontend/dist/.well-known/security.txt

View File

@@ -42,6 +42,7 @@ so that the barrier for entry here is low.
# New Features # New Features
- HTTP/3 (QUIC) Support - HTTP/3 (QUIC) Support
- Darkmode (have a look at the footer)
- Fix Proxy Hosts, if origin only accepts TLSv1.3 - Fix Proxy Hosts, if origin only accepts TLSv1.3
- Only use TLSv1.2 and TLSv1.3 - Only use TLSv1.2 and TLSv1.3
- Uses OCSP Stapling - Uses OCSP Stapling
@@ -73,7 +74,7 @@ so that the barrier for entry here is low.
- See composefile for all options - See composefile for all options
## Soon ## Soon
- dark mode - inbuilt database/redis?
- more - more
## migration ## migration

8
darkreader.js Normal file

File diff suppressed because one or more lines are too long

View File

@@ -21,6 +21,27 @@
<meta name="msapplication-config" content="/images/favicons/browserconfig.xml"> <meta name="msapplication-config" content="/images/favicons/browserconfig.xml">
<meta name="theme-color" content="#ffffff"> <meta name="theme-color" content="#ffffff">
<link href="/css/main.css?v=<%= version %>" rel="stylesheet"> <link href="/css/main.css?v=<%= version %>" rel="stylesheet">
<script src="js/darkreader.js"></script>
<script>
function toggleDarkMode() {
if (DarkReader.isEnabled()) {
DarkReader.disable();
localStorage.setItem('darkMode', 'off');
} else {
DarkReader.enable();
localStorage.setItem('darkMode', 'on');
}
}
if (localStorage.getItem('darkMode') === 'on') {
DarkReader.enable();
} else if (localStorage.getItem('darkMode') === 'off') {
DarkReader.disable();
} else {
DarkReader.auto();
}
</script>
</head> </head>
<body> <body>

View File

@@ -3,6 +3,7 @@
<div class="row align-items-center"> <div class="row align-items-center">
<div class="col-auto"> <div class="col-auto">
<ul class="list-inline list-inline-dots mb-0"> <ul class="list-inline list-inline-dots mb-0">
<li class="list-inline-item"><a href="#" onclick="toggleDarkMode()">Toggle Dark Mode</a></li>
<li class="list-inline-item"><a href="https://github.com/ZoeyVid/nginx-proxy-manager" target="_blank"><%- i18n('footer', 'fork-me') %></a></li> <li class="list-inline-item"><a href="https://github.com/ZoeyVid/nginx-proxy-manager" target="_blank"><%- i18n('footer', 'fork-me') %></a></li>
</ul> </ul>
</div> </div>