aboutsummaryrefslogtreecommitdiff
path: root/plugins/caldav
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/caldav')
-rw-r--r--plugins/caldav/caldav.go10
-rw-r--r--plugins/caldav/plugin.go14
-rw-r--r--plugins/caldav/public/calendar.html2
-rw-r--r--plugins/caldav/public/event.html2
-rw-r--r--plugins/caldav/routes.go18
5 files changed, 23 insertions, 23 deletions
diff --git a/plugins/caldav/caldav.go b/plugins/caldav/caldav.go
index 1c043e9..906e747 100644
--- a/plugins/caldav/caldav.go
+++ b/plugins/caldav/caldav.go
@@ -1,11 +1,11 @@
-package koushincaldav
+package alpscaldav
import (
"fmt"
"net/http"
"net/url"
- "git.sr.ht/~emersion/koushin"
+ "git.sr.ht/~emersion/alps"
"github.com/emersion/go-webdav/caldav"
)
@@ -13,7 +13,7 @@ var errNoCalendar = fmt.Errorf("caldav: no calendar found")
type authRoundTripper struct {
upstream http.RoundTripper
- session *koushin.Session
+ session *alps.Session
}
func (rt *authRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
@@ -21,7 +21,7 @@ func (rt *authRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)
return rt.upstream.RoundTrip(req)
}
-func newClient(u *url.URL, session *koushin.Session) (*caldav.Client, error) {
+func newClient(u *url.URL, session *alps.Session) (*caldav.Client, error) {
rt := authRoundTripper{
upstream: http.DefaultTransport,
session: session,
@@ -34,7 +34,7 @@ func newClient(u *url.URL, session *koushin.Session) (*caldav.Client, error) {
return c, nil
}
-func getCalendar(u *url.URL, session *koushin.Session) (*caldav.Client, *caldav.Calendar, error) {
+func getCalendar(u *url.URL, session *alps.Session) (*caldav.Client, *caldav.Calendar, error) {
c, err := newClient(u, session)
if err != nil {
return nil, nil, err
diff --git a/plugins/caldav/plugin.go b/plugins/caldav/plugin.go
index 27c5663..68de6cf 100644
--- a/plugins/caldav/plugin.go
+++ b/plugins/caldav/plugin.go
@@ -1,11 +1,11 @@
-package koushincaldav
+package alpscaldav
import (
"fmt"
"net/http"
"net/url"
- "git.sr.ht/~emersion/koushin"
+ "git.sr.ht/~emersion/alps"
)
func sanityCheckURL(u *url.URL) error {
@@ -27,9 +27,9 @@ func sanityCheckURL(u *url.URL) error {
return nil
}
-func newPlugin(srv *koushin.Server) (koushin.Plugin, error) {
+func newPlugin(srv *alps.Server) (alps.Plugin, error) {
u, err := srv.Upstream("caldavs", "caldav+insecure", "https", "http+insecure")
- if _, ok := err.(*koushin.NoUpstreamError); ok {
+ if _, ok := err.(*alps.NoUpstreamError); ok {
return nil, nil
} else if err != nil {
return nil, fmt.Errorf("caldav: failed to parse upstream caldav server: %v", err)
@@ -53,7 +53,7 @@ func newPlugin(srv *koushin.Server) (koushin.Plugin, error) {
srv.Logger().Printf("Configured upstream CalDAV server: %v", u)
- p := koushin.GoPlugin{Name: "caldav"}
+ p := alps.GoPlugin{Name: "caldav"}
registerRoutes(&p, u)
@@ -61,7 +61,7 @@ func newPlugin(srv *koushin.Server) (koushin.Plugin, error) {
}
func init() {
- koushin.RegisterPluginLoader(func(s *koushin.Server) ([]koushin.Plugin, error) {
+ alps.RegisterPluginLoader(func(s *alps.Server) ([]alps.Plugin, error) {
p, err := newPlugin(s)
if err != nil {
return nil, err
@@ -69,6 +69,6 @@ func init() {
if p == nil {
return nil, nil
}
- return []koushin.Plugin{p}, err
+ return []alps.Plugin{p}, err
})
}
diff --git a/plugins/caldav/public/calendar.html b/plugins/caldav/public/calendar.html
index 6715258..7787bb1 100644
--- a/plugins/caldav/public/calendar.html
+++ b/plugins/caldav/public/calendar.html
@@ -1,6 +1,6 @@
{{template "head.html"}}
-<h1>koushin</h1>
+<h1>alps</h1>
<p>
<a href="/">Back</a>
diff --git a/plugins/caldav/public/event.html b/plugins/caldav/public/event.html
index 8c88833..a07f663 100644
--- a/plugins/caldav/public/event.html
+++ b/plugins/caldav/public/event.html
@@ -1,6 +1,6 @@
{{template "head.html"}}
-<h1>koushin</h1>
+<h1>alps</h1>
<p>
<a href="/calendar">Back</a>
diff --git a/plugins/caldav/routes.go b/plugins/caldav/routes.go
index 51a9490..ee18574 100644
--- a/plugins/caldav/routes.go
+++ b/plugins/caldav/routes.go
@@ -1,4 +1,4 @@
-package koushincaldav
+package alpscaldav
import (
"fmt"
@@ -6,12 +6,12 @@ import (
"net/url"
"time"
- "git.sr.ht/~emersion/koushin"
+ "git.sr.ht/~emersion/alps"
"github.com/emersion/go-webdav/caldav"
)
type CalendarRenderData struct {
- koushin.BaseRenderData
+ alps.BaseRenderData
Time time.Time
Calendar *caldav.Calendar
Events []caldav.CalendarObject
@@ -19,15 +19,15 @@ type CalendarRenderData struct {
}
type EventRenderData struct {
- koushin.BaseRenderData
+ alps.BaseRenderData
Calendar *caldav.Calendar
Event *caldav.CalendarObject
}
var monthPageLayout = "2006-01"
-func registerRoutes(p *koushin.GoPlugin, u *url.URL) {
- p.GET("/calendar", func(ctx *koushin.Context) error {
+func registerRoutes(p *alps.GoPlugin, u *url.URL) {
+ p.GET("/calendar", func(ctx *alps.Context) error {
var start time.Time
if s := ctx.QueryParam("month"); s != "" {
var err error
@@ -77,7 +77,7 @@ func registerRoutes(p *koushin.GoPlugin, u *url.URL) {
}
return ctx.Render(http.StatusOK, "calendar.html", &CalendarRenderData{
- BaseRenderData: *koushin.NewBaseRenderData(ctx),
+ BaseRenderData: *alps.NewBaseRenderData(ctx),
Time: start,
Calendar: calendar,
Events: events,
@@ -86,7 +86,7 @@ func registerRoutes(p *koushin.GoPlugin, u *url.URL) {
})
})
- p.GET("/calendar/:uid", func(ctx *koushin.Context) error {
+ p.GET("/calendar/:uid", func(ctx *alps.Context) error {
uid := ctx.Param("uid")
c, calendar, err := getCalendar(u, ctx.Session)
@@ -131,7 +131,7 @@ func registerRoutes(p *koushin.GoPlugin, u *url.URL) {
event := &events[0]
return ctx.Render(http.StatusOK, "event.html", &EventRenderData{
- BaseRenderData: *koushin.NewBaseRenderData(ctx),
+ BaseRenderData: *alps.NewBaseRenderData(ctx),
Calendar: calendar,
Event: event,
})