embed site files / form tweaks

This commit is contained in:
Hank
2024-07-19 23:19:41 -04:00
parent b19ac6a129
commit 16619e5c02
4 changed files with 24 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ package main
import (
_ "beszel/migrations"
"beszel/site"
"bytes"
"crypto/ed25519"
"encoding/json"
@@ -83,8 +84,10 @@ func main() {
e.Router.Any("/*", echo.WrapHandler(proxy))
e.Router.Any("/", echo.WrapHandler(proxy))
default:
e.Router.GET("/icons/*", apis.StaticDirectoryHandler(os.DirFS("./site/dist/icons"), false))
e.Router.Any("/*", apis.StaticDirectoryHandler(os.DirFS("./site/dist"), true))
assets, _ := site.Assets()
icons, _ := site.Icons()
e.Router.GET("/icons/*", apis.StaticDirectoryHandler(icons, false))
e.Router.Any("/*", apis.StaticDirectoryHandler(assets, true))
}
return nil
})

17
site/embed.go Normal file
View File

@@ -0,0 +1,17 @@
package site
import (
"embed"
"io/fs"
)
//go:embed all:dist
var assets embed.FS
func Assets() (fs.FS, error) {
return fs.Sub(assets, "dist")
}
func Icons() (fs.FS, error) {
return fs.Sub(assets, "dist/icons")
}

View File

@@ -306,7 +306,7 @@ export function UserAuthForm({
</Dialog>
)}
{authMethods.emailPassword && (
{authMethods.emailPassword && !isFirstRun && (
<Link
href="/forgot-password"
className="text-sm mx-auto hover:text-brand underline underline-offset-4 opacity-70 hover:opacity-100 transition-opacity"

View File

@@ -87,7 +87,7 @@ export default function ForgotPassword() {
<DialogTitle>Command line instructions</DialogTitle>
</DialogHeader>
<p className="text-primary/70 text-[0.95em]">
If you don't have an SMTP server configured, you can use the following command to reset
Use the following command to reset
your password:
</p>
<code className="bg-muted rounded-sm py-0.5 px-2.5 mr-auto text-sm">