diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a335da8..9872e7f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -5,7 +5,7 @@ on: tags: - 'v**' schedule: - - cron: '0 0 * * *' + - cron: '0 1 * * *' jobs: build: @@ -38,7 +38,7 @@ jobs: continue-on-error: false run: | # 3AM CET - since="$(date -d 'yesterday' +%Y-%m-%d) 00:00:00" + since="$(date -d 'yesterday' +%Y-%m-%d) 01:00:00" count=$(git rev-list --count --since="$since" --until=now HEAD) if [ "$count" -gt 0 ]; then echo "new_commits=true" >> $GITHUB_OUTPUT diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 0d7cd11..4b67c25 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -5,7 +5,7 @@ on: tags: - 'v**' schedule: - - cron: '0 0 * * *' + - cron: '0 1 * * *' jobs: build-and-push-image: @@ -25,7 +25,7 @@ jobs: continue-on-error: false run: | # 3AM CET - since="$(date -d 'yesterday' +%Y-%m-%d) 00:00:00" + since="$(date -d 'yesterday' +%Y-%m-%d) 01:00:00" count=$(git rev-list --count --since="$since" --until=now HEAD) if [ "$count" -gt 0 ]; then echo "new_commits=true" >> $GITHUB_OUTPUT diff --git a/internal/universal/downloader.go b/internal/universal/downloader.go index 440b03f..a3b4a2d 100644 --- a/internal/universal/downloader.go +++ b/internal/universal/downloader.go @@ -64,7 +64,7 @@ func (dl *Downloader) DownloadFile( unrestrict, err := torMgr.UnrestrictFile(file, cfg.ShouldServeFromRclone()) if dlErr, ok := err.(*zurghttp.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" { log.Warnf("Your account has reached the bandwidth limit, please try again after 12AM CET") - http.Error(resp, "File is not available", http.StatusLocked) + http.Error(resp, "File is not available (bandwidth limit reached)", http.StatusLocked) return } if err != nil { @@ -108,7 +108,7 @@ func (dl *Downloader) DownloadLink( unrestrict, err := torMgr.UnrestrictLink(link, cfg.ShouldServeFromRclone()) if dlErr, ok := err.(*zurghttp.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" { log.Warnf("Your account has reached the bandwidth limit, please try again after 12AM CET") - http.Error(resp, "Link is not available", http.StatusLocked) + http.Error(resp, "Link is not available (bandwidth limit reached)", http.StatusLocked) return } if err != nil { @@ -151,6 +151,11 @@ func (dl *Downloader) streamFileToResponse( // Perform the request downloadResp, err := dl.client.Do(dlReq) + if dlErr, ok := err.(*zurghttp.DownloadErrorResponse); ok && dlErr.Message == "bytes_limit_reached" { + log.Warnf("Your account has reached the bandwidth limit, please try again after 12AM CET") + http.Error(resp, "File is not available (bandwidth limit reached)", http.StatusLocked) + return + } if err != nil { log.Warnf("Cannot download file %s: %v", unrestrict.Download, err) if file != nil && file.State.Event(context.Background(), "break_file") == nil {