-
Notifications
You must be signed in to change notification settings - Fork 0
/
zie.sh
668 lines (555 loc) · 21.8 KB
/
zie.sh
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
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
#!/data/data/com.termux/files/usr/bin/bash
termux-wake-lock
echo "ZeroNet installation: Step 1 of 4 - Updating Termux repositories"
echo "Please select your preferred mirror when prompted."
termux-change-repo
echo "Repository update completed."
echo "ZeroNet installation: Step 2 of 4 - Setting up Termux storage"
echo "You may need to grant storage permission."
termux-setup-storage
echo "Storage setup completed."
ZERONET_DIR="$HOME/apps/zeronet"
LOG_FILE="$HOME/zeronet_install.log"
TORRC_FILE="$HOME/.tor/torrc"
TOR_PROXY_PORT=49050
TOR_CONTROL_PORT=49051
UI_IP="127.0.0.1"
UI_PORT=43110
SYNCRONITE_ADDRESS="15CEFKBRHFfAP9rmL6hhLmHoXrrgmw4B5o"
USER_AGENT="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
# Create a temporary directory in the user's home folder
WORK_DIR="$HOME/zeronet_tmp"
mkdir -p "$WORK_DIR"
chmod -R 755 "$WORK_DIR"
log() {
echo "[$(date +'%Y-%m-%d %H:%M:%S')] $1" >> "$LOG_FILE"
}
log_and_show() {
log "$1"
echo "$1"
}
log_error() {
log "[ERROR] $1"
echo "Error: $1" >&2
exit 1
}
get_python_version() {
python3 -c "import sys; print(f'{sys.version_info.major}.{sys.version_info.minor}')"
}
PYTHON_VERSION=$(get_python_version)
PYTHON_MAJOR_VERSION=${PYTHON_VERSION%.*}
PYTHON_MINOR_VERSION=${PYTHON_VERSION#*.}
log "Detected Python version: $PYTHON_VERSION"
echo "ZeroNet installation: Step 3 of 4 - Gathering information"
echo "Please provide a URL or path to users.json, or press Enter to skip. users.json is where your ZeroNet accounts are stored and/or will be stored."
read -r users_json_source
echo "Do you want to set up an onion tracker? This will strengthen ZeroNet. This doesn't work for every Android device. (y/n)"
read -r onion_tracker_setup
echo "Do you want to set up auto-start with Termux:Boot? This will start ZeroNet after your device is rebooted. (y/n)"
read -r boot_setup
echo "ZeroNet installation: Step 4 of 4 - Installing ZeroNet"
echo "This may take several minutes. Please be patient. If you have Termux:API installed, you'll receive notifications with further instructions when ZeroNet is installed and running."
update_mirrors() {
local max_attempts=5
local attempt=1
while [ $attempt -le $max_attempts ]; do
if yes | pkg update; then
log "Successfully updated package lists"
return 0
else
log "Failed to update package lists. Attempt $attempt of $max_attempts."
if [ $attempt -lt $max_attempts ]; then
log "Trying a different mirror..."
termux-change-repo
sleep 5
fi
((attempt++))
fi
done
log_error "Failed to update package lists after $max_attempts attempts."
return 1
}
update_mirrors || exit 1
yes | pkg upgrade
required_packages=(
termux-tools termux-keyring python
netcat-openbsd binutils git cmake libffi
curl unzip libtool automake autoconf pkg-config findutils
clang make termux-api tor perl jq openssl-tool iproute2
zlib
)
install_package() {
local package=$1
local max_attempts=3
local attempt=1
while [ $attempt -le $max_attempts ]; do
if yes | pkg install -y "$package"; then
log "Successfully installed $package"
return 0
else
log "Failed to install $package. Attempt $attempt of $max_attempts."
if [ $attempt -lt $max_attempts ]; then
log "Retrying in 5 seconds..."
sleep 5
fi
((attempt++))
fi
done
log_error "Failed to install $package after $max_attempts attempts."
return 1
}
for package in "${required_packages[@]}"; do
if ! dpkg -s "$package" 2>&1; then
install_package "$package" || exit 1
fi
done
install_python_packages() {
log "Installing required Python packages..."
# Ensure Python is up to date
pkg upgrade python
export CFLAGS="-I$PREFIX/include -I$PREFIX/include/python$PYTHON_VERSION"
export LDFLAGS="-L$PREFIX/lib -L$PREFIX/lib/python$PYTHON_VERSION/config-$PYTHON_VERSION"
export PYTHONPATH="$PREFIX/lib/python$PYTHON_VERSION/site-packages"
pip$PYTHON_MAJOR_VERSION install --upgrade pip setuptools wheel
# Create our own requirements.txt file
cat > "$WORK_DIR/custom_requirements.txt" << EOL
setuptools
greenlet
cffi
gevent
gevent-ws
PySocks
requests
GitPython
pycryptodome
pyOpenSSL
coincurve
pyasn1
rsa
msgpack
base58
merkletools
maxminddb
defusedxml
pyaes
ipython
EOL
log "Installing Python packages individually..."
while read -r package; do
if pip$PYTHON_MAJOR_VERSION install "$package"; then
log "Successfully installed $package"
else
log_error "Failed to install $package"
return 1
fi
done < "$WORK_DIR/custom_requirements.txt"
if [ $? -eq 0 ]; then
log "Successfully installed all required Python packages"
else
log_error "Failed to install some Python packages from custom_requirements.txt"
return 1
fi
# Verify installations
log "Verifying installations..."
python$PYTHON_MAJOR_VERSION -c "import gevent; from Crypto.Hash import SHA3_256; import OpenSSL; print('SHA3-256:', SHA3_256.new(b'test').hexdigest()); print('All required Python packages successfully installed')" || log_error "Failed to import one or more required Python packages"
}
if [ -d "$ZERONET_DIR" ] && [ "$(ls -A "$ZERONET_DIR")" ]; then
log "The directory $ZERONET_DIR already exists and is not empty."
log "Proceeding to adjust permissions and clean the directory."
chmod -R u+rwX "$ZERONET_DIR" || { log_error "Failed to adjust permissions on existing directory"; exit 1; }
rm -rf "$ZERONET_DIR" || { log_error "Failed to remove existing directory"; exit 1; }
fi
mkdir -p "$ZERONET_DIR"
cd "$WORK_DIR" || { log_error "Failed to change to working directory"; exit 1; }
git_clone_with_retries() {
local repo_url=$1
local target_dir=$2
local branch=$3
while true; do
log "Attempting to clone $repo_url..."
if git clone --depth 1 --branch "$branch" "$repo_url" "$target_dir"; then
log "Successfully cloned $repo_url"
break
else
log "Failed to clone $repo_url. Retrying in 5 seconds..."
rm -rf "$target_dir"
sleep 5
fi
done
}
zeronet_source="https://github.com/zeronet-conservancy/zeronet-conservancy.git"
git_clone_with_retries "$zeronet_source" "$ZERONET_DIR" "optional-rich-master"
cd "$ZERONET_DIR" || exit 1
# Check for key files
if [ ! -f "$ZERONET_DIR/zeronet.py" ]; then
log_error "zeronet.py not found. ZeroNet installation might be incomplete."
exit 1
fi
# Check if src directory exists
if [ -d "$ZERONET_DIR/src" ]; then
sed -i '1i import traceback' "$ZERONET_DIR/src/util/Git.py"
else
log "src directory not found. Checking alternative structure..."
if [ -f "$ZERONET_DIR/util/Git.py" ]; then
sed -i '1i import traceback' "$ZERONET_DIR/util/Git.py"
else
log_error "Unable to locate Git.py. ZeroNet structure might have changed."
exit 1
fi
fi
if [ ! -d "$ZERONET_DIR/venv" ]; then
python$PYTHON_MAJOR_VERSION -m venv "$ZERONET_DIR/venv"
fi
source "$ZERONET_DIR/venv/bin/activate"
# Check if requirements.txt exists
if [ -f "$ZERONET_DIR/requirements.txt" ]; then
pip install -r "$ZERONET_DIR/requirements.txt"
else
log "requirements.txt not found. Installing packages from custom list..."
# Install packages from our custom list
install_python_packages
fi
chmod -R u+rwX "$ZERONET_DIR"
install_contentfilter_plugin() {
log "Installing ContentFilter plugin..."
local plugins_dir="$ZERONET_DIR/plugins"
local plugins_repo="https://github.com/ZeroNetX/ZeroNet-Plugins.git"
local plugins_tmp_dir="$WORK_DIR/zeronet_plugins"
if [ ! -d "$plugins_dir/ContentFilter" ]; then
git_clone_with_retries "$plugins_repo" "$plugins_tmp_dir" "master"
if [ -d "$plugins_tmp_dir/ContentFilter" ]; then
mv "$plugins_tmp_dir/ContentFilter" "$plugins_dir/ContentFilter"
log "Installed ContentFilter plugin"
else
log "ContentFilter plugin not found in the repository"
fi
# Clean up
rm -rf "$plugins_tmp_dir"
else
log "ContentFilter plugin already exists, skipping installation"
fi
log "ContentFilter plugin installation completed."
}
# Install ContentFilter plugin
install_contentfilter_plugin
mkdir -p ./data
chmod -R u+rwX ./data
if [[ "$users_json_source" == http* ]]; then
mkdir -p data
curl -L "$users_json_source" -o "data/users.json"
elif [ -n "$users_json_source" ]; then
if [ -f "$users_json_source" ]; then
mkdir -p data
cp "$users_json_source" data/users.json || { log_error "Failed to copy users.json"; exit 1; }
log "users.json copied successfully from $users_json_source"
else
log_error "File not found: $users_json_source"
exit 1
fi
fi
mkdir -p $PREFIX/var/log/
TRACKERS_FILE="$ZERONET_DIR/trackers.txt"
update_trackers() {
log "Updating trackers list..."
trackers_urls=(
"https://cf.trackerslist.com/best.txt"
"https://bitbucket.org/xiu2/trackerslistcollection/raw/master/best.txt"
"https://cdn.jsdelivr.net/gh/XIU2/TrackersListCollection/best.txt"
"https://fastly.jsdelivr.net/gh/XIU2/TrackersListCollection/best.txt"
"https://gcore.jsdelivr.net/gh/XIU2/TrackersListCollection/best.txt"
"https://cdn.statically.io/gh/XIU2/TrackersListCollection/best.txt"
"https://raw.githubusercontent.com/XIU2/TrackersListCollection/master/best.txt"
)
for tracker_url in "${trackers_urls[@]}"; do
log "Attempting to download tracker list from $tracker_url..."
if curl -A "$USER_AGENT" -s -f "$tracker_url" -o "$TRACKERS_FILE"; then
log "Successfully downloaded tracker list from $tracker_url"
chmod 644 "$TRACKERS_FILE"
return
else
log "Failed to download from $tracker_url."
fi
done
log_error "Failed to download from any URL. Retrying in 5 seconds..."
sleep 5
}
generate_random_port() {
log "Generating a random, collision-free port number for ZeroNet..."
EXCLUDED_PORTS=($TOR_PROXY_PORT $TOR_CONTROL_PORT)
while true; do
RANDOM_PORT=$(shuf -i 1025-65535 -n 1)
# Check if the port is in the excluded list
if [[ " ${EXCLUDED_PORTS[@]} " =~ " $RANDOM_PORT " ]]; then
log "Port $RANDOM_PORT is excluded (Tor port). Generating a new port..."
continue
fi
# Check if the port is already in use
if ! ss -tuln | grep -q ":$RANDOM_PORT "; then
log "Selected available port $RANDOM_PORT for ZeroNet."
FILESERVER_PORT=$RANDOM_PORT
log "Assigned FILESERVER_PORT = $FILESERVER_PORT"
break
else
log "Port $RANDOM_PORT is in use. Generating a new port..."
fi
done
}
create_zeronet_conf() {
local conf_file="$ZERONET_DIR/zeronet.conf"
cat > "$conf_file" << EOL
[global]
homepage = 191CazMVNaAcT9Y1zhkxd9ixMBPs59g2um
data_dir = $ZERONET_DIR/data
log_dir = $PREFIX/var/log/zeronet
ui_ip = $UI_IP
ui_port = $UI_PORT
tor_controller = $UI_IP:$TOR_CONTROL_PORT
tor_proxy = $UI_IP:$TOR_PROXY_PORT
trackers_file = $TRACKERS_FILE
{data_dir}/$SYNCRONITE_ADDRESS/cache/1/Syncronite.html
language = en
tor = enable
fileserver_port = $FILESERVER_PORT
ip_external =
EOL
log "ZeroNet configuration file created at $conf_file with security settings"
}
configure_tor() {
log "Configuring Tor..."
mkdir -p $HOME/.tor
mkdir -p $PREFIX/var/log/tor
# Mandatory configuration
cat > $TORRC_FILE << EOL
SocksPort $TOR_PROXY_PORT
ControlPort $TOR_CONTROL_PORT
CookieAuthentication 1
Log notice file $PREFIX/var/log/tor/notices.log
EOL
# Optional onion service configuration
if [[ $onion_tracker_setup =~ ^[Yy]$ ]]; then
mkdir -p $HOME/.tor/ZeroNet
cat >> $TORRC_FILE << EOL
HiddenServiceDir $HOME/.tor/ZeroNet
HiddenServicePort 80 127.0.0.1:$FILESERVER_PORT
HiddenServiceVersion 3
EOL
log "Onion tracker configuration added to Tor configuration"
else
log "Onion tracker setup skipped, but mandatory Tor configuration is in place"
fi
log "Tor configuration created at $TORRC_FILE"
}
update_trackers
generate_random_port
create_zeronet_conf
configure_tor
log "Starting Tor service..."
tor -f $TORRC_FILE &
TOR_PID=$!
if [[ $onion_tracker_setup =~ ^[Yy]$ ]]; then
log "Waiting for Tor to start and generate the hidden service..."
for i in {1..60}; do # Increased wait time to 60 seconds
if [ -f "$HOME/.tor/ZeroNet/hostname" ]; then
ONION_ADDRESS=$(cat "$HOME/.tor/ZeroNet/hostname")
log "Onion address generated: $ONION_ADDRESS"
# Update ZeroNet configuration
sed -i "s/^ip_external =.*/ip_external = $ONION_ADDRESS/" "$ZERONET_DIR/zeronet.conf"
break
fi
sleep 1
done
if [ -z "$ONION_ADDRESS" ]; then
log_error "Failed to retrieve onion address. Check Tor logs for issues."
exit 1
fi
else
log "Skipping onion address generation as onion tracker setup was not requested"
fi
if kill -0 $TOR_PID 2>/dev/null; then
log "Tor process is still running. Proceeding with setup."
else
log_error "Tor process is not running. There may have been an issue starting Tor."
exit 1
fi
TERMUX_BOOT_DIR="$HOME/.termux/boot"
BOOT_SCRIPT="$TERMUX_BOOT_DIR/start-zeronet"
if [[ $boot_setup =~ ^[Yy]$ ]]; then
# Check if Termux:Boot directory exists, create if it doesn't
if [ ! -d "$TERMUX_BOOT_DIR" ]; then
log "Termux:Boot directory not found. Creating it..."
mkdir -p "$TERMUX_BOOT_DIR"
if [ $? -ne 0 ]; then
log_error "Failed to create Termux:Boot directory. Make sure Termux:Boot is installed."
log "Skipping boot script creation."
else
log "Termux:Boot directory created successfully."
fi
fi
# Only create the boot script if the directory exists
if [ -d "$TERMUX_BOOT_DIR" ]; then
cat > "$BOOT_SCRIPT" << EOL
#!/data/data/com.termux/files/usr/bin/bash
termux-wake-lock
export PATH=$PATH:/data/data/com.termux/files/usr/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/data/data/com.termux/files/usr/lib
start_tor() {
tor -f "/data/data/com.termux/files/home/.tor/torrc" &
# Wait until Tor is ready
for i in {1..30}; do
if [ -f "/data/data/com.termux/files/home/.tor/ZeroNet/hostname" ]; then
break
fi
sleep 1
done
}
start_zeronet() {
cd "/data/data/com.termux/files/home/apps/zeronet"
. ./venv/bin/activate
python zeronet.py &
ZERONET_PID=$!
echo "ZeroNet started"
termux-notification --id "zeronet_status" --title "ZeroNet Running" --content "ZeroNet started" --ongoing
termux-notification --id "zeronet_url" --title "ZeroNet URL" --content "http://$UI_IP:$UI_PORT" --button1 "Copy" --button1-action "termux-clipboard-set 'http://$UI_IP:$UI_PORT'"
}
start_tor
start_zeronet
EOL
chmod +x "$BOOT_SCRIPT"
log "Termux Boot script created at $BOOT_SCRIPT"
else
log "Termux:Boot directory not found. Boot script creation skipped."
fi
else
log "Boot script setup skipped. To set up auto-start later, ensure Termux:Boot is installed and run this script again."
fi
check_openssl() {
if command -v openssl; then
log "OpenSSL is available. Version: $(openssl version)"
else
log_error "OpenSSL is not found in PATH. Please ensure it's installed."
exit 1
fi
}
start_zeronet() {
cd $ZERONET_DIR
source ./venv/bin/activate
# Add Termux bin to PATH
export PATH=$PATH:$PREFIX/bin
# Check for existing ZeroNet processes
if pgrep -f "python.*zeronet.py" > /dev/null; then
log "Existing ZeroNet process found. Terminating..."
pkill -f "python.*zeronet.py"
sleep 5 # Wait for the process to terminate
fi
# Remove lock file if it exists
LOCK_FILE="$ZERONET_DIR/data/lock.pid"
if [ -f "$LOCK_FILE" ]; then
log "Removing stale lock file..."
rm "$LOCK_FILE"
fi
if [[ $onion_tracker_setup =~ ^[Yy]$ ]]; then
if [ -d "$ZERONET_DIR/plugins/disabled-Bootstrapper" ]; then
mv "$ZERONET_DIR/plugins/disabled-Bootstrapper" "$ZERONET_DIR/plugins/Bootstrapper"
log "Renamed disabled-Bootstrapper to Bootstrapper"
else
log "disabled-Bootstrapper directory not found"
fi
else
log "Skipping renaming of disabled-Bootstrapper folder"
fi
# Add a small delay before starting ZeroNet
sleep 2
# Start ZeroNet with the updated PATH and debug output
python$PYTHON_MAJOR_VERSION zeronet.py > zeronet_debug.log 2>&1 &
ZERONET_PID=$!
log "ZeroNet started with PID $ZERONET_PID"
termux-notification --id "zeronet_status" --title "ZeroNet Running" --content "ZeroNet started with PID $ZERONET_PID" --ongoing
termux-notification --id "zeronet_url" --title "ZeroNet URL" --content "http://$UI_IP:$UI_PORT" --button1 "Copy" --button1-action "termux-clipboard-set 'http://$UI_IP:$UI_PORT'"
# Wait a moment to check if the process is still running
sleep 5
if ! ps -p $ZERONET_PID > /dev/null; then
log_error "ZeroNet process terminated unexpectedly. Check logs for details."
cat zeronet_debug.log
exit 1
fi
}
# Download and unpack the GeoLite2 City database after the first ZeroNet shutdown and before the next run
log "Downloading GeoLite2 City database..."
GEOIP_DB_URL="https://raw.githubusercontent.com/aemr3/GeoLite2-Database/master/GeoLite2-City.mmdb.gz"
GEOIP_DB_PATH="$ZERONET_DIR/data/GeoLite2-City.mmdb"
download_geoip_database() {
while true; do
log "Attempting to download GeoLite2 City database..."
if curl -A "$USER_AGENT" \
-H "Accept: application/octet-stream" \
-s -f -L "$GEOIP_DB_URL" -o "${GEOIP_DB_PATH}.gz"; then
log "Successfully downloaded GeoLite2 City database."
gunzip -f "${GEOIP_DB_PATH}.gz"
chmod 644 "$GEOIP_DB_PATH"
log "GeoLite2 City database unpacked and ready at $GEOIP_DB_PATH"
break
else
log "Failed to download GeoLite2 City database. Retrying in 5 seconds..."
sleep 5
fi
done
}
# Call the function to download and unpack the GeoLite2 City database
download_geoip_database
check_openssl
log "Starting ZeroNet..."
start_zeronet
log "ZeroNet started. Waiting 10 seconds before further operations..."
sleep 10
download_syncronite() {
log "Downloading Syncronite content..."
ZIP_URL="https://0net-preview.com/ZeroNet-Internal/Zip?address=$SYNCRONITE_ADDRESS"
ZIP_DIR="$ZERONET_DIR/data/$SYNCRONITE_ADDRESS"
mkdir -p "$ZIP_DIR"
while true; do
if curl -L "$ZIP_URL" -o "$ZIP_DIR/content.zip"; then
unzip -o "$ZIP_DIR/content.zip" -d "$ZIP_DIR"
rm "$ZIP_DIR/content.zip"
log "Syncronite content downloaded and extracted to $ZIP_DIR"
return 0
else
log "Failed to download Syncronite content. Retrying in 5 seconds..."
sleep 5
fi
done
}
provide_syncronite_instructions() {
local instructions="To add Syncronite to ZeroNet:
1. Visit http://$UI_IP:$UI_PORT/$SYNCRONITE_ADDRESS
2. ZeroNet will add Syncronite to your dashboard so you'll receive trackers list updates as they come.
Note: Only open links to ZeroNet sites that you trust."
log_and_show "To add Syncronite to your ZeroNet:"
log_and_show "1. Open this link in your web browser: http://$UI_IP:$UI_PORT/$SYNCRONITE_ADDRESS"
log_and_show "2. ZeroNet will automatically add Syncronite to your dashboard when you visit the link."
log_and_show "Note: Only open links to ZeroNet sites that you trust."
termux-notification --id "syncronite_url" --title "Syncronite URL" --content "http://$UI_IP:$UI_PORT/$SYNCRONITE_ADDRESS" --button1 "Copy" --button1-action "termux-clipboard-set 'http://$UI_IP:$UI_PORT/$SYNCRONITE_ADDRESS'"
termux-notification --id "syncronite_instructions" --title "Syncronite Instructions" --content "$instructions"
}
if download_syncronite; then
log "Syncronite content is now available in your ZeroNet data directory."
else
log_error "Failed to prepare Syncronite content. You may need to add it manually later."
fi
update_trackers
log_and_show "ZeroNet setup complete."
# Adjusted the process check using pgrep
if ! pgrep -f "zeronet.py" > /dev/null; then
log_error "Failed to start ZeroNet"
termux-notification --id "zeronet_error" --title "ZeroNet Error" --content "Failed to start ZeroNet"
exit 1
fi
log_and_show "ZeroNet is running successfully. Syncronite content is available."
# Clean up
rm -rf "$WORK_DIR"
log_and_show "ZeroNet installation completed successfully!"
log_and_show "You can now access ZeroNet at http://$UI_IP:$UI_PORT"
log "Installation process completed. Please review the log file at $LOG_FILE for details."
# Provide instructions for adding Syncronite
provide_syncronite_instructions
# Final message
log_and_show "Thank you for installing ZeroNet. Enjoy your decentralized web experience!"