mirror of
https://github.com/end-4/dots-hyprland.git
synced 2026-06-05 14:59:27 -05:00
fix(ii): send user agent for Konachan wallpaper
This commit is contained in:
@@ -29,14 +29,18 @@ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
|
||||
mkdir -p "$PICTURES_DIR/Wallpapers"
|
||||
page=$((1 + RANDOM % 1000));
|
||||
response=$(curl "https://konachan.net/post.json?tags=rating%3Asafe&limit=1&page=$page")
|
||||
illogicalImpulseConfigPath="$HOME/.config/illogical-impulse/config.json"
|
||||
userAgent=$(jq -r '.networking.userAgent // empty' "$illogicalImpulseConfigPath" 2>/dev/null)
|
||||
if [ -z "$userAgent" ]; then
|
||||
userAgent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"
|
||||
fi
|
||||
response=$(curl -A "$userAgent" "https://konachan.net/post.json?tags=rating%3Asafe&limit=1&page=$page")
|
||||
link=$(echo "$response" | jq '.[0].file_url' -r);
|
||||
ext=$(echo "$link" | awk -F. '{print $NF}')
|
||||
downloadPath="$PICTURES_DIR/Wallpapers/random_wallpaper.$ext"
|
||||
illogicalImpulseConfigPath="$HOME/.config/illogical-impulse/config.json"
|
||||
currentWallpaperPath=$(jq -r '.background.wallpaperPath' $illogicalImpulseConfigPath)
|
||||
currentWallpaperPath=$(jq -r '.background.wallpaperPath' "$illogicalImpulseConfigPath")
|
||||
if [ "$downloadPath" == "$currentWallpaperPath" ]; then
|
||||
downloadPath="$PICTURES_DIR/Wallpapers/random_wallpaper-1.$ext"
|
||||
fi
|
||||
curl "$link" -o "$downloadPath"
|
||||
curl -A "$userAgent" "$link" -o "$downloadPath"
|
||||
"$SCRIPT_DIR/../switchwall.sh" --image "$downloadPath"
|
||||
|
||||
Reference in New Issue
Block a user