diff --git a/calendar/service.go b/calendar/service.go index 1fadbfb..eda22b1 100644 --- a/calendar/service.go +++ b/calendar/service.go @@ -4,6 +4,7 @@ import ( "math/rand" "time" + "github.com/gin-gonic/gin" "kumoly.io/kumoly/app/server" "kumoly.io/kumoly/app/store" "kumoly.io/kumoly/app/util" @@ -38,6 +39,18 @@ func (srv Service) Load() error { calApi.PUT("", ApiCalUpdate) calApi.DELETE("", ApiCalDelete) + //+-30day + calApi.GET("ics/:cid", func(c *gin.Context) { + cid := c.Param("cid") + ics, err := ICS(cid, + time.Now().Add(time.Hour*-720), + time.Now().Add(time.Hour*720)) + if err != nil { + panic(err) + } + c.String(200, ics) + }) + eventApi := server.API.Group("event") eventApi.GET("", ApiEventQuery) eventApi.POST("", ApiEventNew)