Push notifications
This commit is contained in:
28
pages/notifications/notifications.go
Normal file
28
pages/notifications/notifications.go
Normal file
@ -0,0 +1,28 @@
|
||||
package notifications
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"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)
|
||||
}
|
||||
|
||||
for _, sub := range user.PushSubscriptions().Items {
|
||||
err := sub.SendNotification("Yay, it works!")
|
||||
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
|
||||
return "ok"
|
||||
}
|
@ -21,6 +21,29 @@ component Settings(user *arn.User)
|
||||
InputText("Accounts.Osu.Nick", user.Accounts.Osu.Nick, "Osu", "Your username on osu.ppy.sh")
|
||||
//- InputText("Accounts.AnimePlanet.Nick", user.Accounts.AnimePlanet.Nick, "AnimePlanet", "Your username on anime-planet.com")
|
||||
|
||||
.widget.mountable
|
||||
h3.widget-title
|
||||
Icon("bell")
|
||||
span Notifications
|
||||
|
||||
.widget-input
|
||||
label Enable:
|
||||
button.action(data-action="enableNotifications", data-trigger="click")
|
||||
Icon("toggle-on")
|
||||
span Enable notifications
|
||||
|
||||
.widget-input
|
||||
label Disable:
|
||||
button.action(data-action="disableNotifications", data-trigger="click")
|
||||
Icon("toggle-off")
|
||||
span Disable notifications
|
||||
|
||||
.widget-input
|
||||
label Test:
|
||||
button.action(data-action="testNotification", data-trigger="click")
|
||||
Icon("paper-plane")
|
||||
span Send test notification
|
||||
|
||||
.widget.mountable
|
||||
h3.widget-title
|
||||
Icon("user-plus")
|
||||
@ -49,17 +72,6 @@ component Settings(user *arn.User)
|
||||
Icon("circle-o")
|
||||
span Not connected
|
||||
|
||||
.widget.mountable
|
||||
h3.widget-title
|
||||
Icon("puzzle-piece")
|
||||
span Extensions
|
||||
|
||||
.widget-input
|
||||
label Chrome Extension:
|
||||
button.action(data-action="installExtension", data-trigger="click")
|
||||
Icon("chrome")
|
||||
span Get the Chrome Extension
|
||||
|
||||
.widget.mountable
|
||||
h3.widget-title
|
||||
Icon("download")
|
||||
@ -78,6 +90,17 @@ component Settings(user *arn.User)
|
||||
Icon("upload")
|
||||
span Export anime list as JSON
|
||||
|
||||
.widget.mountable
|
||||
h3.widget-title
|
||||
Icon("puzzle-piece")
|
||||
span Extensions
|
||||
|
||||
.widget-input
|
||||
label Chrome Extension:
|
||||
button.action(data-action="installExtension", data-trigger="click")
|
||||
Icon("chrome")
|
||||
span Get the Chrome Extension
|
||||
|
||||
//- .widget.mountable(data-api="/api/settings/" + user.ID)
|
||||
//- h3.widget-title
|
||||
//- Icon("cogs")
|
||||
|
Reference in New Issue
Block a user