Skip to content

Commit

Permalink
增加获取在线壁纸的最长响应等待时间至3s, 以避免网络环境不佳时无法获取壁纸url
Browse files Browse the repository at this point in the history
  • Loading branch information
SpeedPartner committed Apr 15, 2023
1 parent 03c3972 commit e825831
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions root/usr/libexec/argon/online_wallpaper
Expand Up @@ -10,19 +10,19 @@ WRLOCK=/var/lock/argon_${WEB_PIC_SRC}.lock
fetch_pic_url() {
case $WEB_PIC_SRC in
bing)
local picpath=$(curl -fks --max-time 1 \
local picpath=$(curl -fks --max-time 3 \
"https://www.bing.com/HPImageArchive.aspx?format=js&n=1" |
jsonfilter -q -e '@.images[0].url')
[ -n "${picpath}" ] && echo "//www.bing.com${picpath}"
;;
unsplash)
curl -fks --max-time 1 \
curl -fks --max-time 3 \
"https://source.unsplash.com/1920x1080/daily?wallpapers" |
sed -E 's#^.*href="([^?]+)\?.*$#\1?fm=jpg\&fit=crop\&w=1920\&h=1080#'
;;
unsplash_*)
local collection_id=${WEB_PIC_SRC#unsplash_}
curl -fks --max-time 1 \
curl -fks --max-time 3 \
"https://source.unsplash.com/collection/${collection_id}/1920x1080" |
sed -E 's#^.*href="([^?]+)\?.*$#\1?fm=jpg\&fit=crop\&w=1920\&h=1080#'
;;
Expand Down

0 comments on commit e825831

Please sign in to comment.