Updates to lavender templates and the build script

This commit is contained in:
Melon 2024-05-16 03:07:03 +01:00
parent 4dbb6d346f
commit 1014ffeb8b
Signed by: melon
GPG Key ID: 6C9D970C50D26A25
10 changed files with 16 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,3 +1,3 @@
.idea/ .idea/
node_modules/ node_modules/
*/style.css */assets/style.css

View File

@ -1,4 +1,4 @@
<div class="sticky top-0 z-40 w-full backdrop-blur flex-none transition-colors duration-500 lg:z-50 lg:border-b lg:border-slate-900/10 dark:border-slate-50/[0.06] bg-white/95 supports-backdrop-blur:bg-white/60 dark:bg-transparent"> <div class="sticky top-0 z-40 w-full backdrop-blur flex-none lg:z-50 lg:border-b lg:border-slate-900/10 dark:border-slate-50/[0.06] bg-white/95 supports-backdrop-blur:bg-white/60 dark:bg-transparent">
<div class="max-w-8xl mx-auto"> <div class="max-w-8xl mx-auto">
<div class="py-4 border-b border-slate-900/10 lg:px-8 lg:border-0 dark:border-slate-300/10 mx-4 lg:mx-0"> <div class="py-4 border-b border-slate-900/10 lg:px-8 lg:border-0 dark:border-slate-300/10 mx-4 lg:mx-0">
<div class="relative flex items-center"> <div class="relative flex items-center">

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
</head> </head>
<body class="min-h-screen"> <body class="min-h-screen">
{{template "header.go.html" .}} {{template "header.go.html" .}}

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
</head> </head>
<body class="min-h-screen"> <body class="min-h-screen">
{{template "header.go.html" .}} {{template "header.go.html" .}}
@ -11,7 +11,7 @@
<div class="block rounded-lg shadow bg-gray-800 border border-gray-700 m-8 sm:max-w-md w-full"> <div class="block rounded-lg shadow bg-gray-800 border border-gray-700 m-8 sm:max-w-md w-full">
<div class="p-6 sm:p-8 space-y-4 md:space-y-6"> <div class="p-6 sm:p-8 space-y-4 md:space-y-6">
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white text-center">{{.ServiceName}}</h1> <h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white text-center">{{.ServiceName}}</h1>
<div>Logged in as: {{.DisplayName}} ({{.Subject}})</div> <div>Logged in as: {{.Auth.UserInfo.name}} ({{.Auth.Subject}})</div>
<form method="GET" action="/manage/apps" class="space-y-4 md:space-y-6"> <form method="GET" action="/manage/apps" class="space-y-4 md:space-y-6">
<button type="submit" class="w-full text-white bg-emerald-600 hover:bg-emerald-700 focus:ring-4 focus:outline-none focus:ring-emerald-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-emerald-600 dark:hover:bg-emerald-700 dark:focus:ring-emerald-800">Manage Applications</button> <button type="submit" class="w-full text-white bg-emerald-600 hover:bg-emerald-700 focus:ring-4 focus:outline-none focus:ring-emerald-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-emerald-600 dark:hover:bg-emerald-700 dark:focus:ring-emerald-800">Manage Applications</button>
</form> </form>
@ -20,7 +20,7 @@
<button type="submit" class="w-full text-white bg-emerald-600 hover:bg-emerald-700 focus:ring-4 focus:outline-none focus:ring-emerald-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-emerald-600 dark:hover:bg-emerald-700 dark:focus:ring-emerald-800">Manage Users</button> <button type="submit" class="w-full text-white bg-emerald-600 hover:bg-emerald-700 focus:ring-4 focus:outline-none focus:ring-emerald-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-emerald-600 dark:hover:bg-emerald-700 dark:focus:ring-emerald-800">Manage Users</button>
</form> </form>
{{end}} {{end}}
<form method="GET" action="/logout"> <form method="POST" action="/logout">
<input type="hidden" name="nonce" value="{{.Nonce}}"> <input type="hidden" name="nonce" value="{{.Nonce}}">
<button type="submit" class="w-full text-white bg-rose-600 hover:bg-rose-700 focus:ring-4 focus:outline-none focus:ring-rose-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-rose-600 dark:hover:bg-rose-700 dark:focus:ring-rose-800">Log out</button> <button type="submit" class="w-full text-white bg-rose-600 hover:bg-rose-700 focus:ring-4 focus:outline-none focus:ring-rose-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-rose-600 dark:hover:bg-rose-700 dark:focus:ring-rose-800">Log out</button>
</form> </form>

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
</head> </head>
<body class="min-h-screen"> <body class="min-h-screen">
{{template "header.go.html" .}} {{template "header.go.html" .}}

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
</head> </head>
<body class="min-h-screen"> <body class="min-h-screen">
{{template "header.go.html" .}} {{template "header.go.html" .}}

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
<script> <script>
window.addEventListener("load", function () { window.addEventListener("load", function () {
selectText("app-secret"); selectText("app-secret");

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
</head> </head>
<body> <body>
{{template "header.go.html" .}} {{template "header.go.html" .}}

View File

@ -3,7 +3,7 @@
<head> <head>
<title>{{.ServiceName}}</title> <title>{{.ServiceName}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="stylesheet" href="/style.css"> <link rel="stylesheet" href="/assets/style.css">
</head> </head>
<body class="min-h-screen"> <body class="min-h-screen">
{{template "header.go.html" .}} {{template "header.go.html" .}}
@ -12,7 +12,7 @@
<div class="p-6 sm:p-8 space-y-4"> <div class="p-6 sm:p-8 space-y-4">
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white text-center">{{.AppName}}</h1> <h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white text-center">{{.AppName}}</h1>
<h2 class="text-l font-bold leading-tight tracking-tight text-gray-900 md:text-xl dark:text-white text-center">Would like access to your 1f349 account:</h2> <h2 class="text-l font-bold leading-tight tracking-tight text-gray-900 md:text-xl dark:text-white text-center">Would like access to your 1f349 account:</h2>
<h3 class="text-l leading-tight tracking-tight text-gray-900 md:text-xl dark:text-white text-center">Logged in as: <span class="font-bold">{{.DisplayName}}</span></h3> <h3 class="text-l leading-tight tracking-tight text-gray-900 md:text-xl dark:text-white text-center">Logged in as: <span class="font-bold">{{.Auth.UserInfo.name}}</span></h3>
<div> <div>
<ul class="space-y-1 text-gray-500 list-disc list-inside dark:text-gray-400"> <ul class="space-y-1 text-gray-500 list-disc list-inside dark:text-gray-400">
{{range .WantsList}} {{range .WantsList}}

View File

@ -126,7 +126,7 @@ func main() {
return return
} }
if r.URL.Path == "/style.css" { if r.URL.Path == "/assets/style.css" {
parse, err := url.Parse(r.Referer()) parse, err := url.Parse(r.Referer())
if err != nil { if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError) http.Error(w, err.Error(), http.StatusInternalServerError)
@ -138,7 +138,7 @@ func main() {
http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound) http.Error(w, http.StatusText(http.StatusNotFound), http.StatusNotFound)
return return
} }
http.ServeFile(w, r, filepath.Join(BaseDir, project, "style.css")) http.ServeFile(w, r, filepath.Join(BaseDir, project, "assets/style.css"))
return return
} }
@ -195,9 +195,10 @@ func UpdateOnChange(event <-chan watcher.Event) {
func UpdateTemplate(p string) { func UpdateTemplate(p string) {
Logger.Info("Recompiling template", "path", p) Logger.Info("Recompiling template", "path", p)
_ = os.Mkdir(filepath.Join(p, "assets"), os.ModePerm)
// run tailwind command // run tailwind command
args := []string{"-i", filepath.Join(p, "main.css"), "-o", filepath.Join(p, "style.css"), "-c", filepath.Join(filepath.Dir(p), "tailwind.config.js"), "--minify"} args := []string{"-i", filepath.Join(p, "main.css"), "-o", filepath.Join(p, "assets/style.css"), "-c", filepath.Join(filepath.Dir(p), "tailwind.config.js"), "--minify"}
cmd := exec.Command("tailwindcss", args...) cmd := exec.Command("tailwindcss", args...)
cmd.Dir = p cmd.Dir = p
tailwindOutput, err := cmd.CombinedOutput() tailwindOutput, err := cmd.CombinedOutput()