增加分享链接功能

This commit is contained in:
Olia Lisa
2025-12-29 18:15:29 +08:00
parent 557e8a6fb9
commit 8661527fc0
2 changed files with 28 additions and 3 deletions
+19
View File
@@ -97,3 +97,22 @@ gen_password() {
echo "$rand"
}
# URL编码
url_encode() {
local str="$1"
local encoded=""
local i char hex
for ((i = 0; i < ${#str}; i++)); do
char="${str:$i:1}"
case "$char" in
[a-zA-Z0-9.~_-]) encoded+="$char" ;;
*)
printf -v hex '%02X' "'$char"
encoded+="%$hex"
;;
esac
done
echo "$encoded"
}