Skip to content

High performance, self-hosted, newsletter and mailing list manager with a modern dashboard. Single binary app.

Upgrade `labstack/echo` HTTP lib to v5.

Kailash Nadh52f80cccab39
diff --git a/cmd/admin.go b/cmd/admin.go
index de7951f0..344a1173 100644
--- a/cmd/admin.go
+++ b/cmd/admin.go
@@ -8,7 +8,7 @@ import (
"time"
"github.com/knadh/listmonk/internal/captcha"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
null "gopkg.in/volatiletech/null.v6"
)
@@ -118,7 +118,7 @@ func (a *App) makeAdminJSI18n() json.RawMessage {
}
// GetServerConfig returns general server config.
-func (a *App) GetServerConfig(c echo.Context) error {
+func (a *App) GetServerConfig(c *echo.Context) error {
out, err := a.makeServerConfig()
if err != nil {
return echo.NewHTTPError(http.StatusInternalServerError,
@@ -129,7 +129,7 @@ func (a *App) GetServerConfig(c echo.Context) error {
}
// GetDashboardCharts returns chart data points to render ont he dashboard.
-func (a *App) GetDashboardCharts(c echo.Context) error {
+func (a *App) GetDashboardCharts(c *echo.Context) error {
// Get the chart data from the DB.
out, err := a.core.GetDashboardCharts()
if err != nil {
@@ -140,7 +140,7 @@ func (a *App) GetDashboardCharts(c echo.Context) error {
}
// GetDashboardCounts returns stats counts to show on the dashboard.
-func (a *App) GetDashboardCounts(c echo.Context) error {
+func (a *App) GetDashboardCounts(c *echo.Context) error {
// Get the chart data from the DB.
out, err := a.core.GetDashboardCounts()
if err != nil {
@@ -151,7 +151,7 @@ func (a *App) GetDashboardCounts(c echo.Context) error {
}
// ReloadApp sends a reload signal to the app, causing a full restart.
-func (a *App) ReloadApp(c echo.Context) error {
+func (a *App) ReloadApp(c *echo.Context) error {
go func() {
<-time.After(time.Millisecond * 500)
diff --git a/cmd/archive.go b/cmd/archive.go
index 868fbb9e..1c30906d 100644
--- a/cmd/archive.go
+++ b/cmd/archive.go
@@ -10,7 +10,7 @@ import (
"github.com/gorilla/feeds"
"github.com/knadh/listmonk/internal/manager"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
null "gopkg.in/volatiletech/null.v6"
)
@@ -24,7 +24,7 @@ type campArchive struct {
}
// GetCampaignArchives renders the public campaign archives page.
-func (a *App) GetCampaignArchives(c echo.Context) error {
+func (a *App) GetCampaignArchives(c *echo.Context) error {
// Get archives from the DB.
pg := a.pg.NewFromURL(c.Request().URL.Query())
camps, total, err := a.getCampaignArchives(pg.Offset, pg.Limit, false)
@@ -52,7 +52,7 @@ func (a *App) GetCampaignArchives(c echo.Context) error {
}
// GetCampaignArchivesFeed renders the public campaign archives RSS feed.
-func (a *App) GetCampaignArchivesFeed(c echo.Context) error {
+func (a *App) GetCampaignArchivesFeed(c *echo.Context) error {
var (
pg = a.pg.NewFromURL(c.Request().URL.Query())
showFullContent = a.cfg.EnablePublicArchiveRSSContent
@@ -89,7 +89,7 @@ func (a *App) GetCampaignArchivesFeed(c echo.Context) error {
Items: out,
}
- if err := feed.WriteRss(c.Response().Writer); err != nil {
+ if err := feed.WriteRss(c.Response()); err != nil {
a.log.Printf("error generating archive RSS feed: %v", err)
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("public.errorProcessingRequest"))
}
@@ -98,7 +98,7 @@ func (a *App) GetCampaignArchivesFeed(c echo.Context) error {
}
// CampaignArchivesPage renders the public campaign archives page.
-func (a *App) CampaignArchivesPage(c echo.Context) error {
+func (a *App) CampaignArchivesPage(c *echo.Context) error {
// Get archives from the DB.
pg := a.pg.NewFromURL(c.Request().URL.Query())
out, total, err := a.getCampaignArchives(pg.Offset, pg.Limit, false)
@@ -118,7 +118,7 @@ func (a *App) CampaignArchivesPage(c echo.Context) error {
}
// CampaignArchivePage renders the public campaign archives page.
-func (a *App) CampaignArchivePage(c echo.Context) error {
+func (a *App) CampaignArchivePage(c *echo.Context) error {
// ID can be the UUID or slug.
var (
idStr = c.Param("id")
@@ -176,7 +176,7 @@ func (a *App) CampaignArchivePage(c echo.Context) error {
}
// CampaignArchivePageLatest renders the latest public campaign.
-func (a *App) CampaignArchivePageLatest(c echo.Context) error {
+func (a *App) CampaignArchivePageLatest(c *echo.Context) error {
// Get the latest campaign from the DB.
camps, _, err := a.getCampaignArchives(0, 1, true)
if err != nil {
diff --git a/cmd/auth.go b/cmd/auth.go
index f418ee1d..2a3397c7 100644
--- a/cmd/auth.go
+++ b/cmd/auth.go
@@ -20,7 +20,7 @@ import (
"github.com/knadh/listmonk/internal/tmptokens"
"github.com/knadh/listmonk/internal/utils"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/pquerna/otp/totp"
"github.com/zerodha/simplesessions/v3"
"gopkg.in/volatiletech/null.v6"
@@ -83,7 +83,7 @@ var (
)
// LoginPage renders the login page and handles the login form.
-func (a *App) LoginPage(c echo.Context) error {
+func (a *App) LoginPage(c *echo.Context) error {
// Has the user been setup?
a.Lock()
needsUserSetup := a.needsUserSetup
@@ -107,7 +107,7 @@ func (a *App) LoginPage(c echo.Context) error {
}
// LoginSetupPage renders the first time user login page and handles the login form.
-func (a *App) LoginSetupPage(c echo.Context) error {
+func (a *App) LoginSetupPage(c *echo.Context) error {
// Process POST login request.
var loginErr error
if c.Request().Method == http.MethodPost {
@@ -125,7 +125,7 @@ func (a *App) LoginSetupPage(c echo.Context) error {
}
// TwofaPage renders the 2FA verification page and handles the 2FA form submission.
-func (a *App) TwofaPage(c echo.Context) error {
+func (a *App) TwofaPage(c *echo.Context) error {
var token, next string
if c.Request().Method == http.MethodPost {
@@ -166,7 +166,7 @@ func (a *App) TwofaPage(c echo.Context) error {
}
// Logout logs a user out.
-func (a *App) Logout(c echo.Context) error {
+func (a *App) Logout(c *echo.Context) error {
sess := c.Get(auth.SessionKey).(*simplesessions.Session)
token, err := sess.String(sess.Get("oidc_token"))
if err != nil {
@@ -192,7 +192,7 @@ func (a *App) Logout(c echo.Context) error {
}
// OIDCLogin initializes an OIDC request and redirects to the OIDC provider for login.
-func (a *App) OIDCLogin(c echo.Context) error {
+func (a *App) OIDCLogin(c *echo.Context) error {
// Verify that the request came from the login page (CSRF).
nonce, err := c.Cookie("nonce")
if err != nil || nonce.Value == "" || nonce.Value != c.FormValue("nonce") {
@@ -228,7 +228,7 @@ func (a *App) OIDCLogin(c echo.Context) error {
}
// setOIDCVerifierCookie stores the PKCE verifier or deletes it if it's empty.
-func (a *App) setOIDCVerifierCookie(c echo.Context, verifier string) {
+func (a *App) setOIDCVerifierCookie(c *echo.Context, verifier string) {
ck := &http.Cookie{
Name: "oidc_code_verifier",
Value: verifier,
@@ -246,7 +246,7 @@ func (a *App) setOIDCVerifierCookie(c echo.Context, verifier string) {
}
// OIDCFinish receives the redirect callback from the OIDC provider and completes the handshake.
-func (a *App) OIDCFinish(c echo.Context) error {
+func (a *App) OIDCFinish(c *echo.Context) error {
// Verify that the request actually originated from the login request (which sets the nonce value).
nonce, err := c.Cookie("nonce")
if err != nil || nonce.Value == "" {
@@ -329,7 +329,7 @@ func (a *App) OIDCFinish(c echo.Context) error {
}
// ForgotPage renders the forgot password page and handles the forgot password form.
-func (a *App) ForgotPage(c echo.Context) error {
+func (a *App) ForgotPage(c *echo.Context) error {
// Process the forgot password request.
if c.Request().Method == http.MethodPost {
return a.doForgotPassword(c)
@@ -341,7 +341,7 @@ func (a *App) ForgotPage(c echo.Context) error {
}
// ResetPage renders the reset password page and handles the reset password form.
-func (a *App) ResetPage(c echo.Context) error {
+func (a *App) ResetPage(c *echo.Context) error {
var (
token = strings.TrimSpace(c.QueryParam("token"))
email = strings.ToLower(strings.TrimSpace(c.QueryParam("email")))
@@ -374,7 +374,7 @@ func (a *App) ResetPage(c echo.Context) error {
}
// renderLoginPage renders the login page and handles the login form.
-func (a *App) renderLoginPage(c echo.Context, loginErr error) error {
+func (a *App) renderLoginPage(c *echo.Context, loginErr error) error {
next := utils.SanitizeURI(c.FormValue("next"))
if next == "/" {
next = uriAdmin
@@ -423,7 +423,7 @@ func (a *App) renderLoginPage(c echo.Context, loginErr error) error {
// If there was an error in the previous state (POST reqest), set it to render in the template.
if loginErr != nil {
if e, ok := loginErr.(*echo.HTTPError); ok {
- out.Error = e.Message.(string)
+ out.Error = e.Message
} else {
out.Error = loginErr.Error()
}
@@ -449,7 +449,7 @@ func (a *App) renderLoginPage(c echo.Context, loginErr error) error {
}
// renderLoginSetupPage renders the first time user setup page.
-func (a *App) renderLoginSetupPage(c echo.Context, loginErr error) error {
+func (a *App) renderLoginSetupPage(c *echo.Context, loginErr error) error {
next := utils.SanitizeURI(c.FormValue("next"))
if next == "/" {
next = uriAdmin
@@ -464,7 +464,7 @@ func (a *App) renderLoginSetupPage(c echo.Context, loginErr error) error {
// If there was an error in the previous state (POST reqest), set it to render in the template.
if loginErr != nil {
if e, ok := loginErr.(*echo.HTTPError); ok {
- out.Error = e.Message.(string)
+ out.Error = e.Message
} else {
out.Error = loginErr.Error()
}
@@ -474,7 +474,7 @@ func (a *App) renderLoginSetupPage(c echo.Context, loginErr error) error {
}
// createOIDCUser creates a new user in the DB with the OIDC claims.
-func (a *App) createOIDCUser(claims auth.OIDCclaim, c echo.Context) (auth.User, error) {
+func (a *App) createOIDCUser(claims auth.OIDCclaim, c *echo.Context) (auth.User, error) {
name := claims.Name
if name == "" {
name = strings.TrimSpace(claims.PreferredUsername)
@@ -511,7 +511,7 @@ func (a *App) createOIDCUser(claims auth.OIDCclaim, c echo.Context) (auth.User,
}
// doLogin logs a user in with a username and password.
-func (a *App) doLogin(c echo.Context) error {
+func (a *App) doLogin(c *echo.Context) error {
var (
startTime = time.Now()
username = strings.TrimSpace(c.FormValue("username"))
@@ -564,7 +564,7 @@ func (a *App) doLogin(c echo.Context) error {
}
// doFirstTimeSetup sets a user up for the first time.
-func (a *App) doFirstTimeSetup(c echo.Context) error {
+func (a *App) doFirstTimeSetup(c *echo.Context) error {
var (
email = strings.TrimSpace(c.FormValue("email"))
username = strings.TrimSpace(c.FormValue("username"))
@@ -631,7 +631,7 @@ func (a *App) doFirstTimeSetup(c echo.Context) error {
}
// renderResetPasswordPage renders the reset password page.
-func (a *App) renderResetPasswordPage(c echo.Context, token, email, errMsg string) error {
+func (a *App) renderResetPasswordPage(c *echo.Context, token, email, errMsg string) error {
out := resetPasswordTpl{
Title: a.i18n.T("users.resetPassword"),
Token: token,
@@ -642,7 +642,7 @@ func (a *App) renderResetPasswordPage(c echo.Context, token, email, errMsg strin
}
// doForgotPassword handles the forgot password form submission.
-func (a *App) doForgotPassword(c echo.Context) error {
+func (a *App) doForgotPassword(c *echo.Context) error {
var (
email = strings.ToLower(strings.TrimSpace(c.FormValue("email")))
)
@@ -709,7 +709,7 @@ func (a *App) doForgotPassword(c echo.Context) error {
}
// doResetPassword handles the reset password form submission.
-func (a *App) doResetPassword(c echo.Context, token, email string) error {
+func (a *App) doResetPassword(c *echo.Context, token, email string) error {
var (
password = c.FormValue("password")
password2 = c.FormValue("password2")
@@ -766,7 +766,7 @@ func (a *App) doResetPassword(c echo.Context, token, email string) error {
}
// renderTwofaPage renders the 2FA verification page.
-func (a *App) renderTwofaPage(c echo.Context, token, next, errMsg string) error {
+func (a *App) renderTwofaPage(c *echo.Context, token, next, errMsg string) error {
out := twofaTpl{
Title: a.i18n.T("users.twoFA"),
Description: "",
@@ -778,7 +778,7 @@ func (a *App) renderTwofaPage(c echo.Context, token, next, errMsg string) error
}
// doTwofaVerify handles the 2FA verification form submission.
-func (a *App) doTwofaVerify(c echo.Context, token string, userID int, next string) error {
+func (a *App) doTwofaVerify(c *echo.Context, token string, userID int, next string) error {
totpCode := strings.TrimSpace(c.FormValue("totp_code"))
// Validate.
@@ -816,7 +816,7 @@ func (a *App) doTwofaVerify(c echo.Context, token string, userID int, next strin
}
// GenerateTOTPQR generates a TOTP QR code for a user to scan with their authenticator app.
-func (a *App) GenerateTOTPQR(c echo.Context) error {
+func (a *App) GenerateTOTPQR(c *echo.Context) error {
u := c.Get(auth.UserHTTPCtxKey).(auth.User)
// If TOTP is already enabled, don't generate a new key.
diff --git a/cmd/bounce.go b/cmd/bounce.go
index 7c4439ec..07cf38cb 100644
--- a/cmd/bounce.go
+++ b/cmd/bounce.go
@@ -9,7 +9,7 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// bouncesQueryDefaults is the allowlist of filter query params.
@@ -32,7 +32,7 @@ type bouncesView struct {
}
// ViewBounces renders the HTML view for bounces.
-func (a *App) ViewBounces(c echo.Context) error {
+func (a *App) ViewBounces(c *echo.Context) error {
q := makeQuery(c.Request().URL.Query(), bouncesQueryDefaults)
campID, _ := strconv.Atoi(q.Get("campaign_id"))
@@ -54,7 +54,7 @@ func (a *App) ViewBounces(c echo.Context) error {
}
// GetBounce handles retrieval of a specific bounce record by ID.
-func (a *App) GetBounce(c echo.Context) error {
+func (a *App) GetBounce(c *echo.Context) error {
// Fetch one bounce from the DB.
id := getID(c)
out, err := a.core.GetBounce(id)
@@ -66,7 +66,7 @@ func (a *App) GetBounce(c echo.Context) error {
}
// GetBounces handles retrieval of bounce records.
-func (a *App) GetBounces(c echo.Context) error {
+func (a *App) GetBounces(c *echo.Context) error {
var (
campID, _ = strconv.Atoi(c.QueryParam("campaign_id"))
source = c.FormValue("source")
@@ -101,7 +101,7 @@ func (a *App) GetBounces(c echo.Context) error {
}
// GetSubscriberBounces retrieves a subscriber's bounce records.
-func (a *App) GetSubscriberBounces(c echo.Context) error {
+func (a *App) GetSubscriberBounces(c *echo.Context) error {
subID := getID(c)
// Check if the user has access to at least one of the lists on the subscriber.
@@ -119,7 +119,7 @@ func (a *App) GetSubscriberBounces(c echo.Context) error {
}
// DeleteBounces handles bounce deletion of a list.
-func (a *App) DeleteBounces(c echo.Context) error {
+func (a *App) DeleteBounces(c *echo.Context) error {
all, _ := strconv.ParseBool(c.QueryParam("all"))
var ids []int
@@ -151,7 +151,7 @@ func (a *App) DeleteBounces(c echo.Context) error {
}
// DeleteBounce handles bounce deletion of a single bounce record.
-func (a *App) DeleteBounce(c echo.Context) error {
+func (a *App) DeleteBounce(c *echo.Context) error {
// Delete bounces from the DB.
id := getID(c)
if err := a.core.DeleteBounces([]int{id}, false, 0, "", ""); err != nil {
@@ -162,7 +162,7 @@ func (a *App) DeleteBounce(c echo.Context) error {
}
// BlocklistBouncedSubscribers blocklists subscribers matching bounce IDs or filters.
-func (a *App) BlocklistBouncedSubscribers(c echo.Context) error {
+func (a *App) BlocklistBouncedSubscribers(c *echo.Context) error {
ids, err := parseStringIDs(c.QueryParams()["id"])
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("globals.messages.invalidID"))
@@ -181,7 +181,7 @@ func (a *App) BlocklistBouncedSubscribers(c echo.Context) error {
}
// BounceWebhook handles incoming bounce webhook notifications from various providers.
-func (a *App) BounceWebhook(c echo.Context) error {
+func (a *App) BounceWebhook(c *echo.Context) error {
// If bounce processing is disabled, a.bounce will be nil.
// Return early to prevent nil pointer dereference.
if a.bounce == nil {
@@ -294,7 +294,7 @@ func (a *App) BounceWebhook(c echo.Context) error {
bs, err := a.bounce.Postmark.ProcessBounce(rawReq, c)
if err != nil {
a.log.Printf("error processing postmark notification: %v", err)
- if _, ok := err.(*echo.HTTPError); ok {
+ if echo.StatusCode(err) != 0 {
return err
}
@@ -311,7 +311,7 @@ func (a *App) BounceWebhook(c echo.Context) error {
bs, err := a.bounce.Forwardemail.ProcessBounce(sig, rawReq)
if err != nil {
a.log.Printf("error processing forwardemail notification: %v", err)
- if _, ok := err.(*echo.HTTPError); ok {
+ if echo.StatusCode(err) != 0 {
return err
}
@@ -325,7 +325,7 @@ func (a *App) BounceWebhook(c echo.Context) error {
bs, err := a.bounce.Lettermint.ProcessBounce(sig, rawReq)
if err != nil {
a.log.Printf("error processing lettermint notification: %v", err)
- if _, ok := err.(*echo.HTTPError); ok {
+ if echo.StatusCode(err) != 0 {
return err
}
diff --git a/cmd/campaign_analytics.go b/cmd/campaign_analytics.go
index 94863e7c..5564997e 100644
--- a/cmd/campaign_analytics.go
+++ b/cmd/campaign_analytics.go
@@ -6,7 +6,7 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// analyticsData is the chart data embedded into the analytics page for the Chart.js renderer.
@@ -50,16 +50,16 @@ type analyticsView struct {
}
// ViewCampaignAnalytics renders the HTML view for campaign analytics.
-func (a *App) ViewCampaignAnalytics(c echo.Context) error {
+func (a *App) ViewCampaignAnalytics(c *echo.Context) error {
return a.viewAnalytics(c, models.ResourceCampaigns)
}
// ViewListAnalytics renders analytics for selected lists.
-func (a *App) ViewListAnalytics(c echo.Context) error {
+func (a *App) ViewListAnalytics(c *echo.Context) error {
return a.viewAnalytics(c, models.ResourceLists)
}
-func (a *App) viewAnalytics(c echo.Context, resource string) error {
+func (a *App) viewAnalytics(c *echo.Context, resource string) error {
user := auth.GetUser(c)
ids, err := getQueryInts("id", c.QueryParams())
if err != nil {
@@ -190,16 +190,16 @@ func (a *App) viewAnalytics(c echo.Context, resource string) error {
}
// GetCampaignViewAnalytics retrieves analytics for campaigns.
-func (a *App) GetCampaignViewAnalytics(c echo.Context) error {
+func (a *App) GetCampaignViewAnalytics(c *echo.Context) error {
return a.getAnalytics(c, models.ResourceCampaigns)
}
// GetListAnalytics retrieves analytics for lists.
-func (a *App) GetListAnalytics(c echo.Context) error {
+func (a *App) GetListAnalytics(c *echo.Context) error {
return a.getAnalytics(c, models.ResourceLists)
}
-func (a *App) getAnalytics(c echo.Context, resource string) error {
+func (a *App) getAnalytics(c *echo.Context, resource string) error {
ids, err := parseStringIDs(c.Request().URL.Query()["id"])
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest,
diff --git a/cmd/campaigns.go b/cmd/campaigns.go
index 50617b28..b1019a9e 100644
--- a/cmd/campaigns.go
+++ b/cmd/campaigns.go
@@ -17,7 +17,7 @@ import (
"github.com/knadh/listmonk/internal/messenger/email"
"github.com/knadh/listmonk/internal/notifs"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
"gopkg.in/volatiletech/null.v6"
)
@@ -85,7 +85,7 @@ type campaignView struct {
}
// ViewNewCampaign renders the new campaign page (only the "campaign" tab).
-func (a *App) ViewNewCampaign(c echo.Context) error {
+func (a *App) ViewNewCampaign(c *echo.Context) error {
var tpls []models.Template
if can(auth.GetUser(c), auth.PermTemplatesGet) {
var err error
@@ -124,7 +124,7 @@ func (a *App) ViewNewCampaign(c echo.Context) error {
// tabs (campaign/content/attribs/archive) are inline on this page, deep-linked
// via the URL hash (#tab=<id>). Legacy per-tab paths (/campaigns/:id/:tab) are
// redirected to the canonical hash form for backward compatibility.
-func (a *App) ViewCampaign(c echo.Context) error {
+func (a *App) ViewCampaign(c *echo.Context) error {
id := getID(c)
switch c.Param("tab") {
@@ -197,7 +197,7 @@ func (a *App) ViewCampaign(c echo.Context) error {
}
// ViewCampaigns renders the HTML list view for campaigns.
-func (a *App) ViewCampaigns(c echo.Context) error {
+func (a *App) ViewCampaigns(c *echo.Context) error {
camps, props, err := a.getViewCampaigns(c)
if err != nil {
return err
@@ -213,7 +213,7 @@ func (a *App) ViewCampaigns(c echo.Context) error {
}
// getViewCampaigns queries paginated campaigns for the HTML list view.
-func (a *App) getViewCampaigns(c echo.Context, listIDs ...int) ([]models.Campaign, models.PageProps, error) {
+func (a *App) getViewCampaigns(c *echo.Context, listIDs ...int) ([]models.Campaign, models.PageProps, error) {
q := makeQuery(c.Request().URL.Query(), campaignsQueryDefaults)
// Get the authenticated user.
@@ -249,7 +249,7 @@ func (a *App) getViewCampaigns(c echo.Context, listIDs ...int) ([]models.Campaig
}
// GetCampaigns handles retrieval of campaigns.
-func (a *App) GetCampaigns(c echo.Context) error {
+func (a *App) GetCampaigns(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -309,7 +309,7 @@ func (a *App) GetCampaigns(c echo.Context) error {
}
// GetCampaign handles retrieval of campaigns.
-func (a *App) GetCampaign(c echo.Context) error {
+func (a *App) GetCampaign(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -334,7 +334,7 @@ func (a *App) GetCampaign(c echo.Context) error {
}
// PreviewCampaign renders the HTML preview of a campaign body.
-func (a *App) PreviewCampaign(c echo.Context) error {
+func (a *App) PreviewCampaign(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -396,7 +396,7 @@ func (a *App) PreviewCampaign(c echo.Context) error {
}
// PreviewCampaignArchive renders the public campaign archives page.
-func (a *App) PreviewCampaignArchive(c echo.Context) error {
+func (a *App) PreviewCampaignArchive(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -434,7 +434,7 @@ func (a *App) PreviewCampaignArchive(c echo.Context) error {
}
// CampaignContent handles campaign content (body) format conversions.
-func (a *App) CampaignContent(c echo.Context) error {
+func (a *App) CampaignContent(c *echo.Context) error {
var camp campContentReq
if err := c.Bind(&camp); err != nil {
return err
@@ -451,7 +451,7 @@ func (a *App) CampaignContent(c echo.Context) error {
// CreateCampaign handles campaign creation.
// Newly created campaigns are always drafts.
-func (a *App) CreateCampaign(c echo.Context) error {
+func (a *App) CreateCampaign(c *echo.Context) error {
var o campReq
if err := c.Bind(&o); err != nil {
return err
@@ -500,7 +500,7 @@ func (a *App) CreateCampaign(c echo.Context) error {
// UpdateCampaign handles campaign modification.
// Campaigns that are done cannot be modified.
-func (a *App) UpdateCampaign(c echo.Context) error {
+func (a *App) UpdateCampaign(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -551,7 +551,7 @@ func (a *App) UpdateCampaign(c echo.Context) error {
}
// UpdateCampaignStatus handles campaign status modification.
-func (a *App) UpdateCampaignStatus(c echo.Context) error {
+func (a *App) UpdateCampaignStatus(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -582,7 +582,7 @@ func (a *App) UpdateCampaignStatus(c echo.Context) error {
}
// UpdateCampaignArchive handles campaign status modification.
-func (a *App) UpdateCampaignArchive(c echo.Context) error {
+func (a *App) UpdateCampaignArchive(c *echo.Context) error {
id := getID(c)
// Check if the user has access to the campaign.
@@ -617,7 +617,7 @@ func (a *App) UpdateCampaignArchive(c echo.Context) error {
// DeleteCampaign handles campaign deletion.
// Only scheduled campaigns that have not started yet can be deleted.
-func (a *App) DeleteCampaign(c echo.Context) error {
+func (a *App) DeleteCampaign(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -635,7 +635,7 @@ func (a *App) DeleteCampaign(c echo.Context) error {
}
// DeleteCampaigns deletes multiple campaigns by IDs or by query.
-func (a *App) DeleteCampaigns(c echo.Context) error {
+func (a *App) DeleteCampaigns(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -685,7 +685,7 @@ func (a *App) DeleteCampaigns(c echo.Context) error {
}
// GetRunningCampaignStats returns stats of a given set of campaign IDs.
-func (a *App) GetRunningCampaignStats(c echo.Context) error {
+func (a *App) GetRunningCampaignStats(c *echo.Context) error {
// Get the running campaign stats from the DB.
out, err := a.core.GetRunningCampaignStats()
if err != nil {
@@ -719,7 +719,7 @@ func (a *App) GetRunningCampaignStats(c echo.Context) error {
// TestCampaign handles the sending of a campaign message to
// arbitrary subscribers for testing.
-func (a *App) TestCampaign(c echo.Context) error {
+func (a *App) TestCampaign(c *echo.Context) error {
// Get the campaign ID.
id := getID(c)
@@ -961,7 +961,7 @@ func (a *App) makeOptinCampaignMessage(o campReq) (campReq, error) {
// checkCampaignPerm checks if the user has get or manage access to the given campaign.
// Either the user has blanket get_all/manage_all permissions, or the campaign
// belongs to lists that the user has access to.
-func (a *App) checkCampaignPerm(types auth.PermType, id int, c echo.Context) error {
+func (a *App) checkCampaignPerm(types auth.PermType, id int, c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
diff --git a/cmd/dashboard.go b/cmd/dashboard.go
index 7701b663..e31a679d 100644
--- a/cmd/dashboard.go
+++ b/cmd/dashboard.go
@@ -13,7 +13,7 @@ import (
"github.com/jmoiron/sqlx/types"
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// dashboardCampaignCount is the number of recent campaigns to show on the dashboard.
@@ -74,7 +74,7 @@ type dashboardView struct {
}
// ViewDashboard renders the admin dashboard (home) page.
-func (a *App) ViewDashboard(c echo.Context) error {
+func (a *App) ViewDashboard(c *echo.Context) error {
counts, err := a.core.GetDashboardCounts()
if err != nil {
return err
@@ -111,7 +111,7 @@ func (a *App) ViewDashboard(c echo.Context) error {
// GetDashboardCampaigns returns recent campaigns to show on the dashboard,
// with scheduled campaigns on top.
-func (a *App) GetDashboardCampaigns(c echo.Context) error {
+func (a *App) GetDashboardCampaigns(c *echo.Context) error {
camps, err := a.getDashboardCampaigns(c)
if err != nil {
return err
@@ -121,7 +121,7 @@ func (a *App) GetDashboardCampaigns(c echo.Context) error {
}
// getDashboardCampaigns queries recent campaigns to show on the dashboard.
-func (a *App) getDashboardCampaigns(c echo.Context) (models.Campaigns, error) {
+func (a *App) getDashboardCampaigns(c *echo.Context) (models.Campaigns, error) {
user := auth.GetUser(c)
// Either the user has campaigns:get_all permission and can view all campaigns,
diff --git a/cmd/events.go b/cmd/events.go
index 97e19bd8..35d1333a 100644
--- a/cmd/events.go
+++ b/cmd/events.go
@@ -4,14 +4,15 @@ import (
"encoding/json"
"fmt"
"log"
+ "net/http"
"time"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// EventStream serves an endpoint that never closes and pushes a
// live event stream (text/event-stream) such as a error messages.
-func (a *App) EventStream(c echo.Context) error {
+func (a *App) EventStream(c *echo.Context) error {
hdr := c.Response().Header()
hdr.Set(echo.HeaderContentType, "text/event-stream")
hdr.Set(echo.HeaderCacheControl, "no-store")
@@ -35,7 +36,10 @@ func (a *App) EventStream(c echo.Context) error {
}
c.Response().Write([]byte(fmt.Sprintf("retry: 3000\ndata: %s\n\n", b)))
- c.Response().Flush()
+ if err := http.NewResponseController(c.Response()).Flush(); err != nil {
+ a.events.Unsubscribe(id)
+ return err
+ }
case <-ctx.Done():
// On HTTP connection close, unsubscribe.
diff --git a/cmd/handlers.go b/cmd/handlers.go
index d4efacd8..f4414fab 100644
--- a/cmd/handlers.go
+++ b/cmd/handlers.go
@@ -6,10 +6,11 @@ import (
"path"
"regexp"
"strconv"
+ "strings"
"github.com/knadh/listmonk/internal/auth"
- "github.com/labstack/echo/v4"
- "github.com/labstack/echo/v4/middleware"
+ "github.com/labstack/echo/v5"
+ "github.com/labstack/echo/v5/middleware"
)
const (
@@ -31,6 +32,10 @@ var (
// registerHandlers registers HTTP handlers.
func initHTTPHandlers(e *echo.Echo, a *App) {
e.HTTPErrorHandler = a.handleHTTPErr
+ e.Pre(middleware.RemoveTrailingSlashWithConfig(middleware.RemoveTrailingSlashConfig{
+ RedirectCode: http.StatusPermanentRedirect,
+ Skipper: skipAdminTrailingSlash,
+ }))
// Configure CORS middleware if domains are configured.
if corsOrigins := trustedURLsToCORSOrigins(a.cfg.Security.TrustedURLs); len(corsOrigins) > 0 {
@@ -47,7 +52,7 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
// Attach a middleware to the group that checks for auth.
g := e.Group("", a.auth.Middleware, func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
u := c.Get(auth.UserHTTPCtxKey)
// On no-auth, redirect to login page
@@ -123,7 +128,7 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
// Attach a middleware to the group that checks for auth.
g = e.Group("", a.auth.Middleware, func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
u := c.Get(auth.UserHTTPCtxKey)
// On no-auth, respond with a JSON error.
@@ -278,7 +283,7 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
}
// Landing page.
- g.GET("/", func(c echo.Context) error {
+ g.GET("/", func(c *echo.Context) error {
return c.Render(http.StatusOK, "home", publicTpl{Title: "listmonk"})
})
@@ -334,26 +339,26 @@ func initHTTPHandlers(e *echo.Echo, a *App) {
g.GET("/robots.txt", a.RobotsTxt)
// 404 pages.
- g.RouteNotFound("/*", func(c echo.Context) error {
+ g.RouteNotFound("/*", func(c *echo.Context) error {
return c.Render(http.StatusNotFound, tplMessage,
makeMsgTpl("404 - "+a.i18n.T("globals.terms.notFound"), "", ""))
})
- g.RouteNotFound("/api/*", func(c echo.Context) error {
+ g.RouteNotFound("/api/*", func(c *echo.Context) error {
return echo.NewHTTPError(http.StatusNotFound, "404 unknown endpoint")
})
- g.RouteNotFound("/admin/*", a.adminPage(func(c echo.Context) error {
+ g.RouteNotFound("/admin/*", a.adminPage(func(c *echo.Context) error {
return echo.NewHTTPError(http.StatusNotFound, "404 page not found")
}))
}
}
// HealthCheck is a healthcheck endpoint that returns a 200 response.
-func (a *App) HealthCheck(c echo.Context) error {
+func (a *App) HealthCheck(c *echo.Context) error {
return c.JSON(http.StatusOK, okResp{true})
}
// RobotsTxt serves the robots.txt file from the static filesystem.
-func (a *App) RobotsTxt(c echo.Context) error {
+func (a *App) RobotsTxt(c *echo.Context) error {
b, err := a.fs.Read("/public/static/robots.txt")
if err != nil {
return echo.NewHTTPError(http.StatusNotFound, "robots.txt not found")
@@ -364,7 +369,7 @@ func (a *App) RobotsTxt(c echo.Context) error {
// serveCustomAppearance serves the given custom CSS/JS appearance blob
// meant for customizing public and admin pages from the admin settings UI.
func serveCustomAppearance(name string) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
var (
app = c.Get("app").(*App)
@@ -396,7 +401,7 @@ func serveCustomAppearance(name string) echo.HandlerFunc {
// hasUUID middleware validates the UUID string format for a given set of params.
func (a *App) hasUUID(next echo.HandlerFunc, params ...string) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
for _, p := range params {
if !reUUID.MatchString(c.Param(p)) {
return c.Render(http.StatusBadRequest, tplMessage, makeMsgTpl(a.i18n.T("globals.terms.error"), "",
@@ -409,7 +414,7 @@ func (a *App) hasUUID(next echo.HandlerFunc, params ...string) echo.HandlerFunc
// hasID middleware validates the :id param in the URL and sets its int value in the context.
func hasID(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
id, _ := strconv.Atoi(c.Param("id"))
if id < 1 {
return echo.NewHTTPError(http.StatusBadRequest, "invalid ID")
@@ -423,13 +428,13 @@ func hasID(next echo.HandlerFunc) echo.HandlerFunc {
// hasSub middleware checks if a subscriber exists given the UUID
// param in a request.
func (a *App) hasSub(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
subUUID := c.Param("subUUID")
if _, err := a.core.GetSubscriber(0, subUUID, ""); err != nil {
if er, ok := err.(*echo.HTTPError); ok && er.Code == http.StatusBadRequest {
return c.Render(http.StatusNotFound, tplMessage,
- makeMsgTpl(a.i18n.T("globals.terms.notFound"), "", er.Message.(string)))
+ makeMsgTpl(a.i18n.T("globals.terms.notFound"), "", er.Message))
}
a.log.Printf("error checking subscriber existence: %v", err)
@@ -442,24 +447,24 @@ func (a *App) hasSub(next echo.HandlerFunc) echo.HandlerFunc {
}
// handleHTTPErr logs errors and delegates response formatting to Echo.
-func (a *App) handleHTTPErr(err error, c echo.Context) {
- if _, ok := err.(*echo.HTTPError); !ok {
+func (a *App) handleHTTPErr(c *echo.Context, err error) {
+ if echo.StatusCode(err) == 0 {
a.log.Println(err.Error())
}
- c.Echo().DefaultHTTPErrorHandler(err, c)
+ echo.DefaultHTTPErrorHandler(false)(c, err)
}
// noIndex adds the HTTP header requesting robots to not crawl the page.
func noIndex(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
c.Response().Header().Set("X-Robots-Tag", "noindex")
return next(c)
}
}
// getID returns the :id param from the URL parsed and stored as an int by the hasID middleware.
-func getID(c echo.Context) int {
+func getID(c *echo.Context) int {
return c.Get("id").(int)
}
@@ -490,7 +495,15 @@ func trustedURLsToCORSOrigins(urls []string) []string {
}
// renderSandboxedHTML executes the HTML rendering handler with CSP sandboxing headers (for iframes).
-func renderSandboxedHTML(c echo.Context, body string) error {
+func renderSandboxedHTML(c *echo.Context, body string) error {
c.Response().Header().Add("Content-Security-Policy", "sandbox allow-scripts allow-popups allow-popups-to-escape-sandbox")
return c.HTML(http.StatusOK, body)
}
+
+// skipAdminTrailingSlash excludes assets and non-admin URLs from canonical redirects.
+func skipAdminTrailingSlash(c *echo.Context) bool {
+ p := strings.TrimRight(c.Request().URL.Path, "/")
+ return (p != uriAdmin && !strings.HasPrefix(p, uriAdmin+"/")) ||
+ p == uriAdmin+"/static" || strings.HasPrefix(p, uriAdmin+"/static/") ||
+ p == uriAdmin+"/custom.css" || p == uriAdmin+"/custom.js"
+}
diff --git a/cmd/i18n.go b/cmd/i18n.go
index f3254017..e9190e19 100644
--- a/cmd/i18n.go
+++ b/cmd/i18n.go
@@ -9,7 +9,7 @@ import (
"github.com/knadh/listmonk/internal/i18n"
"github.com/knadh/stuffbin"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
type i18nLang struct {
@@ -25,7 +25,7 @@ type i18nLangRaw struct {
var reLangCode = regexp.MustCompile(`[^a-zA-Z_0-9\\-]`)
// GetI18nLang returns the JSON language pack given the language code.
-func (a *App) GetI18nLang(c echo.Context) error {
+func (a *App) GetI18nLang(c *echo.Context) error {
lang := c.Param("lang")
if len(lang) > 6 || reLangCode.MatchString(lang) {
return echo.NewHTTPError(http.StatusBadRequest, "Invalid language code.")
diff --git a/cmd/import.go b/cmd/import.go
index 30979d3a..4049cae7 100644
--- a/cmd/import.go
+++ b/cmd/import.go
@@ -10,7 +10,7 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/internal/subimporter"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// importView is the admin view for the subscriber import page.
@@ -23,7 +23,7 @@ type importView struct {
}
// ViewImport renders the HTML view for the subscriber CSV import page.
-func (a *App) ViewImport(c echo.Context) error {
+func (a *App) ViewImport(c *echo.Context) error {
// Get the lists the user can access.
allLists, err := a.getViewableLists(c)
if err != nil {
@@ -58,7 +58,7 @@ func (a *App) ViewImport(c echo.Context) error {
// ImportSubscribers handles the uploading and bulk importing of
// a ZIP file of one or more CSV files.
-func (a *App) ImportSubscribers(c echo.Context) error {
+func (a *App) ImportSubscribers(c *echo.Context) error {
// Is an import already running?
if a.importer.GetStats().Status == subimporter.StatusImporting {
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("import.alreadyRunning"))
@@ -162,20 +162,20 @@ func (a *App) ImportSubscribers(c echo.Context) error {
}
// GetImportSubscribers returns import statistics.
-func (a *App) GetImportSubscribers(c echo.Context) error {
+func (a *App) GetImportSubscribers(c *echo.Context) error {
s := a.importer.GetStats()
return c.JSON(http.StatusOK, okResp{s})
}
// GetImportSubscriberStats returns import statistics.
-func (a *App) GetImportSubscriberStats(c echo.Context) error {
+func (a *App) GetImportSubscriberStats(c *echo.Context) error {
return c.JSON(http.StatusOK, okResp{string(a.importer.GetLogs())})
}
// StopImportSubscribers sends a stop signal to the importer.
// If there's an ongoing import, it'll be stopped, and if an import
// is finished, it's state is cleared.
-func (a *App) StopImportSubscribers(c echo.Context) error {
+func (a *App) StopImportSubscribers(c *echo.Context) error {
a.importer.Stop()
return c.JSON(http.StatusOK, okResp{a.importer.GetStats()})
}
diff --git a/cmd/init.go b/cmd/init.go
index 69f816a8..a9a473b6 100644
--- a/cmd/init.go
+++ b/cmd/init.go
@@ -54,7 +54,7 @@ import (
"github.com/knadh/listmonk/internal/subimporter"
"github.com/knadh/listmonk/models"
"github.com/knadh/stuffbin"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
flag "github.com/spf13/pflag"
"golang.org/x/text/language"
@@ -991,15 +991,14 @@ func initAbout(q *models.Queries, db *sqlx.DB) about {
}
-// initHTTPServer sets up and runs the app's main HTTP server and blocks forever.
-func initHTTPServer(cfg *Config, urlCfg *UrlConfig, i *i18n.I18n, fs stuffbin.FileSystem, app *App) *echo.Echo {
+// initHTTPServer sets up and starts the app's main HTTP server.
+func initHTTPServer(cfg *Config, urlCfg *UrlConfig, i *i18n.I18n, fs stuffbin.FileSystem, app *App) *http.Server {
// Initialize the HTTP server.
var srv = echo.New()
- srv.HideBanner = true
// Register app (*App) to be injected into all HTTP handlers.
srv.Use(func(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
c.Set("app", app)
// Used for computing a request's finish time.
@@ -1080,8 +1079,9 @@ func initHTTPServer(cfg *Config, urlCfg *UrlConfig, i *i18n.I18n, fs stuffbin.Fi
initHTTPHandlers(srv, app)
// Start the server.
+ httpSrv := &http.Server{Addr: ko.String("app.address"), Handler: srv}
go func() {
- if err := srv.Start(ko.String("app.address")); err != nil {
+ if err := httpSrv.ListenAndServe(); err != nil {
if errors.Is(err, http.ErrServerClosed) {
lo.Println("HTTP server shut down")
} else {
@@ -1090,7 +1090,7 @@ func initHTTPServer(cfg *Config, urlCfg *UrlConfig, i *i18n.I18n, fs stuffbin.Fi
}
}()
- return srv
+ return httpSrv
}
// staticServer returns an http.Handler that serves static files from the stuffbin
@@ -1419,12 +1419,12 @@ func initAuth(co *core.Core, db *sql.DB, ko *koanf.Koanf) (bool, *auth.Auth) {
// Setup the sessio manager callbacks for getting and setting cookies.
cb := &auth.Callbacks{
GetCookie: func(name string, r any) (*http.Cookie, error) {
- c := r.(echo.Context)
+ c := r.(*echo.Context)
cookie, err := c.Cookie(name)
return cookie, err
},
SetCookie: func(cookie *http.Cookie, w any) error {
- c := w.(echo.Context)
+ c := w.(*echo.Context)
cookie.SameSite = http.SameSiteLaxMode
c.SetCookie(cookie)
return nil
diff --git a/cmd/lists.go b/cmd/lists.go
index aab98c77..ce92393c 100644
--- a/cmd/lists.go
+++ b/cmd/lists.go
@@ -8,7 +8,7 @@ import (
"github.com/jmoiron/sqlx/types"
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// listsQueryDefaults is the allow list of filter query params.
@@ -55,7 +55,7 @@ type publicListForm struct {
}
// GetLists retrieves lists with additional metadata like subscriber counts.
-func (a *App) GetLists(c echo.Context) error {
+func (a *App) GetLists(c *echo.Context) error {
lists, props, err := a.getLists(c)
if err != nil {
return err
@@ -72,7 +72,7 @@ func (a *App) GetLists(c echo.Context) error {
}
// ViewLists renders the HTML view for lists.
-func (a *App) ViewLists(c echo.Context) error {
+func (a *App) ViewLists(c *echo.Context) error {
lists, props, err := a.getLists(c)
if err != nil {
return err
@@ -94,7 +94,7 @@ func (a *App) ViewLists(c echo.Context) error {
}
// ViewNewList renders the new list page.
-func (a *App) ViewNewList(c echo.Context) error {
+func (a *App) ViewNewList(c *echo.Context) error {
data := listView{
adminView: newAdminView(c, fmt.Sprintf("%s / %s", a.i18n.T("lists.newList"), a.i18n.T("globals.terms.lists")), "", "lists.all"),
IsNew: true,
@@ -104,7 +104,7 @@ func (a *App) ViewNewList(c echo.Context) error {
}
// ViewList renders the list overview and editor.
-func (a *App) ViewList(c echo.Context) error {
+func (a *App) ViewList(c *echo.Context) error {
user := auth.GetUser(c)
// Check if the user has access to the list.
@@ -149,7 +149,7 @@ func (a *App) ViewList(c echo.Context) error {
}
// ViewForms renders the HTML view for the public subscription form generator.
-func (a *App) ViewForms(c echo.Context) error {
+func (a *App) ViewForms(c *echo.Context) error {
user := auth.GetUser(c)
hasAllPerm, permittedIDs := user.GetPermittedLists(auth.PermTypeGet)
lists, err := a.core.GetLists(models.ListTypePublic, models.ListStatusActive, hasAllPerm, permittedIDs)
@@ -178,7 +178,7 @@ func (a *App) ViewForms(c echo.Context) error {
}
// GetList retrieves a single list by id.
-func (a *App) GetList(c echo.Context) error {
+func (a *App) GetList(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -198,7 +198,7 @@ func (a *App) GetList(c echo.Context) error {
}
// CreateList handles list creation.
-func (a *App) CreateList(c echo.Context) error {
+func (a *App) CreateList(c *echo.Context) error {
l := models.List{}
if err := c.Bind(&l); err != nil {
return err
@@ -218,7 +218,7 @@ func (a *App) CreateList(c echo.Context) error {
}
// UpdateList handles list modification.
-func (a *App) UpdateList(c echo.Context) error {
+func (a *App) UpdateList(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -249,7 +249,7 @@ func (a *App) UpdateList(c echo.Context) error {
}
// DeleteList deletes a single list by ID.
-func (a *App) DeleteList(c echo.Context) error {
+func (a *App) DeleteList(c *echo.Context) error {
id := getID(c)
// Check if the user has manage permission for the list.
@@ -268,7 +268,7 @@ func (a *App) DeleteList(c echo.Context) error {
}
// DeleteLists deletes multiple lists by IDs or by query.
-func (a *App) DeleteLists(c echo.Context) error {
+func (a *App) DeleteLists(c *echo.Context) error {
user := auth.GetUser(c)
var (
@@ -330,7 +330,7 @@ func (a *App) DeleteLists(c echo.Context) error {
return c.JSON(http.StatusOK, okResp{true})
}
-func (a *App) getLists(c echo.Context) ([]models.List, models.PageProps, error) {
+func (a *App) getLists(c *echo.Context) ([]models.List, models.PageProps, error) {
q := makeQuery(c.Request().URL.Query(), listsQueryDefaults)
if err := a.validateListFilters(q.Get("type"), q.Get("optin"), q.Get("status")); err != nil {
return nil, models.PageProps{}, err
diff --git a/cmd/maintenance.go b/cmd/maintenance.go
index c8a09794..261be580 100644
--- a/cmd/maintenance.go
+++ b/cmd/maintenance.go
@@ -9,7 +9,7 @@ import (
"github.com/jmoiron/sqlx"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// maintenanceView is the admin page view for the maintenance/garbage-collection page.
@@ -23,7 +23,7 @@ type maintenanceView struct {
}
// ViewMaintenance renders the HTML view for the maintenance page.
-func (a *App) ViewMaintenance(c echo.Context) error {
+func (a *App) ViewMaintenance(c *echo.Context) error {
s, err := a.core.GetSettings()
if err != nil {
return err
@@ -39,7 +39,7 @@ func (a *App) ViewMaintenance(c echo.Context) error {
}
// GCSubscribers garbage collects (deletes) orphaned or blocklisted subscribers.
-func (a *App) GCSubscribers(c echo.Context) error {
+func (a *App) GCSubscribers(c *echo.Context) error {
var (
typ = c.Param("type")
@@ -66,7 +66,7 @@ func (a *App) GCSubscribers(c echo.Context) error {
}
// GCSubscriptions garbage collects (deletes) orphaned or blocklisted subscribers.
-func (a *App) GCSubscriptions(c echo.Context) error {
+func (a *App) GCSubscriptions(c *echo.Context) error {
// Validate the date.
t, err := time.Parse(time.RFC3339, c.FormValue("before_date"))
if err != nil {
@@ -85,7 +85,7 @@ func (a *App) GCSubscriptions(c echo.Context) error {
}
// GCCampaignAnalytics garbage collects (deletes) campaign analytics.
-func (a *App) GCCampaignAnalytics(c echo.Context) error {
+func (a *App) GCCampaignAnalytics(c *echo.Context) error {
t, err := time.Parse(time.RFC3339, c.FormValue("before_date"))
if err != nil {
@@ -114,7 +114,7 @@ func (a *App) GCCampaignAnalytics(c echo.Context) error {
}
// ExportCampaignAnalytics streams campaign analytics (views or link clicks) as a CSV file.
-func (a *App) ExportCampaignAnalytics(c echo.Context) error {
+func (a *App) ExportCampaignAnalytics(c *echo.Context) error {
since, err := time.Parse(time.RFC3339, c.QueryParam("since"))
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("globals.messages.invalidData"))
diff --git a/cmd/media.go b/cmd/media.go
index 5032b5af..3d8aad7c 100644
--- a/cmd/media.go
+++ b/cmd/media.go
@@ -10,7 +10,7 @@ import (
"github.com/disintegration/imaging"
"github.com/knadh/listmonk/internal/media"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
const (
@@ -33,7 +33,7 @@ type mediaView struct {
}
// ViewMedia renders the HTML gallery view for uploaded media.
-func (a *App) ViewMedia(c echo.Context) error {
+func (a *App) ViewMedia(c *echo.Context) error {
res, props, err := a.getMedia(c)
if err != nil {
return err
@@ -50,7 +50,7 @@ func (a *App) ViewMedia(c echo.Context) error {
}
// ViewMediaFragment renders the header/footer-less media gallery for in iframes (popup dialogs).
-func (a *App) ViewMediaFragment(c echo.Context) error {
+func (a *App) ViewMediaFragment(c *echo.Context) error {
res, props, err := a.getMedia(c)
if err != nil {
return err
@@ -74,7 +74,7 @@ var mediaQueryDefaults = map[string]string{
}
// getMedia queries paginated media items from the DB.
-func (a *App) getMedia(c echo.Context) ([]media.Media, models.PageProps, error) {
+func (a *App) getMedia(c *echo.Context) ([]media.Media, models.PageProps, error) {
q := makeQuery(c.Request().URL.Query(), mediaQueryDefaults)
pg := a.pg.NewFromURL(q)
@@ -87,7 +87,7 @@ func (a *App) getMedia(c echo.Context) ([]media.Media, models.PageProps, error)
}
// UploadMedia handles media file uploads.
-func (a *App) UploadMedia(c echo.Context) error {
+func (a *App) UploadMedia(c *echo.Context) error {
file, err := c.FormFile("file")
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest,
@@ -204,7 +204,7 @@ func (a *App) UploadMedia(c echo.Context) error {
}
// GetAllMedia handles retrieval of uploaded media.
-func (a *App) GetAllMedia(c echo.Context) error {
+func (a *App) GetAllMedia(c *echo.Context) error {
var (
query = c.FormValue("query")
@@ -229,7 +229,7 @@ func (a *App) GetAllMedia(c echo.Context) error {
}
// GetMedia handles retrieval of a media item by ID.
-func (a *App) GetMedia(c echo.Context) error {
+func (a *App) GetMedia(c *echo.Context) error {
// Fetch the media item from the DB.
id := getID(c)
out, err := a.core.GetMedia(id, "", "", a.media)
@@ -241,7 +241,7 @@ func (a *App) GetMedia(c echo.Context) error {
}
// DeleteMedia handles deletion of uploaded media.
-func (a *App) DeleteMedia(c echo.Context) error {
+func (a *App) DeleteMedia(c *echo.Context) error {
// Delete the media from the DB. The query returns the filename.
id := getID(c)
@@ -258,7 +258,7 @@ func (a *App) DeleteMedia(c echo.Context) error {
}
// ServeS3Media serves media files stored in S3 when the public URL is a relative path.
-func (a *App) ServeS3Media(c echo.Context) error {
+func (a *App) ServeS3Media(c *echo.Context) error {
key := c.Param("filepath")
if key == "" {
return echo.NewHTTPError(http.StatusBadRequest, "missing media file path")
diff --git a/cmd/public.go b/cmd/public.go
index f76ca67e..f0952957 100644
--- a/cmd/public.go
+++ b/cmd/public.go
@@ -19,7 +19,7 @@ import (
"github.com/knadh/listmonk/internal/manager"
"github.com/knadh/listmonk/internal/notifs"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
@@ -143,7 +143,7 @@ var (
)
// Render executes and renders a template for echo.
-func (t *pubTplRenderer) Render(w io.Writer, name string, data any, c echo.Context) error {
+func (t *pubTplRenderer) Render(c *echo.Context, w io.Writer, name string, data any) error {
return t.templates.ExecuteTemplate(w, name, tplData{
SiteName: t.SiteName,
RootURL: t.RootURL,
@@ -160,7 +160,7 @@ func (t *pubTplRenderer) Render(w io.Writer, name string, data any, c echo.Conte
}
// Render executes and renders an admin template for echo.
-func (t *adminTplRenderer) Render(w io.Writer, name string, data any, c echo.Context) error {
+func (t *adminTplRenderer) Render(c *echo.Context, w io.Writer, name string, data any) error {
app := c.Get("app").(*App)
configJS, err := app.makeServerConfig()
if err != nil {
@@ -190,12 +190,12 @@ func (t *adminTplRenderer) Render(w io.Writer, name string, data any, c echo.Con
}
// Render routes template execution to admin or public templates.
-func (t *appTplRenderer) Render(w io.Writer, name string, data any, c echo.Context) error {
+func (t *appTplRenderer) Render(c *echo.Context, w io.Writer, name string, data any) error {
if t.AdminRenderer != nil && t.AdminRenderer.templates.Lookup(name) != nil {
- return t.AdminRenderer.Render(w, name, data, c)
+ return t.AdminRenderer.Render(c, w, name, data)
}
- return t.PubRenderer.Render(w, name, data, c)
+ return t.PubRenderer.Render(c, w, name, data)
}
func jsonForTpl(v any) template.JS {
@@ -205,7 +205,7 @@ func jsonForTpl(v any) template.JS {
// GetPublicLists returns the list of public lists with minimal fields
// required to submit a subscription.
-func (a *App) GetPublicLists(c echo.Context) error {
+func (a *App) GetPublicLists(c *echo.Context) error {
// Get all public lists.
lists, err := a.core.GetLists(models.ListTypePublic, models.ListStatusActive, true, nil)
if err != nil {
@@ -230,7 +230,7 @@ func (a *App) GetPublicLists(c echo.Context) error {
// ViewCampaignMessage renders the HTML view of a campaign message.
// This is the view the {{ MessageURL }} template tag links to in e-mail campaigns.
-func (a *App) ViewCampaignMessage(c echo.Context) error {
+func (a *App) ViewCampaignMessage(c *echo.Context) error {
// Get the campaign.
campUUID := c.Param("campUUID")
camp, err := a.core.GetCampaign(0, campUUID, "")
@@ -282,7 +282,7 @@ func (a *App) ViewCampaignMessage(c echo.Context) error {
// SubscriptionPage renders the subscription management page and handles unsubscriptions.
// This is the view that {{ UnsubscribeURL }} in campaigns link to.
-func (a *App) SubscriptionPage(c echo.Context) error {
+func (a *App) SubscriptionPage(c *echo.Context) error {
var (
subUUID = c.Param("subUUID")
showManage, _ = strconv.ParseBool(c.FormValue("manage"))
@@ -338,7 +338,7 @@ func (a *App) SubscriptionPage(c echo.Context) error {
// SubscriptionPrefs renders the subscription management page and
// s unsubscriptions. This is the view that {{ UnsubscribeURL }} in
// campaigns link to.
-func (a *App) SubscriptionPrefs(c echo.Context) error {
+func (a *App) SubscriptionPrefs(c *echo.Context) error {
// Read the form.
var req struct {
Name string `form:"name" json:"name"`
@@ -433,7 +433,7 @@ func (a *App) SubscriptionPrefs(c echo.Context) error {
// OptinPage renders the double opt-in confirmation page that subscribers
// see when they click on the "Confirm subscription" button in double-optin
// notifications.
-func (a *App) OptinPage(c echo.Context) error {
+func (a *App) OptinPage(c *echo.Context) error {
var (
subUUID = c.Param("subUUID")
confirm, _ = strconv.ParseBool(c.FormValue("confirm"))
@@ -478,7 +478,7 @@ func (a *App) OptinPage(c echo.Context) error {
return c.Render(http.StatusOK, "optin", out)
}
-func (a *App) confirmOptinSubscription(c echo.Context, subUUID string, listUUIDs []string, lists []models.List) error {
+func (a *App) confirmOptinSubscription(c *echo.Context, subUUID string, listUUIDs []string, lists []models.List) error {
if len(listUUIDs) == 0 {
listUUIDs = make([]string, 0, len(lists))
for _, l := range lists {
@@ -507,7 +507,7 @@ func (a *App) confirmOptinSubscription(c echo.Context, subUUID string, listUUIDs
// SubscriptionFormPage handles subscription requests coming from public
// HTML subscription forms.
-func (a *App) SubscriptionFormPage(c echo.Context) error {
+func (a *App) SubscriptionFormPage(c *echo.Context) error {
if !a.cfg.EnablePublicSubPage {
return c.Render(http.StatusNotFound, tplMessage,
makeMsgTpl(a.i18n.T("globals.terms.error"), "", a.i18n.Ts("public.invalidFeature")))
@@ -546,7 +546,7 @@ func (a *App) SubscriptionFormPage(c echo.Context) error {
// SubscriptionForm handles subscription requests coming from public
// HTML subscription forms.
-func (a *App) SubscriptionForm(c echo.Context) error {
+func (a *App) SubscriptionForm(c *echo.Context) error {
if !a.cfg.EnablePublicSubPage {
return echo.NewHTTPError(http.StatusNotFound, a.i18n.T("public.invalidFeature"))
@@ -619,7 +619,7 @@ func (a *App) SubscriptionForm(c echo.Context) error {
// PublicSubscription handles subscription requests coming from public
// API calls.
-func (a *App) PublicSubscription(c echo.Context) error {
+func (a *App) PublicSubscription(c *echo.Context) error {
if !a.cfg.EnablePublicSubPage {
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("public.invalidFeature"))
}
@@ -637,7 +637,7 @@ func (a *App) PublicSubscription(c echo.Context) error {
// LinkRedirect redirects a link UUID to its original underlying link
// after recording the link click for a particular subscriber in the particular
// campaign. These links are generated by {{ TrackLink }} tags in campaigns.
-func (a *App) LinkRedirect(c echo.Context) error {
+func (a *App) LinkRedirect(c *echo.Context) error {
var (
linkUUID = c.Param("linkUUID")
campUUID = c.Param("campUUID")
@@ -672,7 +672,7 @@ func (a *App) LinkRedirect(c echo.Context) error {
// the form of an pixel image request. Regardless of errors, this handler
// should always render the pixel image bytes. The pixel URL is generated by
// the {{ TrackView }} template tag in campaigns.
-func (a *App) RegisterCampaignView(c echo.Context) error {
+func (a *App) RegisterCampaignView(c *echo.Context) error {
// If tracking is globally disabled, return the pixel without recording.
if a.cfg.Privacy.DisableTracking {
c.Response().Header().Set("Cache-Control", "no-cache")
@@ -701,7 +701,7 @@ func (a *App) RegisterCampaignView(c echo.Context) error {
// campaign views and clicks and produces a JSON report that is then e-mailed
// to the subscriber. This is a privacy feature and the data that's exported
// is dependent on the configuration.
-func (a *App) SelfExportSubscriberData(c echo.Context) error {
+func (a *App) SelfExportSubscriberData(c *echo.Context) error {
// Is export allowed?
if !a.cfg.Privacy.AllowExport {
return c.Render(http.StatusBadRequest, tplMessage,
@@ -757,7 +757,7 @@ func (a *App) SelfExportSubscriberData(c echo.Context) error {
// WipeSubscriberData allows a subscriber to delete their data. The
// profile and subscriptions are deleted, while the campaign_views and link
// clicks remain as orphan data unconnected to any subscriber.
-func (a *App) WipeSubscriberData(c echo.Context) error {
+func (a *App) WipeSubscriberData(c *echo.Context) error {
// Is wiping allowed?
if !a.cfg.Privacy.AllowWipe {
return c.Render(http.StatusBadRequest, tplMessage,
@@ -776,7 +776,7 @@ func (a *App) WipeSubscriberData(c echo.Context) error {
}
// AltchaChallenge generates a challenge for Altcha captcha.
-func (a *App) AltchaChallenge(c echo.Context) error {
+func (a *App) AltchaChallenge(c *echo.Context) error {
// Check if Altcha is enabled.
if !a.captcha.IsEnabled() || a.captcha.GetProvider() != captcha.ProviderAltcha {
return echo.NewHTTPError(http.StatusNotFound, "captcha not enabled")
@@ -809,7 +809,7 @@ func drawTransparentImage(h, w int) []byte {
// processSubForm processes an incoming form/public API subscription request.
// The bool indicates whether there was subscription to an optin list so that
// an appropriate message can be shown.
-func (a *App) processSubForm(c echo.Context) (bool, error) {
+func (a *App) processSubForm(c *echo.Context) (bool, error) {
// Get and validate fields.
var req struct {
Name string `form:"name" json:"name"`
diff --git a/cmd/roles.go b/cmd/roles.go
index 96c0cf45..6b3ff674 100644
--- a/cmd/roles.go
+++ b/cmd/roles.go
@@ -8,7 +8,7 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"gopkg.in/volatiletech/null.v6"
)
@@ -53,7 +53,7 @@ type roleFormView struct {
}
// ViewUserRoles renders the HTML view listing user roles.
-func (a *App) ViewUserRoles(c echo.Context) error {
+func (a *App) ViewUserRoles(c *echo.Context) error {
q := makeQuery(c.Request().URL.Query(), rolesQueryDefaults)
roles, err := a.core.GetRoles(q.Get("query"), q.Get("order_by"), q.Get("order"))
if err != nil {
@@ -76,7 +76,7 @@ func (a *App) ViewUserRoles(c echo.Context) error {
}
// ViewListRoles renders the HTML view listing list roles.
-func (a *App) ViewListRoles(c echo.Context) error {
+func (a *App) ViewListRoles(c *echo.Context) error {
q := makeQuery(c.Request().URL.Query(), rolesQueryDefaults)
roles, err := a.core.GetListRoles(q.Get("query"), q.Get("order_by"), q.Get("order"))
if err != nil {
@@ -99,7 +99,7 @@ func (a *App) ViewListRoles(c echo.Context) error {
}
// ViewUserRole renders the HTML add/edit form for a user role.
-func (a *App) ViewUserRole(c echo.Context) error {
+func (a *App) ViewUserRole(c *echo.Context) error {
var (
role auth.Role
isNew = true
@@ -135,7 +135,7 @@ func (a *App) ViewUserRole(c echo.Context) error {
}
// ViewListRole renders the HTML add/edit form for a list role.
-func (a *App) ViewListRole(c echo.Context) error {
+func (a *App) ViewListRole(c *echo.Context) error {
var (
role auth.ListRole
isNew = true
@@ -193,7 +193,7 @@ func (a *App) parsePermGroups() ([]permGroup, error) {
}
// GetUserRoles retrieves roles.
-func (a *App) GetUserRoles(c echo.Context) error {
+func (a *App) GetUserRoles(c *echo.Context) error {
// Get all roles.
out, err := a.core.GetRoles(c.QueryParam("query"), c.QueryParam("order_by"), c.QueryParam("order"))
if err != nil {
@@ -204,7 +204,7 @@ func (a *App) GetUserRoles(c echo.Context) error {
}
// GeListRoles retrieves roles.
-func (a *App) GeListRoles(c echo.Context) error {
+func (a *App) GeListRoles(c *echo.Context) error {
// Get all roles.
out, err := a.core.GetListRoles(c.QueryParam("query"), c.QueryParam("order_by"), c.QueryParam("order"))
if err != nil {
@@ -215,7 +215,7 @@ func (a *App) GeListRoles(c echo.Context) error {
}
// CreateUserRole handles role creation.
-func (a *App) CreateUserRole(c echo.Context) error {
+func (a *App) CreateUserRole(c *echo.Context) error {
var r auth.Role
if err := c.Bind(&r); err != nil {
return err
@@ -234,7 +234,7 @@ func (a *App) CreateUserRole(c echo.Context) error {
}
// CreateListRole handles role creation.
-func (a *App) CreateListRole(c echo.Context) error {
+func (a *App) CreateListRole(c *echo.Context) error {
var r auth.ListRole
if err := c.Bind(&r); err != nil {
return err
@@ -253,7 +253,7 @@ func (a *App) CreateListRole(c echo.Context) error {
}
// UpdateUserRole handles role modification.
-func (a *App) UpdateUserRole(c echo.Context) error {
+func (a *App) UpdateUserRole(c *echo.Context) error {
id := getID(c)
// ID 1 is reserved for the Super Admin user role.
@@ -288,7 +288,7 @@ func (a *App) UpdateUserRole(c echo.Context) error {
}
// UpdateListRole handles role modification.
-func (a *App) UpdateListRole(c echo.Context) error {
+func (a *App) UpdateListRole(c *echo.Context) error {
// Get the role ID.
id := getID(c)
@@ -325,7 +325,7 @@ func (a *App) UpdateListRole(c echo.Context) error {
}
// DeleteRole handles (user|list) role deletion.
-func (a *App) DeleteRole(c echo.Context) error {
+func (a *App) DeleteRole(c *echo.Context) error {
// Get the role ID.
id := getID(c)
diff --git a/cmd/settings.go b/cmd/settings.go
index 7763a463..89c012a3 100644
--- a/cmd/settings.go
+++ b/cmd/settings.go
@@ -24,7 +24,7 @@ import (
"github.com/knadh/listmonk/internal/messenger/email"
"github.com/knadh/listmonk/internal/notifs"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
const pwdMask = "•"
@@ -56,7 +56,7 @@ var (
)
// GetSettings returns settings from the DB.
-func (a *App) GetSettings(c echo.Context) error {
+func (a *App) GetSettings(c *echo.Context) error {
s, err := a.core.GetSettings()
if err != nil {
return err
@@ -107,7 +107,7 @@ type settingsView struct {
}
// ViewSettings renders the HTML view for the settings form.
-func (a *App) ViewSettings(c echo.Context) error {
+func (a *App) ViewSettings(c *echo.Context) error {
s, err := a.core.GetSettings()
if err != nil {
return err
@@ -146,7 +146,7 @@ func (a *App) ViewSettings(c echo.Context) error {
}
// UpdateSettings returns settings from the DB.
-func (a *App) UpdateSettings(c echo.Context) error {
+func (a *App) UpdateSettings(c *echo.Context) error {
// Unmarshal and marshal the fields once to sanitize the settings blob.
var set models.Settings
if err := c.Bind(&set); err != nil {
@@ -392,7 +392,7 @@ func (a *App) UpdateSettings(c echo.Context) error {
}
// UpdateSettingsByKey updates a single setting key-value in the DB.
-func (a *App) UpdateSettingsByKey(c echo.Context) error {
+func (a *App) UpdateSettingsByKey(c *echo.Context) error {
key := c.Param("key")
if key == "" {
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("globals.messages.invalidData"))
@@ -442,7 +442,7 @@ func (a *App) validateOIDCSettings(set models.Settings) error {
// handleSettingsRestart checks for running campaigns and either triggers an
// immediate app restart or marks the app as needing a restart.
-func (a *App) handleSettingsRestart(c echo.Context) error {
+func (a *App) handleSettingsRestart(c *echo.Context) error {
// If there are any active campaigns, don't do an auto reload and
// warn the user on the frontend.
if a.manager.HasRunningCampaigns() {
@@ -472,7 +472,7 @@ type logsView struct {
}
// ViewLogs renders the HTML view for the application log viewer.
-func (a *App) ViewLogs(c echo.Context) error {
+func (a *App) ViewLogs(c *echo.Context) error {
data := logsView{
adminView: newAdminView(c, a.i18n.T("globals.terms.logs"), "", "settings.logs"),
Lines: a.bufLog.Lines(),
@@ -482,12 +482,12 @@ func (a *App) ViewLogs(c echo.Context) error {
}
// GetLogs returns the log entries stored in the log buffer.
-func (a *App) GetLogs(c echo.Context) error {
+func (a *App) GetLogs(c *echo.Context) error {
return c.JSON(http.StatusOK, okResp{a.bufLog.Lines()})
}
// TestSMTPSettings returns the log entries stored in the log buffer.
-func (a *App) TestSMTPSettings(c echo.Context) error {
+func (a *App) TestSMTPSettings(c *echo.Context) error {
// Copy the raw JSON post body.
reqBody, err := io.ReadAll(c.Request().Body)
if err != nil {
@@ -542,7 +542,7 @@ func (a *App) TestSMTPSettings(c echo.Context) error {
return c.JSON(http.StatusOK, okResp{a.bufLog.Lines()})
}
-func (a *App) GetAboutInfo(c echo.Context) error {
+func (a *App) GetAboutInfo(c *echo.Context) error {
var mem runtime.MemStats
runtime.ReadMemStats(&mem)
diff --git a/cmd/subscribers.go b/cmd/subscribers.go
index 69cad48f..fd59d5ed 100644
--- a/cmd/subscribers.go
+++ b/cmd/subscribers.go
@@ -17,7 +17,7 @@ import (
"github.com/knadh/listmonk/internal/notifs"
"github.com/knadh/listmonk/internal/subimporter"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
@@ -117,7 +117,7 @@ type subLinkClick struct {
}
// ViewSubscribers renders the HTML view for subscribers, optionally filtered by a list.
-func (a *App) ViewSubscribers(c echo.Context) error {
+func (a *App) ViewSubscribers(c *echo.Context) error {
listID, _ := strconv.Atoi(c.Param("id"))
if listID > 0 {
user := auth.GetUser(c)
@@ -157,7 +157,7 @@ func (a *App) ViewSubscribers(c echo.Context) error {
}
// ViewNewSubscriber renders the new subscriber page.
-func (a *App) ViewNewSubscriber(c echo.Context) error {
+func (a *App) ViewNewSubscriber(c *echo.Context) error {
allLists, err := a.getViewableLists(c)
if err != nil {
return err
@@ -173,7 +173,7 @@ func (a *App) ViewNewSubscriber(c echo.Context) error {
}
// ViewSubscriber renders the profile and subscriptions tabs of a subscriber.
-func (a *App) ViewSubscriber(c echo.Context) error {
+func (a *App) ViewSubscriber(c *echo.Context) error {
out, err := a.getViewSubscriber(c)
if err != nil {
return err
@@ -200,7 +200,7 @@ func (a *App) ViewSubscriber(c echo.Context) error {
}
// ViewSubscriberBounces renders the bounces tab of a subscriber.
-func (a *App) ViewSubscriberBounces(c echo.Context) error {
+func (a *App) ViewSubscriberBounces(c *echo.Context) error {
out, err := a.getViewSubscriber(c)
if err != nil {
return err
@@ -222,7 +222,7 @@ func (a *App) ViewSubscriberBounces(c echo.Context) error {
}
// ViewSubscriberInfo renders the activity tab (campaign views and link clicks) of a subscriber.
-func (a *App) ViewSubscriberInfo(c echo.Context) error {
+func (a *App) ViewSubscriberInfo(c *echo.Context) error {
out, err := a.getViewSubscriber(c)
if err != nil {
return err
@@ -258,7 +258,7 @@ func (a *App) ViewSubscriberInfo(c echo.Context) error {
}
// getViewSubscriber fetches the subscriber in the request path after validating permissions.
-func (a *App) getViewSubscriber(c echo.Context) (models.Subscriber, error) {
+func (a *App) getViewSubscriber(c *echo.Context) (models.Subscriber, error) {
user := auth.GetUser(c)
id := getID(c)
@@ -276,7 +276,7 @@ func (a *App) getViewSubscriber(c echo.Context) (models.Subscriber, error) {
}
// getViewableLists returns all active lists the user has access to.
-func (a *App) getViewableLists(c echo.Context) ([]models.List, error) {
+func (a *App) getViewableLists(c *echo.Context) ([]models.List, error) {
user := auth.GetUser(c)
hasAllPerm, permittedIDs := user.GetPermittedLists(auth.PermTypeGet)
@@ -285,10 +285,10 @@ func (a *App) getViewableLists(c echo.Context) ([]models.List, error) {
// getSubscribers queries subscribers from query params for the HTML view. If listID > 0,
// results are filtered by that list (the per-list subscribers view).
-func (a *App) getSubscribers(c echo.Context, listID int) ([]models.Subscriber, models.PageProps, error) {
+func (a *App) getSubscribers(c *echo.Context, listID int) ([]models.Subscriber, models.PageProps, error) {
// GET and POST are both supported. `query` (SQL query) is sent by the frontend
// as a POST form param.
- params, err := c.FormParams()
+ params, err := c.FormValues()
if err != nil {
return nil, models.PageProps{}, err
}
@@ -341,7 +341,7 @@ func (a *App) getSubscribers(c echo.Context, listID int) ([]models.Subscriber, m
}
// GetSubscriber handles the retrieval of a single subscriber by ID.
-func (a *App) GetSubscriber(c echo.Context) error {
+func (a *App) GetSubscriber(c *echo.Context) error {
user := auth.GetUser(c)
// Check if the user has access to at least one of the lists on the subscriber.
@@ -362,7 +362,7 @@ func (a *App) GetSubscriber(c echo.Context) error {
}
// GetSubscriberActivity handles the retrieval of a subscriber's campaign views and link clicks.
-func (a *App) GetSubscriberActivity(c echo.Context) error {
+func (a *App) GetSubscriberActivity(c *echo.Context) error {
user := auth.GetUser(c)
// Check if the user has access to at least one of the lists on the subscriber.
@@ -381,7 +381,7 @@ func (a *App) GetSubscriberActivity(c echo.Context) error {
}
// DeleteSubscriberActivity deletes a subscriber's campaign views or link clicks.
-func (a *App) DeleteSubscriberActivity(c echo.Context) error {
+func (a *App) DeleteSubscriberActivity(c *echo.Context) error {
id := getID(c)
if err := a.hasSubPerm(auth.GetUser(c), auth.PermTypeManage, []int{id}); err != nil {
return err
@@ -395,7 +395,7 @@ func (a *App) DeleteSubscriberActivity(c echo.Context) error {
}
// QuerySubscribers handles querying subscribers based on an arbitrary SQL expression.
-func (a *App) QuerySubscribers(c echo.Context) error {
+func (a *App) QuerySubscribers(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -448,7 +448,7 @@ func (a *App) QuerySubscribers(c echo.Context) error {
}
// ExportSubscribers handles querying subscribers based on an arbitrary SQL expression.
-func (a *App) ExportSubscribers(c echo.Context) error {
+func (a *App) ExportSubscribers(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -524,7 +524,7 @@ loop:
}
// CreateSubscriber handles the creation of a new subscriber.
-func (a *App) CreateSubscriber(c echo.Context) error {
+func (a *App) CreateSubscriber(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -561,7 +561,7 @@ func (a *App) CreateSubscriber(c echo.Context) error {
}
// UpdateSubscriber handles modification of a subscriber.
-func (a *App) UpdateSubscriber(c echo.Context) error {
+func (a *App) UpdateSubscriber(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -624,7 +624,7 @@ func (a *App) UpdateSubscriber(c echo.Context) error {
// PatchSubscriber handles partially modifying a subscriber.
// Only fields present in the request body are updated.
-func (a *App) PatchSubscriber(c echo.Context) error {
+func (a *App) PatchSubscriber(c *echo.Context) error {
user := auth.GetUser(c)
id := getID(c)
@@ -695,7 +695,7 @@ func (a *App) PatchSubscriber(c echo.Context) error {
}
// SubscriberSendOptin sends an optin confirmation e-mail to a subscriber.
-func (a *App) SubscriberSendOptin(c echo.Context) error {
+func (a *App) SubscriberSendOptin(c *echo.Context) error {
user := auth.GetUser(c)
// Fetch the subscriber.
@@ -718,7 +718,7 @@ func (a *App) SubscriberSendOptin(c echo.Context) error {
}
// BlocklistSubscriber handles the blocklisting of a given subscriber.
-func (a *App) BlocklistSubscriber(c echo.Context) error {
+func (a *App) BlocklistSubscriber(c *echo.Context) error {
user := auth.GetUser(c)
// Update the subscribers in the DB.
@@ -735,7 +735,7 @@ func (a *App) BlocklistSubscriber(c echo.Context) error {
}
// BlocklistSubscribers handles the blocklisting of one or more subscribers.
-func (a *App) BlocklistSubscribers(c echo.Context) error {
+func (a *App) BlocklistSubscribers(c *echo.Context) error {
user := auth.GetUser(c)
var req subQueryReq
@@ -763,7 +763,7 @@ func (a *App) BlocklistSubscribers(c echo.Context) error {
// ManageSubscriberLists handles bulk addition or removal of subscribers
// from or to one or more target lists.
// It takes either an ID in the URI, or a list of IDs in the request body.
-func (a *App) ManageSubscriberLists(c echo.Context) error {
+func (a *App) ManageSubscriberLists(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -831,7 +831,7 @@ func (a *App) ManageSubscriberLists(c echo.Context) error {
}
// DeleteSubscriber handles deletion of a single subscriber.
-func (a *App) DeleteSubscriber(c echo.Context) error {
+func (a *App) DeleteSubscriber(c *echo.Context) error {
user := auth.GetUser(c)
// Delete the subscribers from the DB.
@@ -848,7 +848,7 @@ func (a *App) DeleteSubscriber(c echo.Context) error {
}
// DeleteSubscribers handles bulk deletion of one or more subscribers.
-func (a *App) DeleteSubscribers(c echo.Context) error {
+func (a *App) DeleteSubscribers(c *echo.Context) error {
user := auth.GetUser(c)
// Multiple IDs.
@@ -876,7 +876,7 @@ func (a *App) DeleteSubscribers(c echo.Context) error {
// DeleteSubscribersByQuery bulk deletes based on an
// arbitrary SQL expression.
-func (a *App) DeleteSubscribersByQuery(c echo.Context) error {
+func (a *App) DeleteSubscribersByQuery(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -912,7 +912,7 @@ func (a *App) DeleteSubscribersByQuery(c echo.Context) error {
// BlocklistSubscribersByQuery bulk blocklists subscribers
// based on an arbitrary SQL expression.
-func (a *App) BlocklistSubscribersByQuery(c echo.Context) error {
+func (a *App) BlocklistSubscribersByQuery(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -947,7 +947,7 @@ func (a *App) BlocklistSubscribersByQuery(c echo.Context) error {
// ManageSubscriberListsByQuery bulk adds/removes/unsubscribes subscribers
// from one or more lists based on an arbitrary SQL expression.
-func (a *App) ManageSubscriberListsByQuery(c echo.Context) error {
+func (a *App) ManageSubscriberListsByQuery(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -1002,7 +1002,7 @@ func (a *App) ManageSubscriberListsByQuery(c echo.Context) error {
}
// DeleteSubscriberBounces deletes all the bounces on a subscriber.
-func (a *App) DeleteSubscriberBounces(c echo.Context) error {
+func (a *App) DeleteSubscriberBounces(c *echo.Context) error {
id := getID(c)
// Check if the user has access to at least one of the lists on the subscriber.
@@ -1022,7 +1022,7 @@ func (a *App) DeleteSubscriberBounces(c echo.Context) error {
// list subscriptions, campaign views and clicks and produces
// a JSON report. This is a privacy feature and depends on the
// configuration in a.Constants.Privacy.
-func (a *App) ExportSubscriberData(c echo.Context) error {
+func (a *App) ExportSubscriberData(c *echo.Context) error {
// Get the subscriber's data. A single query that gets the profile,
// list subscriptions, campaign views, and link clicks. Names of
// private lists are replaced with "Private list".
diff --git a/cmd/templates.go b/cmd/templates.go
index d5934127..d4bf901c 100644
--- a/cmd/templates.go
+++ b/cmd/templates.go
@@ -8,7 +8,7 @@ import (
"strings"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
const (
@@ -56,7 +56,7 @@ type templateView struct {
}
// ViewTemplates renders the HTML list view for templates.
-func (a *App) ViewTemplates(c echo.Context) error {
+func (a *App) ViewTemplates(c *echo.Context) error {
q := makeQuery(c.Request().URL.Query(), templatesQueryDefaults)
typ := q.Get("type")
@@ -76,7 +76,7 @@ func (a *App) ViewTemplates(c echo.Context) error {
}
// ViewNewTemplate renders the new template page.
-func (a *App) ViewNewTemplate(c echo.Context) error {
+func (a *App) ViewNewTemplate(c *echo.Context) error {
data := templateView{
adminView: newAdminView(c, a.i18n.T("templates.newTemplate")+" / "+a.i18n.T("globals.terms.templates"), "", "campaigns.templates"),
IsNew: true,
@@ -87,7 +87,7 @@ func (a *App) ViewNewTemplate(c echo.Context) error {
}
// ViewTemplate renders the single-page editor for an existing template.
-func (a *App) ViewTemplate(c echo.Context) error {
+func (a *App) ViewTemplate(c *echo.Context) error {
id := getID(c)
out, err := a.core.GetTemplate(id, false)
if err != nil {
@@ -103,7 +103,7 @@ func (a *App) ViewTemplate(c echo.Context) error {
}
// GetTemplate handles the retrieval of a template
-func (a *App) GetTemplate(c echo.Context) error {
+func (a *App) GetTemplate(c *echo.Context) error {
// If no_body is true, blank out the body of the template from the response.
noBody, _ := strconv.ParseBool(c.QueryParam("no_body"))
@@ -118,7 +118,7 @@ func (a *App) GetTemplate(c echo.Context) error {
}
// GetTemplates handles retrieval of templates.
-func (a *App) GetTemplates(c echo.Context) error {
+func (a *App) GetTemplates(c *echo.Context) error {
// If no_body is true, blank out the body of the template from the response.
noBody, _ := strconv.ParseBool(c.QueryParam("no_body"))
@@ -132,7 +132,7 @@ func (a *App) GetTemplates(c echo.Context) error {
}
// PreviewTemplate renders the HTML preview of a template in the DB.
-func (a *App) PreviewTemplate(c echo.Context) error {
+func (a *App) PreviewTemplate(c *echo.Context) error {
// Fetch one template from the DB.
id := getID(c)
tpl, err := a.core.GetTemplate(id, false)
@@ -150,7 +150,7 @@ func (a *App) PreviewTemplate(c echo.Context) error {
}
// PreviewTemplateBody renders the HTML preview of a template given its type and body.
-func (a *App) PreviewTemplateBody(c echo.Context) error {
+func (a *App) PreviewTemplateBody(c *echo.Context) error {
tpl := models.Template{
Type: c.FormValue("template_type"),
Body: c.FormValue("body"),
@@ -176,7 +176,7 @@ func (a *App) PreviewTemplateBody(c echo.Context) error {
}
// CreateTemplate handles template creation.
-func (a *App) CreateTemplate(c echo.Context) error {
+func (a *App) CreateTemplate(c *echo.Context) error {
var o models.Template
if err := c.Bind(&o); err != nil {
return err
@@ -220,7 +220,7 @@ func (a *App) CreateTemplate(c echo.Context) error {
}
// UpdateTemplate handles template modification.
-func (a *App) UpdateTemplate(c echo.Context) error {
+func (a *App) UpdateTemplate(c *echo.Context) error {
var o models.Template
if err := c.Bind(&o); err != nil {
return err
@@ -261,7 +261,7 @@ func (a *App) UpdateTemplate(c echo.Context) error {
}
// TemplateSetDefault handles template modification.
-func (a *App) TemplateSetDefault(c echo.Context) error {
+func (a *App) TemplateSetDefault(c *echo.Context) error {
// Update the template in the DB.
id := getID(c)
if err := a.core.SetDefaultTemplate(id); err != nil {
@@ -272,7 +272,7 @@ func (a *App) TemplateSetDefault(c echo.Context) error {
}
// DeleteTemplate handles template deletion.
-func (a *App) DeleteTemplate(c echo.Context) error {
+func (a *App) DeleteTemplate(c *echo.Context) error {
// Delete the template from the DB.
id := getID(c)
if err := a.core.DeleteTemplate(id); err != nil {
diff --git a/cmd/tx.go b/cmd/tx.go
index 3d56f0cc..8b6d699d 100644
--- a/cmd/tx.go
+++ b/cmd/tx.go
@@ -11,11 +11,11 @@ import (
"github.com/knadh/listmonk/internal/manager"
"github.com/knadh/listmonk/internal/messenger/email"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// SendTxMessage handles the sending of a transactional message.
-func (a *App) SendTxMessage(c echo.Context) error {
+func (a *App) SendTxMessage(c *echo.Context) error {
var m models.TxMessage
// If it's a multipart form, there may be file attachments.
diff --git a/cmd/users.go b/cmd/users.go
index a9acd9b4..3f706f1e 100644
--- a/cmd/users.go
+++ b/cmd/users.go
@@ -11,7 +11,7 @@ import (
"github.com/knadh/listmonk/internal/core"
"github.com/knadh/listmonk/internal/utils"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/pquerna/otp/totp"
"gopkg.in/volatiletech/null.v6"
)
@@ -57,7 +57,7 @@ type userView struct {
}
// ViewUsers renders the HTML view listing all users.
-func (a *App) ViewUsers(c echo.Context) error {
+func (a *App) ViewUsers(c *echo.Context) error {
// Whitelisted filter params.
q := makeQuery(c.Request().URL.Query(), usersQueryDefaults)
var (
@@ -102,7 +102,7 @@ func (a *App) ViewUsers(c echo.Context) error {
// ViewUser renders the HTML add/edit form for a user. It handles both the "new user"
// (no ID) and the "edit user" (ID in the URI) cases.
-func (a *App) ViewUser(c echo.Context) error {
+func (a *App) ViewUser(c *echo.Context) error {
var (
user auth.User
isNew = true
@@ -156,7 +156,7 @@ type profileView struct {
}
// ViewProfile renders the HTML view for the logged in user's profile.
-func (a *App) ViewProfile(c echo.Context) error {
+func (a *App) ViewProfile(c *echo.Context) error {
user := auth.GetUser(c)
// Blank out the password hash before sending (obviously!).
@@ -184,7 +184,7 @@ func (a *App) getRoles() ([]auth.Role, []auth.ListRole, error) {
}
// GetUser retrieves a single user by ID.
-func (a *App) GetUser(c echo.Context) error {
+func (a *App) GetUser(c *echo.Context) error {
// Get the user from the DB.
id := getID(c)
out, err := a.core.GetUser(id, "", "")
@@ -199,7 +199,7 @@ func (a *App) GetUser(c echo.Context) error {
}
// GetUsers retrieves all users.
-func (a *App) GetUsers(c echo.Context) error {
+func (a *App) GetUsers(c *echo.Context) error {
// Get all users from the DB.
out, err := a.core.GetUsers("", "", 0, 0, c.QueryParam("order_by"), c.QueryParam("order"))
if err != nil {
@@ -215,7 +215,7 @@ func (a *App) GetUsers(c echo.Context) error {
}
// CreateUser handles user creation.
-func (a *App) CreateUser(c echo.Context) error {
+func (a *App) CreateUser(c *echo.Context) error {
var u auth.User
if err := c.Bind(&u); err != nil {
return err
@@ -275,7 +275,7 @@ func (a *App) CreateUser(c echo.Context) error {
}
// UpdateUser handles user modification.
-func (a *App) UpdateUser(c echo.Context) error {
+func (a *App) UpdateUser(c *echo.Context) error {
// Incoming params.
var u auth.User
if err := c.Bind(&u); err != nil {
@@ -362,7 +362,7 @@ func (a *App) UpdateUser(c echo.Context) error {
}
// DeleteUser handles the deletion of a single user by ID.
-func (a *App) DeleteUser(c echo.Context) error {
+func (a *App) DeleteUser(c *echo.Context) error {
// Delete the user(s) from the DB.
id := getID(c)
if err := a.core.DeleteUsers([]int{id}); err != nil {
@@ -378,7 +378,7 @@ func (a *App) DeleteUser(c echo.Context) error {
}
// DeleteUsers handles user deletion, either a single one (ID in the URI), or a list.
-func (a *App) DeleteUsers(c echo.Context) error {
+func (a *App) DeleteUsers(c *echo.Context) error {
ids, err := getQueryInts("id", c.QueryParams())
if err != nil {
return echo.NewHTTPError(http.StatusBadRequest, a.i18n.T("globals.messages.invalidID"))
@@ -398,7 +398,7 @@ func (a *App) DeleteUsers(c echo.Context) error {
}
// GetUserProfile fetches the uesr profile for the currently logged in user.
-func (a *App) GetUserProfile(c echo.Context) error {
+func (a *App) GetUserProfile(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -410,7 +410,7 @@ func (a *App) GetUserProfile(c echo.Context) error {
}
// UpdateUserProfile update's the current user's profile.
-func (a *App) UpdateUserProfile(c echo.Context) error {
+func (a *App) UpdateUserProfile(c *echo.Context) error {
// Get the authenticated user.
user := auth.GetUser(c)
@@ -457,7 +457,7 @@ func (a *App) UpdateUserProfile(c echo.Context) error {
}
// EnableTOTP enables TOTP 2FA for a user after verifying the code.
-func (a *App) EnableTOTP(c echo.Context) error {
+func (a *App) EnableTOTP(c *echo.Context) error {
u := c.Get(auth.UserHTTPCtxKey).(auth.User)
// Incoming request.
@@ -502,7 +502,7 @@ func (a *App) EnableTOTP(c echo.Context) error {
}
// DisableTOTP disables TOTP 2FA for a user after verifying the password.
-func (a *App) DisableTOTP(c echo.Context) error {
+func (a *App) DisableTOTP(c *echo.Context) error {
u := c.Get(auth.UserHTTPCtxKey).(auth.User)
// Incoming request.
diff --git a/cmd/views.go b/cmd/views.go
index 74fc966e..938e3215 100644
--- a/cmd/views.go
+++ b/cmd/views.go
@@ -6,7 +6,7 @@ import (
"strings"
"github.com/knadh/listmonk/internal/auth"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
type adminView struct {
@@ -16,7 +16,7 @@ type adminView struct {
Profile auth.User
}
-func newAdminView(c echo.Context, title, description, pageID string) adminView {
+func newAdminView(c *echo.Context, title, description, pageID string) adminView {
// Admin views like error pages can be rendereded inside/outside auth.
profile, _ := c.Get(auth.UserHTTPCtxKey).(auth.User)
@@ -59,14 +59,14 @@ func canManageList(user auth.User, id int) bool {
}
// renderAdminMessage renders a message page.
-func (a *App) renderAdminMessage(c echo.Context, status int, title, description string) error {
+func (a *App) renderAdminMessage(c *echo.Context, status int, title, description string) error {
return c.Render(status, "admin-message", newAdminView(c, title, description, ""))
}
// adminPage captures errors from admin HTML handlers and converts
// error messages into HTML renders.
func (a *App) adminPage(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
if err := next(c); err != nil {
return a.renderAdminError(c, err)
}
@@ -76,8 +76,12 @@ func (a *App) adminPage(next echo.HandlerFunc) echo.HandlerFunc {
}
// renderAdminError renders an error as an admin message page.
-func (a *App) renderAdminError(c echo.Context, err error) error {
- if c.Response().Committed {
+func (a *App) renderAdminError(c *echo.Context, err error) error {
+ response, unwrapErr := echo.UnwrapResponse(c.Response())
+ if unwrapErr != nil {
+ return unwrapErr
+ }
+ if response.Committed {
return nil
}
@@ -85,18 +89,11 @@ func (a *App) renderAdminError(c echo.Context, err error) error {
status = http.StatusInternalServerError
msg = http.StatusText(status)
)
- if httpErr, ok := errors.AsType[*echo.HTTPError](err); ok {
- if internal, ok := httpErr.Internal.(*echo.HTTPError); ok {
- httpErr = internal
- }
-
- status = httpErr.Code
+ if code := echo.StatusCode(err); code != 0 {
+ status = code
msg = http.StatusText(status)
- switch m := httpErr.Message.(type) {
- case string:
- msg = m
- case error:
- msg = m.Error()
+ if httpErr, ok := errors.AsType[*echo.HTTPError](err); ok && httpErr.Message != "" {
+ msg = httpErr.Message
}
} else {
a.log.Println(err.Error())
@@ -109,7 +106,7 @@ func (a *App) renderAdminError(c echo.Context, err error) error {
if err := a.renderAdminMessage(c, status, "Error", msg); err != nil {
a.log.Println(err.Error())
// The template renderer itself failed!
- if !c.Response().Committed {
+ if !response.Committed {
return c.HTML(http.StatusInternalServerError, "Internal Server Error")
}
}
diff --git a/go.mod b/go.mod
index 67fc1d12..1b854015 100644
--- a/go.mod
+++ b/go.mod
@@ -26,7 +26,7 @@ require (
github.com/knadh/paginator/v2 v2.0.3
github.com/knadh/smtppool/v2 v2.2.1
github.com/knadh/stuffbin v1.3.0
- github.com/labstack/echo/v4 v4.16.0
+ github.com/labstack/echo/v5 v5.4.0
github.com/lib/pq v1.12.3
github.com/paulbellamy/ratecounter v0.2.0
github.com/pquerna/otp v1.5.0
@@ -53,16 +53,11 @@ require (
github.com/google/uuid v1.6.0 // indirect
github.com/huandu/xstrings v1.6.2 // indirect
github.com/josharian/intern v1.0.0 // indirect
- github.com/labstack/gommon v0.5.0 // indirect
- github.com/mattn/go-colorable v0.1.15 // indirect
- github.com/mattn/go-isatty v0.0.24 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/shopspring/decimal v1.5.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
- github.com/valyala/bytebufferpool v1.0.0 // indirect
- github.com/valyala/fasttemplate v1.2.2 // indirect
golang.org/x/crypto v0.57.0 // indirect
golang.org/x/image v0.46.0 // indirect
golang.org/x/net v0.59.0 // indirect
diff --git a/go.sum b/go.sum
index cb982610..3b03f3c2 100644
--- a/go.sum
+++ b/go.sum
@@ -4,20 +4,15 @@ filippo.io/edwards25519 v1.1.0 h1:FNf4tywRC1HmFuKW5xopWpigGjJKiJSV0Cqo0cJWDaA=
filippo.io/edwards25519 v1.1.0/go.mod h1:BxyFTGdWcka3PhytdK4V28tE5sGfRvvvRV7EaN4VDT4=
github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI=
github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
-github.com/Masterminds/semver/v3 v3.4.0 h1:Zog+i5UMtVoCU8oKka5P7i9q9HgrJeGzI9SA1Xbatp0=
-github.com/Masterminds/semver/v3 v3.4.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/semver/v3 v3.5.0 h1:kQceYJfbupGfZOKZQg0kou0DgAKhzDg2NZPAwZ/2OOE=
github.com/Masterminds/semver/v3 v3.5.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
github.com/Masterminds/sprig/v3 v3.3.0 h1:mQh0Yrg1XPo6vjYXgtf5OtijNAKJRNcTdOOGZe3tPhs=
github.com/Masterminds/sprig/v3 v3.3.0/go.mod h1:Zy1iXRYNqNLUolqCpL4uhk6SHUMAOSCzdgBfDb35Lz0=
github.com/altcha-org/altcha-lib-go v1.0.0 h1:7oPti0aUS+YCep8nwt5b9g4jYfCU55ZruWESL8G9K5M=
github.com/altcha-org/altcha-lib-go v1.0.0/go.mod h1:I8ESLVWR9C58uvGufB/AJDPhaSU4+4Oh3DLpVtgwDAk=
-github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8WK8raXaxBx6fRVTlJILwEwQGL1I/ByEI=
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/boombuler/barcode v1.1.0 h1:ChaYjBR63fr4LFyGn8E8nt7dBSt3MiU3zMOZqFvVkHo=
github.com/boombuler/barcode v1.1.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
-github.com/coreos/go-oidc/v3 v3.14.1 h1:9ePWwfdwC4QKRlCXsJGou56adA/owXczOzwKdOumLqk=
-github.com/coreos/go-oidc/v3 v3.14.1/go.mod h1:HaZ3szPaZ0e4r6ebqvsLWlk2Tn+aejfmrfah6hnSYEU=
github.com/coreos/go-oidc/v3 v3.21.0 h1:wZo4Q9Pum8dYEj0eMUPrqR+kvuGkeUplbLpNCkBqoWM=
github.com/coreos/go-oidc/v3 v3.21.0/go.mod h1:DYCf24+ncYi+XkIH97GY1+dqoRlbaSI26KVTCI9SrY4=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -31,25 +26,15 @@ github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHk
github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0=
github.com/fsnotify/fsnotify v1.10.1 h1:b0/UzAf9yR5rhf3RPm9gf3ehBPpf0oZKIjtpKrx59Ho=
github.com/fsnotify/fsnotify v1.10.1/go.mod h1:TLheqan6HD6GBK6PrDWyDPBaEV8LspOxvPSjC+bVfgo=
-github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k=
-github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0=
-github.com/gdgvda/cron v0.4.0 h1:hGXFhEXisTqOByNVf2YEL3pWcND90Acjf4gjF4S+ICg=
-github.com/gdgvda/cron v0.4.0/go.mod h1:caBF+mzTZGtQqFE05T1m6u9OmCASY3EK51XAICf3wio=
github.com/gdgvda/cron v0.7.0 h1:LFPZUTbCb5ZpzYxavbQDDbjd6nwTwkiNUWyulOdlY2I=
github.com/gdgvda/cron v0.7.0/go.mod h1:caBF+mzTZGtQqFE05T1m6u9OmCASY3EK51XAICf3wio=
-github.com/go-jose/go-jose/v4 v4.1.4 h1:moDMcTHmvE6Groj34emNPLs/qtYXRVcd6S7NHbHz3kA=
-github.com/go-jose/go-jose/v4 v4.1.4/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-jose/go-jose/v4 v4.1.5 h1:RjgjO2LOtWOJKUC5wpwY9LR3B3vwVAz6JS2YHfYU6eA=
github.com/go-jose/go-jose/v4 v4.1.5/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08=
github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w=
github.com/go-sql-driver/mysql v1.8.1 h1:LedoTUt/eveggdHS9qUFC1EFSa8bU2+1pZjSRpvNJ1Y=
github.com/go-sql-driver/mysql v1.8.1/go.mod h1:wEBSXgmK//2ZFJyE+qWnIsVGmvmEKlqwuVSjsCm7DZg=
-github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs=
-github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro=
github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
-github.com/gofrs/uuid/v5 v5.3.2 h1:2jfO8j3XgSwlz/wHqemAEugfnTlikAYHhnqQ8Xh4fE0=
-github.com/gofrs/uuid/v5 v5.3.2/go.mod h1:CDOjlDMVAtN56jqyRUZh58JT31Tiw7/oQyEXZV+9bD8=
github.com/gofrs/uuid/v5 v5.5.1 h1:z1Ce19/JwNidXpy3tOQc3241lnJLKdKyq/xlNvlD4Ng=
github.com/gofrs/uuid/v5 v5.5.1/go.mod h1:bbAA98EoIlxyRHIVg6ektCSsZ5n8mSbwgEhvhMYlZgg=
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
@@ -59,8 +44,6 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/feeds v1.2.0 h1:O6pBiXJ5JHhPvqy53NsjKOThq+dNFm8+DFrxBEdzSCc=
github.com/gorilla/feeds v1.2.0/go.mod h1:WMib8uJP3BbY+X8Szd1rA5Pzhdfh+HCCAYT2z7Fza6Y=
-github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI=
-github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/huandu/xstrings v1.6.2 h1:+X5X6N46b40cmDw7FFJFU6Eoq0yJS8lbYigT2EFau4c=
github.com/huandu/xstrings v1.6.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/jmoiron/sqlx v1.2.0/go.mod h1:1FEQNm3xlJgrMD+FBdI9+xvCksHtbpVBBw5dYhBSsks=
@@ -72,44 +55,26 @@ github.com/knadh/go-pop3 v1.0.2 h1:gbdtwzEYedLVos/vpebM2d73NTyZxEgjgRJ4S77HlzM=
github.com/knadh/go-pop3 v1.0.2/go.mod h1:3gKw2jmrEa1lYLVtP1yEoo6bkkJ4XHDySPy8xaSjG0s=
github.com/knadh/goyesql/v2 v2.2.0 h1:DNQIzgITmMTXA+z+jDzbXCpgr7fGD6Hp0AJ7ZLEAem4=
github.com/knadh/goyesql/v2 v2.2.0/go.mod h1:is+wK/XQBukYK3DdKfpJRyDH9U/ZTMyX2u6DFijjRnI=
-github.com/knadh/koanf/maps v0.1.2 h1:RBfmAW5CnZT+PJ1CVc1QSJKf4Xu9kxfQgYVQSu8hpbo=
-github.com/knadh/koanf/maps v0.1.2/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
github.com/knadh/koanf/maps v0.1.3 h1:P1z7EvTqdFBrPYbzSvorvrpib+sjkUMxf0FVvA5NKK4=
github.com/knadh/koanf/maps v0.1.3/go.mod h1:npD/QZY3V6ghQDdcQzl1W4ICNVTkohC8E73eI2xW4yI=
-github.com/knadh/koanf/parsers/json v1.0.0 h1:1pVR1JhMwbqSg5ICzU+surJmeBbdT4bQm7jjgnA+f8o=
-github.com/knadh/koanf/parsers/json v1.0.0/go.mod h1:zb5WtibRdpxSoSJfXysqGbVxvbszdlroWDHGdDkkEYU=
github.com/knadh/koanf/parsers/json v1.0.1 h1:w/HTGw5+t5R4dA1OUtHNwOQCBsdNTcVw8Fhje2u76+c=
github.com/knadh/koanf/parsers/json v1.0.1/go.mod h1:zb5WtibRdpxSoSJfXysqGbVxvbszdlroWDHGdDkkEYU=
github.com/knadh/koanf/parsers/toml v0.1.0 h1:S2hLqS4TgWZYj4/7mI5m1CQQcWurxUz6ODgOub/6LCI=
github.com/knadh/koanf/parsers/toml v0.1.0/go.mod h1:yUprhq6eo3GbyVXFFMdbfZSo928ksS+uo0FFqNMnO18=
-github.com/knadh/koanf/providers/confmap v1.0.0 h1:mHKLJTE7iXEys6deO5p6olAiZdG5zwp8Aebir+/EaRE=
-github.com/knadh/koanf/providers/confmap v1.0.0/go.mod h1:txHYHiI2hAtF0/0sCmcuol4IDcuQbKTybiB1nOcUo1A=
github.com/knadh/koanf/providers/confmap v1.0.1 h1:L15hbvMqlvhwUuCtL9BkL+rqiMAjk6cZc8O9XoDtE3A=
github.com/knadh/koanf/providers/confmap v1.0.1/go.mod h1:txHYHiI2hAtF0/0sCmcuol4IDcuQbKTybiB1nOcUo1A=
github.com/knadh/koanf/providers/env v1.1.0 h1:U2VXPY0f+CsNDkvdsG8GcsnK4ah85WwWyJgef9oQMSc=
github.com/knadh/koanf/providers/env v1.1.0/go.mod h1:QhHHHZ87h9JxJAn2czdEl6pdkNnDh/JS1Vtsyt65hTY=
-github.com/knadh/koanf/providers/file v1.2.0 h1:hrUJ6Y9YOA49aNu/RSYzOTFlqzXSCpmYIDXI7OJU6+U=
-github.com/knadh/koanf/providers/file v1.2.0/go.mod h1:bp1PM5f83Q+TOUu10J/0ApLBd9uIzg+n9UgthfY+nRA=
github.com/knadh/koanf/providers/file v1.2.1 h1:bEWbtQwYrA+W2DtdBrQWyXqJaJSG3KrP3AESOJYp9wM=
github.com/knadh/koanf/providers/file v1.2.1/go.mod h1:bp1PM5f83Q+TOUu10J/0ApLBd9uIzg+n9UgthfY+nRA=
-github.com/knadh/koanf/providers/posflag v1.0.1 h1:EnMxHSrPkYCFnKgBUl5KBgrjed8gVFrcXDzaW4l/C6Y=
-github.com/knadh/koanf/providers/posflag v1.0.1/go.mod h1:3Wn3+YG3f4ljzRyCUgIwH7G0sZ1pMjCOsNBovrbKmAk=
github.com/knadh/koanf/providers/posflag v1.0.2 h1:ky9Yqmoz0EHGfby6/gB6SUXmLs5kjxW/1ekbHRuPwIk=
github.com/knadh/koanf/providers/posflag v1.0.2/go.mod h1:3Wn3+YG3f4ljzRyCUgIwH7G0sZ1pMjCOsNBovrbKmAk=
-github.com/knadh/koanf/providers/rawbytes v1.0.0 h1:MrKDh/HksJlKJmaZjgs4r8aVBb/zsJyc/8qaSnzcdNI=
-github.com/knadh/koanf/providers/rawbytes v1.0.0/go.mod h1:KxwYJf1uezTKy6PBtfE+m725NGp4GPVA7XoNTJ/PtLo=
github.com/knadh/koanf/providers/rawbytes v1.0.1 h1:JCQoly+djX23Okr8kqtS19R7UXKleTAp62Vib2VrVYs=
github.com/knadh/koanf/providers/rawbytes v1.0.1/go.mod h1:KxwYJf1uezTKy6PBtfE+m725NGp4GPVA7XoNTJ/PtLo=
-github.com/knadh/koanf/v2 v2.2.2 h1:ghbduIkpFui3L587wavneC9e3WIliCgiCgdxYO/wd7A=
-github.com/knadh/koanf/v2 v2.2.2/go.mod h1:abWQc0cBXLSF/PSOMCB/SK+T13NXDsPvOksbpi5e/9Q=
-github.com/knadh/koanf/v2 v2.3.7 h1:amceufOeoQcq6VFKjm7/ggJ3t0Dkqaxy5fza4j3YgTA=
-github.com/knadh/koanf/v2 v2.3.7/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28=
github.com/knadh/koanf/v2 v2.4.0 h1:wmp0NlAUIasxphpHIU6Su5sKQn3Up/AvI2ZA2GeJTUk=
github.com/knadh/koanf/v2 v2.4.0/go.mod h1:gRb40VRAbd4iJMYYD5IxZ6hfuopFcXBpc9bbQpZwo28=
github.com/knadh/paginator/v2 v2.0.3 h1:r3SXb48puySU34R5W8F5oh/0opawtoLlKnxWOK/RCK4=
github.com/knadh/paginator/v2 v2.0.3/go.mod h1:Vw3XTxOpKQyYNiv+eKMtemEz6iHBBs4yWygPDpdOcBo=
-github.com/knadh/smtppool/v2 v2.1.2 h1:FBpwnDTKmWwUy1reeeMeYJXl2QbUgVsKhAGVgJF3F2I=
-github.com/knadh/smtppool/v2 v2.1.2/go.mod h1:D7HcfSS8Xd3jpZ9LRwQ3aGdqp9FzFE66uW6w/BTpy4E=
github.com/knadh/smtppool/v2 v2.2.1 h1:iUwpTubd1zsjeiTXjWrrHRJnrBqJTHgKQRZIzFCjBsU=
github.com/knadh/smtppool/v2 v2.2.1/go.mod h1:D7HcfSS8Xd3jpZ9LRwQ3aGdqp9FzFE66uW6w/BTpy4E=
github.com/knadh/stuffbin v1.3.0 h1:HaVSuYV+KnrlCHl7DrLNyOCgpTU2K8x5Hb+J4Ck3gww=
@@ -118,34 +83,15 @@ github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
-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/echo/v4 v4.15.3 h1:lIdG4kK5RdMyhwCwSc4AmSQsLBb3AVwok6S8PX/9kwQ=
-github.com/labstack/echo/v4 v4.15.3/go.mod h1:Xzp1Ns1RA2c9fY7nSgUJkpkUZGNbEIVHZbtbOMPktBI=
-github.com/labstack/echo/v4 v4.16.0 h1:cFqqpqVNmSVyn4nvsXHp5rU4aVLYG3hx4fGWc3FngBk=
-github.com/labstack/echo/v4 v4.16.0/go.mod h1:VHAohjgM63iiTVI6EahEDjtRhQNXCMXFp0TMeIsFuW0=
-github.com/labstack/gommon v0.4.2 h1:F8qTUNXgG1+6WQmqoUWnz8WiEU60mXVVw0P4ht1WRA0=
-github.com/labstack/gommon v0.4.2/go.mod h1:QlUFxVM+SNXhDL/Z7YhocGIBYOiwB0mXm1+1bAPHPyU=
-github.com/labstack/gommon v0.5.0 h1:6VSQ2NOzsnEJ5W6+84E0RbcaDDmgB6NIAzWCczTEe6c=
-github.com/labstack/gommon v0.5.0/go.mod h1:Rzlg7HHy1maLfzBYGg9NZcVuz1sA68HHhLjhcEllYE0=
+github.com/labstack/echo/v5 v5.4.0 h1:iY674460IvSmUcj7MziL3YrgyTClghz5BpdZoKiGxR4=
+github.com/labstack/echo/v5 v5.4.0/go.mod h1:4iEGNQiPPZnkfYpNR/L6fINd3NLiGWUD5+eBotFALas=
github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo=
-github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw=
github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/lib/pq v1.12.3 h1:tTWxr2YLKwIvK90ZXEw8GP7UFHtcbTtty8zsI+YjrfQ=
github.com/lib/pq v1.12.3/go.mod h1:/p+8NSbOcwzAEI7wiMXFlgydTwcgTr3OSKMsD2BitpA=
-github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
-github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
-github.com/mattn/go-colorable v0.1.15 h1:+u9SLTRGnXv73cEsnsmoZBom+dMU88B2M0aDcWy0/jY=
-github.com/mattn/go-colorable v0.1.15/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
-github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
-github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
-github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
-github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
-github.com/mattn/go-isatty v0.0.24 h1:tGZZoVgT/KiqK1c8ocVLeDS8BSWMRd47J3Lbz7vsReI=
-github.com/mattn/go-isatty v0.0.24/go.mod h1:nMCL3Zebbrt45jsMDgnfIwz6ydEQApk5oEI3HqDio6A=
+github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-sqlite3 v1.14.22 h1:2gZY6PC6kBnID23Tichd1K+Z0oS6nE/XwU+Vz/5o4kU=
github.com/mattn/go-sqlite3 v1.14.22/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
-github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw=
github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s=
github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ=
@@ -162,36 +108,22 @@ github.com/rhnvrm/simples3 v0.11.1 h1:/IU3Jz7R3oSJfafPvXemwSZvh0wZ1nFcc2CceMmloU
github.com/rhnvrm/simples3 v0.11.1/go.mod h1:c2xW30bukipkBlWNnXG1wDjq3gykQ6ww2AB/9NHMLMY=
github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
-github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
-github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/shopspring/decimal v1.5.0 h1:HxSWk31RmJv0EyY4oLiGQB9u7WPludUwPBdvQZnYFPc=
github.com/shopspring/decimal v1.5.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY=
github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
-github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE=
-github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo=
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
-github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
-github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
-github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
-github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
-github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
-github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
-github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
-github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
-github.com/valyala/fasttemplate v1.2.2 h1:lxLXG0uE3Qnshl9QyaK6XJxMXlQZELvChBOCmQD0Loo=
-github.com/valyala/fasttemplate v1.2.2/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
+github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
+github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
-github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY=
-github.com/yuin/goldmark v1.7.12/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
github.com/yuin/goldmark v1.8.6 h1:d0VcaP1sx9GkFVkoW+KtggpGi2KZ965i14b0+bDQST4=
github.com/yuin/goldmark v1.8.6/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg=
github.com/zerodha/easyjson v1.0.1 h1:GTdVnhd1RxUSeTGua6YTy2ZC7ivywWBeZ9NoyoFaQdM=
@@ -202,32 +134,22 @@ github.com/zerodha/simplesessions/v3 v3.0.0 h1:seHwxVNnlCbp5nG8GFxSsRUdiHnfb39Qd
github.com/zerodha/simplesessions/v3 v3.0.0/go.mod h1:lAK+CJmZRlbvfq+OnkB8Iyf6LWgjzvUuWYKX1XA51P0=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
-golang.org/x/crypto v0.52.0 h1:RMs7fP2rXdep0CftQlK8Uf+kibLm7qkCcradZWYz988=
-golang.org/x/crypto v0.52.0/go.mod h1:1QgfPxDqh0T2M/elOJtp9RvuR95kVjir0e6/BvEmGbc=
golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M=
golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
-golang.org/x/image v0.41.0 h1:8wS72eGJMJaBxK6okTzd4WaXumUlTVlb753MlsSvTCo=
-golang.org/x/image v0.41.0/go.mod h1:uIc348UZMSvS5Z65CVZ7iDPaNobNFEPeJ4kbqTOszmA=
golang.org/x/image v0.46.0 h1:b1+oYj0Jbp6K5MDT4i4/eZpYlk3V8SJhhDKh6LBHAyQ=
golang.org/x/image v0.46.0/go.mod h1:3B3W05VGVQyuXucLINLjXKrqISASfi4Xj+iCVkLMwew=
-golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM=
-golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU=
-golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
-golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c=
+golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
-golang.org/x/net v0.54.0 h1:2zJIZAxAHV/OHCDTCOHAYehQzLfSXuf/5SoL/Dv6w/w=
-golang.org/x/net v0.54.0/go.mod h1:Sj4oj8jK6XmHpBZU/zWHw3BV3abl4Kvi+Ut7cQcY+cQ=
+golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.59.0 h1:5zfYln+w5XCxwrnMMJPufRgNoXEaGxl0wo5GqPXyues=
golang.org/x/net v0.59.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg=
-golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
-golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI=
-golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU=
golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98=
golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -238,28 +160,20 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
-golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
+golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo=
golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
-golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
-golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
-golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
+golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
+golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI=
golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E=
-golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
-golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE=
-golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg=
-golang.org/x/time v0.15.0 h1:bbrp8t3bGUeFOx08pvsMYRTCVSMk89u4tKbNOZbp88U=
-golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE=
golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
diff --git a/internal/auth/auth.go b/internal/auth/auth.go
index e053cff1..cecc0fea 100644
--- a/internal/auth/auth.go
+++ b/internal/auth/auth.go
@@ -19,7 +19,7 @@ import (
"time"
"github.com/coreos/go-oidc/v3/oidc"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/zerodha/simplesessions/stores/postgres/v3"
"github.com/zerodha/simplesessions/v3"
"golang.org/x/oauth2"
@@ -346,7 +346,7 @@ func (o *Auth) ExchangeOIDCToken(code, nonce, codeVerifier string) (string, OIDC
// sets the authenticated User{} on the echo context on the key UserKey. On failure, it sets an Error{}
// instead on the same key.
func (o *Auth) Middleware(next echo.HandlerFunc) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
// It's an `Authorization` header request.
hdr := strings.TrimSpace(c.Request().Header.Get("Authorization"))
@@ -396,7 +396,7 @@ func (o *Auth) Middleware(next echo.HandlerFunc) echo.HandlerFunc {
// Perm is an HTTP handler middleware that checks if the authenticated user has the required permissions.
func (o *Auth) Perm(next echo.HandlerFunc, perms ...string) echo.HandlerFunc {
- return func(c echo.Context) error {
+ return func(c *echo.Context) error {
u, ok := c.Get(UserHTTPCtxKey).(User)
if !ok {
c.Set(UserHTTPCtxKey, echo.NewHTTPError(http.StatusForbidden, "invalid session"))
@@ -429,7 +429,7 @@ func (o *Auth) Perm(next echo.HandlerFunc, perms ...string) echo.HandlerFunc {
}
// SaveSession creates and sets a session (post successful login/auth).
-func (o *Auth) SaveSession(u User, oidcToken string, c echo.Context) error {
+func (o *Auth) SaveSession(u User, oidcToken string, c *echo.Context) error {
sess, err := o.sess.NewSession(c, c)
if err != nil {
o.log.Printf("error creating login session: %v", err)
@@ -478,7 +478,7 @@ func (o *Auth) GetOIDCLogoutURL(token, redirectURL string) (string, error) {
}
// GetSessionID returns the current session ID from the echo context.
-func GetSessionID(c echo.Context) string {
+func GetSessionID(c *echo.Context) string {
sess, ok := c.Get(SessionKey).(*simplesessions.Session)
if !ok || sess == nil {
return ""
@@ -494,7 +494,7 @@ func HashAPIToken(token string) string {
}
// validateSession checks if the cookie session is valid (in the DB) and returns the session and user details.
-func (o *Auth) validateSession(c echo.Context) (*simplesessions.Session, User, error) {
+func (o *Auth) validateSession(c *echo.Context) (*simplesessions.Session, User, error) {
// Cookie session.
sess, err := o.sess.Acquire(context.TODO(), c, c)
if err != nil {
@@ -529,7 +529,7 @@ func (o *Auth) validateSession(c echo.Context) (*simplesessions.Session, User, e
// GetUser retrieves and returns the User object from an authenticated
// HTTP handler request.
-func GetUser(c echo.Context) User {
+func GetUser(c *echo.Context) User {
return c.Get(UserHTTPCtxKey).(User)
}
diff --git a/internal/auth/models.go b/internal/auth/models.go
index 175da7cb..0d840be3 100644
--- a/internal/auth/models.go
+++ b/internal/auth/models.go
@@ -4,7 +4,7 @@ import (
"encoding/json"
"net/http"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
null "gopkg.in/volatiletech/null.v6"
)
diff --git a/internal/bounce/webhooks/postmark.go b/internal/bounce/webhooks/postmark.go
index 156d2bb7..a88e8e94 100644
--- a/internal/bounce/webhooks/postmark.go
+++ b/internal/bounce/webhooks/postmark.go
@@ -9,8 +9,8 @@ import (
"time"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
- "github.com/labstack/echo/v4/middleware"
+ "github.com/labstack/echo/v5"
+ "github.com/labstack/echo/v5/middleware"
)
type postmarkNotif struct {
@@ -43,14 +43,14 @@ type Postmark struct {
func NewPostmark(username, password string) *Postmark {
return &Postmark{
- authHandler: middleware.BasicAuth(makePostmarkAuthHandler(username, password))(func(c echo.Context) error {
+ authHandler: middleware.BasicAuth(makePostmarkAuthHandler(username, password))(func(c *echo.Context) error {
return nil
}),
}
}
// ProcessBounce processes Postmark bounce notifications and returns one object.
-func (p *Postmark) ProcessBounce(b []byte, c echo.Context) ([]models.Bounce, error) {
+func (p *Postmark) ProcessBounce(b []byte, c *echo.Context) ([]models.Bounce, error) {
// Do basicauth.
if err := p.authHandler(c); err != nil {
return nil, err
@@ -99,13 +99,13 @@ func (p *Postmark) ProcessBounce(b []byte, c echo.Context) ([]models.Bounce, err
}}, nil
}
-func makePostmarkAuthHandler(cfgUser, cfgPassword string) func(username, password string, c echo.Context) (bool, error) {
+func makePostmarkAuthHandler(cfgUser, cfgPassword string) func(c *echo.Context, username, password string) (bool, error) {
var (
u = []byte(cfgUser)
p = []byte(cfgPassword)
)
- return func(username, password string, c echo.Context) (bool, error) {
+ return func(c *echo.Context, username, password string) (bool, error) {
if len(u) == 0 || len(p) == 0 {
return false, errors.New("webhook credentials are not configured")
}
diff --git a/internal/core/analytics.go b/internal/core/analytics.go
index d83f34ee..5f623f7b 100644
--- a/internal/core/analytics.go
+++ b/internal/core/analytics.go
@@ -5,7 +5,7 @@ import (
"github.com/jmoiron/sqlx"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/bounces.go b/internal/core/bounces.go
index 85fa25a4..e1f528db 100644
--- a/internal/core/bounces.go
+++ b/internal/core/bounces.go
@@ -5,7 +5,7 @@ import (
"strings"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/campaigns.go b/internal/core/campaigns.go
index cbd682ec..c4b31b83 100644
--- a/internal/core/campaigns.go
+++ b/internal/core/campaigns.go
@@ -8,7 +8,7 @@ import (
"github.com/gofrs/uuid/v5"
"github.com/jmoiron/sqlx"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/core.go b/internal/core/core.go
index 0dfa6e5d..5799b5e2 100644
--- a/internal/core/core.go
+++ b/internal/core/core.go
@@ -16,7 +16,7 @@ import (
"github.com/knadh/listmonk/internal/i18n"
"github.com/knadh/listmonk/internal/throttle"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/dashboard.go b/internal/core/dashboard.go
index f406b789..c86eda65 100644
--- a/internal/core/dashboard.go
+++ b/internal/core/dashboard.go
@@ -4,7 +4,7 @@ import (
"net/http"
"github.com/jmoiron/sqlx/types"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// GetDashboardCharts returns chart data points to render on the dashboard.
diff --git a/internal/core/lists.go b/internal/core/lists.go
index 70ab1326..8d137e3e 100644
--- a/internal/core/lists.go
+++ b/internal/core/lists.go
@@ -7,7 +7,7 @@ import (
"github.com/jmoiron/sqlx"
"github.com/jmoiron/sqlx/types"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/media.go b/internal/core/media.go
index 2e9256de..c304e90a 100644
--- a/internal/core/media.go
+++ b/internal/core/media.go
@@ -9,7 +9,7 @@ import (
"github.com/gofrs/uuid/v5"
"github.com/knadh/listmonk/internal/media"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"gopkg.in/volatiletech/null.v6"
)
diff --git a/internal/core/roles.go b/internal/core/roles.go
index 701f4ac8..05fea6fe 100644
--- a/internal/core/roles.go
+++ b/internal/core/roles.go
@@ -6,7 +6,7 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/settings.go b/internal/core/settings.go
index 5368b415..9637aeed 100644
--- a/internal/core/settings.go
+++ b/internal/core/settings.go
@@ -8,7 +8,7 @@ import (
"github.com/jmoiron/sqlx/types"
"github.com/knadh/listmonk/internal/utils"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
)
// GetSettings returns settings from the DB.
diff --git a/internal/core/subscribers.go b/internal/core/subscribers.go
index 967cf5c3..4b3e526d 100644
--- a/internal/core/subscribers.go
+++ b/internal/core/subscribers.go
@@ -15,7 +15,7 @@ import (
"github.com/jmoiron/sqlx/types"
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/subscriptions.go b/internal/core/subscriptions.go
index 6e25e97e..b6db77b1 100644
--- a/internal/core/subscriptions.go
+++ b/internal/core/subscriptions.go
@@ -5,7 +5,7 @@ import (
"time"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
)
diff --git a/internal/core/templates.go b/internal/core/templates.go
index f137cc23..342591cc 100644
--- a/internal/core/templates.go
+++ b/internal/core/templates.go
@@ -5,7 +5,7 @@ import (
"net/http"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
null "gopkg.in/volatiletech/null.v6"
)
diff --git a/internal/core/users.go b/internal/core/users.go
index 85a39868..12e874f9 100644
--- a/internal/core/users.go
+++ b/internal/core/users.go
@@ -9,7 +9,7 @@ import (
"github.com/knadh/listmonk/internal/auth"
"github.com/knadh/listmonk/internal/utils"
"github.com/knadh/listmonk/models"
- "github.com/labstack/echo/v4"
+ "github.com/labstack/echo/v5"
"github.com/lib/pq"
"gopkg.in/volatiletech/null.v6"
)