diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 130edc0..ce399fe 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -19,7 +19,18 @@ jobs: mkdir -p ~/.ssh/ echo "$SSH_KEY" > ~/.ssh/staging.key chmod 600 ~/.ssh/staging.key - - name: Run docker restart on Server + - name: Run git pull on Server 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" + + - 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" \ No newline at end of file diff --git a/.gitignore b/.gitignore index cb9e1b4..feddf7a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -web/css/output.css \ No newline at end of file +web/version.txt \ No newline at end of file diff --git a/web/css/dogstats.css b/web/css/dogstats.css index e69de29..da31db9 100644 --- a/web/css/dogstats.css +++ b/web/css/dogstats.css @@ -0,0 +1,3 @@ +main > .container { + padding: 60px 15px 0; + } \ No newline at end of file diff --git a/web/js/color-modes.js b/web/js/color-modes.js new file mode 100644 index 0000000..2ca1959 --- /dev/null +++ b/web/js/color-modes.js @@ -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) + }) + }) + }) + })() \ No newline at end of file diff --git a/web/templates/mainpage.html b/web/templates/mainpage.html index c501f03..49dad13 100644 --- a/web/templates/mainpage.html +++ b/web/templates/mainpage.html @@ -1,5 +1,5 @@ - + @@ -9,10 +9,9 @@ - - +
@@ -27,7 +26,11 @@ -

© 2022 Company, Inc

+

+ +
+ © 2023 Crispi +