Pictures in Posts now works!
This commit is contained in:
@@ -23,14 +23,12 @@ fields:
|
||||
- type: "password"
|
||||
name: "pass1"
|
||||
caption: "Password"
|
||||
required: true
|
||||
size: 32
|
||||
maxlength: 128
|
||||
- type: "password"
|
||||
name: "pass2"
|
||||
caption: "Password"
|
||||
subcaption: "(retype)"
|
||||
required: true
|
||||
size: 32
|
||||
maxlength: 128
|
||||
- type: "text"
|
||||
|
||||
+22
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* Amsterdam Web Communities System
|
||||
* Copyright (c) 2025 Erbosoft Metaverse Design Solutions, All Rights Reserved
|
||||
* Copyright (c) 2025-2026 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
|
||||
@@ -89,6 +89,27 @@ func AmServeImage(c echo.Context) error {
|
||||
return c.String(http.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
/* AmServeVeniceCompatibleImage serves an image from the image store under a Venice-compatible URI.
|
||||
* Parameters:
|
||||
* c - The Echo context for this request.
|
||||
* Returns:
|
||||
* Standard Go error return.
|
||||
*/
|
||||
func AmServeVeniceCompatibleImage(c echo.Context) error {
|
||||
id, err := strconv.Atoi(c.Param("id"))
|
||||
if err == nil {
|
||||
var img *database.ImageStore
|
||||
img, err = database.AmLoadImage(c.Request().Context(), int32(id))
|
||||
if err == nil {
|
||||
return c.Blob(http.StatusOK, img.MimeType, img.Data)
|
||||
}
|
||||
}
|
||||
if err == nil {
|
||||
err = fmt.Errorf("image not found: %s", c.Request().URL.Path)
|
||||
}
|
||||
return c.String(http.StatusNotFound, err.Error())
|
||||
}
|
||||
|
||||
/* AmProcessUploadedImage takes an image and resizes it to a specified size, returning its data.
|
||||
* Parameters:
|
||||
* fileheader - The multipart file header from the uploaded file.
|
||||
|
||||
@@ -110,6 +110,7 @@
|
||||
{{ post_overrideLink := "" }}
|
||||
{{ post_attach := nil }}
|
||||
{{ post_bozo := false }}
|
||||
{{ post_profile_pic := "" }}
|
||||
{{ range i, p := posts }}
|
||||
{{ post_cur = p }}
|
||||
{{ post_userName = post_getUserName(p, .) }}
|
||||
@@ -118,6 +119,9 @@
|
||||
{{ post_overrideLink = post_getOverrideLink(p, post_topicPermalink) }}
|
||||
{{ post_attach = post_getAttachmentInfo(p, .) }}
|
||||
{{ post_bozo = post_isBozo(p, post_topic, .) }}
|
||||
{{ if showPics }}
|
||||
{{ post_profile_pic = post_profileImage(p, .) }}
|
||||
{{ end }}
|
||||
{{ include "singlepost.jet" }}
|
||||
{{ if advancedControls }}
|
||||
<div class="flex flex-col gap-2">
|
||||
|
||||
@@ -20,7 +20,8 @@
|
||||
<!-- Left Column: Photo and Metadata -->
|
||||
<div class="flex-shrink-0 w-40">
|
||||
<div class="border-2 border-gray-300 rounded mb-4">
|
||||
<img src="{{ photoURL }}" alt="{{ username }}'s photo" class="w-full h-auto">
|
||||
<img src="{{ photoURL }}" alt="{{ username }}'s photo" class="w-full h-auto rounded-3xl border-2 border-gray-300"
|
||||
onerror="this.src='/img/builtin/no-user.png'">
|
||||
</div>
|
||||
<div class="text-xs text-gray-700 space-y-2">
|
||||
<div>
|
||||
|
||||
+50
-39
@@ -7,45 +7,56 @@
|
||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||
*}
|
||||
<div class="flex-1 border-2 border-gray-300 rounded-lg p-4 bg-white">
|
||||
<div class="flex justify-between items-start mb-3">
|
||||
<div class="text-sm text-gray-600">
|
||||
<a href="{{ post_stem }}?r={{ post_cur.Num }}&ac=1" class="text-blue-700 hover:text-blue-900 font-mono">{{ post_cur.Num }}</a> of
|
||||
<a href="{{ post_stem }}?r={{ post_max }}&ac=1" class="text-blue-700 hover:text-blue-900 font-mono">{{ post_max }}</a>
|
||||
<a href="{{ post_topicPermalink }}.{{ post_cur.Num }}" class="ml-2 text-xs text-blue-700 hover:text-blue-900"
|
||||
title="Permalink to this post">🔗<{{ post_confRef }}.{{ post_cur.Num }}></a>
|
||||
<div class="flex gap-2">
|
||||
{{ if !post_bozo && isset(post_profile_pic) && (post_profile_pic != "") }}
|
||||
<div class="flex-shrink-0">
|
||||
<img src="{{ post_profile_pic }}" alt="Profile image: {{ post_userName }}"
|
||||
class="w-16 h-16 rounded-lg border-2 border-gray-300"
|
||||
onerror="this.src='/img/builtin/no-user.png'">
|
||||
</div>
|
||||
{{ end }}
|
||||
<div class="flex-1">
|
||||
<div class="flex justify-between items-start mb-3">
|
||||
<div class="text-sm text-gray-600">
|
||||
<a href="{{ post_stem }}?r={{ post_cur.Num }}&ac=1" class="text-blue-700 hover:text-blue-900 font-mono">{{ post_cur.Num }}</a> of
|
||||
<a href="{{ post_stem }}?r={{ post_max }}&ac=1" class="text-blue-700 hover:text-blue-900 font-mono">{{ post_max }}</a>
|
||||
<a href="{{ post_topicPermalink }}.{{ post_cur.Num }}" class="ml-2 text-xs text-blue-700 hover:text-blue-900"
|
||||
title="Permalink to this post">🔗<{{ post_confRef }}.{{ post_cur.Num }}></a>
|
||||
</div>
|
||||
</div>
|
||||
{{ if post_bozo }}
|
||||
<div class="mt-4 mb-2">
|
||||
<span class="italic font-bold">
|
||||
(User filtered; <a class="text-blue-700 hover:text-blue-900" href="{{ post_stem }}?r={{ post_cur.Num }}&ac=1&bozo=0">remove filter</a>)
|
||||
</span>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="mb-2">
|
||||
<strong class="text-lg">{{ post_cur.Pseud | raw }}</strong>
|
||||
<span class="text-gray-600 text-sm ml-2">(<em>
|
||||
<a href="/user/{{ post_userName }}" target="_blank" class="text-blue-700 hover:text-blue-900">{{ post_userName }}</a>,
|
||||
{{ DisplayDateTime(post_cur.Posted, .) }}</em>)
|
||||
{{ if post_attach.Filename != "" }}
|
||||
<a href="/attachment/{{ post_cur.PostId }}" title="(Attachment {{ post_attach.Filename }} - {{ post_attach.Length }} bytes)"
|
||||
{{ if hasPrefix(post_attach.MIMEType, "text/") || hasPrefix(post_attach.MIMEType, "image/" )}}
|
||||
target="_blank"
|
||||
{{ end }}
|
||||
class="text-lg">📎</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
{{ if post_overrideLine != "" }}
|
||||
<div class="mb-2">
|
||||
{{ if post_overrideLink != "" }}
|
||||
<a href="{{ post_overrideLink }}" target="_blank" class="text-blue-700 hover:text-blue-900"><span class="italic font-bold">{{ post_overrideLine }}</span></a>
|
||||
{{ else }}
|
||||
<span class="italic text-bold">{{ post_overrideLine }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<pre class="amsPost font-mono text-sm whitespace-pre-wrap bg-gray-50 p-4 rounded border border-gray-200">{{ post_text | postRewrite | raw }}</pre>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
{{ if post_bozo }}
|
||||
<div class="mt-4 mb-2">
|
||||
<span class="italic font-bold">
|
||||
(User filtered; <a class="text-blue-700 hover:text-blue-900" href="{{ post_stem }}?r={{ post_cur.Num }}&ac=1&bozo=0">remove filter</a>)
|
||||
</span>
|
||||
</div>
|
||||
{{ else }}
|
||||
<div class="mb-2">
|
||||
<strong class="text-lg">{{ post_cur.Pseud | raw }}</strong>
|
||||
<span class="text-gray-600 text-sm ml-2">(<em>
|
||||
<a href="/user/{{ post_userName }}" target="_blank" class="text-blue-700 hover:text-blue-900">{{ post_userName }}</a>,
|
||||
{{ DisplayDateTime(post_cur.Posted, .) }}</em>)
|
||||
{{ if post_attach.Filename != "" }}
|
||||
<a href="/attachment/{{ post_cur.PostId }}" title="(Attachment {{ post_attach.Filename }} - {{ post_attach.Length }} bytes)"
|
||||
{{ if hasPrefix(post_attach.MIMEType, "text/") || hasPrefix(post_attach.MIMEType, "image/" )}}
|
||||
target="_blank"
|
||||
{{ end }}
|
||||
class="text-lg">📎</a>
|
||||
{{ end }}
|
||||
</span>
|
||||
</div>
|
||||
{{ if post_overrideLine != "" }}
|
||||
<div class="mb-2">
|
||||
{{ if post_overrideLink != "" }}
|
||||
<a href="{{ post_overrideLink }}" target="_blank" class="text-blue-700 hover:text-blue-900"><span class="italic font-bold">{{ post_overrideLine }}</span></a>
|
||||
{{ else }}
|
||||
<span class="italic text-bold">{{ post_overrideLine }}</span>
|
||||
{{ end }}
|
||||
</div>
|
||||
{{ else }}
|
||||
<pre class="amsPost font-mono text-sm whitespace-pre-wrap bg-gray-50 p-4 rounded border border-gray-200">{{ post_text | postRewrite | raw }}</pre>
|
||||
{{ end }}
|
||||
{{ end }}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user