diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1f1c14f..a695f99 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,8 @@
-
+
-
-
@@ -42,34 +40,34 @@
- {
+ "keyToString": {
+ "DefaultGoTemplateProperty": "Go File",
+ "Go Build.Backend.executor": "Run",
+ "Go 构建.Backend.executor": "Run",
+ "RunOnceActivity.ShowReadmeOnStart": "true",
+ "RunOnceActivity.go.formatter.settings.were.checked": "true",
+ "RunOnceActivity.go.migrated.go.modules.settings": "true",
+ "RunOnceActivity.go.modules.automatic.dependencies.download": "true",
+ "RunOnceActivity.go.modules.go.list.on.any.changes.was.set": "true",
+ "git-widget-placeholder": "master",
+ "go.import.settings.migrated": "true",
+ "go.sdk.automatically.set": "true",
+ "last_opened_file_path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/web/src/components/admin",
+ "node.js.detected.package.eslint": "true",
+ "node.js.selected.package.eslint": "(autodetect)",
+ "nodejs_package_manager_path": "npm",
+ "run.code.analysis.last.selected.profile": "pProject Default",
+ "settings.editor.selected.configurable": "preferences.pluginManager",
+ "ts.external.directory.path": "/Users/littlesheep/Documents/Projects/Hydrogen/Passport/web/node_modules/typescript/lib",
+ "vue.rearranger.settings.migration": "true"
},
- "keyToStringList": {
- "DatabaseDriversLRU": [
- "postgresql"
+ "keyToStringList": {
+ "DatabaseDriversLRU": [
+ "postgresql"
]
}
-}]]>
+}
@@ -153,7 +151,6 @@
-
@@ -178,7 +175,8 @@
-
+
+
true
diff --git a/pkg/internal/services/notifications.go b/pkg/internal/services/notifications.go
index bfbd18a..61ad21f 100644
--- a/pkg/internal/services/notifications.go
+++ b/pkg/internal/services/notifications.go
@@ -2,6 +2,8 @@ package services
import (
"context"
+ "reflect"
+
"firebase.google.com/go/messaging"
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
@@ -9,7 +11,6 @@ import (
"github.com/sideshow/apns2"
payload2 "github.com/sideshow/apns2/payload"
"github.com/spf13/viper"
- "reflect"
)
func AddNotifySubscriber(user models.Account, provider, id, tk, ua string) (models.NotificationSubscriber, error) {
diff --git a/pkg/internal/services/statuses.go b/pkg/internal/services/statuses.go
index ba413ab..813ac3a 100644
--- a/pkg/internal/services/statuses.go
+++ b/pkg/internal/services/statuses.go
@@ -2,10 +2,11 @@ package services
import (
"fmt"
+ "time"
+
"git.solsynth.dev/hydrogen/passport/pkg/internal/database"
"git.solsynth.dev/hydrogen/passport/pkg/internal/models"
"github.com/samber/lo"
- "time"
)
var statusCache = make(map[uint]models.Status)
@@ -30,15 +31,17 @@ func GetStatus(uid uint) (models.Status, error) {
return status, nil
}
+func GetUserOnline(uid uint) bool {
+ return wsConn[uid] != nil && len(wsConn[uid]) > 0
+}
+
func GetStatusDisturbable(uid uint) error {
status, err := GetStatus(uid)
- isOnline := wsConn[uid] != nil && len(wsConn[uid]) > 0
+ isOnline := GetUserOnline(uid)
if isOnline && err != nil {
return nil
} else if err == nil && status.IsNoDisturb {
return fmt.Errorf("do not disturb")
- } else if !isOnline {
- return fmt.Errorf("offline")
} else {
return nil
}
diff --git a/web/bun.lockb b/web/bun.lockb
new file mode 100755
index 0000000..29dcf9b
Binary files /dev/null and b/web/bun.lockb differ