aboutsummaryrefslogtreecommitdiff
path: root/plugins/viewhtml
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2020-05-13 14:07:44 +0200
committerSimon Ser <contact@emersion.fr>2020-05-13 14:07:44 +0200
commitb891a95fcf4a3d4b64100911dae49fb28904a7fd (patch)
treefe07b29d6f2443047b7f740c79d86b3c499cc9e9 /plugins/viewhtml
parent4cf5ad68afd80f27512c464843b0d917182ef0c2 (diff)
downloadalps-b891a95fcf4a3d4b64100911dae49fb28904a7fd.tar.gz
alps-b891a95fcf4a3d4b64100911dae49fb28904a7fd.zip
Rename project to alps
Diffstat (limited to 'plugins/viewhtml')
-rw-r--r--plugins/viewhtml/plugin.go16
-rw-r--r--plugins/viewhtml/sanitize.go6
-rw-r--r--plugins/viewhtml/viewer.go12
3 files changed, 17 insertions, 17 deletions
diff --git a/plugins/viewhtml/plugin.go b/plugins/viewhtml/plugin.go
index 1007d4a..a121d92 100644
--- a/plugins/viewhtml/plugin.go
+++ b/plugins/viewhtml/plugin.go
@@ -1,4 +1,4 @@
-package koushinviewhtml
+package alpsviewhtml
import (
"io"
@@ -8,8 +8,8 @@ import (
"strconv"
"strings"
- "git.sr.ht/~emersion/koushin"
- koushinbase "git.sr.ht/~emersion/koushin/plugins/base"
+ "git.sr.ht/~emersion/alps"
+ alpsbase "git.sr.ht/~emersion/alps/plugins/base"
"github.com/labstack/echo/v4"
)
@@ -19,10 +19,10 @@ var (
)
func init() {
- p := koushin.GoPlugin{Name: "viewhtml"}
+ p := alps.GoPlugin{Name: "viewhtml"}
- p.Inject("message.html", func(ctx *koushin.Context, _data koushin.RenderData) error {
- data := _data.(*koushinbase.MessageRenderData)
+ p.Inject("message.html", func(ctx *alps.Context, _data alps.RenderData) error {
+ data := _data.(*alpsbase.MessageRenderData)
data.Extra["RemoteResourcesAllowed"] = ctx.QueryParam("allow-remote-resources") == "1"
hasRemoteResources := false
if v := ctx.Get("viewhtml.hasRemoteResources"); v != nil {
@@ -32,7 +32,7 @@ func init() {
return nil
})
- p.GET("/proxy", func(ctx *koushin.Context) error {
+ p.GET("/proxy", func(ctx *alps.Context) error {
if !proxyEnabled {
return echo.NewHTTPError(http.StatusForbidden, "proxy disabled")
}
@@ -67,5 +67,5 @@ func init() {
return ctx.Stream(http.StatusOK, mediaType, &lr)
})
- koushin.RegisterPluginLoader(p.Loader())
+ alps.RegisterPluginLoader(p.Loader())
}
diff --git a/plugins/viewhtml/sanitize.go b/plugins/viewhtml/sanitize.go
index ba2aca9..61a011d 100644
--- a/plugins/viewhtml/sanitize.go
+++ b/plugins/viewhtml/sanitize.go
@@ -1,4 +1,4 @@
-package koushinviewhtml
+package alpsviewhtml
import (
"bytes"
@@ -7,7 +7,7 @@ import (
"regexp"
"strings"
- koushinbase "git.sr.ht/~emersion/koushin/plugins/base"
+ alpsbase "git.sr.ht/~emersion/alps/plugins/base"
"github.com/aymerick/douceur/css"
cssparser "github.com/chris-ramon/douceur/parser"
"github.com/microcosm-cc/bluemonday"
@@ -71,7 +71,7 @@ var allowedStyles = map[string]bool{
}
type sanitizer struct {
- msg *koushinbase.IMAPMessage
+ msg *alpsbase.IMAPMessage
allowRemoteResources bool
hasRemoteResources bool
}
diff --git a/plugins/viewhtml/viewer.go b/plugins/viewhtml/viewer.go
index abc9f2d..de6ee4a 100644
--- a/plugins/viewhtml/viewer.go
+++ b/plugins/viewhtml/viewer.go
@@ -1,4 +1,4 @@
-package koushinviewhtml
+package alpsviewhtml
import (
"bytes"
@@ -7,8 +7,8 @@ import (
"io/ioutil"
"strings"
- "git.sr.ht/~emersion/koushin"
- koushinbase "git.sr.ht/~emersion/koushin/plugins/base"
+ "git.sr.ht/~emersion/alps"
+ alpsbase "git.sr.ht/~emersion/alps/plugins/base"
"github.com/emersion/go-message"
)
@@ -24,7 +24,7 @@ var tpl = template.Must(template.New("view-html.html").Parse(tplSrc))
type viewer struct{}
-func (viewer) ViewMessagePart(ctx *koushin.Context, msg *koushinbase.IMAPMessage, part *message.Entity) (interface{}, error) {
+func (viewer) ViewMessagePart(ctx *alps.Context, msg *alpsbase.IMAPMessage, part *message.Entity) (interface{}, error) {
allowRemoteResources := ctx.QueryParam("allow-remote-resources") == "1"
mimeType, _, err := part.Header.ContentType()
@@ -32,7 +32,7 @@ func (viewer) ViewMessagePart(ctx *koushin.Context, msg *koushinbase.IMAPMessage
return nil, err
}
if !strings.EqualFold(mimeType, "text/html") {
- return nil, koushinbase.ErrViewUnsupported
+ return nil, alpsbase.ErrViewUnsupported
}
body, err := ioutil.ReadAll(part.Body)
@@ -61,5 +61,5 @@ func (viewer) ViewMessagePart(ctx *koushin.Context, msg *koushinbase.IMAPMessage
}
func init() {
- koushinbase.RegisterViewer(viewer{})
+ alpsbase.RegisterViewer(viewer{})
}