Compare commits
No commits in common. "720f9690f6bb2b071812c0163d2dc10418b88d7d" and "8e1ed67c482e3eeaa793311ca8febda0235275e5" have entirely different histories.
720f9690f6
...
8e1ed67c48
10
.idea/workspace.xml
generated
10
.idea/workspace.xml
generated
@ -4,9 +4,9 @@
|
|||||||
<option name="autoReloadType" value="ALL" />
|
<option name="autoReloadType" value="ALL" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":boom: Remove deprecated subscription API">
|
<list default="true" id="3fefb2c4-b6f9-466b-a523-53352e8d6f95" name="更改" comment=":sparkles: Allow access user info via numeric id">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/pkg/internal/services/notifications.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/notifications.go" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/pkg/internal/http/api/userinfo_api.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/http/api/userinfo_api.go" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@ -159,6 +159,8 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
<option name="CHECK_CODE_SMELLS_BEFORE_PROJECT_COMMIT" value="false" />
|
||||||
|
<MESSAGE value=":bug: Fix notification order" />
|
||||||
|
<MESSAGE value=":bug: Fix notification order... again" />
|
||||||
<MESSAGE value=":bug: Trying to fix panic" />
|
<MESSAGE value=":bug: Trying to fix panic" />
|
||||||
<MESSAGE value=":recycle: Remove most of the dealer deps and move to nexus" />
|
<MESSAGE value=":recycle: Remove most of the dealer deps and move to nexus" />
|
||||||
<MESSAGE value=":recycle: Refactored more modules into nexus" />
|
<MESSAGE value=":recycle: Refactored more modules into nexus" />
|
||||||
@ -182,9 +184,7 @@
|
|||||||
<MESSAGE value=":bug: Fix auth cache" />
|
<MESSAGE value=":bug: Fix auth cache" />
|
||||||
<MESSAGE value=":sparkles: Allow get realm by numeric auto increment id" />
|
<MESSAGE value=":sparkles: Allow get realm by numeric auto increment id" />
|
||||||
<MESSAGE value=":sparkles: Allow access user info via numeric id" />
|
<MESSAGE value=":sparkles: Allow access user info via numeric id" />
|
||||||
<MESSAGE value=":bug: Fix get user info query statement bug" />
|
<option name="LAST_COMMIT_MESSAGE" value=":sparkles: Allow access user info via numeric id" />
|
||||||
<MESSAGE value=":boom: Remove deprecated subscription API" />
|
|
||||||
<option name="LAST_COMMIT_MESSAGE" value=":boom: Remove deprecated subscription API" />
|
|
||||||
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
|
<option name="GROUP_MULTIFILE_MERGE_BY_DIRECTORY" value="true" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VgoProject">
|
<component name="VgoProject">
|
||||||
|
@ -18,6 +18,9 @@ func MapAPIs(app *fiber.App, baseURL string) {
|
|||||||
|
|
||||||
notify := api.Group("/notifications").Name("Notifications API")
|
notify := api.Group("/notifications").Name("Notifications API")
|
||||||
{
|
{
|
||||||
|
// Deprecated, use /subscription instead, will be removed in the future
|
||||||
|
notify.Post("/subscribe", addNotifySubscriber)
|
||||||
|
|
||||||
notify.Get("/", getNotifications)
|
notify.Get("/", getNotifications)
|
||||||
notify.Get("/subscription", getNotifySubscriber)
|
notify.Get("/subscription", getNotifySubscriber)
|
||||||
notify.Post("/subscription", addNotifySubscriber)
|
notify.Post("/subscription", addNotifySubscriber)
|
||||||
|
@ -129,8 +129,6 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b
|
|||||||
tokens = append(tokens, subscriber.DeviceToken)
|
tokens = append(tokens, subscriber.DeviceToken)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Str("topic", notification.Topic).Any("uid", notification.AccountID).Msg("Pushing notify to user...")
|
|
||||||
|
|
||||||
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{
|
err = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{
|
||||||
@ -138,9 +136,6 @@ func PushNotification(notification models.Notification, skipNotifiableCheck ...b
|
|||||||
Tokens: tokens,
|
Tokens: tokens,
|
||||||
Notification: notification.EncodeToPushkit(),
|
Notification: notification.EncodeToPushkit(),
|
||||||
})
|
})
|
||||||
if err != nil {
|
|
||||||
log.Warn().Err(err).Str("topic", notification.Topic).Msg("Failed to push notification to Pusher")
|
|
||||||
}
|
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -172,8 +167,6 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Debug().Str("topic", notifications[0].Topic).Any("uid", accountIdx).Msg("Pushing notify to users...")
|
|
||||||
|
|
||||||
if len(accountIdx) == 0 {
|
if len(accountIdx) == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -208,13 +201,11 @@ func PushNotificationBatch(notifications []models.Notification, skipNotifiableCh
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
ctx, cancel = context.WithTimeout(context.Background(), 5*time.Second)
|
||||||
if err := gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{
|
_ = gap.Px.PushNotifyBatch(pushkit.NotificationPushBatchRequest{
|
||||||
Providers: providers,
|
Providers: providers,
|
||||||
Tokens: tokens,
|
Tokens: tokens,
|
||||||
Notification: notification.EncodeToPushkit(),
|
Notification: notification.EncodeToPushkit(),
|
||||||
}); err != nil {
|
})
|
||||||
log.Warn().Err(err).Str("topic", notification.Topic).Msg("Failed to push notification to Pusher")
|
|
||||||
}
|
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user