diff --git a/lavender/data.json b/lavender/data.json index af11eb9..84c1c6d 100644 --- a/lavender/data.json +++ b/lavender/data.json @@ -1,7 +1,11 @@ { "ServiceName": "Test Service", - "DisplayName": "Test User", - "Subject": "uuid", + "Auth": { + "Subject": "user uuid", + "UserInfo": { + "name": "Test User" + } + }, "IsAdmin": true, "LoginName": "jane@example.com", "WantsList": [ @@ -9,5 +13,44 @@ "Another perm" ], "AppName": "Marshmallow Sample App", - "AppDomain": "https://marshmallow.example.com" + "AppDomain": "https://marshmallow.example.com", + "NewAppSecret": "$$AppSecret$$", + "NewAppName": "Marshmallow Sample App", + "EditApp": { + "Subject": "msa-uuid", + "Name": "Marshmallow Sample App", + "Domain": "http://marshmallow.example.com", + "Perms": "lavender:subject", + "Public": true, + "Sso": false, + "Active": true + }, + "Apps": [ + { + "Subject": "msa-uuid", + "Name": "Marshmallow Sample App", + "Domain": "http://marshmallow.example.com", + "Perms": "lavender:subject", + "Public": true, + "Sso": false, + "Active": true, + "Owner": true + } + ], + "EditUser": { + "Subject": "msu-uuid", + "Roles": "msu:role", + "Active": true + }, + "Users": [ + { + "Subject": "msu-uuid", + "Email": "jane@example.com", + "EmailVerified": true, + "Roles": "msu:role", + "LastUpdated": "2024-01-01", + "Active": true + } + ], + "Offset": 0 } diff --git a/lavender/header.go.html b/lavender/header.go.html index 7e4a4c2..9ff6708 100644 --- a/lavender/header.go.html +++ b/lavender/header.go.html @@ -1,8 +1,8 @@ -
+
-
+ diff --git a/lavender/index-guest.go.html b/lavender/index-guest.go.html index 7ad761f..0d1bc18 100644 --- a/lavender/index-guest.go.html +++ b/lavender/index-guest.go.html @@ -1,21 +1,19 @@ - + {{.ServiceName}} - + - + {{template "header.go.html" .}} -
-
-
-

{{.ServiceName}}

-
-
Not logged in
- -
-
+
+
+

{{.ServiceName}}

+
+
Not logged in
+ +
diff --git a/lavender/index.go.html b/lavender/index.go.html index 89bfc03..5c0a1d5 100644 --- a/lavender/index.go.html +++ b/lavender/index.go.html @@ -1,30 +1,28 @@ - + {{.ServiceName}} - + {{template "header.go.html" .}} -
-
-
-

{{.ServiceName}}

-
Logged in as: {{.Auth.UserInfo.name}} ({{.Auth.Subject}})
-
- +
+
+

{{.ServiceName}}

+
Logged in as: {{.Auth.UserInfo.name}} ({{.Auth.Subject}})
+ + + + {{if .IsAdmin}} +
+
- {{if .IsAdmin}} -
- -
- {{end}} -
- - -
-
+ {{end}} +
+ + +
diff --git a/lavender/login-memory.go.html b/lavender/login-memory.go.html index 625d5a7..ef9d45c 100644 --- a/lavender/login-memory.go.html +++ b/lavender/login-memory.go.html @@ -1,30 +1,28 @@ - + {{.ServiceName}} - + {{template "header.go.html" .}} -
-
-
-

Login

+
+
+

Login

- - + +
- +
- +
-
diff --git a/lavender/login.go.html b/lavender/login.go.html index 82ede54..9af60c1 100644 --- a/lavender/login.go.html +++ b/lavender/login.go.html @@ -1,25 +1,23 @@ - + {{.ServiceName}} - + - + {{template "header.go.html" .}} -
-
-
-

Login

-
- -
- - -
- -
-
+
+
+

Login

+
+ +
+ + +
+ +
diff --git a/lavender/main.css b/lavender/main.css index 1d9c4be..b2d2cba 100644 --- a/lavender/main.css +++ b/lavender/main.css @@ -3,5 +3,83 @@ @tailwind utilities; html { - @apply bg-zinc-900 text-zinc-300 scroll-smooth selection:bg-fuchsia-400/30 text-pretty; + @apply bg-white dark:bg-gray-900 text-black dark:text-gray-200 scroll-smooth selection:bg-blue-500 text-pretty; +} + +body { + @apply min-h-screen; +} + +@layer components { + header { + @apply 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-emerald-500/95 dark:bg-transparent text-black dark:text-gray-200; + } + + main { + @apply flex flex-col items-center mx-auto p-8; + } + + .center-box { + @apply block rounded-lg shadow bg-gray-200 dark:bg-gray-800 border border-gray-700 w-full p-6 sm:p-8 space-y-4 md:space-y-6; + } + + .center-box h1.box-title { + @apply text-xl font-bold leading-tight tracking-tight md:text-2xl text-center; + } + + button { + @apply w-full text-white focus:ring-4 focus:outline-none font-medium rounded-lg text-sm px-5 py-2.5 text-center; + } + + button.btn-green { + @apply bg-emerald-600 hover:bg-emerald-700 focus:ring-emerald-300 dark:bg-emerald-600 dark:hover:bg-emerald-700 dark:focus:ring-emerald-800; + } + + button.btn-red { + @apply bg-rose-600 hover:bg-rose-700 focus:ring-rose-300 dark:bg-rose-600 dark:hover:bg-rose-700 dark:focus:ring-rose-800; + } + + button.btn-amber { + @apply bg-amber-600 hover:bg-amber-700 focus:ring-amber-300 dark:bg-amber-600 dark:hover:bg-amber-700 dark:focus:ring-amber-800; + } + + label[for] { + @apply block mb-2 text-sm font-medium text-gray-900 dark:text-white; + } + + input[type=text], input[type=email] { + @apply bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-emerald-600 focus:border-emerald-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500; + } + + input[type=checkbox] { + @apply focus:outline-none appearance-none relative w-6 h-6 border border-gray-300 rounded bg-gray-50 focus:ring-2 focus:ring-emerald-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-emerald-600 dark:ring-offset-gray-800 checked:bg-emerald-700; + } + + input[type=checkbox] + svg.check { + @apply absolute w-6 h-6 mt-1 hidden pointer-events-none text-gray-200; + } + + input[type=checkbox]:checked + svg.check { + @apply block; + } + + table.table-default { + @apply w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-200; + } + + table.table-default thead { + @apply text-xs text-gray-700 bg-gray-200 dark:bg-gray-700 dark:text-gray-200; + } + + table.table-default thead tr th { + @apply px-6 py-3 text-center; + } + + table.table-default tbody { + @apply bg-white dark:bg-gray-800; + } + + table.table-default tbody tr td { + @apply px-6 py-4 text-center; + } } diff --git a/lavender/manage-apps-create.go.html b/lavender/manage-apps-create.go.html new file mode 100644 index 0000000..005914e --- /dev/null +++ b/lavender/manage-apps-create.go.html @@ -0,0 +1,77 @@ + + + + {{.ServiceName}} + + + + +{{template "header.go.html" .}} +
+
+

Create Client Application

+
+ + +
+ + +
+
+ + +
+ {{if .IsAdmin}} +
+ + +
+ {{end}} +
+
+
+
+ + + + +
+
+ +
+
+ {{if .IsAdmin}} +
+
+ + + + +
+
+ +
+
+ {{end}} +
+
+ + + + +
+
+ +
+
+
+
+
+ + +
+
+
+
+ + diff --git a/lavender/manage-apps-edit.go.html b/lavender/manage-apps-edit.go.html new file mode 100644 index 0000000..296ebf5 --- /dev/null +++ b/lavender/manage-apps-edit.go.html @@ -0,0 +1,81 @@ + + + + {{.ServiceName}} + + + + +{{template "header.go.html" .}} +
+
+

Edit Client Application

+
+ + + +
+ +
+
+ + +
+
+ + +
+ {{if .IsAdmin}} +
+ + +
+ {{end}} +
+
+
+
+ + + + +
+
+ +
+
+ {{if .IsAdmin}} +
+
+ + + + +
+
+ +
+
+ {{end}} +
+
+ + + + +
+
+ +
+
+
+
+
+ + +
+
+
+
+ + diff --git a/lavender/manage-apps.go.html b/lavender/manage-apps.go.html index 65c37fa..5547292 100644 --- a/lavender/manage-apps.go.html +++ b/lavender/manage-apps.go.html @@ -1,5 +1,5 @@ - + {{.ServiceName}} @@ -31,130 +31,62 @@ {{template "header.go.html" .}} -
+
{{if .NewAppSecret}} -
New application secret: {{.NewAppSecret}} for {{.NewAppName}}
+
New application secret: {{.NewAppSecret}} for {{.NewAppName}}
{{end}} - {{if .Edit}} -

Edit Client Application

-
- - - -
- -
-
- - -
-
- - -
- {{if .IsAdmin}} -
- - -
- {{end}} -
- -
- {{if .IsAdmin}} -
- -
- {{end}} -
- -
- -
-
- - -
- {{else}} -

Manage Client Applications

- {{if eq (len .Apps) 0}} -
No client applications found
- {{else}} - - +

Manage Client Applications

