Add job for monitoring bw limit status of tokens

This commit is contained in:
Ben Adrian Sarmiento
2024-06-28 18:55:02 +02:00
parent c3aea427d0
commit 67111696a2
13 changed files with 136 additions and 55 deletions

View File

@@ -2,9 +2,13 @@ package utils
import "github.com/debridmediamanager/zurg/pkg/http"
func IsBWLimitExceeded(err error) bool {
func IsBytesLimitReached(err error) bool {
if dlErr, ok := err.(*http.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" {
return true
}
return false
}
func AreAllTokensExpired(err error) bool {
return err.Error() == "all tokens are expired"
}

7
pkg/utils/mask_token.go Normal file
View File

@@ -0,0 +1,7 @@
package utils
import "strings"
func MaskToken(token string) string {
return strings.Repeat("*", len(token)-4) + token[len(token)-4:]
}