π End-to-end encrypted cloud for everything.
Dart 2faandroidauthye2eeencryptionend-to-end-encryptionfluttergolanggoogle-photosgoogle-photos-alternativeiosopensourcephotosprivacyprivacy-toolstypescriptzero-knowledge
Simplify device limit alert logic
Neeraj Gupta1d26d0d9b7f8
diff --git a/server/pkg/middleware/collection_link.go b/server/pkg/middleware/collection_link.goindex 1c8ed7e42c..797dacd382 100644--- a/server/pkg/middleware/collection_link.go+++ b/server/pkg/middleware/collection_link.go@@ -32,7 +32,6 @@ import ()var passwordWhiteListedURLs = []string{"/public-collection/info", "/public-collection/report-abuse", "/public-collection/verify-password"}-var whitelistedCollectionShareIDs = []int64{111, 2275}// CollectionLinkMiddleware intercepts and authenticates incoming requeststype CollectionLinkMiddleware struct {@@ -161,17 +160,10 @@ func (m *CollectionLinkMiddleware) isDeviceLimitReached(ctx context.Context,deviceLimit = public2.DeviceLimitThresholdMultiplier * public2.DeviceLimitThreshold}- if count >= public2.DeviceLimitWarningThreshold {- alertStepSize := int64(200)- shouldAlert := count == public2.DeviceLimitWarningThreshold ||- (count > public2.DeviceLimitWarningThreshold &&- (count-public2.DeviceLimitWarningThreshold)%alertStepSize == 0)-- if shouldAlert && !array.Int64InList(sharedID, whitelistedCollectionShareIDs) {- m.DiscordController.NotifyPotentialAbuse(- fmt.Sprintf("Album exceeds warning threshold: {CollectionID: %d, ShareID: %d, DeviceCount: %d}",- collectionSummary.CollectionID, collectionSummary.ID, count))- }+ if count >= public2.DeviceLimitWarningThreshold && count%200 == 0 {+ m.DiscordController.NotifyPotentialAbuse(+ fmt.Sprintf("Album exceeds warning threshold: {CollectionID: %d, ShareID: %d, DeviceCount: %d}",+ collectionSummary.CollectionID, collectionSummary.ID, count))}if deviceLimit > 0 && count >= deviceLimit {diff --git a/server/pkg/middleware/file_link.go b/server/pkg/middleware/file_link.goindex 80f6d59fec..44748ddd69 100644--- a/server/pkg/middleware/file_link.go+++ b/server/pkg/middleware/file_link.go@@ -139,17 +139,10 @@ func (m *FileLinkMiddleware) isDeviceLimitReached(ctx context.Context,deviceLimit = publicCtrl.DeviceLimitThresholdMultiplier * publicCtrl.DeviceLimitThreshold}- if count >= publicCtrl.DeviceLimitWarningThreshold {- alertStepSize := int64(200)- shouldAlert := count == publicCtrl.DeviceLimitWarningThreshold ||- (count > publicCtrl.DeviceLimitWarningThreshold &&- (count-publicCtrl.DeviceLimitWarningThreshold)%alertStepSize == 0)-- if shouldAlert {- m.DiscordController.NotifyPotentialAbuse(- fmt.Sprintf("FileLink exceeds warning threshold: {FileID: %d, ShareID: %s, DeviceCount: %d}",- collectionSummary.FileID, collectionSummary.LinkID, count))- }+ if count >= publicCtrl.DeviceLimitWarningThreshold && count%200 == 0 {+ m.DiscordController.NotifyPotentialAbuse(+ fmt.Sprintf("FileLink exceeds warning threshold: {FileID: %d, ShareID: %s, DeviceCount: %d}",+ collectionSummary.FileID, collectionSummary.LinkID, count))}if deviceLimit > 0 && count >= deviceLimit {