footer and version
Some checks failed
Build and push / Pulling repo on server (push) Failing after 3s

This commit is contained in:
Chris 2023-10-26 11:15:39 +02:00
parent 501b893688
commit c0b4b08cbb
5 changed files with 103 additions and 6 deletions

View File

@ -19,7 +19,18 @@ jobs:
mkdir -p ~/.ssh/ mkdir -p ~/.ssh/
echo "$SSH_KEY" > ~/.ssh/staging.key echo "$SSH_KEY" > ~/.ssh/staging.key
chmod 600 ~/.ssh/staging.key chmod 600 ~/.ssh/staging.key
- name: Run docker restart on Server - name: Run git pull on Server
run: | run: |
ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no -p 22 -o UserKnownHostsFile=/dev/null ${{ secrets.SSH_WEBSERVER_IP }} "cd /var/www/dogstats/ && git pull" ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no -p 22 -o UserKnownHostsFile=/dev/null ${{ secrets.SSH_WEBSERVER_IP }} "cd /var/www/dogstats/ && git pull"
- name: Prepare
id: prep
run: |
SHORTREF=${GITHUB_SHA::8}
# Set output parameters.
echo ::set-output name=shortref::${SHORTREF}
- name: Updating version
run: |
echo ${{ steps.prep.outputs.shortref }} | ssh -i ~/.ssh/staging.key -o StrictHostKeyChecking=no -p 22 -o UserKnownHostsFile=/dev/null ${{ secrets.SSH_WEBSERVER_IP }} > "/var/www/dogstats/web/version.txt"

2
.gitignore vendored
View File

@ -1 +1 @@
web/css/output.css web/version.txt

View File

@ -0,0 +1,3 @@
main > .container {
padding: 60px 15px 0;
}

80
web/js/color-modes.js Normal file
View File

@ -0,0 +1,80 @@
/*!
* Color mode toggler for Bootstrap's docs (https://getbootstrap.com/)
* Copyright 2011-2023 The Bootstrap Authors
* Licensed under the Creative Commons Attribution 3.0 Unported License.
*/
(() => {
'use strict'
const getStoredTheme = () => localStorage.getItem('theme')
const setStoredTheme = theme => localStorage.setItem('theme', theme)
const getPreferredTheme = () => {
const storedTheme = getStoredTheme()
if (storedTheme) {
return storedTheme
}
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'
}
const setTheme = theme => {
if (theme === 'auto' && window.matchMedia('(prefers-color-scheme: dark)').matches) {
document.documentElement.setAttribute('data-bs-theme', 'dark')
} else {
document.documentElement.setAttribute('data-bs-theme', theme)
}
}
setTheme(getPreferredTheme())
const showActiveTheme = (theme, focus = false) => {
const themeSwitcher = document.querySelector('#bd-theme')
if (!themeSwitcher) {
return
}
const themeSwitcherText = document.querySelector('#bd-theme-text')
const activeThemeIcon = document.querySelector('.theme-icon-active use')
const btnToActive = document.querySelector(`[data-bs-theme-value="${theme}"]`)
const svgOfActiveBtn = btnToActive.querySelector('svg use').getAttribute('href')
document.querySelectorAll('[data-bs-theme-value]').forEach(element => {
element.classList.remove('active')
element.setAttribute('aria-pressed', 'false')
})
btnToActive.classList.add('active')
btnToActive.setAttribute('aria-pressed', 'true')
activeThemeIcon.setAttribute('href', svgOfActiveBtn)
const themeSwitcherLabel = `${themeSwitcherText.textContent} (${btnToActive.dataset.bsThemeValue})`
themeSwitcher.setAttribute('aria-label', themeSwitcherLabel)
if (focus) {
themeSwitcher.focus()
}
}
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', () => {
const storedTheme = getStoredTheme()
if (storedTheme !== 'light' && storedTheme !== 'dark') {
setTheme(getPreferredTheme())
}
})
window.addEventListener('DOMContentLoaded', () => {
showActiveTheme(getPreferredTheme())
document.querySelectorAll('[data-bs-theme-value]')
.forEach(toggle => {
toggle.addEventListener('click', () => {
const theme = toggle.getAttribute('data-bs-theme-value')
setStoredTheme(theme)
setTheme(theme)
showActiveTheme(theme, true)
})
})
})
})()

View File

@ -1,5 +1,5 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en" class="h-100" data-bs-theme="auto">
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
@ -9,10 +9,9 @@
<link href="/css/fontawesome.min.css" rel="stylesheet"> <link href="/css/fontawesome.min.css" rel="stylesheet">
<link href="/css/bootstrap.min.css" rel="stylesheet"> <link href="/css/bootstrap.min.css" rel="stylesheet">
<link href="/css/dogstats.css" rel="stylesheet"> <link href="/css/dogstats.css" rel="stylesheet">
</head> </head>
<body class=""> <body class="d-flex flex-column h-100">
<?php include(ROOT."/templates/menu.html") ?> <?php include(ROOT."/templates/menu.html") ?>
<main id="main" class="container" hx-get="/" hx-trigger="load"> <main id="main" class="container" hx-get="/" hx-trigger="load">
@ -27,7 +26,11 @@
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">FAQs</a></li>
<li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li> <li class="nav-item"><a href="#" class="nav-link px-2 text-muted">About</a></li>
</ul> </ul>
<p class="text-center text-muted">© 2022 Company, Inc</p> <p class="text-center text-muted">
<small hx-get="/version.txt" hx-trigger="load"></small>
<br/>
© 2023 Crispi
</p>
</footer> </footer>
<script src="/js/htmx.min.js"></script> <script src="/js/htmx.min.js"></script>