-
Notifications
You must be signed in to change notification settings - Fork 785
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #310 from jjm2473/luci-21
Luci 21相关的各种优化
- Loading branch information
Showing
11 changed files
with
109 additions
and
66 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
Drop background here! | ||
accept jpg png gif and mp4 | ||
accept jpg png gif mp4 webm |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/bin/sh | ||
# author jjm2473 | ||
|
||
BING_BASE=http://www.bing.com | ||
CACHE=/var/run/argon_bing.url | ||
WRLOCK=/var/lock/argon_bing.lock | ||
|
||
fetch_url_path() { | ||
curl --fail --show-error --max-time 1 \ | ||
"$BING_BASE/HPImageArchive.aspx?format=js&idx=0&n=1&mkt=en-US" 2>/dev/null \ | ||
| jsonfilter -q -e '@.images[0].url' | ||
} | ||
|
||
try_update() { | ||
local lock="$WRLOCK" | ||
exec 200>$lock | ||
|
||
if flock -n 200 >/dev/null 2>&1; then | ||
local path=`fetch_url_path` | ||
if [ -n "$path" ]; then | ||
echo "${BING_BASE}${path}" | tee "$CACHE" | ||
else | ||
if [ -s "$CACHE" ]; then | ||
cat "$CACHE" | ||
else | ||
touch "$CACHE" | ||
fi | ||
fi | ||
flock -u 200 >/dev/null 2>&1 | ||
elif [ -s "$CACHE" ]; then | ||
cat "$CACHE" | ||
fi | ||
} | ||
|
||
get_url() { | ||
if [ -f "$CACHE" ]; then | ||
local idle_t=$((`date '+%s'` - `date -r "$CACHE" '+%s' 2>/dev/null || echo '0'`)) | ||
if [ -s "$CACHE" ]; then | ||
if [ $idle_t -le 43200 ]; then | ||
cat "$CACHE" | ||
return | ||
fi | ||
else | ||
if [ $idle_t -le 120 ]; then | ||
return | ||
fi | ||
fi | ||
fi | ||
try_update | ||
} | ||
|
||
get_url |