Compare commits

...

3 Commits

Author SHA1 Message Date
ac65de5c3d gut 2025-05-19 23:33:58 +02:00
07b6d25665 unschön 2025-05-19 23:24:17 +02:00
f2227e4445 init 2025-05-19 21:45:54 +02:00
7 changed files with 444 additions and 0 deletions

3
go.mod Normal file
View File

@@ -0,0 +1,3 @@
module git.send.nrw/sendnrw/hikos
go 1.23.1

118
main.go Normal file
View File

@@ -0,0 +1,118 @@
package main
import (
"fmt"
"html/template"
"net/http"
"os"
"os/signal"
"strconv"
"strings"
"syscall"
"time"
)
func getenv(k, d string) string {
if v := os.Getenv(k); v != "" {
return v
}
return d
}
func enabled(k string, def bool) bool {
b, err := strconv.ParseBool(strings.ToLower(os.Getenv(k)))
if err != nil {
return def
}
return b
}
func cacheControl(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Cache-Control", "public, max-age=31536000, immutable")
next.ServeHTTP(w, r)
})
}
func main() {
// Signal-Kanal einrichten
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
// Goroutine, die auf Signale wartet
go func() {
<-stop
fmt.Println("Stop Sign...")
prepareExit()
os.Exit(0)
}()
// --- Verzeichnisse konfigurierbar machen -------------------------
staticDir := getenv("BLOG_STATIC_DIR", "./static")
templatesDir := getenv("BLOG_TEMPLATES_DIR", "./static/templates")
/*storeEnabled := enabled("STORE_ENABLE", false)*/
/*TickCatalog = nil
if err := LoadTickCatalog(ticksDir + "/ticks.json"); err != nil {
fmt.Println("Fehler beim Laden:", err)
}
fmt.Println("Geladener Katalog:", TickCatalog)
cloneRepo(gitRepo, gitBranch, gitDir)*/
funcs := template.FuncMap{
"now": time.Now, // jetztZeit bereitstellen
}
// Basislayout zuerst parsen
layout := template.Must(template.New("base").Funcs(funcs).ParseFiles(templatesDir + "/base.html"))
// LISTSeite: base + list.html
/*tplList = template.Must(layout.Clone())
template.Must(tplList.Funcs(funcs).ParseFiles(templatesDir + "/list.html"))
tplArticle = template.Must(layout.Clone())
template.Must(tplArticle.Funcs(funcs).ParseFiles(templatesDir + "/article.html"))
tplPage := template.Must(layout.Clone())
template.Must(tplPage.ParseFiles(templatesDir + "/page.html"))*/
mux := http.NewServeMux()
// Handler für /
mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
layout.ExecuteTemplate(w, "layout", nil)
})
mux.HandleFunc("/post/", func(w http.ResponseWriter, r *http.Request) {
})
mux.HandleFunc("/page/", func(w http.ResponseWriter, r *http.Request) {
})
mux.Handle("/static/", cacheControl(http.StripPrefix("/static/", http.FileServer(http.Dir(staticDir)))))
mux.HandleFunc("/store", func(w http.ResponseWriter, r *http.Request) {
})
StopServer(http.ListenAndServe(":8080", mux))
}
func prepareExit() {
fmt.Println("~", "Running exit tasks...")
/*if err := SaveTickCatalog(getenv("BLOG_TICKS_DIR", "/ticks") + "/ticks.json"); err != nil {
fmt.Println("Fehler beim Speichern:", err)
}
fmt.Println("Geladener Katalog:", TickCatalog)*/
fmt.Println("~", "Exit completed.")
}
func StopServer(e error) {
fmt.Println("~", "Stopping server...")
prepareExit()
fmt.Println("~", "Server stopped!")
}

187
static/css/main.css Normal file
View File

