mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-03-08 05:32:33 +01:00
🎨 Support sending notifications on HarmonyOS https://github.com/siyuan-note/siyuan/issues/17125
Signed-off-by: Daniel <845765@qq.com>
This commit is contained in:
parent
b0abc47901
commit
656e676c8b
3 changed files with 13 additions and 4 deletions
|
|
@ -19,6 +19,7 @@ package api
|
|||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/88250/gulu"
|
||||
"github.com/gin-gonic/gin"
|
||||
|
|
@ -47,6 +48,13 @@ func sendDeviceNotification(c *gin.Context) {
|
|||
channel = "SiYuan Notifications"
|
||||
}
|
||||
|
||||
var id int
|
||||
if nil != arg["id"] {
|
||||
id = int(arg["id"].(float64))
|
||||
} else {
|
||||
id = int(time.Now().Unix())
|
||||
}
|
||||
|
||||
var title string
|
||||
if nil != arg["title"] {
|
||||
title = strings.TrimSpace(arg["title"].(string))
|
||||
|
|
@ -74,6 +82,7 @@ func sendDeviceNotification(c *gin.Context) {
|
|||
|
||||
util.BroadcastByType("main", "sendDeviceNotification", 0, "", map[string]interface{}{
|
||||
"channel": channel,
|
||||
"id": id,
|
||||
"title": title,
|
||||
"body": body,
|
||||
"delayInSeconds": delayInSeconds,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue