Use local Github clone as backup + fallback to statically.io#2778
Merged
Use local Github clone as backup + fallback to statically.io#2778
Conversation
- Add ensure_local_backup_repo() to clone repo fresh on each update - Add try_local_backup() to copy files from local backup when GitHub fails - Modify curl_to_dir() to automatically fall back to local backup - Update fetch_lib.sh to use local backup when downloading lib.sh fails - Call ensure_local_backup_repo() in update and install scripts This solves issue #2771 by providing a local fallback when GitHub raw.githubusercontent.com hits rate limits. The implementation: - Prioritizes GitHub (online-first approach) - Falls back to local clone automatically on download failures - Clones fresh repo on each update run (no stale files) - Minimal code changes (~55 lines across 4 files) - Zero breaking changes - fully backward compatible
|
will this cover #2511 also? |
Member
Author
Yeah I think so, if I understand you correctly. The PR aims to keep a copy of all scripts "offline" at all times - mostly as a backup, but could also be used offline. |
|
to be more precise: |
Remove network_ok check in menu.sh to allow running offline. The run_script function will automatically: 1. Try to download from GitHub (if online) 2. Fall back to local backup (if offline or rate limited) This allows users to run menu.sh for configuration changes even when completely offline, as requested in issue #2771.
- Add CDN fallback between GitHub and local backup - Update curl_to_dir() in lib.sh to try cdn.statically.io - Update fetch_lib.sh with CDN fallback - Update nextcloud_update.sh initial source with CDN fallback - Statically.io caches main branch for 1 day (helps with rate limits) - Fallback order: GitHub → Statically CDN → Local backup
- Source fetch_lib.sh which handles GitHub → CDN → Local backup - Check for local fetch_lib.sh first before downloading - Add CDN fallback for fetch_lib.sh itself - Cleaner code, no duplication of fallback logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Solves #2771 by implementing a three-tier fallback system for script downloads:
Implementation:
Testing:
Comprehensive test suite validates all scenarios including intentional GitHub failure to confirm CDN fallback works automatically.