Add logos and static
This commit is contained in:
@@ -36,6 +36,9 @@ func init() {
|
|||||||
//go:embed views/*
|
//go:embed views/*
|
||||||
var viewsfs embed.FS
|
var viewsfs embed.FS
|
||||||
|
|
||||||
|
//go:embed public/*
|
||||||
|
var embeddedFiles embed.FS
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// current dir
|
// current dir
|
||||||
cwd, err := os.Getwd()
|
cwd, err := os.Getwd()
|
||||||
|
|||||||
BIN
example/webui/public/dash.png
Normal file
BIN
example/webui/public/dash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 MiB |
BIN
example/webui/public/dash2.png
Normal file
BIN
example/webui/public/dash2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 118 KiB |
BIN
example/webui/public/logo_1.png
Normal file
BIN
example/webui/public/logo_1.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 341 KiB |
@@ -2,14 +2,19 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"math/rand"
|
"math/rand"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
fiber "github.com/gofiber/fiber/v2"
|
fiber "github.com/gofiber/fiber/v2"
|
||||||
|
"github.com/gofiber/fiber/v2/middleware/filesystem"
|
||||||
)
|
)
|
||||||
|
|
||||||
func RegisterRoutes(webapp *fiber.App, pool *AgentPool, db *InMemoryDatabase, app *App) {
|
func RegisterRoutes(webapp *fiber.App, pool *AgentPool, db *InMemoryDatabase, app *App) {
|
||||||
|
|
||||||
// Serve static files
|
webapp.Use("/public", filesystem.New(filesystem.Config{
|
||||||
webapp.Static("/", "./public")
|
Root: http.FS(embeddedFiles),
|
||||||
|
PathPrefix: "public",
|
||||||
|
Browse: true,
|
||||||
|
}))
|
||||||
|
|
||||||
webapp.Get("/", func(c *fiber.Ctx) error {
|
webapp.Get("/", func(c *fiber.Ctx) error {
|
||||||
return c.Render("views/index", fiber.Map{
|
return c.Render("views/index", fiber.Map{
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
<h1 class="text-3xl md:text-5xl font-bold">Smart Agent Dashboard</h1>
|
<h1 class="text-3xl md:text-5xl font-bold">Smart Agent Dashboard</h1>
|
||||||
</header>
|
</header>
|
||||||
<div class="flex flex-col items-center space-y-4">
|
<div class="flex flex-col items-center space-y-4">
|
||||||
|
<img class="flex" src="/public/logo_1.png" width="250">
|
||||||
<!-- Button to Agent List Page -->
|
<!-- Button to Agent List Page -->
|
||||||
<a href="/agents" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
<a href="/agents" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
|
||||||
Agent List
|
Agent List
|
||||||
|
|||||||
Reference in New Issue
Block a user