Update admin page

This commit is contained in:
OctoSpacc 2024-10-22 20:01:09 +02:00
parent 700d4c872e
commit a5cf31a5fd
7 changed files with 48 additions and 14 deletions

View File

@ -11,17 +11,20 @@ hugoexternal=true
if [ -n "$(which apt)" ]
then
asroot apt update
asroot apt install -y python3 nodejs findutils git wget tar gzip p7zip-full #zip
asroot apt install -y python3 python-pip nodejs findutils git wget tar gzip
if [ "$(uname -o)" != Android ]
then asroot apt install -y npm
then
# Debian(s)
asroot apt install -y npm p7zip-full
else
asroot apt install -y hugo
# Termux
asroot apt install -y hugo p7zip
hugoexternal=false
fi
elif [ -n "$(which apk)" ]
then
asroot apk update
asroot apk add hugo python3 py3-pip nodejs npm findutils git wget tar gzip 7zip #zip
asroot apk add hugo python3 py3-pip nodejs npm findutils git wget tar gzip 7zip
hugoexternal=false
fi

View File

@ -13,6 +13,6 @@ swd="$(dirname "$(realpath "$0")")"
if [ ! -e "${swd}/Lib/Globals.sh" ]
then swd="${swd}/.."
fi
#eval "$(sed -e 's| = |=|g' "${swd}/../config.toml")"
eval "$(sed -e 's| = |=|g' "${swd}/../assets/SiteProps.toml")"
Python3="$([ -n "$(which python3)" ] && echo python3 || echo python)"

5
assets/SiteProps.toml Normal file
View File

@ -0,0 +1,5 @@
GitInstanceUrl="https://gitlab.com"
GitRepoThis="octtspacc/sitoctt"
GitBranchThis="sitoctt-next"
GitRepoAssets="octtspacc/sitoctt-assets"
GitBranchAssets="main"

View File

@ -1,10 +1,27 @@
+++
Hidden = true
+++
<form>
<p><label>Git Instance: &nbsp; <input type="url" name="instance"/></label></p>
<p><label>Repository: &nbsp; <input type="text" name="repo"/></label></p>
<p><label>Branch: &nbsp; <input type="text" name="branch"/></label></p>
<p><label>Access Token: &nbsp; <input type="password" name="token"/></label></p>
<form name="admin">
<fieldset name="git" disabled>
<legend>Git Configuration</legend>
<p><label>Instance URL: &nbsp; <input type="url" name="InstanceUrl"/></label></p>
<p><label>Repository Path: &nbsp; <input type="text" name="RepoThis"/></label></p>
<p><label>Branch Name: &nbsp; <input type="text" name="BranchThis"/></label></p>
<p><label>Access Token: &nbsp; <input type="password" name="token" placeholder="***"/></label></p>
</fieldset>
</form>
<style> form > p > label > input { float: right; } </style>
<style> form[name="admin"] input { float: right; } </style>
<script>(() => {
const formEl = document.querySelector('form[name="admin"]');
const gitEl = formEl.querySelector('fieldset[name="git"]');
const gitData = (sitoctt.localStorage('gitAuth') || {});
for (const fieldEl of gitEl.querySelectorAll('input')) {
fieldEl.placeholder ||= sitoctt.Props[`Git${fieldEl.name}`];
fieldEl.value = (gitData[fieldEl.name] || '');
fieldEl.oninput = fieldEl.onchange = fieldEl.onpaste = () => {
gitData[fieldEl.name] = fieldEl.value;
sitoctt.localStorage('gitAuth', gitData);
};
}
gitEl.disabled = false;
})();</script>

View File

@ -1,4 +1,13 @@
<script> window.sitoctt = {}; window.Void = (function Void(){}); </script>
<script>
window.sitoctt = {};
window.Void = (function Void(){});
{{- with resources.Get "SiteProps.toml" -}}
{{- with . | transform.Unmarshal -}}
window.sitoctt.Props = JSON.parse({{ . | jsonify }});
{{- end -}}
{{- end -}}
window.sitoctt.localStorage = (function localStorage(key, value){ return SpaccDotWeb.LocalStorage('org.eu.octt.sitoctt', key, value); });
</script>
<script src="/ajax-navigation.js"></script>
<script src="/local-file-tweaks.js"></script>
<script src="/{{ .Lang }}/searchindex.js"></script>

View File

@ -3,7 +3,7 @@
{{ $facebook_href := printf "https://www.facebook.com/sharer.php?u=%s" $url }}
{{ $twitter_href := printf "https://twitter.com/intent/tweet?url=%s&text=%s" $url $title }}
{{ with site.Social.twitter }}
{{ with site.Params.Social.twitter }}
{{ $twitter_href = printf "%s&via=%s" $twitter_href . }}
{{ end }}
{{ $linkedin_href := printf "https://www.linkedin.com/shareArticle?mini=true&url=%s&title=%s" $url $title }}