Initial Commit
This commit is contained in:
1
resources/public/css/bulma.min.css
vendored
Normal file
1
resources/public/css/bulma.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
4742
resources/public/css/darkreader.css
Normal file
4742
resources/public/css/darkreader.css
Normal file
File diff suppressed because it is too large
Load Diff
13
resources/public/js/iconify.min.js
vendored
Normal file
13
resources/public/js/iconify.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
65
resources/templates/base.html
Normal file
65
resources/templates/base.html
Normal file
@@ -0,0 +1,65 @@
|
||||
{{define "head"}}
|
||||
<title>{{.SiteTitle}} - {{.PageTitle}}</title>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="stylesheet" type="text/css" href="/css/bulma.min.css">
|
||||
<style>
|
||||
::-webkit-scrollbar {border-radius: 24px; width: 8px;}
|
||||
::-webkit-scrollbar-thumb {background: #e5e5e5; border-radius: 10px;}
|
||||
</style>
|
||||
<script async src="/js/iconify.min.js"></script>
|
||||
<script>
|
||||
function toggleNavMenu() {
|
||||
const navMenu = document.getElementById("navMenu");
|
||||
const navbarBurger = document.getElementById("navbarBurger");
|
||||
if (navMenu.classList.contains("is-active")) {
|
||||
navMenu.classList.remove("is-active")
|
||||
navbarBurger.classList.remove("is-active")
|
||||
} else {
|
||||
navMenu.classList.add("is-active")
|
||||
navbarBurger.classList.add("is-active")
|
||||
}
|
||||
}
|
||||
</script>
|
||||
{{if eq .Theme "dark"}}
|
||||
<link rel="stylesheet" type="text/css" href="/css/darkreader.css">
|
||||
{{end}}
|
||||
{{end}}
|
||||
|
||||
{{define "navbar"}}
|
||||
<nav class="navbar" role="navigation" aria-label="main nav" >
|
||||
<div class="container">
|
||||
<div class="navbar-brand">
|
||||
<a class="navbar-item" href="/">{{.SiteTitle}}</a>
|
||||
|
||||
<a role="button" class="navbar-burger" onclick="toggleNavMenu()" aria-label="menu" aria-expanded="false" id="navbarBurger">
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
<span aria-hidden="true"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="navbar-menu" id="navMenu">
|
||||
<div class="navbar-end">
|
||||
<a class="navbar-item {{if eq (print .Page) `home`}}is-active{{end}}" href="/">Home</a>
|
||||
{{if and .User (ne .User "_public_")}}
|
||||
<div class="navbar-item has-dropdown is-hoverable">
|
||||
<a class="navbar-link">{{.User}}</a>
|
||||
<div class="navbar-dropdown">
|
||||
<a class="navbar-item" href="/logout">Logout</a>
|
||||
</div>
|
||||
</div>
|
||||
{{else if eq .User "_public_"}}
|
||||
<a class="navbar-item {{if eq (print .Page) `login`}}is-active{{end}}" href="/login">Login</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
{{end}}
|
||||
|
||||
{{define "icon"}}
|
||||
<span class="iconify icon:{{.}} icon-inline:false"></span>
|
||||
{{end}}
|
||||
|
||||
{{define "icon-inline"}}
|
||||
<span class="iconify icon:{{.}}"></span>
|
||||
{{end}}
|
21
resources/templates/cards/collection.html
Normal file
21
resources/templates/cards/collection.html
Normal file
@@ -0,0 +1,21 @@
|
||||
<div class="card-header">
|
||||
<p class="card-header-title">{{.Title}}</p>
|
||||
{{if ne .Icon ""}}
|
||||
<div class="card-header-icon subtitle">
|
||||
{{template "icon" .Icon}}
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<div class="card-content">
|
||||
{{ range $name, $info := .Data }}
|
||||
{{$data := dict "target" ""}}
|
||||
{{- if eq $info.target "sameTab" -}}
|
||||
{{- $_ := set $data "target" "_self" -}}
|
||||
{{- else if eq $info.target "newTab" -}}
|
||||
{{- $_ := set $data "target" "_blank" -}}
|
||||
{{- else -}}
|
||||
{{- $_ := set $data "target" "_self" -}}
|
||||
{{- end -}}
|
||||
<a href="{{$info.url}}" class="button is-fullwidth has-text-left is-justify-content-start" target="{{$data.target}}" style="margin-bottom: 0.5rem; background-color: #f5f5f5">{{$name}}</a>
|
||||
{{end}}
|
||||
</div>
|
18
resources/templates/cards/simple.html
Normal file
18
resources/templates/cards/simple.html
Normal file
@@ -0,0 +1,18 @@
|
||||
<div class="card-header">
|
||||
<a class="card-header-title" href="{{.URL}}">
|
||||
{{if ne .Icon ""}}
|
||||
{{template "icon" .Icon}}
|
||||
{{end}}
|
||||
{{.Title}}
|
||||
</a>
|
||||
</div>
|
||||
{{if ne .Description ""}}
|
||||
<div class="card-content">
|
||||
<p>{{.Description}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{if ne .URL ""}}
|
||||
<div class="card-footer" style="margin-top: auto">
|
||||
<a class="card-footer-item has-text-info" href="{{.URL}}">{{.URL}}</a>
|
||||
</div>
|
||||
{{end}}
|
39
resources/templates/cards/status.html
Normal file
39
resources/templates/cards/status.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<div class="card-header">
|
||||
<a class="card-header-title" href="{{.URL}}">
|
||||
{{if ne .Icon ""}}
|
||||
{{template "icon" .Icon}}
|
||||
{{end}}
|
||||
{{.Title}}
|
||||
</a>
|
||||
<div class="card-header-icon">
|
||||
<div class="tags has-addons">
|
||||
<p class="tag">Status</p>
|
||||
<p class="tag is-warning" id="{{.Title}}Status">Loading...</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{if ne .Description ""}}
|
||||
<div class="card-content">
|
||||
<p>{{.Description}}</p>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="card-footer" style="margin-top: auto">
|
||||
<a class="card-footer-item has-text-info" href="{{.URL}}">{{.URL}}</a>
|
||||
</div>
|
||||
<script>
|
||||
var request = new XMLHttpRequest()
|
||||
request.open('GET', "/status/{{b64enc .URL}}", true)
|
||||
request.onload = function () {
|
||||
var data = JSON.parse(this.response)
|
||||
if (data.down === true || parseInt(data.code) > 500 && parseInt(data.code) < 600 ) {
|
||||
document.getElementById('{{.Title}}Status').classList.remove("is-warning")
|
||||
document.getElementById('{{.Title}}Status').classList.add("is-danger")
|
||||
document.getElementById('{{.Title}}Status').innerHTML = "Offline"
|
||||
} else {
|
||||
document.getElementById('{{.Title}}Status').classList.remove("is-warning")
|
||||
document.getElementById('{{.Title}}Status').classList.add("is-success")
|
||||
document.getElementById('{{.Title}}Status').innerHTML = "Online"
|
||||
}
|
||||
}
|
||||
request.send()
|
||||
</script>
|
43
resources/templates/cards/weather.html
Normal file
43
resources/templates/cards/weather.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<div class="card-header">
|
||||
<p class="card-header-title">{{.Title}}</p>
|
||||
</div>
|
||||
<div class="card-content">
|
||||
<p id="weatherLoadingText">Loading...</p>
|
||||
<div class="columns is-mobile">
|
||||
<div class="column is-half">
|
||||
<object type="image/svg+xml" id="weatherStateImg" style="width:45px; height: 45px"></object>
|
||||
</div>
|
||||
<div class="column is-half">
|
||||
<p id="weatherTempText" class="has-text-right subtitle"></p>
|
||||
</div>
|
||||
</div>
|
||||
<p class="subtitle is-marginless" id="weatherStateText"></p>
|
||||
<p id="weatherMinText"></p>
|
||||
<p id="weatherMaxText"></p>
|
||||
<p id="weatherWindSpeedText"></p>
|
||||
<p id="weatherHumidityText"></p>
|
||||
<p id="weatherVisibilityText"></p>
|
||||
<p id="weatherPredictabilityText"></p>
|
||||
</div>
|
||||
<div class="card-footer" style="margin-top: auto">
|
||||
<span class="card-footer-item">Data from <a href="https://www.metaweather.com" class="has-text-info">Metaweather</a></span>
|
||||
</div>
|
||||
<script>
|
||||
var request = new XMLHttpRequest()
|
||||
request.open('GET', "{{proxy (printf `https://www.metaweather.com/api/location/%s/` .Data.woeid) }}", true)
|
||||
const round = function (flt){return Number.parseFloat(flt).toPrecision(3)}
|
||||
request.onload = function () {
|
||||
const data = JSON.parse(this.response)
|
||||
document.getElementById('weatherLoadingText').classList.add("is-hidden")
|
||||
document.getElementById('weatherStateText').innerText = data["consolidated_weather"][0]["weather_state_name"]
|
||||
document.getElementById('weatherTempText').innerHTML = round(data["consolidated_weather"][0]["the_temp"]*1.8+32) + " °F"
|
||||
document.getElementById('weatherStateImg').data = "/proxy/" + btoa("https://www.metaweather.com/static/img/weather/" + data["consolidated_weather"][0]["weather_state_abbr"] + ".svg")
|
||||
document.getElementById('weatherMinText').innerHTML = "Min: " + round(data["consolidated_weather"][0]["min_temp"]*1.8+32) + " °F"
|
||||
document.getElementById('weatherMaxText').innerHTML = "Max: " + round(data["consolidated_weather"][0]["max_temp"]*1.8+32) + " °F"
|
||||
document.getElementById('weatherWindSpeedText').innerText = "Wind Speed: " + round(data["consolidated_weather"][0]["wind_speed"]) + "mph"
|
||||
document.getElementById('weatherHumidityText').innerText = "Humidity: " + data["consolidated_weather"][0]["humidity"] + "%"
|
||||
document.getElementById('weatherVisibilityText').innerText = "Visibility: " + round(data["consolidated_weather"][0]["visibility"]) + "mi"
|
||||
document.getElementById('weatherPredictabilityText').innerText = "Predictability: " + data["consolidated_weather"][0]["predictability"] + "%"
|
||||
}
|
||||
request.send()
|
||||
</script>
|
24
resources/templates/error.html
Normal file
24
resources/templates/error.html
Normal file
@@ -0,0 +1,24 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
{{template "head" dict
|
||||
"SiteTitle" .Config.Title
|
||||
"PageTitle" "Error"
|
||||
"Theme" .Config.Theme}}
|
||||
</head>
|
||||
<body>
|
||||
{{template "navbar" dict
|
||||
"SiteTitle" .Config.Title
|
||||
"Page" "error"
|
||||
"User" ""}}
|
||||
<div class="hero is-fullheight-with-navbar is-light">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<p class="title">Error <span class="has-text-danger">{{.StatusCode}}</span></p>
|
||||
<p class="subtitle">{{.Reason}}</p>
|
||||
<a class="button is-danger" href="/">Go to homepage</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
39
resources/templates/home.html
Normal file
39
resources/templates/home.html
Normal file
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
{{template "base.html"}}
|
||||
<html lang="en">
|
||||
<head>
|
||||
{{template "head" dict
|
||||
"SiteTitle" .Config.Title
|
||||
"PageTitle" "Home"
|
||||
"Theme" .Config.Theme}}
|
||||
</head>
|
||||
<body>
|
||||
{{ template "navbar" dict
|
||||
"SiteTitle" .Config.Title
|
||||
"Page" "home"
|
||||
"User" .Username }}
|
||||
<div class="hero is-fullheight-with-navbar is-light">
|
||||
<div class="hero-head" style="margin: 10px 30px 0 30px">
|
||||
<div class="row columns is-multiline is-mobile">
|
||||
{{if .User.ShowPublic}}
|
||||
{{ range $_, $card := .Config.Users._public_.Cards }}
|
||||
<div class="column is-half-tablet is-one-quarter-fullhd is-one-third-desktop is-full-mobile">
|
||||
<div class="card is-flex is-flex-direction-column" style="min-height: 175px; max-height: 175px; overflow: auto">
|
||||
{{dyn_template $card.Type $card}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{ range $_, $card := .User.Cards }}
|
||||
<div class="column is-half-tablet is-one-quarter-fullhd is-one-third-desktop is-full-mobile">
|
||||
<div class="card is-flex is-flex-direction-column" style="min-height: 175px; max-height: 175px; overflow: auto">
|
||||
{{dyn_template $card.Type $card}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
</div>
|
||||
<br>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
33
resources/templates/login.html
Normal file
33
resources/templates/login.html
Normal file
@@ -0,0 +1,33 @@
|
||||
<!DOCTYPE html>
|
||||
{{template "base.html"}}
|
||||
<html lang="en">
|
||||
<head>
|
||||
{{template "head" dict
|
||||
"SiteTitle" .Config.Title
|
||||
"PageTitle" "Login"
|
||||
"Theme" .Config.Theme}}
|
||||
</head>
|
||||
<body>
|
||||
{{ template "navbar" dict "SiteTitle" .Config.Title "Page" "login" "User" .Username}}
|
||||
<div class="hero is-fullheight-with-navbar is-light">
|
||||
<div class="hero-body">
|
||||
<div class="container has-text-centered">
|
||||
<article style="max-width: 30rem; margin-left: auto; margin-right: auto" class="message is-danger">
|
||||
{{if eq .Error "usr"}}
|
||||
<p class="message-header">User does not exist!</p>
|
||||
{{else if eq .Error "pwd"}}
|
||||
<p class="message-header">Incorrect password!</p>
|
||||
{{end}}
|
||||
</article>
|
||||
<p class="subtitle">Login to {{.Config.Title}}</p>
|
||||
<form action="/login" method="post">
|
||||
<input style="max-width: 20rem" class="input is-info" type="text" placeholder="Username" name="username"><br>
|
||||
<br>
|
||||
<input style="max-width: 20rem" class="input is-info" type="password" placeholder="Password" name="password"><br><br>
|
||||
<input class="button" style="background-color: #f5f5f5" type="submit" value="Submit">
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user