put the ad (quote) banners in - last major feature in MISSINGFUNCS
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 5.9 KiB |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 7.5 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
|
After Width: | Height: | Size: 6.2 KiB |
|
After Width: | Height: | Size: 4.9 KiB |
|
After Width: | Height: | Size: 7.2 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 5.8 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.2 KiB |
|
After Width: | Height: | Size: 2.4 KiB |
@@ -34,6 +34,9 @@ import (
|
||||
//go:embed static_images/*
|
||||
var static_images embed.FS
|
||||
|
||||
//go:embed adbanners/*
|
||||
var ad_banners embed.FS
|
||||
|
||||
// Constants for default photo sizes.
|
||||
const (
|
||||
UserPhotoWidth = 100
|
||||
@@ -71,6 +74,12 @@ func AmServeImage(c echo.Context) error {
|
||||
if err == nil {
|
||||
return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b)
|
||||
}
|
||||
case "ads/":
|
||||
var b []byte
|
||||
b, err = ad_banners.ReadFile(filepath.Join("adbanners", components[3]))
|
||||
if err == nil {
|
||||
return c.Blob(http.StatusOK, mimeTypeFromFilename(components[3]), b)
|
||||
}
|
||||
case "store/":
|
||||
var id int
|
||||
id, err = strconv.Atoi(components[3])
|
||||
|
||||
@@ -16,6 +16,7 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"git.erbosoft.com/amy/amsterdam/database"
|
||||
"github.com/klauspost/lctime"
|
||||
"github.com/labstack/echo/v4"
|
||||
log "github.com/sirupsen/logrus"
|
||||
@@ -129,6 +130,17 @@ func AmSendPageData(ctxt echo.Context, amctxt AmContext, command string, data an
|
||||
}
|
||||
menus[1] = AmMenu("fixed")
|
||||
amctxt.VarMap().Set("__leftMenus", menus)
|
||||
ad, err := database.AmGetRandomAd(ctxt.Request().Context())
|
||||
if err != nil {
|
||||
ad = &database.Advert{
|
||||
AdId: -1,
|
||||
ImagePath: "",
|
||||
PathStyle: -1,
|
||||
Caption: nil,
|
||||
LinkURL: nil,
|
||||
}
|
||||
}
|
||||
amctxt.VarMap().Set("__bannerad", ad)
|
||||
if tmp := amctxt.GetScratch("frame_suppressLogin"); tmp != nil {
|
||||
amctxt.VarMap().Set("__suppressLogin", true)
|
||||
}
|
||||
|
||||
@@ -49,7 +49,16 @@
|
||||
|
||||
<!-- Banner Ad -->
|
||||
<div class="w-2/5 flex justify-end">
|
||||
<img src="/img/builtin/placeholder_ad.gif" alt="" class="w-96 h-15 mx-2 my-2">
|
||||
{{ p := __bannerad.ResolvePath() }}
|
||||
{{ if p != "" }}
|
||||
{{ if isset(__bannerad.LinkURL) }}
|
||||
<a href="{{ __bannerad.LinkURL }}"><img src="{{ p }}" {{ if isset(__bannerad.Caption) }}alt="{{ __bannerad.Caption }}"{{ end }} class="w-96 h-15 mx-2 my-2"></a>
|
||||
{{ else }}
|
||||
<img src="{{ p }}" {{ if isset(__bannerad.Caption) }}alt="{{ __bannerad.Caption }}"{{ end }} class="w-96 h-15 mx-2 my-2">
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
|
||||
{{ end }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||