29 lines
540 B
Go
Raw Normal View History

2017-07-14 21:50:34 +00:00
package notifications
import (
"net/http"
"github.com/aerogo/aero"
2017-07-14 23:32:06 +00:00
"github.com/animenotifier/arn"
2017-07-14 21:50:34 +00:00
"github.com/animenotifier/notify.moe/utils"
)
// Test ...
func Test(ctx *aero.Context) string {
user := utils.GetUser(ctx)
if user == nil {
return ctx.Error(http.StatusBadRequest, "Not logged in", nil)
}
2017-07-14 23:32:06 +00:00
notification := &arn.Notification{
Title: "Anime Notifier",
Message: "Yay, it works!",
2017-10-01 22:55:37 +00:00
Icon: "https://" + ctx.App.Config.Domain + "/images/brand/300.png",
2017-07-14 21:50:34 +00:00
}
2017-07-14 23:32:06 +00:00
user.SendNotification(notification)
2017-07-14 21:50:34 +00:00
return "ok"
}