This commit is contained in:
Simon Ser 2020-05-20 19:08:06 +02:00
parent 9465f8db6d
commit 8813faf71e
No known key found for this signature in database
GPG key ID: 0FDE7BE0E88F5E48
2 changed files with 6 additions and 6 deletions

View file

@ -135,14 +135,14 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
NextTime: start.AddDate(0, 1, 0), NextTime: start.AddDate(0, 1, 0),
EventsForDate: func(when time.Time) []CalendarObject { EventsForDate: func(when time.Time) []CalendarObject {
if events, ok := eventMap[when.Truncate(time.Hour * 24)]; ok { if events, ok := eventMap[when.Truncate(time.Hour*24)]; ok {
return events return events
} }
return nil return nil
}, },
DaySuffix: func(n int) string { DaySuffix: func(n int) string {
if n % 100 >= 11 && n % 100 <= 13 { if n%100 >= 11 && n%100 <= 13 {
return "th" return "th"
} }
return map[int]string{ return map[int]string{
@ -156,10 +156,10 @@ func registerRoutes(p *alps.GoPlugin, u *url.URL) {
7: "th", 7: "th",
8: "th", 8: "th",
9: "th", 9: "th",
}[n % 10] }[n%10]
}, },
Sub: func (a, b int) int { Sub: func(a, b int) int {
// Why isn't this built-in, come on Go // Why isn't this built-in, come on Go
return a - b return a - b
}, },

View file

@ -10,8 +10,8 @@ import (
"sync" "sync"
"time" "time"
"github.com/labstack/echo/v4"
"github.com/fernet/fernet-go" "github.com/fernet/fernet-go"
"github.com/labstack/echo/v4"
) )
const ( const (
@ -318,7 +318,7 @@ func (ctx *Context) GetLoginToken() (string, string) {
} }
bytes := fernet.VerifyAndDecrypt([]byte(cookie.Value), bytes := fernet.VerifyAndDecrypt([]byte(cookie.Value),
24 * time.Hour * 30, []*fernet.Key{fkey}) 24*time.Hour*30, []*fernet.Key{fkey})
if bytes == nil { if bytes == nil {
return "", "" return "", ""
} }