🎨 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:
Daniel 2026-03-05 23:30:11 +08:00
parent b0abc47901
commit 656e676c8b
No known key found for this signature in database
GPG key ID: 86211BA83DF03017
3 changed files with 13 additions and 4 deletions

View file

@ -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,