+ +
+
+ + + + + + + + + + {{if eq (len .Apps) 0}} - - - - - - - - + - - - {{range .Apps}} - - - - - - - - - + + + + - - {{end}} - -
NameDomainActiveActions
IDNameDomainPermsSSOActiveOwnerActionsNo client applications found
{{.Sub}}{{.Name}}{{.Domain}}{{.Perms}}{{.SSO}}{{.Active}}{{.Owner}} + {{end}} + {{range .Apps}} +
{{.Name}}{{.Domain}} + + +
- - + +
- - + +
-
- {{end}} - -

Create Client Application

-
- - -
- - -
-
- - -
- {{if .IsAdmin}} -
- - -
+
+ + {{end}} -
- -
- {{if .IsAdmin}} -
- -
- {{end}} -
- -
- - - {{end}} + + +
diff --git a/lavender/manage-users-edit.go.html b/lavender/manage-users-edit.go.html new file mode 100644 index 0000000..3c48f58 --- /dev/null +++ b/lavender/manage-users-edit.go.html @@ -0,0 +1,47 @@ + + + + {{.ServiceName}} + + + + +{{template "header.go.html" .}} +
+
+

Edit User

+
+ + + +
+ +
+
+ + +
+
+
+
+
+ + + + +
+
+ +
+
+
+
+
+ + +
+
+
+
+ + diff --git a/lavender/manage-users.go.html b/lavender/manage-users.go.html index 0af67d6..a927811 100644 --- a/lavender/manage-users.go.html +++ b/lavender/manage-users.go.html @@ -1,5 +1,5 @@ - + {{.ServiceName}} @@ -7,85 +7,74 @@ {{template "header.go.html" .}} -
- {{if .Edit}} -

Edit User

-
- - -
- - -
-
- - -
-
- -
- -
-
- - -
- {{else}} -

Manage Users

- {{if eq (len .Users) 0}} -
No users found, this is definitely a bug.
- {{else}} - - +
+

Manage Users

+ +
+
+ + + + + + + + + + + + {{if eq (len .Users) 0}} - - - - - - - + - - - {{range .Users}} - - - - - - - - + + + + + + - - {{end}} - -
SubjectEmailEmail VerifiedLast UpdatedActiveActions
SubjectEmailEmail VerifiedRolesLast UpdatedActiveActionsNo users found, this is definitely a bug.
{{.Sub}} - {{if $.EmailShow}} - {{.Email}} - {{else}} - {{emailHide .Email}} - {{end}} - {{.EmailVerified}}{{.Roles}}{{.UpdatedAt}}{{.Active}} + {{end}} + {{range .Users}} +
{{.Subject}} + {{if $.EmailShow}} + {{.Email}} + {{else}} + {{emailHide .Email}} + {{end}} + {{.EmailVerified}}{{.UpdatedAt}} + + +
- +
- +
-
-
- - {{if not .EmailShow}} - - {{end}} - -
+ + + + {{end}} + + + + +
+ + {{if not .EmailShow}} + {{end}} - {{end}} + +
diff --git a/lavender/oauth-authorize.go.html b/lavender/oauth-authorize.go.html index d761c14..8a020c8 100644 --- a/lavender/oauth-authorize.go.html +++ b/lavender/oauth-authorize.go.html @@ -1,40 +1,38 @@ - + {{.ServiceName}} - + {{template "header.go.html" .}} -
-
-
-

{{.AppName}}

-

Would like access to your 1f349 account:

-

Logged in as: {{.Auth.UserInfo.name}}

-
-
    - {{range .WantsList}} -
  • {{.}}
  • - {{end}} -
-
-
- - - - - - - -
- - -
-
-
Authorizing this action will redirect you to {{.AppDomain}} with access to the permissions requested above.
+
+
+

{{.AppName}}

+

Would like access to your 1f349 account:

+

Logged in as: {{.Auth.UserInfo.name}}

+
+
    + {{range .WantsList}} +
  • {{.}}
  • + {{end}} +
+
+ + + + + + + +
+ + +
+
+
Authorizing this action will redirect you to {{.AppDomain}} with access to the permissions requested above.
diff --git a/main.go b/main.go index cab5af8..3b146d2 100644 --- a/main.go +++ b/main.go @@ -84,7 +84,7 @@ func main() { go UpdateOnChange(w.Event) go func() { - err := w.Start(5 * time.Second) + err := w.Start(time.Second) Logger.Warn("Watcher stopped", "err", err) }() @@ -202,11 +202,11 @@ func UpdateTemplate(p string) { cmd := exec.Command("tailwindcss", args...) cmd.Dir = p tailwindOutput, err := cmd.CombinedOutput() + Logger.Debug(string(tailwindOutput)) if err != nil { Logger.Warn("Failed to run tailwind", "err", err) return } - Logger.Debug(string(tailwindOutput)) // make new template fs, err := template.New("theme-template-root").Funcs(DefaultFuncMap).ParseFS(os.DirFS(p), "*.go.html")