debugged image serving and fixed a couple of images in the frame

This commit is contained in:
2025-09-14 15:51:27 -06:00
parent 3fe226938c
commit ae3c9ca748
5 changed files with 32 additions and 12 deletions
+8
View File
@@ -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/.
*}
+1 -5
View File
@@ -9,8 +9,6 @@
package main package main
import ( import (
"fmt"
"git.erbosoft.com/amy/amsterdam/ui" "git.erbosoft.com/amy/amsterdam/ui"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
) )
@@ -18,9 +16,7 @@ import (
func setupEcho() *echo.Echo { func setupEcho() *echo.Echo {
e := echo.New() e := echo.New()
e.Renderer = &ui.TemplateRenderer{} e.Renderer = &ui.TemplateRenderer{}
e.GET("/img/*", ui.AmWrap(func(ctxt ui.AmContext) (string, any, error) { e.GET("/img/*", ui.AmWrap(ui.AmServeImage))
return "string", fmt.Sprintf("Path: %s", ctxt.URLPath()), nil
}))
e.GET("/", ui.AmWrap(func(ctxt ui.AmContext) (string, any, error) { e.GET("/", ui.AmWrap(func(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("amsterdam_pageTitle", "My Front Page") ctxt.VarMap().Set("amsterdam_pageTitle", "My Front Page")
return "framed_template", "top.jet", nil return "framed_template", "top.jet", nil
+3 -3
View File
@@ -22,11 +22,11 @@ var static_images embed.FS
func AmServeImage(ctxt AmContext) (string, any, error) { func AmServeImage(ctxt AmContext) (string, any, error) {
components := strings.SplitAfter(ctxt.URLPath(), "/") components := strings.SplitAfter(ctxt.URLPath(), "/")
var err error = nil var err error = nil
if len(components) == 2 && components[0] == "builtin" { if len(components) == 4 && components[2] == "builtin/" {
var b []byte var b []byte
b, err = static_images.ReadFile(fmt.Sprintf("static_images/%s", components[1])) b, err = static_images.ReadFile(fmt.Sprintf("static_images/%s", components[3]))
if err == nil { if err == nil {
mtype := mime.TypeByExtension(components[1][strings.LastIndex(components[1], "."):]) mtype := mime.TypeByExtension(components[3][strings.LastIndex(components[3], "."):])
ctxt.SetOutputType(mtype) ctxt.SetOutputType(mtype)
return "bytes", b, nil return "bytes", b, nil
} }
+12 -4
View File
@@ -1,3 +1,11 @@
{*
* 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/.
*}
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
@@ -17,8 +25,8 @@
<!-- Site Logo --> <!-- Site Logo -->
<div class="w-1/5"> <div class="w-1/5">
<a href="http://venice.sourceforge.net/"> <a href="http://venice.sourceforge.net/">
<img src="./venice-frontpage_files/powered-by-venice.gif" <img src="/img/builtin/powered-by-amsterdam.png"
alt="Venice Test" alt="Amsterdam Test"
class="w-35 h-20 mx-2 my-2"> class="w-35 h-20 mx-2 my-2">
</a> </a>
</div> </div>
@@ -106,8 +114,8 @@
</div> </div>
<div class="flex-shrink-0"> <div class="flex-shrink-0">
<a href="http://venice.users.sf.net/" target="_blank"> <a href="http://venice.users.sf.net/" target="_blank">
<img src="./venice-frontpage_files/powered-by-venice.gif" <img src="/img/builtin/powered-by-amsterdam.png"
alt="Powered By Venice" alt="Powered By Amsterdam"
class="w-32 h-26"> class="w-32 h-26">
</a> </a>
</div> </div>
+8
View File
@@ -1,3 +1,11 @@
{*
* 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/.
*}
<!-- Content Area --> <!-- Content Area -->
<div class="flex-1 p-4"> <div class="flex-1 p-4">
<!-- Welcome Section --> <!-- Welcome Section -->