diff --git a/amsterdam b/amsterdam new file mode 100755 index 0000000..0a333c2 Binary files /dev/null and b/amsterdam differ diff --git a/docs/templates/go-header.txt b/docs/templates/go-header.txt new file mode 100644 index 0000000..bb7ef15 --- /dev/null +++ b/docs/templates/go-header.txt @@ -0,0 +1,8 @@ +/* + * Amsterdam Web Communities System + * Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ diff --git a/go.mod b/go.mod index 4be8832..8d5519e 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,8 @@ module git.erbosoft.com/amy/amsterdam go 1.25.0 require ( + github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 // indirect + github.com/CloudyKit/jet/v6 v6.3.1 // indirect github.com/labstack/echo/v4 v4.13.4 // indirect github.com/labstack/gommon v0.4.2 // indirect github.com/mattn/go-colorable v0.1.14 // indirect diff --git a/go.sum b/go.sum index de42c50..de9e125 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,7 @@ +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53 h1:sR+/8Yb4slttB4vD+b9btVEnWgL3Q00OBTzVT8B9C0c= +github.com/CloudyKit/fastprinter v0.0.0-20200109182630-33d98a066a53/go.mod h1:+3IMCy2vIlbG1XG/0ggNQv0SvxCAIpPM5b1nCz56Xno= +github.com/CloudyKit/jet/v6 v6.3.1 h1:6IAo5Cx21xrHVaR8zzXN5gJatKV/wO7Nf6bfCnCSbUw= +github.com/CloudyKit/jet/v6 v6.3.1/go.mod h1:lf8ksdNsxZt7/yH/3n4vJQWA9RUq4wpaHtArHhGVMOw= github.com/labstack/echo/v4 v4.13.4 h1:oTZZW+T3s9gAu5L8vmzihV7/lkXGZuITzTQkTEhcXEA= github.com/labstack/echo/v4 v4.13.4/go.mod h1:g63b33BZ5vZzcIUF8AtRH40DrTlXnx4UMC8rBdndmjQ= github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0= diff --git a/server.go b/server.go index 07d76d4..4dda5a5 100644 --- a/server.go +++ b/server.go @@ -1,14 +1,47 @@ +/* + * Amsterdam Web Communities System + * Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ package main import ( + "io" "net/http" + + "github.com/CloudyKit/jet/v6" "github.com/labstack/echo/v4" ) -func main() { +var views = jet.NewSet( + jet.NewOSFileSystemLoader("./views"), + jet.DevelopmentMode(true), +) + +type TemplateRenderer struct { +} + +func (self *TemplateRenderer) Render(w io.Writer, name string, data interface{}, c echo.Context) error { + view, err := views.GetTemplate(name) + if err != nil { + return err + } + return view.Execute(w, nil, nil) +} + +func setupEcho() *echo.Echo { e := echo.New() + e.Renderer = &TemplateRenderer{} e.GET("/", func(c echo.Context) error { - return c.String(http.StatusOK, "Hello, world!") + return c.Render(http.StatusOK, "frame.jet", nil) }) + return e +} + +func main() { + e := setupEcho() e.Logger.Fatal(e.Start(":1323")) } diff --git a/ui/amcontext.go b/ui/amcontext.go new file mode 100644 index 0000000..d63e80e --- /dev/null +++ b/ui/amcontext.go @@ -0,0 +1,32 @@ +/* + * Amsterdam Web Communities System + * Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ +package ui + +import ( + "github.com/labstack/echo/v4" +) + +type AmContext interface { + Render(int, string, interface{}) error +} + +type amContext struct { + echoContext echo.Context +} + +func (c *amContext) Render(code int, name string, data interface{}) error { + return c.echoContext.Render(code, name, data) +} + +func NewAmContext(ctxt echo.Context) AmContext { + rc := amContext{ + echoContext: ctxt, + } + return &rc +} diff --git a/views/frame.jet b/views/frame.jet new file mode 100644 index 0000000..4f49de3 --- /dev/null +++ b/views/frame.jet @@ -0,0 +1,202 @@ + + +
+ + ++ Welcome to the Venice Web Communities System. To get the most out of this site, you should log in or create an account, using one of the links above. +
+This is a test. +This is only a test. +If this had been an actual emergency, we would all be +dead by now.+
+
+