mirror of
https://codeberg.org/librewolf/source.git
synced 2024-12-22 05:33:03 -05:00
Merge branch 'custom_ubo_assets' into 'main'
Custom uBO `assets.json` patch Closes librewolf-community/settings#4 See merge request librewolf-community/browser/source!14
This commit is contained in:
commit
2d7c35fefc
4 changed files with 63 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
patches/allow-ubo-private-mode.patch
|
||||
patches/context-menu.patch
|
||||
patches/custom-ubo-assets-bootstrap-location.patch
|
||||
patches/disable-data-reporting-at-compile-time.patch
|
||||
patches/librewolf-pref-pane.patch
|
||||
patches/mozilla-vpn-ad.patch
|
||||
|
|
1
assets/uBOAssets.json
Normal file
1
assets/uBOAssets.json
Normal file
File diff suppressed because one or more lines are too long
17
patches/custom-ubo-assets-bootstrap-location.patch
Normal file
17
patches/custom-ubo-assets-bootstrap-location.patch
Normal file
|
@ -0,0 +1,17 @@
|
|||
--- a/toolkit/components/extensions/parent/ext-storage.js
|
||||
+++ b/toolkit/components/extensions/parent/ext-storage.js
|
||||
@@ -177,6 +177,14 @@ this.storage = class extends ExtensionAPI {
|
||||
|
||||
let data = await lookup;
|
||||
if (!data) {
|
||||
+ const assetsBootstrapLocation = Services.prefs.getBoolPref("librewolf.uBO.assetsBootstrapLocation", undefined);
|
||||
+ if (extension.id == "uBlock0@raymondhill.net" && assetsBootstrapLocation) {
|
||||
+ return {
|
||||
+ adminSettings: {
|
||||
+ assetsBootstrapLocation
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
return Promise.reject({
|
||||
message: "Managed storage manifest not found",
|
||||
});
|
44
scripts/update-ubo-assets.sh
Executable file
44
scripts/update-ubo-assets.sh
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
echo "update-ubo-assets.sh"
|
||||
echo
|
||||
|
||||
# Download the original assets.json from GitHub
|
||||
echo "-> Downloading original assets.json"
|
||||
assets=$(curl https://raw.githubusercontent.com/gorhill/uBlock/master/assets/assets.json)
|
||||
|
||||
# Overwrite the contentURL of assets.json so that uBO will always use the LW provided version
|
||||
echo "-> Overwriting assets.json update location"
|
||||
assets=$(echo "$assets" | jq '
|
||||
del(.["assets.json"].cdnURLs) |
|
||||
.["assets.json"].contentURL = "https://gitlab.com/librewolf-community/browser/source/-/raw/main/assets/uBOAssets.json"
|
||||
')
|
||||
|
||||
# Enable some filter lists that are disabled by default
|
||||
function enable_filter_list {
|
||||
echo "-> Enabling filter list \"$1\""
|
||||
assets=$(echo "$assets" | jq "del(.[\"$1\"].off)")
|
||||
}
|
||||
enable_filter_list "curben-phishing"
|
||||
enable_filter_list "adguard-spyware-url"
|
||||
|
||||
# Add some custom filter lists
|
||||
function add_filter_list {
|
||||
echo "-> Adding custom filter list \"$1\""
|
||||
assets=$(echo "$assets" | jq ".[\"$1\"] = $2")
|
||||
}
|
||||
add_filter_list "LegitimateURLShortener" '{
|
||||
"content": "filters",
|
||||
"group": "privacy",
|
||||
"title": "➗ Actually Legitimate URL Shortener Tool",
|
||||
"contentURL": "https://raw.githubusercontent.com/DandelionSprout/adfilt/master/LegitimateURLShortener.txt",
|
||||
"supportURL": "https://github.com/DandelionSprout/adfilt/discussions/163"
|
||||
}'
|
||||
|
||||
# Write the resulting json into line 4 of the patchfile
|
||||
echo "-> Writing to assets/uBOAssets.json"
|
||||
echo $assets | jq -c >./assets/uBOAssets.json
|
||||
|
||||
echo
|
||||
echo "Done!"
|
Loading…
Reference in a new issue