From d24cbff7ac4b15fecce0f6ae7e47152ddf9b9050 Mon Sep 17 00:00:00 2001 From: Hugo Hsi Date: Tue, 14 Apr 2026 01:51:08 -0400 Subject: [PATCH 1/7] fix(ii): send user agent for Konachan wallpaper --- .../ii/scripts/colors/random/random_konachan_wall.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh b/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh index a1f922121..e69cc9306 100755 --- a/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh +++ b/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh @@ -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" From 36e0c3fddc37c02b9ca9375c80030dd80acccd12 Mon Sep 17 00:00:00 2001 From: Hugo Hsi Date: Tue, 14 Apr 2026 01:58:30 -0400 Subject: [PATCH 2/7] fix(ii): remove Konachan wallpaper UA fallback --- .../ii/scripts/colors/random/random_konachan_wall.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh b/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh index e69cc9306..5e92a5bf3 100755 --- a/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh +++ b/dots/.config/quickshell/ii/scripts/colors/random/random_konachan_wall.sh @@ -31,9 +31,6 @@ mkdir -p "$PICTURES_DIR/Wallpapers" page=$((1 + RANDOM % 1000)); 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}') From 14f8b846355588fd5342fb62d3c40512b5d7703e Mon Sep 17 00:00:00 2001 From: Hugo Hsi Date: Tue, 14 Apr 2026 01:58:37 -0400 Subject: [PATCH 3/7] fix(ii): add Konachan support in sidebar --- .../modules/common/utils/ImageDownloaderProcess.qml | 13 ++++++++++++- .../ii/modules/ii/sidebarLeft/anime/BooruImage.qml | 4 +++- .../modules/ii/sidebarLeft/anime/BooruResponse.qml | 2 +- dots/.config/quickshell/ii/services/Booru.qml | 8 ++++---- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/dots/.config/quickshell/ii/modules/common/utils/ImageDownloaderProcess.qml b/dots/.config/quickshell/ii/modules/common/utils/ImageDownloaderProcess.qml index 3a86b2fe1..37276378e 100644 --- a/dots/.config/quickshell/ii/modules/common/utils/ImageDownloaderProcess.qml +++ b/dots/.config/quickshell/ii/modules/common/utils/ImageDownloaderProcess.qml @@ -16,9 +16,20 @@ Process { return StringUtils.shellSingleQuoteEscape(FileUtils.trimFileProtocol(filePath)); } + function processSourceUrl() { + return StringUtils.shellSingleQuoteEscape(sourceUrl); + } + + function curlUserAgentArg() { + if (!downloadUserAgent) { + return ""; + } + return ` -H 'User-Agent: ${StringUtils.shellSingleQuoteEscape(downloadUserAgent)}'`; + } + running: true command: ["bash", "-c", - `mkdir -p $(dirname '${processFilePath()}'); [ -f '${processFilePath()}' ] || curl -sSL '${sourceUrl}' -o '${processFilePath()}' && file '${processFilePath()}'` + `mkdir -p $(dirname '${processFilePath()}'); [ -f '${processFilePath()}' ] || curl -sSL '${processSourceUrl()}'${curlUserAgentArg()} -o '${processFilePath()}' && file '${processFilePath()}'` ] stdout: StdioCollector { id: imageSizeOutputCollector diff --git a/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruImage.qml b/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruImage.qml index feeeeb05b..4f14c85eb 100644 --- a/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruImage.qml +++ b/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruImage.qml @@ -174,8 +174,10 @@ Button { onClicked: { root.showActions = false; const targetPath = root.imageData.is_nsfw ? root.nsfwPath : root.downloadPath; + const userAgent = Config.options?.networking?.userAgent ?? "" + const userAgentHeader = userAgent ? ` -H 'User-Agent: ${StringUtils.shellSingleQuoteEscape(userAgent)}'` : "" Quickshell.execDetached(["bash", "-c", - `mkdir -p '${targetPath}' && curl '${root.imageData.file_url}' -o '${targetPath}/${root.fileName}' && notify-send '${Translation.tr("Download complete")}' '${root.downloadPath}/${root.fileName}' -a 'Shell'` + `mkdir -p '${targetPath}' && curl '${StringUtils.shellSingleQuoteEscape(root.imageData.file_url)}'${userAgentHeader} -o '${targetPath}/${root.fileName}' && notify-send '${Translation.tr("Download complete")}' '${root.downloadPath}/${root.fileName}' -a 'Shell'` ]) } } diff --git a/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruResponse.qml b/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruResponse.qml index f67db79b5..57e42472d 100644 --- a/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruResponse.qml +++ b/dots/.config/quickshell/ii/modules/ii/sidebarLeft/anime/BooruResponse.qml @@ -230,7 +230,7 @@ Rectangle { rowHeight: imageRow.rowHeight imageRadius: imageRow.modelData.images.length == 1 ? 50 : Appearance.rounding.normal // Download manually to reduce redundant requests or make sure downloading works - manualDownload: ["danbooru", "waifu.im", "t.alcy.cc"].includes(root.responseData.provider) + manualDownload: ["danbooru", "waifu.im", "t.alcy.cc", "konachan"].includes(root.responseData.provider) previewDownloadPath: root.previewDownloadPath downloadPath: root.downloadPath nsfwPath: root.nsfwPath diff --git a/dots/.config/quickshell/ii/services/Booru.qml b/dots/.config/quickshell/ii/services/Booru.qml index 090476b9f..78977bbea 100644 --- a/dots/.config/quickshell/ii/services/Booru.qml +++ b/dots/.config/quickshell/ii/services/Booru.qml @@ -406,8 +406,8 @@ Singleton { } try { - // Required for danbooru - if (currentProvider == "danbooru") { + // Required for danbooru and konachan + if (["danbooru", "konachan"].includes(currentProvider)) { xhr.setRequestHeader("User-Agent", defaultUserAgent) } else if (currentProvider == "zerochan") { @@ -458,8 +458,8 @@ Singleton { } try { - // Required for danbooru - if (currentProvider == "danbooru") { + // Required for danbooru and konachan + if (["danbooru", "konachan"].includes(currentProvider)) { xhr.setRequestHeader("User-Agent", defaultUserAgent) } xhr.send() From 329fa312621ee695343360b8676c516f2b8ef2c5 Mon Sep 17 00:00:00 2001 From: Kashi754 Date: Wed, 15 Apr 2026 18:16:56 +0900 Subject: [PATCH 4/7] Fix broken waifu.im image and tag search --- dots/.config/quickshell/ii/services/Booru.qml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/dots/.config/quickshell/ii/services/Booru.qml b/dots/.config/quickshell/ii/services/Booru.qml index 090476b9f..b4064058d 100644 --- a/dots/.config/quickshell/ii/services/Booru.qml +++ b/dots/.config/quickshell/ii/services/Booru.qml @@ -190,19 +190,19 @@ Singleton { "waifu.im": { "name": "waifu.im", "url": "https://waifu.im", - "api": "https://api.waifu.im/search", + "api": "https://api.waifu.im/images", "description": Translation.tr("Waifus only | Excellent quality, limited quantity"), "mapFunc": (response) => { - response = response.images + response = response.items return response.map(item => { return { - "id": item.image_id, + "id": item.id, "width": item.width, "height": item.height, "aspect_ratio": item.width / item.height, "tags": item.tags.map(tag => {return tag.name}).join(" "), - "rating": item.is_nsfw ? "e" : "s", - "is_nsfw": item.is_nsfw, + "rating": item.isNsfw ? "e" : "s", + "is_nsfw": item.isNsfw, "md5": item.md5, "preview_url": item.sample_url ?? item.url, // preview_url just says access denied (maybe i fucked up and sent too many requests idk) "sample_url": item.url, @@ -212,10 +212,9 @@ Singleton { } }) }, - "tagSearchTemplate": "https://api.waifu.im/tags", + "tagSearchTemplate": "https://api.waifu.im/tags?Name={{query}}", "tagMapFunc": (response) => { - return [...response.versatile.map(item => {return {"name": item}}), - ...response.nsfw.map(item => {return {"name": item}})] + return response.items.map(item => {return {"name": item.name}}) } }, "t.alcy.cc": { @@ -332,7 +331,7 @@ Singleton { tagsArray.forEach(tag => { params.push("included_tags=" + encodeURIComponent(tag)); }); - params.push("limit=" + Math.min(limit, 30)) // Only admin can do > 30 + params.push("PageSize=" + Math.min(limit, 30)) // Only admin can do > 30 params.push("is_nsfw=" + (nsfw ? "null" : "false")) // null is random } else if (currentProvider === "t.alcy.cc") { From 4eef9ea18e44b76cc2fa7b97bdccc36490df5677 Mon Sep 17 00:00:00 2001 From: Kashi754 Date: Tue, 21 Apr 2026 19:23:21 +0900 Subject: [PATCH 5/7] Fix still tags not being applied to search request. --- dots/.config/quickshell/ii/services/Booru.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dots/.config/quickshell/ii/services/Booru.qml b/dots/.config/quickshell/ii/services/Booru.qml index b4064058d..187d047fc 100644 --- a/dots/.config/quickshell/ii/services/Booru.qml +++ b/dots/.config/quickshell/ii/services/Booru.qml @@ -329,10 +329,10 @@ Singleton { else if (currentProvider === "waifu.im") { var tagsArray = tagString.split(" "); tagsArray.forEach(tag => { - params.push("included_tags=" + encodeURIComponent(tag)); + params.push("IncludedTags=" + encodeURIComponent(tag.toLowerCase())); }); params.push("PageSize=" + Math.min(limit, 30)) // Only admin can do > 30 - params.push("is_nsfw=" + (nsfw ? "null" : "false")) // null is random + params.push("IsNsfw=" + (nsfw ? "All" : "False")) // null is random } else if (currentProvider === "t.alcy.cc") { url += tagString From aa044b456349cd10954cd2c30b51b90c4a020c57 Mon Sep 17 00:00:00 2001 From: Minh <97237370+end-4@users.noreply.github.com> Date: Sun, 24 May 2026 23:45:15 +0200 Subject: [PATCH 6/7] fix source url safe access --- dots/.config/quickshell/ii/services/Booru.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dots/.config/quickshell/ii/services/Booru.qml b/dots/.config/quickshell/ii/services/Booru.qml index 187d047fc..4cba189df 100644 --- a/dots/.config/quickshell/ii/services/Booru.qml +++ b/dots/.config/quickshell/ii/services/Booru.qml @@ -275,7 +275,7 @@ Singleton { property var currentProvider: Persistent.states.booru.provider function getWorkingImageSource(url) { - if (url.includes('pximg.net')) { + if (url?.includes('pximg.net')) { return `https://www.pixiv.net/en/artworks/${url.substring(url.lastIndexOf('/') + 1).replace(/_p\d+\.(png|jpg|jpeg|gif)$/, '')}`; } return url; From 6eb590b1a2f3948b1700a3b3a626a13eb2526665 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Mon, 25 May 2026 00:27:31 +0200 Subject: [PATCH 7/7] add light/dark wallpaper variant switching based on suffix --- .../ii/scripts/colors/switchwall.sh | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/dots/.config/quickshell/ii/scripts/colors/switchwall.sh b/dots/.config/quickshell/ii/scripts/colors/switchwall.sh index 381d879df..7c52083af 100755 --- a/dots/.config/quickshell/ii/scripts/colors/switchwall.sh +++ b/dots/.config/quickshell/ii/scripts/colors/switchwall.sh @@ -444,6 +444,30 @@ main() { fi fi + # If mode_flag is dark or light, try to find a variant with that mode suffix + if [[ "$mode_flag" == "dark" || "$mode_flag" == "light" ]]; then + # Get directory, filename without extension, and extension + local imgdir="$(dirname "$imgpath")" + local imgbase="$(basename "$imgpath")" + local imgname="${imgbase%.*}" + local imgext="${imgbase##*.}" + + # Strip existing -dark or -light suffix + local stripped_name="${imgname%-dark}" + stripped_name="${stripped_name%-light}" + + # Construct the new path with the requested mode suffix + local new_imgpath="${imgdir}/${stripped_name}-${mode_flag}.${imgext}" + local new_stripped_imgpath="${imgdir}/${stripped_name}.${imgext}" + + # If the variant exists, use it + if [[ -f "$new_imgpath" ]]; then + imgpath="$new_imgpath" + elif [[ -f "$new_stripped_imgpath" ]]; then + imgpath="$new_stripped_imgpath" + fi + fi + switch "$imgpath" "$mode_flag" "$type_flag" "$color_flag" "$color" }