Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions cmd/vocat/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ func run(logger *slog.Logger, logs *loghub.Hub) error {
case err := <-serverError:
cancelDeviceStartup()
_ = protocolMux.Close()
handler.StopQQBotBinding()
return err
case <-signalContext.Done():
// Stop delayed OpenStick 410 startup work before the deferred VoWiFi
Expand All @@ -761,9 +762,12 @@ func run(logger *slog.Logger, logs *loghub.Hub) error {
if err := <-shutdownErrors; err != nil {
_ = plainServer.Close()
_ = tlsServer.Close()
handler.StopQQBotBinding()
return fmt.Errorf("graceful HTTP shutdown: %w", err)
}
}
// QQ 机器人绑定在请求结束后仍在后台运行:在数据库关闭前停止并等待。
handler.StopQQBotBinding()
return nil
}

Expand Down
3 changes: 3 additions & 0 deletions internal/server/automatic_task_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ func sendAutomaticTaskNotification(ctx context.Context, channel string, config m
if channel == "meow" {
return sendMeowNotification(ctx, config, &message.Task.DeviceID, message.Title, message.DetailText())
}
if channel == "qqbot" {
return sendQQBotNotification(ctx, config, &message.Task.DeviceID, message.Title, message.DetailText())
}
switch channel {
case "telegram":
return sendTelegramTextNotification(ctx, config, message.Task.DeviceID, message.Text)
Expand Down
3 changes: 3 additions & 0 deletions internal/server/call_notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,9 @@ func sendCallNotification(ctx context.Context, channel string, config map[string
if channel == "meow" {
return sendMeowNotification(ctx, config, &message.DeviceID, message.Title(), message.DetailText())
}
if channel == "qqbot" {
return sendQQBotNotification(ctx, config, &message.DeviceID, message.Title(), message.DetailText())
}
switch channel {
case "telegram":
return sendTelegramTextNotification(ctx, config, message.DeviceID, message.Text())
Expand Down
2 changes: 1 addition & 1 deletion internal/server/meow_notification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ func TestMeowSettingsRoundTrip(t *testing.T) {
}
response = api.request(t, http.MethodGet, "/api/settings/notifications", "")
data := decodeSettingsResponse(t, response)["data"].(map[string]any)
if len(data) != 8 || data["meow"].(map[string]any)["nickname"] != "测试昵称" {
if len(data) != len(notificationChannels) || data["meow"].(map[string]any)["nickname"] != "测试昵称" {
t.Fatalf("unexpected channels: %#v", data)
}
}
Expand Down
1 change: 1 addition & 0 deletions internal/server/notification_routing_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ func TestManualNotificationIgnoresDeviceScope(t *testing.T) {
config := map[string]any{"device_ids": []string{}, "nickname": "/", "payload_template": "{"}
for name, send := range map[string]func() error{
"meow": func() error { return sendMeowNotification(ctx, config, nil, "test", "test") },
"qqbot": func() error { return sendQQBotNotification(ctx, config, nil, "test", "test") },
"wecom": func() error { return sendWecomNotificationTest(ctx, config) },
"lark": func() error { return sendLarkNotificationTest(ctx, config) },
} {
Expand Down
Loading
Loading