-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
298 lines (270 loc) · 11.7 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
#<html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>alrc.luisadha.my.id</title><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-fork-ribbon-css/0.2.3/gh-fork-ribbon.min.css" /><link rel="stylesheet" href="https://unpkg.com/@highlightjs/cdn-assets@11.5.0/styles/default.min.css"><script src="https://unpkg.com/@highlightjs/cdn-assets@11.5.0/highlight.min.js"></script><script> hljs.initHighlightingOnLoad();</script><style>body { font-family: monospace; background: rgba(245, 245, 245, 1); } footer { font-size: 0.65rem; } a { color: inherit; text-decoration: none; } pre, code { border-radius: 4px; font-size: 1.1rem; color: #F0F0F0 !important; background: rgb(11 12 14) !important; } .github-fork-ribbon:before { background-color: rgb(11 12 14); }</style></head><body>: weapon-url-opener(1) installer<a class="github-fork-ribbon" href="https://github.com/luisadha/alrc-termux" data-ribbon="Contribute on GitHub" title="Contribute on GitHub">Contribute on GitHub</a> <h2>
#!/usr/bin/env bash
#</h2><span>luisadha.github.io/weapon-url-opener Use this self-hosted script to install your weapon-url-opener.</span><h3>
### <a name="usage" href="#usage">INSTALL</a></h2><pre><code code="shell">basher install luisadha/weapon-url-opener</code></pre><h3>
### <a name="code" href="#code">CODE</a></h2><pre><code code="bash">
# `weapon-url-opener(1)` installer script that fetches the canonical `setup.sh` script and runs it
# in the calling context.
# ============================================================
# Script Name : ztme-toolbox.sh (Zero Tolerance for Major Errors)
# Version : 1.3.5
# Description : Interactive Manager Collection Script for bash
# Author : Luis Adha (luisadha.my.id)
# Created Date : 2025-Feb-05 (Wedn)
# License : Apache 2.0 License
# GitHub : https://github.com/luisadha/weapon-url-opener
# ============================================================
# ============================================================
# Script Name : wuo.sh / weapon-url-opener.sh
# Version : 1.4
# Description : Switch downloader scripts easily and quickly for termux-url-opener purpose.
# Author : Luis Adha (luisadha.my.id)
# Created Date : 2025-Feb-05 (Wedn)
# License : MIT
# GitHub : https://github.com/luisadha/weapon-url-opener
# ============================================================
#set -xv
user_agent=$_
run_with_curl=false
SCRIPT_NAME=${BASH_SOURCE[0]##*/}
BIN="${PREFIX}/bin"
version_ztme="1.3.5"
version_wuo="1.4"
version_both="1.3.5(1.4)"
banner='[ZTME-TOOLBOX]'
warn='[warning]'
fail='[failure]'
succ='[success]'
a_href="https://github.com/luisadha/weapon-url-opener/blob/master/README.md"
PS3="Your choice: "
if [[ -e /proc/self/fd/63 && $(readlink /proc/self/fd/63) == pipe:* ]]; then
#echo "Skrip dijalankan via source <(curl ...)"
run_with_curl=true
user_agent='curl'
fi
if [[ ${BASH_SOURCE[0]} != "$0" && "${run_with_curl}" != "true" ]]; then
user_agent='source'
echo -e "User Agent: $(echo "$user_agent" | awk -F/ '{print $NF}')";
echo -e "\nError: Don't use \`source ${SCRIPT_NAME}' or \`. ${SCRIPT_NAME}'";
echo -e "Use \`bash ${SCRIPT_NAME}' or \`${SCRIPT_NAME}'"
return 127 2>/dev/null || exit 127
fi
mkdir -p ~/bin
touch ~/bin/termux-url-opener 2>/dev/null;
SELFMD5="$(md5sum ~/bin/ztme-toolbox.sh 2>/dev/null | cut -d' ' -f1)"
TARGETMD5="$(md5sum "$HOME/bin/termux-url-opener" | cut -d' ' -f1)"
plugin_enabled=''
if [ "$SELFMD5" = "$TARGETMD5" ]; then
# echo "MD5 cocok!"
plugin_enabled=true
else
plugin_enabled=false
# echo "MD5 berbeda!"
fi
mkdir -p ~/.tmp
echo '#!/usr/bin/bash
exec ~/.tmp/ztme-toolbox.sh --uninstall "$@"' > ~/.local/bin/wuo-uninstall.sh
chmod +x ~/.local/bin/wuo-uninstall.sh
echo '#!/usr/bin/bash
exec ~/.tmp/ztme-toolbox.sh --run-wuo "$@"' > ~/.local/bin/wuo.sh
chmod +x ~/.local/bin/wuo.sh
[ -e "$HOME/.local/bin/wuo" ] || ln -sf ~/.local/bin/wuo.sh ~/.local/bin/wuo &>/dev/null;
cp -f ~/.basher/cellar/bin/weapon-url-opener.sh ~/.tmp/ztme-toolbox.sh 2>/dev/null;
#cp -f "$0" ${PREFIX:-/usr/local}/bin/weapon-url-opener 2>/dev/null; chmod +x ${PREFIX:-/usr/local}/bin/weapon-url-opener 2>/dev/null;
clonePackage() {
# local args="$1"
if timeout 10s ping -c 1 google.com &> /dev/null; then
if [ -z "${1:-$REPO_LINK}" ]; then
echo "$warn : Broken link."
exit 1
fi
REPO_FOLDER=$(basename "${1:-$REPO_LINK}" .git)
if git clone "${1:-$REPO_LINK}.git" "$REPO_FOLDER"; then
echo "$succ : Repo's was completly cloned, please refresh!"
else
echo "$fail : Unable to clone the repository, please correct the names. "
exit 1
fi
else
echo "$fail : Couldn't connected to internet!, Abort."
exit 2
fi
}
findMatch() {
find . -maxdepth 1 -type d -exec sh -c 'for d; do [ -f "$d/${d##*/}.sh" ] && basename "$d/${d##*/}.sh" .sh; done' _ {} +
}
findMatchRecursif() {
find . -type d -exec sh -c 'for d; do [ -f "$d/${d##*/}.sh" ] && basename "$d/${d##*/}.sh" ".sh"; done' _ {} +
}
wuo() {
#!/data/data/com.termux/files/usr/bin/bash
# weapon-url-opener v1.0
# Created March 2024
# by: luisadha
# Algoritm: dynamic-condition-response using 'select do' and etc.
cat << "EOF"
_ __ __
| | / /__ ____ _____ ____ ____ __ _______/ / ____ ____ ___ ____ ___ _____
| | /| / / _ \/ __ `/ __ \/ __ \/ __ \______/ / / / ___/ /_____/ __ \/ __ \/ _ \/ __ \/ _ \/ ___/
| |/ |/ / __/ /_/ / /_/ / /_/ / / / /_____/ /_/ / / / /_____/ /_/ / /_/ / __/ / / / __/ /
|__/|__/\___/\__,_/ .___/\____/_/ /_/ \__,_/_/ /_/ \____/ .___/\___/_/ /_/\___/_/
/_/ /_/
EOF
echo -e " ╔════════════════════════════════════════════════╗"
echo -e " )⇒ Project Name :weapon-url-opener x ztme ⇐("
echo -e " )⇒ Author :luisadha ⇐("
echo -e " )⇒ Github :github.com/luisadha ⇐("
echo -e " )⇒ Telegram :@adharudin14 ⇐("
echo -e " ╚════════════════════════════════════════════════╝"
echo -e " Version: v$version_wuo"
echo -e " Tips: Use CTRL + D or CTRL + Z to force exit!\n"
#test -f ~/bin/termux-url-opener
ref_hash=$(md5sum ~/bin/termux-url-opener | awk '{print $1}'); match="";
for file in ~/bin/*.sh; do
file_hash=$(md5sum "$file" | awk '{print $1}')
if [ "$ref_hash" = "$file_hash" ]; then
match=true
toggle="$(basename "$file")"
#echo -n " IN USE: $toggle"; echo
#cocok dengan termux-url-opener
else
match=false
toggle="$(basename "$file")" #idak cocok dengan termux-ur
#echo -n " IN USE: $toggle"; echo
fi
[[ "$match" == "true" ]] && echo " IN USE: $toggle"
done
echo
#file_list=($(ls -Art ~/bin/*.sh))
#file_list=( $(for file in "${file_list[@]}"; do basename "$file"; done) )
IFS=$'\n' read -d '' -r -a file_list < <(\ls -Art ~/bin/*.sh)
IFS=$'\n' read -d '' -r -a file_list < <(printf "%s\n" "${file_list[@]}" | xargs -n1 basename)
select weapon in "${file_list[@]}" "BACK"; do
{
diff -sq ~/bin/"$weapon" ~/bin/termux-url-opener > .weapon-url-opener.status 2>/dev/null
}
[[ -n "$weapon" ]] || { break; }
if [[ "$weapon" == "BACK" ]]; then
#echo "Exiting the program"
rm -f .weapon-url-opener.status
break
else
echo "You selected $(basename "$weapon") as primary weapon"
sleep 1
cp -f ~/bin/"$(basename "$weapon")" ~/bin/termux-url-opener
break
fi
done
}
while [[ $# -gt 0 ]]; do
case "$1" in
--add-repo)
clonePackage "$2"
shift 2
;;
--uninstall)
echo "Cleaning symlink."
rm -v ~/.local/bin/wuo.sh
rm -v ~/.local/bin/wuo
rm -v ~/.tmp/ztme-toolbox.sh
rm -v ~/.local/bin/wuo-uninstall.sh;
rm -v ${BIN}/ztme-toolbox
rm -v ~/bin/ztme-toolbox.sh
sleep 0.5
echo -n "..All done";
echo -e ""
echo -e "You can make symlink again with \`weapon-url-opener' or\n"
echo -e "Procced full erases with \`basher uninstall luisadha/weapon-url-opener'\n"
echo -e ""
exit 0
;;
--wuo|--run-wuo)
wuo
shift 2
;;
-h|--help)
echo "Help messages"
exit 0
;;
*)
if [[ "$1" =~ ^https?:// ]]; then
echo "Cloning repository from: $1"
clonePackage "$1"
shift
fi
;;
esac
done
files="$(findMatch)"
echo "Preparing..." && findMatch &>/dev/null
sleep 0.8 && clear
printf %"$(tput cols)"s | tr " " "-"
#echo "-------------------------------------------"
echo "ZTME-Toolbox x Weapon Url Opener v$version_both"
echo "Run script as interactively from repository. "
#echo "-------------------------------------------"
printf %"$(tput cols)"s | tr " " "-"
echo -e "User Agent: $(echo "$user_agent" | awk -F/ '{print $NF}')"
echo -e "Info : $a_href
Author: <adharudin14@gmail.com>"
printf %"$(tput cols)"s | tr " " "-"
select filename in ${files} "Add repository (weapon-url-opener status)" "Fix issue if any" Exit;
do
[[ -n $filename ]] || { echo "$warn :What's that? Please try again." >&2; continue; }
case ${filename} in
"Exit")
echo "You selected $filename ($REPLY)"
echo "Exiting.."
break
;;
"Fix issue if any")
echo "You selected $filename ($REPLY)"
echo -e "Fixing the HISTSIZE BAD NUMBER issue..."
sleep 0.5
unset HISTSIZE
# echo -e "Fixing the REQUIRED FILE NOT FOUND issue..."
# sleep 0.5
echo -n "...Done!"
;;
"Add repository (weapon-url-opener status)")
if [[ "$plugin_enabled" == "true" ]]; then
echo "Info: Feature have been applied with termux-url-opener, try sharing the repository URL you want to clone via the Android Shared.";
else
[[ ! -f ~/bin/ztme-toolbox.sh ]] && echo -e "Warning: It seems that the file named \`ztme-Toolbox' is not in dir ~/bin\n";
echo -e "Do you want apply this feature into Termux-URL-Opener? (Y) \n";
[[ "$run_with_curl" == "true" ]] && echo -e "Warning: You cannot use this feature(y) until you have installed it completely. You can ignore this warning, (n) Continue as is \n"
read -r -p "Confirm (Y/n): " enableIt
if [[ "$enableIt" == "Y" ]] || [[ "$enableIt" == "y" ]]; then
if [[ "$user_agent" == "curl" ]]; then
echo -e "\nPlease install the entire package.\n";
break
fi
echo '#!/data/data/com.termux/files/usr/bin/bash
ztme-toolbox --add-repo "$@"' > ~/bin/ztme-toolbox.sh
cp -f "$0" "${BIN}/ztme-toolbox";
chmod +x "${BIN}/ztme-toolbox";
cp -f "${BIN}/ztme-toolbox" "${HOME}/.tmp/ztme-toolbox.sh" 2>/dev/null;
chmod +x ${HOME}/.tmp/ztme-toolbox.sh 2>/dev/null;
wuo
fi
fi
echo
echo "You selected $filename ($REPLY)"
echo "$banner : Paste your repository link below :"
read -r REPO_LINK
clonePackage "$REPO_LINK"
break
;;
*)
echo "You selected $filename ($REPLY)"
echo
chmod +x "${filename}"/"${filename,,}".sh
# termux-fix-shebang ${filename}/${filename,,}.sh
./"${filename}"/"${filename,,}".sh
echo
read -t 0.1
continue
;;
esac
done
#</code></pre><footer>#### Copyright (c) 2025 <a href="https://luisadha.my.id">luisadha.my.id</a> (<a href="https://github.com/luisadha">github.com/luisadha</a>) ####</footer></body></html>