summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsiddharth ravikumar <s@ricketyspace.net>2022-06-18 08:32:04 -0400
committersiddharth ravikumar <s@ricketyspace.net>2022-06-18 08:32:04 -0400
commite416310ae81a1ecc648c3ae59f6f46326880e818 (patch)
tree0c5bdde0ccb1134668b487e6817b8692bb53b59b
parent4f121d3a90ae2b7c79cc06df93ab25504a76892b (diff)
peach: add `/about` section
Initial version.
-rw-r--r--main.go18
-rw-r--r--meta/meta.go16
-rw-r--r--static/peach.css56
-rw-r--r--static/peach.min.css2
-rw-r--r--templates/about.tmpl77
5 files changed, 167 insertions, 2 deletions
diff --git a/main.go b/main.go
index ed988c9..79071e8 100644
--- a/main.go
+++ b/main.go
@@ -13,6 +13,7 @@ import (
"regexp"
"strconv"
+ "ricketyspace.net/peach/meta"
"ricketyspace.net/peach/search"
"ricketyspace.net/peach/version"
"ricketyspace.net/peach/weather"
@@ -52,6 +53,9 @@ func main() {
// Search handler.
http.HandleFunc("/search", showSearch)
+ // Meta handler.
+ http.HandleFunc("/about", showMeta)
+
// Start server
log.Fatal(http.ListenAndServe(peachAddr, nil))
}
@@ -100,6 +104,20 @@ func showWeather(w http.ResponseWriter, lat, lng float32) {
}
}
+func showMeta(w http.ResponseWriter, r *http.Request) {
+ logRequest(r)
+
+ // Make meta info.
+ meta := meta.NewMeta()
+
+ // Render.
+ err := peachTemplates.ExecuteTemplate(w, "about.tmpl", meta)
+ if err != nil {
+ log.Printf("weather: template: %v", err)
+ return
+ }
+}
+
func serveStaticFile(w http.ResponseWriter, r *http.Request) {
logRequest(r)
diff --git a/meta/meta.go b/meta/meta.go
new file mode 100644
index 0000000..a00504b
--- /dev/null
+++ b/meta/meta.go
@@ -0,0 +1,16 @@
+// Copyright © 2022 siddharth ravikumar <s@ricketyspace.net>
+// SPDX-License-Identifier: ISC
+
+package meta
+
+import "ricketyspace.net/peach/version"
+
+type Meta struct {
+ Version string
+}
+
+func NewMeta() *Meta {
+ m := new(Meta)
+ m.Version = version.Version
+ return m
+}
diff --git a/static/peach.css b/static/peach.css
index ac9a780..48589e1 100644
--- a/static/peach.css
+++ b/static/peach.css
@@ -48,7 +48,7 @@ body {
margin: 0;
}
-.header {
+.header-container .header {
margin-top: 10px;
margin-bottom: 0px;
font-size: 1.5em;
@@ -294,3 +294,57 @@ body {
transition: background-color 0.3s linear;
background-color: rgb(245,245,245);
}
+
+/** About **/
+.about-container,
+.terms-container,
+.privacy-container,
+.footer-container {
+ padding: 0 20px;
+}
+
+.about-container p,
+.terms-container p,
+.privacy-container p {
+ margin: 10px 0;
+ padding: 0 5px;
+ line-height: 25px;
+}
+
+.footer-container p {
+ margin: 1px 0;
+ padding: 0 5px;
+ line-height: 0px;
+ color: rgb(225,225,225);
+}
+
+.about-container a,
+.terms-container a,
+.privacy-container a {
+ text-decoration: none;
+ border-bottom: 2px solid rgb(0,0,0);
+ color: rgb(0,0,0);
+}
+
+.footer-container a {
+ text-decoration: none;
+ color: rgb(225,225,225);
+}
+
+.about-container .header {
+ font-size: 1.5em;
+}
+
+.about-container .header h1 {
+ margin: 5px; 0 15px;
+}
+
+.terms-container .header,
+.privacy-container .header {
+ font-size: 1.3em;
+}
+
+.terms-container .header h2,
+.privacy-container .header h2 {
+ margin: 0 0 10px;
+}
diff --git a/static/peach.min.css b/static/peach.min.css
index 588025d..93dc518 100644
--- a/static/peach.min.css
+++ b/static/peach.min.css
@@ -1 +1 @@
-/* Copyright © 2022 siddharth ravikumar <s@ricketyspace.net> *//* SPDX-License-Identifier: ISC *//* Peach */@font-face{font-family: Roboto;src: url('/static/font/roboto-flex.ttf');font-display: swap;}body{font-family: Roboto, sans-serif;text-transform: lowercase;}.peach{display: flex;flex-direction: row;justify-content: center;}.root-container{display: flex;flex-direction: column;row-gap: 15px;}@media (min-width: 440px) {.root-container{width: 440px;}}@media (max-width: 440px) {.peach{flex-direction: column;}}/* Weather */.header-container,.main-container{display: flex;justify-content: center;}.header-container h1{margin: 0;}.header{margin-top: 10px;margin-bottom: 0px;font-size: 1.5em;}.period-container{display: flex;flex-direction: column;row-gap: 10px;}.now-container{display: flex;flex-direction: column;}.temperature-forecast-container{display: flex;flex-direction: column;align-items: center;}.temperature-forecast-container .temperature{font-size: 2.8em;}.temperature-forecast-container .forecast{font-size: 1.8em;font-weight: 500;color: rgb(10,10,10);text-align: center;}.wind-container{display: flex;flex-direction: row;justify-content: center;column-gap: 10px;color: rgb(10,10,10);}/* Q2H Timeline */.timeline-container{display: flex;justify-content: center;}.timeline-container .periods-container{width: 440px;display: flex;justify-content: space-around;align-content: space-around;}.timeline-container .periods-container .period .temperature{font-size: 1.2em;}.timeline-container .periods-container .period .hour{font-size: 0.8em;color: rgb(0,0,0);}/* Alerts */.alerts-container{display: flex;justify-content: center;flex-direction: column;row-gap: 10px;}@media (max-width: 440px) {.alerts-container{ padding: 0 15px;}}.alert-container .alert-header{background-color: rgb(0,0,0);color: rgb(255,255,255);font-weight: 900;padding: 5px 0px 5px 10px;}.alert-container{border-radius: 3px;border: 0.3px solid rgb(0,0,0);}.alert-container .alert-header .event-name{font-size: 1.2em;}.alert-container .alert-body{display: flex;flex-direction: column;padding: 15px 15px 2px 15px;}.alert-container .alert-body p{margin: 0 0 10px 0;}.alert-container .alert-body .severity{font-size: 1em;}.alert-container .alert-body .description{font-size: 0.9em;}.alert-container .alert-body .instruction{font-size: 0.8em;border-top: 1px solid rgb(150,150,150);padding: 10px 0 0 0;}/* BiDaily Timeline */.bd-timeline-container{display: flex;justify-content: center;}@media (max-width: 440px) {.bd-timeline-container{ padding: 0 15px;}}.bd-timeline-container .periods-container{width: 440px;display: flex;flex-direction: column;row-gap: 10px;}.bd-timeline-container .periods-container .period{display: flex;flex-direction: column;row-gap: 1px;border-radius: 3px;border: 0.1px solid rgb(0,0,0);padding: 10px 10px;}.bd-timeline-container .periods-container .period .name{font-size: 1.5em;}.bd-timeline-container .periods-container .period .temperature{font-size: 1.2em;}.bd-timeline-container .periods-container .period .forecast{font-size: 0.9em;}/* Search */.search-link-container{position: absolute;right: 10px;top: 0px;font-size: 1.5em;font-weight: 900;transform: rotate(-45deg);}.search-link-container a{text-decoration: none;color: rgb(0,0,0);}.search-container .search-form{display: flex;flex-direction: row;align-items: baseline;justify-content: center;}@media (max-width: 440px) {.search-container .search-form{ justify-content: flex-start; flex-wrap: wrap; row-gap: 5px;}}.search-container .search-form .search-box .location{font-size: 1.5em;border: 0;}.search-container .search-form .search-box .location:focus-within{border: 0;outline: 0;border-bottom: 2px solid rgb(0,0,0);}.search-container .search-form .search-box .location::placeholder{color: rgb(240,240,240);font-weight: 900;}.search-container .search-form .btn-block .search-btn{cursor: pointer;border: none;background-color: rgb(0 0 0);color: rgb(255 255 255);font-size: 1.3em;padding: 3px 10px 3px 10px;border-radius: 8px;font-weight: 900;}.message-container{font-size: 1.2em;}.message-container p{margin: 5px 0 5px 0;padding: 0 0 0 5px;}.search-result-container{display: flex;flex-direction: column;row-gap: 6px;}.search-result-container .item{font-size: 1.5em;}.search-result-container .location-name a{text-decoration: none;color: rgb(0,0,0);font-weight: 600;padding: 3px 5px 5px 5px;}.search-result-container .location-name a:hover{transition: background-color 0.3s linear;background-color: rgb(245,245,245);} \ No newline at end of file
+/* Copyright © 2022 siddharth ravikumar <s@ricketyspace.net> *//* SPDX-License-Identifier: ISC *//* Peach */@font-face{font-family: Roboto;src: url('/static/font/roboto-flex.ttf');font-display: swap;}body{font-family: Roboto, sans-serif;text-transform: lowercase;}.peach{display: flex;flex-direction: row;justify-content: center;}.root-container{display: flex;flex-direction: column;row-gap: 15px;}@media (min-width: 440px) {.root-container{width: 440px;}}@media (max-width: 440px) {.peach{flex-direction: column;}}/* Weather */.header-container,.main-container{display: flex;justify-content: center;}.header-container h1{margin: 0;}.header-container .header{margin-top: 10px;margin-bottom: 0px;font-size: 1.5em;}.period-container{display: flex;flex-direction: column;row-gap: 10px;}.now-container{display: flex;flex-direction: column;}.temperature-forecast-container{display: flex;flex-direction: column;align-items: center;}.temperature-forecast-container .temperature{font-size: 2.8em;}.temperature-forecast-container .forecast{font-size: 1.8em;font-weight: 500;color: rgb(10,10,10);text-align: center;}.wind-container{display: flex;flex-direction: row;justify-content: center;column-gap: 10px;color: rgb(10,10,10);}/* Q2H Timeline */.timeline-container{display: flex;justify-content: center;}.timeline-container .periods-container{width: 440px;display: flex;justify-content: space-around;align-content: space-around;}.timeline-container .periods-container .period .temperature{font-size: 1.2em;}.timeline-container .periods-container .period .hour{font-size: 0.8em;color: rgb(0,0,0);}/* Alerts */.alerts-container{display: flex;justify-content: center;flex-direction: column;row-gap: 10px;}@media (max-width: 440px) {.alerts-container{ padding: 0 15px;}}.alert-container .alert-header{background-color: rgb(0,0,0);color: rgb(255,255,255);font-weight: 900;padding: 5px 0px 5px 10px;}.alert-container{border-radius: 3px;border: 0.3px solid rgb(0,0,0);}.alert-container .alert-header .event-name{font-size: 1.2em;}.alert-container .alert-body{display: flex;flex-direction: column;padding: 15px 15px 2px 15px;}.alert-container .alert-body p{margin: 0 0 10px 0;}.alert-container .alert-body .severity{font-size: 1em;}.alert-container .alert-body .description{font-size: 0.9em;}.alert-container .alert-body .instruction{font-size: 0.8em;border-top: 1px solid rgb(150,150,150);padding: 10px 0 0 0;}/* BiDaily Timeline */.bd-timeline-container{display: flex;justify-content: center;}@media (max-width: 440px) {.bd-timeline-container{ padding: 0 15px;}}.bd-timeline-container .periods-container{width: 440px;display: flex;flex-direction: column;row-gap: 10px;}.bd-timeline-container .periods-container .period{display: flex;flex-direction: column;row-gap: 1px;border-radius: 3px;border: 0.1px solid rgb(0,0,0);padding: 10px 10px;}.bd-timeline-container .periods-container .period .name{font-size: 1.5em;}.bd-timeline-container .periods-container .period .temperature{font-size: 1.2em;}.bd-timeline-container .periods-container .period .forecast{font-size: 0.9em;}/* Search */.search-link-container{position: absolute;right: 10px;top: 0px;font-size: 1.5em;font-weight: 900;transform: rotate(-45deg);}.search-link-container a{text-decoration: none;color: rgb(0,0,0);}.search-container .search-form{display: flex;flex-direction: row;align-items: baseline;justify-content: center;}@media (max-width: 440px) {.search-container .search-form{ justify-content: flex-start; flex-wrap: wrap; row-gap: 5px;}}.search-container .search-form .search-box .location{font-size: 1.5em;border: 0;}.search-container .search-form .search-box .location:focus-within{border: 0;outline: 0;border-bottom: 2px solid rgb(0,0,0);}.search-container .search-form .search-box .location::placeholder{color: rgb(240,240,240);font-weight: 900;}.search-container .search-form .btn-block .search-btn{cursor: pointer;border: none;background-color: rgb(0 0 0);color: rgb(255 255 255);font-size: 1.3em;padding: 3px 10px 3px 10px;border-radius: 8px;font-weight: 900;}.message-container{font-size: 1.2em;}.message-container p{margin: 5px 0 5px 0;padding: 0 0 0 5px;}.search-result-container{display: flex;flex-direction: column;row-gap: 6px;}.search-result-container .item{font-size: 1.5em;}.search-result-container .location-name a{text-decoration: none;color: rgb(0,0,0);font-weight: 600;padding: 3px 5px 5px 5px;}.search-result-container .location-name a:hover{transition: background-color 0.3s linear;background-color: rgb(245,245,245);}/** About **/.about-container,.terms-container,.privacy-container,.footer-container{padding: 0 20px; }.about-container p,.terms-container p,.privacy-container p{margin: 10px 0;padding: 0 5px;line-height: 25px;}.footer-container p{margin: 1px 0;padding: 0 5px;line-height: 0px;color: rgb(225,225,225);}.about-container a,.terms-container a,.privacy-container a{text-decoration: none;border-bottom: 2px solid rgb(0,0,0);color: rgb(0,0,0);}.footer-container a{text-decoration: none;color: rgb(225,225,225);}.about-container .header{font-size: 1.5em;}.about-container .header h1{margin: 5px; 0 15px;}.terms-container .header,.privacy-container .header{font-size: 1.3em;}.terms-container .header h2,.privacy-container .header h2{margin: 0 0 10px;} \ No newline at end of file
diff --git a/templates/about.tmpl b/templates/about.tmpl
new file mode 100644
index 0000000..950a3f4
--- /dev/null
+++ b/templates/about.tmpl
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html lang="en">
+ <head>
+ <meta charset="UTF-8">
+ <title>peach - about</title>
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
+ <meta name="author" content="siddharth ravikumar">
+ <link rel="preload" href="/static/peach.min.css?{{ .Version }}" as="style" />
+ <style>@import url("/static/peach.min.css?{{ .Version }}");</style>
+ </head>
+ <body>
+ <div class="peach">
+ <div class="root-container">
+ <div class="about-container">
+ <div class="header">
+ <h1>peach</h1>
+ </div>
+ <div class="content">
+ <p>Peach's a barebones weather service.</p>
+
+ <p>
+ Forecast data and weather alerts are from
+ <a href="//weather.gov">weather.gov</a>.
+ </p>
+ </div>
+ </div> <!-- about-container end -->
+
+ <div class="terms-container">
+ <div class="header">
+ <h2>terms</h2>
+ </div>
+ <div class="content">
+ <p>
+ Peach's available for anybody to use.
+ </p>
+
+ <p>
+ It is licensed under the
+ <a href="//git.ricketyspace.net/peach/tree/LICENSE">ISC license</a>. Your
+ use of this service indicates an implicit
+ agreement to the terms of this license.</p>
+
+ <p>
+ Peach's source code can be found at
+ <a href="//ricketyspace.net/peach">
+ ricketyspace.net/peach
+ </a>.
+ </p>
+ </div>
+ </div> <!-- terms-container end -->
+
+ <div class="privacy-container">
+ <div class="header">
+ <h2>privacy</h2>
+ </div>
+ <div class="content">
+ <p>
+ Your IP address and the user agent header
+ of your browser gets itched into an
+ ephemeral log when you use Peach.</p>
+
+ <p>Peach does not use cookies.</p>
+
+ <p>That's it.</p>
+ </div>
+ </div> <!-- privacy-container end -->
+
+ <div class="footer-container">
+ <div class="footer">
+ <p>&mdash; <a href="//ricketyspace.net/contact">siddharth ravikumar</a></p>
+ </div>
+ </div> <!-- footer-container end -->
+
+ </div> <!-- root-container end -->
+ </div> <!-- peach end -->
+ </body>
+</html>