@@ -0,0 +1,187 @@
/* ---------- Local WebFonts ---------- */
@font-face {
font-family: "Fira Code";
src: url("/static/fonts/FiraCode-VariableFont.woff2") format("woff2");
font-weight: 400 700;
font-style: normal;
font-display: swap;
}
@font-face {
font-family: "Inter";
src: url("/static/fonts/InterVariable.woff2") format("woff2");
font-weight: 100 900;
font-style: normal;
font-display: swap;
}
/* ---------- Farbpalette ---------- */
:root {
/* Light theme */
--bg: #f5f7fa;
--bg-alt: #ffffff;
--card-bg: #ffffff;
--text: #000000;
--text-muted: #1f2933;
--accent: #2563eb; /* Indigo600 */
--accent-light: #3b82f6; /* Indigo500 */
--code-bg: #f1f5f9;
--code-border: #e2e8f0;
--radius: 0.75rem;
--gap: 2rem;
--shadow: 0 4px 16px rgba(0,0,0,.08);
font-size: 16px;
font-family: "Inter", system-ui, sans-serif;
color-scheme: light;
}
/* Dark mode (optional) */
@media (prefers-color-scheme: dark) {
:root {
--bg: #0d1117;
--bg-alt: #161b22;
--card-bg: #161b22;
--text: #ffffff;
--text-muted: #e4e8ec;
--accent: #3b82f6;
--accent-light:#60a5fa;
--code-bg: #1e242c;
--code-border: #30363d;
--shadow: 0 4px 16px rgba(0,0,0,.32);
}
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body, html {
height: 100%;
width: 100%;
background: var(--bg);
color: var(--text);
}
.container {
display: flex;
flex-wrap: wrap;
height: 100%;
width: 100%;
}
#bereich-a {
width: 72.5%;
display: flex;
flex-direction: column;
height: 100%;
}
#bereich-b {
width: 27.5%;
display: flex;
flex-direction: column;
height: 100%;
}
.top {
display: grid;
gap: 0px;
grid-template-columns: 68.96% 6.92% 10.34% 13.79%;
margin-top: 10px;
}
.top > div {
background-color: var(--bg); /* Beispiel für Formularfelder */
}
.top input {
width: 100%; /* Vollständige Breite */
padding: 8px;
border: 1px solid #ddd;
border-radius: var(--radius); /* Abgerundete Ecken */
background-color: #fff;
font-size: 14px;
color: var(--text);
transition: all 0.3s ease;
}
.top input::placeholder {
color: #aaa; /* Platzhalter in einer helleren Farbe */
font-style: italic;
}
.top input:focus {
border-color: var(--accent); /* Die Rahmenfarbe beim Fokus */
outline: none; /* Entfernt den Standard-Fokusrahmen */
}
#bereich-a .bottom {
flex-grow: 1;
background-color: var(--bg-alt); /* Beispiel für unteren Bereich */
padding: 0px;
overflow: hidden; /* Verhindert, dass das untere Element aus dem Container herausragt */
}
#bereich-b .top {
margin-top: 10px;
height: 35px;
display: grid;
width: 100%;
grid-template-columns: 100%;
}
#bereich-b .top > div {
background-color: var(--bg); /* Beispiel für Formularfelder */
}
#bereich-b .top input {
width: 100%; /* Das Textfeld nimmt die gesamte Breite der Spalte ein */
padding: 8px;
border: 1px solid #ddd;
border-radius: var(--radius); /* Abgerundete Ecken */
background-color: #fff;
font-size: 14px;
color: var(--text);
transition: all 0.3s ease; /* Für weiche Übergänge */
}
#bereich-b .top input::placeholder {
color: #aaa; /* Platzhalter in einer helleren Farbe */
font-style: italic;
}
#bereich-b .top input:focus {
border-color: var(--accent); /* Die Rahmenfarbe beim Fokus */
outline: none; /* Entfernt den Standard-Fokusrahmen */
}
#bereich-b .bottom {
flex-grow: 1;
background-color: var(--bg-alt); /* Beispiel für unteren Bereich */
padding: 0px;
overflow-y: auto; /* Ermöglicht vertikales Scrollen im unteren Bereich von Bereich B */
/*margin-top: 10px;*/ /* Abstand zwischen Top und Bottom */
}
/* Tabelle */
table {
width: 100%;
border-collapse: collapse; /* Für eine saubere Darstellung */
table-layout: fixed; /* Die Breiten der Spalten werden strikt angewendet */
}
th, td {
border: 1px solid #ddd; /* Beispiel für einen Rahmen */
padding: 8px;
text-align: center; /* Beispiel für Textzentrierung */
}
colgroup col {
background-color: var(--bg); /* Hintergrundfarbe als Beispiel */
}
table th, table td {
text-align: left;
}

Binary file not shown.

Binary file not shown.

BIN
static/img/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

136
static/templates/base.html Normal file
View File

@@ -0,0 +1,136 @@
{{ define "layout" }}
<!DOCTYPE html>
<html lang="de">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="HiKoS">
<title>HiKoS</title>
<link rel="icon" type="image/vnd.icon" href="/static/img/favicon.ico">
<link rel="stylesheet" href="/static/css/main.css">
</head>
<body>
<div class="container">
<div id="bereich-a">
<div class="top">
<input type="text" placeholder="A 1" />
<input type="text" placeholder="B 2" />
<input type="text" placeholder="C 3" />
<input type="text" placeholder="D 4" />
</div>
<div class="bottom">
<table>
<colgroup>
<col style="width: 27.5%">
<col style="width: 7.5%">
<col style="width: 7.5%">
<col style="width: 7.5%">
<col style="width: 5%">
<col style="width: 7.5%">
<col style="width: 10%">
</colgroup>
<thead>
<tr>
<th>Spalte 1</th>
<th>Spalte 2</th>
<th>Spalte 3</th>
<th>Spalte 4</th>
<th>Spalte 5</th>
<th>Spalte 6</th>
<th>Spalte 7</th>
</tr>
</thead>
<tbody>
<tr>
<td>Teil 1</td>
<td>Teil 2</td>
<td>Teil 3</td>
<td>Teil 4</td>
<td>Teil 5</td>
<td>Teil 6</td>
<td>Teil 7</td>
</tr>
<tr>
<td>Teil 8</td>
<td>Teil 9</td>
<td>Teil 10</td>
<td>Teil 11</td>
<td>Teil 12</td>
<td>Teil 13</td>
<td>Teil 14</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="bereich-b">
<div class="top">
<input type="text" placeholder="E 5" />
</div>
<div class="bottom">
<table>
<colgroup>
<col style="width: 100%">
</colgroup>
<thead>
<tr>
<th>Spalte 1</th>
</tr>
</thead>
<tbody>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
<tr><td>Teil 1</td></tr>
<tr><td>Teil 2</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>
{{ end }}