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
import (
"fmt"
"git.erbosoft.com/amy/amsterdam/ui"
"github.com/labstack/echo/v4"
)
@@ -18,9 +16,7 @@ import (
func setupEcho() *echo.Echo {
e := echo.New()
e.Renderer = &ui.TemplateRenderer{}
e.GET("/img/*", ui.AmWrap(func(ctxt ui.AmContext) (string, any, error) {
return "string", fmt.Sprintf("Path: %s", ctxt.URLPath()), nil
}))
e.GET("/img/*", ui.AmWrap(ui.AmServeImage))
e.GET("/", ui.AmWrap(func(ctxt ui.AmContext) (string, any, error) {
ctxt.VarMap().Set("amsterdam_pageTitle", "My Front Page")
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) {
components := strings.SplitAfter(ctxt.URLPath(), "/")
var err error = nil
if len(components) == 2 && components[0] == "builtin" {
if len(components) == 4 && components[2] == "builtin/" {
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 {
mtype := mime.TypeByExtension(components[1][strings.LastIndex(components[1], "."):])
mtype := mime.TypeByExtension(components[3][strings.LastIndex(components[3], "."):])
ctxt.SetOutputType(mtype)
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>
<html lang="en">
<head>
@@ -17,8 +25,8 @@
<!-- Site Logo -->
<div class="w-1/5">
<a href="http://venice.sourceforge.net/">
<img src="./venice-frontpage_files/powered-by-venice.gif"
alt="Venice Test"
<img src="/img/builtin/powered-by-amsterdam.png"
alt="Amsterdam Test"
class="w-35 h-20 mx-2 my-2">
</a>
</div>
@@ -106,8 +114,8 @@
</div>
<div class="flex-shrink-0">
<a href="http://venice.users.sf.net/" target="_blank">
<img src="./venice-frontpage_files/powered-by-venice.gif"
alt="Powered By Venice"
<img src="/img/builtin/powered-by-amsterdam.png"
alt="Powered By Amsterdam"
class="w-32 h-26">
</a>
</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 -->
<div class="flex-1 p-4">
<!-- Welcome Section -->