mirror of
https://github.com/renorris/openfsd
synced 2026-03-30 19:15:35 +08:00
v0.1.0-alpha
Changes:
- Implement bootstrapping library for managing several concurrent internal services
- Refactor concurrency model for connections/logical clients and their associated I/O
- Refactor server context singleton
- Refactor error handling
- Most errors are now gracefully sent to the FSD client directly encoded as an $ER packet,
enhancing visibility and debugging
- Most errors are now rightfully treated as non-fatal
- Refactor package/dependency graph
- Refactor calling conventions/interfaces for many packages
- Refactor database package
- Refactor post office
Features:
- Add VATSIM-esque HTTP/JSON "data feed"
- Add ephemeral in-memory database option
- Add user management REST API
- Add improved web interface
- Add MySQL support (drop SQLite support)
This commit is contained in:
24
web/template.go
Normal file
24
web/template.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package web
|
||||
|
||||
import (
|
||||
"embed"
|
||||
"github.com/renorris/openfsd/database"
|
||||
"html/template"
|
||||
"io"
|
||||
)
|
||||
|
||||
//go:embed templates
|
||||
var templateFS embed.FS
|
||||
|
||||
type DashboardPageData struct {
|
||||
UserRecord *database.FSDUserRecord
|
||||
}
|
||||
|
||||
func RenderTemplate(w io.Writer, name string, data interface{}) (err error) {
|
||||
var tmpl *template.Template
|
||||
if tmpl, err = template.ParseFS(templateFS, "templates/layout.html", "templates/"+name); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return tmpl.ExecuteTemplate(w, name, data)
|
||||
}
|
||||
Reference in New Issue
Block a user