-
Notifications
You must be signed in to change notification settings - Fork 800
/
all_in_one.sh
5781 lines (5135 loc) · 221 KB
/
all_in_one.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
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# shellcheck shell=bash
# shellcheck disable=SC2086
# shellcheck source=/dev/null
PATH=${PATH}:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin:/opt/homebrew/bin
export PATH
#
# ——————————————————————————————————————————————————————————————————————————————————
# __ ___ _ _ _
# \ \ / (_) /\ | (_) | |
# \ V / _ __ _ ___ _ _ __ _ / \ | |_ ___| |_
# > < | |/ _` |/ _ \| | | |/ _` | / /\ \ | | / __| __|
# / . \| | (_| | (_) | |_| | (_| | / ____ \| | \__ \ |_
# /_/ \_\_|\__,_|\___/ \__, |\__,_| /_/ \_\_|_|___/\__|
# __/ |
# |___/
#
# Copyright (c) 2024 DDSRem <https://blog.ddsrem.com>
#
# This is free software, licensed under the GNU General Public License v3.0.
#
# ——————————————————————————————————————————————————————————————————————————————————
#
DATE_VERSION="v1.8.0-2024_11_23_17_53"
#
# ——————————————————————————————————————————————————————————————————————————————————
amilys_embyserver_latest_version=4.8.10.0
emby_embyserver_latest_version=4.8.10.0
amilys_embyserver_beta_version=4.9.0.32
emby_embyserver_beta_version=4.9.0.32
# ——————————————————————————————————————————————————————————————————————————————————
Sky_Blue="\e[36m"
Blue="\033[34m"
Green="\033[32m"
Red="\033[31m"
Yellow='\033[33m'
Font="\033[0m"
INFO="[${Green}INFO${Font}]"
ERROR="[${Red}ERROR${Font}]"
WARN="[${Yellow}WARN${Font}]"
function INFO() {
echo -e "${INFO} ${1}"
}
function ERROR() {
echo -e "${ERROR} ${1}"
}
function WARN() {
echo -e "${WARN} ${1}"
}
# shellcheck disable=SC2034
mirrors=(
"docker.io"
"registry-docker-hub-latest-9vqc.onrender.com"
"docker.fxxk.dedyn.io"
"dockerproxy.com"
"hub.uuuadc.top"
"docker.jsdelivr.fyi"
"docker.registry.cyou"
"dockerhub.anzu.vip"
"docker.luyao.dynv6.net"
"freeno.xyz"
"docker.1panel.live"
"dockerpull.com"
"docker.anyhub.us.kg"
"dockerhub.icu"
"docker.nastool.de"
)
pikpakshare_list_base64="6auY5riF55S15b2xL+WQiOmbhjEgICAgICAgICAgVk5SbE5MQVJMbXl5MVZtMjVDSlBwYzBYbzEgICAgVk5SbE1Xd2lMbXl5MVZtMjVDSlBwUnpNbzEK6auY5riF55S15b2xL+WQiOmbhjIgICAgICAgICAgVk5SbFZ3UVlRZ3F2Mzk1a3hHQmhQbURvbzEgICAgVk5SbE9mSjBVVTluakpPUmh1cnpic2RwbzEK6auY5riF55S15b2xL+WQiOmbhjMgICAgICAgICAgVk5SbTN5WnRCR3l3S2ExMTh2enZnQWc2bzEgICAgVk5SbGtETExVVTluakpPUmh1cnpoNEZRbzEK6auY5riF55S15b2xL+WQiOmbhjQgICAgICAgICAgVk5SbVdPbVFCR3l3S2ExMTh2enZsUmlabzEgICAgVk5SbThGcGc3YVdOM0hXSkdWR3A4YXhUbzEgCumrmOa4heeUteW9sS/lkIjpm4Y1ICAgICAgICAgIFZOUm1vRm1vcm9SUk9oRWtob184a1lfMW8xICAgIFZOUm1aTVAxUWdxdjM5NWt4R0JoZC15UW8xCumrmOa4heeUteW9sS/lkIjpm4Y2ICAgICAgICAgIFZOUm42SHFpQkd5d0thMTE4dnp2dXFGcW8xICAgIFZOUm1yZlRBQkd5d0thMTE4dnp2cWJjdG8xCumrmOa4heeUteW9sS/lkIjpm4Y3ICAgICAgICAgIFZOUm5KQVNVcm9SUk9oRWtob184dHBHZm8xICAgIFZOUm5BenZuQkd5d0thMTE4dnp2d0cxV28xCumrmOa4heeUteW9sS/lkIjpm4Y4ICAgICAgICAgIFZOUmxnMHBTN2FXTjNIV0pHVkdwMnBaVG8xICAgIFZOUmxadzRqVVU5bmpKT1JodXJ6ZVYzRW8xCumrmOa4heeUteW9sS/lkIjpm4Y5ICAgICAgICAgIFZOUm5RYk1ON2FXTjNIV0pHVkdwU2t4Rm8xICAgIFZOUm5OYTRweU0yTlFZbEtvNzhRNzBGX28xCumrmOa4heeUteW9sS/lkIjpm4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jU1MzU4NzQgNzY0MjI0YjQxYWZlNGY2ZmJlYTUwYjg4YTNhNmI1MmMK6Z+z5LmQL+S5pummmemfs+S5kOS4lue6quWFuOiXjyBkMmRmYTMyNjQ3ZjYgMTY3YWU5ZWRkM2ZlNDY2MmEyY2UzNzc1NTllMzVmNTgK6Z+z5LmQL+WPpOWFuOmfs+S5kOeyvumAieWQiOmbhiAyYjQ5NzgyMTNiMjkgNjkwMzhmZjA5MDA1NGExZWI4ODAzMTJiZTQ3NzUzOTIK6Z+z5LmQL+Wkp+iHqueEtumfs+S5kOezu+WIl+WQiOmbhiA2NTFlNWZhOTMwNTcgOWM5ZjMzMzY3ODNlNDhhZjlmNDdjNWVjZDk5OGU5MTQK6Z+z5LmQL+e6r+mfs+S5kOWQiOmbhiAxMjg0ODM4MWRjZTEgYWUyY2FlYjc4NDZkNGY4NTg0NjdkMmI2MjZkNzhjYTMK6Z+z5LmQL+i9pui9veaXoOaNn+eOr+e7lemfs+aViOmfs+S5kOWQiOmbhiA4MDVkNzZhMDgwNjMgNTkzZjk4MTA0ZjE5NDMwMmEyN2FlOTFiYTdjZDE4ZGIK6Z+z5LmQL+mch+aSvOW/g+eBteeahOWPsuivl+mfs+S5kOWQiOmbhiBkMWEwYjcwNDZiMjAgMjk0YTUzYTNjOWU4NGVmMGEwYWNjMDQxOTVjMDI1ZDg="
function root_need() {
if [[ $EUID -ne 0 ]]; then
ERROR '此脚本必须以 root 身份运行!'
exit 1
fi
}
function get_default_network() {
_default_network=$(cat "${DDSREM_CONFIG_DIR}/default_network.txt")
if [ "${_default_network}" == "host" ]; then
echo '--net=host'
else
case "${1}" in
qrcode)
echo '-p 34256:34256'
;;
xiaoya-proxy)
echo '-p 9988:9988'
;;
xiaoya-aliyuntvtoken_connector)
echo '-p 34278:34278'
;;
esac
fi
}
function check_path() {
if [ -z "${1}" ]; then
return 1
fi
# 目录不能为‘/’
if [ "${1}" == "/" ]; then
return 1
fi
# 目录结尾不能有空格
if [ "${1: -1}" == " " ]; then
return 1
fi
# 目录必须以`/`开头,不能包含`//`或`./`或`..`
if [[ "${1}" =~ ^/ && ! "${1}" =~ // && ! "${1}" =~ (\./|\.\.) ]]; then
return 0
else
return 1
fi
}
function get_path() {
case "${OSNAME}" in
synology)
path_lib=/volume1/docker
;;
unraid)
path_lib=/mnt/user/appdata
;;
fnos)
if [ -d "/vol1/1000" ]; then
path_lib=/vol1/1000
fi
;;
*)
if auto_path="$(df -h | awk '$2 ~ /G/ && $2+0 > 200 {print $6}' | grep -E -v "Avail|loop|boot|overlay|tmpfs|proc" | head -n 1)" > /dev/null 2>&1; then
if check_path "${auto_path}"; then
path_lib="${auto_path}"
fi
fi
;;
esac
if [ -z "${path_lib}" ]; then
case "${1}" in
xiaoya_alist_config_dir)
echo '/etc/xiaoya'
;;
xiaoya_alist_media_dir)
echo '/opt/media'
;;
esac
else
case "${1}" in
xiaoya_alist_config_dir)
echo "${path_lib}/xiaoya"
;;
xiaoya_alist_media_dir)
echo "${path_lib}/xiaoya_emby"
;;
esac
fi
}
function wait_emby_start() {
start_time=$(date +%s)
CONTAINER_NAME="$(cat "${DDSREM_CONFIG_DIR}"/container_name/xiaoya_emby_name.txt)"
TARGET_LOG_LINE_SUCCESS="All entry points have started"
while true; do
line=$(docker logs "$CONTAINER_NAME" 2>&1 | tail -n 10)
echo -e "$line"
if [[ "$line" == *"$TARGET_LOG_LINE_SUCCESS"* ]]; then
break
fi
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [ "$elapsed_time" -gt 600 ]; then
WARN "Emby 未正常启动超时 10 分钟!"
break
fi
sleep 8
done
}
function wait_xiaoya_start() {
start_time=$(date +%s)
TARGET_LOG_LINE_SUCCESS="success load storage: [/©️"
while true; do
line=$(docker logs "$(cat ${DDSREM_CONFIG_DIR}/container_name/xiaoya_alist_name.txt)" 2>&1 | tail -n 10)
echo -e "$line"
current_time=$(date +%s)
elapsed_time=$((current_time - start_time))
if [[ "$line" == *"$TARGET_LOG_LINE_SUCCESS"* ]]; then
if [ "$elapsed_time" -gt 20 ]; then
break
fi
fi
if [ "$elapsed_time" -gt 600 ]; then
WARN "小雅alist 未正常启动超时 10 分钟!"
break
fi
sleep 8
done
}
function check_quark_cookie() {
if [[ ! -f "${1}/quark_cookie.txt" ]] && [[ ! -s "${1}/quark_cookie.txt" ]]; then
return 1
fi
local cookie user_agent url headers response status url2 response2 member member_type vip_88
cookie=$(head -n1 "${1}/quark_cookie.txt")
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch"
url="https://drive-pc.quark.cn/1/clouddrive/config?pr=ucpro&fr=pc&uc_param_str="
headers="Cookie: $cookie; User-Agent: $user_agent; Referer: https://pan.quark.cn"
response=$(curl -s -D - -H "$headers" "$url")
status=$(echo "$response" | grep -i status | cut -f2 -d: | cut -f1 -d,)
if [ "$status" == "401" ]; then
ERROR "无效夸克 Cookie"
return 1
elif [ "$status" == "200" ]; then
url2="https://drive-pc.quark.cn/1/clouddrive/member?pr=ucpro&fr=pc&uc_param_str=&fetch_subscribe=true&_ch=home&fetch_identity=true"
response2=$(curl -s -H "$headers" "$url2")
member=$(echo $response2 | grep -o '"member_type":"[^"]*"' | sed 's/"member_type":"\(.*\)"/\1/')
if [ $member == 'EXP_SVIP' ] || [ $member == 'SVIP' ]; then
vip_88=$(echo $response2 | grep -o '"vip88_new":[t|f]' | cut -f2 -d:)
if [ $vip_88 == 't' ]; then
member_type="88VIP会员"
else
member_type="SVIP会员"
fi
elif [ $member == 'NORMAL' ]; then
member_type="普通用户"
else
member_type="${member//\"/}会员"
fi
INFO "有效 夸克 Cookie,${member_type}"
return 0
else
ERROR "请求失败,请检查 Cookie 或网络连接是否正确。"
return 1
fi
}
function check_uc_cookie() {
if [[ ! -f "${1}/uc_cookie.txt" ]] && [[ ! -s "${1}/uc_cookie.txt" ]]; then
return 1
fi
local cookie user_agent url headers response status referer set_cookie
cookie=$(head -n1 "${1}/uc_cookie.txt")
referer="https://drive.uc.cn"
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) quark-cloud-drive/2.5.20 Chrome/100.0.4896.160 Electron/18.3.5.4-b478491100 Safari/537.36 Channel/pckk_other_ch"
url="https://pc-api.uc.cn/1/clouddrive/file/sort?pr=UCBrowser&fr=pc&pdir_fid=0&_page=1&_size=50&_fetch_total=1&_fetch_sub_dirs=0&_sort=file_type:asc,updated_at:desc"
headers="Cookie: $cookie; User-Agent: $user_agent; Referer: $referer"
response=$(curl -s -D - -H "$headers" "$url")
set_cookie=$(echo "$response" | grep -i "^Set-Cookie:" | sed 's/Set-Cookie: //')
status=$(echo "$response" | grep -i status | cut -f2 -d: | cut -f1 -d,)
if [ "$status" == "401" ]; then
ERROR "无效 UC Cookie"
return 1
elif [ -n "${set_cookie}" ]; then
local new_puus new_cookie
new_puus=$(echo "$set_cookie" | cut -f2 -d: | cut -f1 -d\;)
new_cookie=${cookie//__puus=[^;]*/$new_puus}
echo "$new_cookie" > ${1}/uc_cookie.txt
INFO "有效 UC Cookie 并更新"
return 0
elif [ -z "${set_cookie}" ] && [ "${status}" == "200" ]; then
INFO "有效 UC Cookie"
return 0
else
ERROR "请求失败,请检查 Cookie 或网络连接是否正确。"
return 1
fi
}
function check_115_cookie() {
if [[ ! -f "${1}/115_cookie.txt" ]] && [[ ! -s "${1}/115_cookie.txt" ]]; then
return 1
fi
local cookie user_agent url headers response vip
cookie=$(head -n1 "${1}/115_cookie.txt")
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
url="https://my.115.com/?ct=ajax&ac=nav"
headers="Cookie: $cookie; User-Agent: $user_agent; Referer: https://115.com/"
response=$(curl -s -D - -H "$headers" "$url")
vip=$(echo -e "$response" | grep -o '"vip":[^,]*' | sed 's/"vip"://')
if echo -e "${response}" | grep -q "user_id"; then
if [ $vip == "0" ]; then
INFO "有效 115 Cookie,普通用户"
else
INFO "有效 115 Cookie,VIP用户"
fi
return 0
else
ERROR "请求失败,请检查 Cookie 或网络连接是否正确。"
return 1
fi
}
function check_aliyunpan_tvtoken() {
local token url response refresh_token data_dir
data_dir="${1}"
if [ -n "${2}" ]; then
token="${2}"
else
token=$(head -n1 "${data_dir}/myopentoken.txt")
fi
url=$(head -n1 "${data_dir}/open_tv_token_url.txt")
if ! response=$(curl -s "${url}" -X POST -H "User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36" -H "Rererer: https://www.aliyundrive.com/" -H "Content-Type: application/json" -d '{"refresh_token":"'$token'", "grant_type": "refresh_token"}'); then
WARN "网络问题,无法检测 阿里云盘 TV Token 有效性"
return 0
fi
refresh_token=$(echo "$response" | sed 's/:\s*/:/g' | sed -n 's/.*"refresh_token":"\([^"]*\).*/\1/p')
if [ -n "${refresh_token}" ]; then
echo "${refresh_token}" > "${data_dir}/myopentoken.txt"
INFO "有效 阿里云盘 TV Token"
return 0
else
ERROR "无效 阿里云盘 TV Token"
return 1
fi
}
function check_aliyunpan_refreshtoken() {
local token header referer response refresh_token data_dir
data_dir="${1}"
if [ -n "${2}" ]; then
token="${2}"
else
token=$(head -n1 "${data_dir}/mytoken.txt")
fi
header="User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/94.0.4606.54 Safari/537.36"
referer=https://www.aliyundrive.com/
if ! response=$(curl -s https://auth.aliyundrive.com/v2/account/token -X POST -H "User-Agent: $header" -H "Content-Type:application/json" -H "Referer: $referer" -d '{"refresh_token":"'$token'", "grant_type": "refresh_token"}'); then
WARN "网络问题,无法检测 阿里云盘 Refresh Token 有效性"
return 0
fi
refresh_token=$(echo "$response" | sed 's/:\s*/:/g' | sed -n 's/.*"refresh_token":"\([^"]*\).*/\1/p')
if [ -n "${refresh_token}" ]; then
echo "${refresh_token}" > "${data_dir}/mytoken.txt"
INFO "有效 阿里云盘 Refresh Token"
return 0
else
ERROR "无效 阿里云盘 Refresh Token"
return 1
fi
}
function check_aliyunpan_opentoken() {
local token code response refresh_token data_dir
data_dir="${1}"
if [ -n "${2}" ]; then
token="${2}"
else
token=$(head -n1 "${data_dir}/myopentoken.txt")
fi
if ! response=$(curl -s "https://api.xhofe.top/alist/ali_open/token" -X POST -H "User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36" -H "Rererer: https://www.aliyundrive.com/" -H "Content-Type: application/json" -d '{"refresh_token":"'$token'", "grant_type": "refresh_token"}'); then
if ! response=$(curl -s "https://api-cf.nn.ci/alist/ali_open/token" -X POST -H "User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/99.0.4844.83 Safari/537.36" -H "Rererer: https://www.aliyundrive.com/" -H "Content-Type: application/json" -d '{"refresh_token":"'$token'", "grant_type": "refresh_token"}'); then
WARN "网络问题,无法检测 阿里云盘 Open Token 有效性"
return 0
fi
fi
code=$(echo "$response" | sed -n 's/.*"code":"\([^"]*\).*/\1/p')
refresh_token=$(echo "$response" | sed 's/:\s*/:/g' | sed -n 's/.*"refresh_token":"\([^"]*\).*/\1/p')
if [ -n "${refresh_token}" ]; then
echo "${refresh_token}" > "${data_dir}/myopentoken.txt"
INFO "有效 阿里云盘 Open Token"
return 0
elif [ "${code}" == "Too Many Requests" ]; then
WARN "已被限流,无法检测 阿里云盘 Open Token 有效性"
return 0
else
ERROR "无效 阿里云盘 Open Token"
return 1
fi
}
function qrcode_mode_choose() {
function qrcode_web() {
if ! check_port "34256"; then
ERROR "34256 端口被占用,请关闭占用此端口的程序!"
exit 1
fi
local local_ip
if [[ "${OSNAME}" = "macos" ]]; then
local_ip=$(ifconfig "$(route -n get default | grep interface | awk -F ':' '{print$2}' | awk '{$1=$1};1')" | grep 'inet ' | awk '{print$2}')
else
local_ip=$(ip address | grep inet | grep -v 172.17 | grep -v 127.0.0.1 | grep -v inet6 | awk '{print $2}' | sed 's/addr://' | head -n1 | cut -f1 -d"/")
fi
if [ -z "${local_ip}" ]; then
local_ip="小雅服务器IP"
fi
INFO "请浏览器访问 http://${local_ip}:34256 并使用阿里云盘APP扫描二维码!"
# shellcheck disable=SC2046
docker run -i --rm \
-v "${1}:/data" \
-e LANG=C.UTF-8 \
$(get_default_network "qrcode") \
ddsderek/xiaoya-glue:python \
"${2}" --qrcode_mode=web
}
if [ "${2}" == "/aliyuntoken/aliyuntoken_vercel.py" ]; then
WARN "当前模式只能浏览器扫码!"
qrcode_web "${1}" "${2}"
fi
while true; do
INFO "请选择扫码模式 [ 1: 命令行扫码 | 2: 浏览器扫码 ](默认 2)"
read -erp "QRCODE_MODE:" QRCODE_MODE
[[ -z "${QRCODE_MODE}" ]] && QRCODE_MODE="2"
if [[ ${QRCODE_MODE} == [1] ]]; then
docker run -i --rm \
-v "${1}:/data" \
-e LANG=C.UTF-8 \
ddsderek/xiaoya-glue:python \
"${2}" --qrcode_mode=shell
return 0
elif [[ ${QRCODE_MODE} == [2] ]]; then
qrcode_web "${1}" "${2}"
return 0
else
ERROR "输入无效,请重新选择"
fi
done
}
function qrcode_aliyunpan_tvtoken() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "阿里云盘 TV Token 配置"
pull_glue_python_ddsrem
qrcode_mode_choose "${1}" "/aliyuntvtoken/alitoken2.py"
INFO "操作全部完成!"
;;
*)
WARN "目前阿里云盘 TV Token 扫码获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function qrcode_aliyunpan_refreshtoken() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "阿里云盘 Refresh Token 配置"
local command_file
pull_glue_python_ddsrem
if curl -Is https://api.xhofe.top/alist/ali/qr | head -n 1 | grep -q '200'; then
command_file="aliyuntoken.py"
INFO "使用 api.xhofe.top 地址"
elif curl -Is https://api-cf.nn.ci/alist/ali/qr | head -n 1 | grep -q '200'; then
command_file="aliyuntoken_nn.ci.py"
INFO "使用 api-cf.nn.ci 地址"
else
command_file="aliyuntoken_vercel.py"
INFO "使用 aliyuntoken.vercel.app 地址"
fi
qrcode_mode_choose "${1}" "/aliyuntoken/${command_file}"
INFO "操作全部完成!"
;;
*)
WARN "目前阿里云盘 Refresh Token 扫码获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function qrcode_aliyunpan_opentoken() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "阿里云盘 Open Token 配置"
local command_file
pull_glue_python_ddsrem
if curl -Is https://api.xhofe.top/alist/ali_open/qr | head -n 1 | grep -q '200'; then
command_file="aliyunopentoken.py"
INFO "使用 api.xhofe.top 地址"
else
command_file="aliyunopentoken_nn.ci.py"
INFO "使用 api-cf.nn.ci 地址"
fi
qrcode_mode_choose "${1}" "/aliyunopentoken/${command_file}"
INFO "操作全部完成!"
;;
*)
WARN "目前阿里云盘 Open Token 扫码获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function qrcode_115_cookie() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "115 Cookie 扫码获取"
pull_glue_python_ddsrem
qrcode_mode_choose "${1}" "/115cookie/115cookie.py"
INFO "操作全部完成!"
;;
*)
WARN "目前 115 Cookie 扫码获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function qrcode_quark_cookie() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "夸克 Cookie 扫码获取"
pull_glue_python_ddsrem
qrcode_mode_choose "${1}" "/quark_cookie/quark_cookie.py"
INFO "操作全部完成!"
;;
*)
WARN "目前夸克 Cookie 扫码获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function qrcode_uc_cookie() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "UC Cookie 扫码获取"
pull_glue_python_ddsrem
qrcode_mode_choose "${1}" "/uc_cookie/uc_cookie.py"
INFO "操作全部完成!"
;;
*)
WARN "目前 UC Cookie 扫码获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function enter_aliyunpan_refreshtoken() {
while true; do
INFO "是否使用扫码自动获取 阿里云盘 Token [Y/n](默认 Y)"
read -erp "Token:" choose_qrcode_aliyunpan_refreshtoken
[[ -z "${choose_qrcode_aliyunpan_refreshtoken}" ]] && choose_qrcode_aliyunpan_refreshtoken="y"
if [[ ${choose_qrcode_aliyunpan_refreshtoken} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_qrcode_aliyunpan_refreshtoken} == [Yy] ]]; then
qrcode_aliyunpan_refreshtoken "${1}"
fi
mytokenfilesize=$(cat "${1}"/mytoken.txt)
mytokenstringsize=${#mytokenfilesize}
if [ "$mytokenstringsize" -le 31 ] || ! check_aliyunpan_refreshtoken "${1}"; then
if [[ ${choose_qrcode_aliyunpan_refreshtoken} == [Yy] ]]; then
WARN "扫码获取 阿里云盘 Token 失败,请手动获取!"
fi
while true; do
INFO "输入你的 阿里云盘 Token(32位长)"
read -erp "TOKEN:" token
token_len=${#token}
if [ "$token_len" -ne 32 ]; then
ERROR "长度不对,阿里云盘 Token是32位长"
ERROR "请参考指南配置文件: https://xiaoyaliu.notion.site/xiaoya-docker-69404af849504fa5bcf9f2dd5ecaa75f"
else
echo "$token" > "${1}"/mytoken.txt
if check_aliyunpan_refreshtoken "${1}"; then
break
fi
fi
done
fi
}
function settings_aliyunpan_refreshtoken() {
if [ "${2}" == "force" ]; then
enter_aliyunpan_refreshtoken "${1}"
else
mytokenfilesize=$(cat "${1}"/mytoken.txt)
mytokenstringsize=${#mytokenfilesize}
if [ "$mytokenstringsize" -le 31 ] || ! check_aliyunpan_refreshtoken "${1}"; then
enter_aliyunpan_refreshtoken "${1}"
fi
fi
}
function enter_aliyunpan_opentoken() {
while true; do
INFO "是否使用扫码自动获取 阿里云盘 Open Token [Y/n](默认 Y)"
read -erp "Token:" choose_qrcode_aliyunpan_opentoken
[[ -z "${choose_qrcode_aliyunpan_opentoken}" ]] && choose_qrcode_aliyunpan_opentoken="y"
if [[ ${choose_qrcode_aliyunpan_opentoken} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_qrcode_aliyunpan_opentoken} == [Yy] ]]; then
qrcode_aliyunpan_opentoken "${1}"
fi
myopentokenfilesize=$(cat "${1}"/myopentoken.txt)
myopentokenstringsize=${#myopentokenfilesize}
if [ "$myopentokenstringsize" -le 279 ] || ! check_aliyunpan_opentoken "${1}"; then
if [[ ${choose_qrcode_aliyunpan_opentoken} == [Yy] ]]; then
WARN "扫码获取 阿里云盘 Open Token 失败,请手动获取!"
fi
while true; do
INFO "输入你的 阿里云盘 Open Token(280位长或者335位长)"
read -erp "OPENTOKEN:" opentoken
opentoken_len=${#opentoken}
if [[ "$opentoken_len" -ne 280 ]] && [[ "$opentoken_len" -ne 335 ]]; then
ERROR "长度不对,阿里云盘 Open Token是280位长或者335位"
ERROR "请参考指南配置文件: https://xiaoyaliu.notion.site/xiaoya-docker-69404af849504fa5bcf9f2dd5ecaa75f"
else
echo "$opentoken" > "${1}"/myopentoken.txt
if check_aliyunpan_opentoken "${1}"; then
break
fi
fi
done
fi
}
function settings_aliyunpan_opentoken() {
if [ -f "${1}/open_tv_token_url.txt" ]; then
mv "${1}/open_tv_token_url.txt" "${1}/open_tv_token_url.txt.bak"
fi
if [ "${2}" == "force" ]; then
enter_aliyunpan_opentoken "${1}"
else
myopentokenfilesize=$(cat "${1}"/myopentoken.txt)
myopentokenstringsize=${#myopentokenfilesize}
if [ "$myopentokenstringsize" -le 279 ] || ! check_aliyunpan_opentoken "${1}"; then
enter_aliyunpan_opentoken "${1}"
fi
fi
}
function enter_115_cookie() {
touch ${1}/115_cookie.txt
while true; do
INFO "是否使用扫码自动获取 115 Cookie [Y/n](默认 Y)"
read -erp "Cookie:" choose_qrcode_115_cookie
[[ -z "${choose_qrcode_115_cookie}" ]] && choose_qrcode_115_cookie="y"
if [[ ${choose_qrcode_115_cookie} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_qrcode_115_cookie} == [Yy] ]]; then
qrcode_115_cookie "${1}"
fi
if ! check_115_cookie "${1}"; then
if [[ ${choose_qrcode_115_cookie} == [Yy] ]]; then
WARN "扫码获取 115 Cookie 失败,请手动获取!"
fi
while true; do
INFO "输入你的 115 Cookie"
read -erp "Cookie:" set_115_cookie
echo -e "${set_115_cookie}" > ${1}/115_cookie.txt
if check_115_cookie "${1}"; then
break
fi
done
fi
}
function settings_115_cookie() {
if [ "${2}" == "force" ]; then
enter_115_cookie "${1}"
else
if [ ! -f "${1}/115_cookie.txt" ] || ! check_115_cookie "${1}"; then
while true; do
INFO "是否配置 115 Cookie [Y/n](默认 n 不配置)"
read -erp "Cookie:" choose_115_cookie
[[ -z "${choose_115_cookie}" ]] && choose_115_cookie="n"
if [[ ${choose_115_cookie} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_115_cookie} == [Yy] ]]; then
enter_115_cookie "${1}"
fi
fi
fi
}
function enter_quark_cookie() {
touch ${1}/quark_cookie.txt
while true; do
INFO "是否使用扫码自动获取 夸克 Cookie [Y/n](默认 Y)"
read -erp "Cookie:" choose_qrcode_quark_cookie
[[ -z "${choose_qrcode_quark_cookie}" ]] && choose_qrcode_quark_cookie="y"
if [[ ${choose_qrcode_quark_cookie} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_qrcode_quark_cookie} == [Yy] ]]; then
qrcode_quark_cookie "${1}"
fi
if ! check_quark_cookie "${1}"; then
if [[ ${choose_qrcode_quark_cookie} == [Yy] ]]; then
WARN "扫码获取 夸克 Cookie 失败,请手动获取!"
fi
while true; do
INFO "输入你的 夸克 Cookie"
read -erp "Cookie:" quark_cookie
echo -e "${quark_cookie}" > ${1}/quark_cookie.txt
if check_quark_cookie "${1}"; then
break
fi
done
fi
}
function settings_quark_cookie() {
if [ "${2}" == "force" ]; then
enter_quark_cookie "${1}"
else
if [ ! -f "${1}/quark_cookie.txt" ] || ! check_quark_cookie "${1}"; then
while true; do
INFO "是否配置 夸克 Cookie [Y/n](默认 n 不配置)"
read -erp "Cookie:" choose_quark_cookie
[[ -z "${choose_quark_cookie}" ]] && choose_quark_cookie="n"
if [[ ${choose_quark_cookie} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_quark_cookie} == [Yy] ]]; then
enter_quark_cookie "${1}"
fi
fi
fi
}
function enter_uc_cookie() {
touch ${1}/uc_cookie.txt
while true; do
INFO "是否使用扫码自动获取 UC Cookie [Y/n](默认 Y)"
read -erp "Cookie:" choose_qrcode_uc_cookie
[[ -z "${choose_qrcode_uc_cookie}" ]] && choose_qrcode_uc_cookie="y"
if [[ ${choose_qrcode_uc_cookie} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_qrcode_uc_cookie} == [Yy] ]]; then
qrcode_uc_cookie "${1}"
fi
if ! check_uc_cookie "${1}"; then
if [[ ${choose_qrcode_uc_cookie} == [Yy] ]]; then
WARN "扫码获取 UC Cookie 失败,请手动获取!"
fi
while true; do
INFO "输入你的 UC Cookie"
read -erp "Cookie:" uc_cookie
echo -e "${uc_cookie}" > ${1}/uc_cookie.txt
if check_uc_cookie "${1}"; then
break
fi
done
fi
}
function settings_uc_cookie() {
if [ "${2}" == "force" ]; then
enter_uc_cookie "${1}"
else
if [ ! -f "${1}/uc_cookie.txt" ] || ! check_uc_cookie "${1}"; then
while true; do
INFO "是否配置 UC Cookie [Y/n](默认 n 不配置)"
read -erp "Cookie:" choose_uc_cookie
[[ -z "${choose_uc_cookie}" ]] && choose_uc_cookie="n"
if [[ ${choose_uc_cookie} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${choose_uc_cookie} == [Yy] ]]; then
enter_uc_cookie "${1}"
fi
fi
fi
}
function enter_pikpak_account() {
touch ${1}/pikpak.txt
INFO "输入你的 PikPak 账号(手机号或邮箱)"
INFO "如果手机号,要\"+区号\",比如你的手机号\"12345678900\"那么就填\"+8612345678900\""
read -erp "PikPak_Username:" PikPak_Username
INFO "输入你的 PikPak 账号密码"
read -erp "PikPak_Password:" PikPak_Password
INFO "输入你的 PikPak X-Device-Id"
read -erp "PikPak_Device_Id:" PikPak_Device_Id
echo -e "\"${PikPak_Username}\" \"${PikPak_Password}\" \"web\" \"${PikPak_Device_Id}\"" > ${1}/pikpak.txt
}
function settings_pikpak_account() {
if [ "${2}" == "force" ]; then
enter_pikpak_account "${1}"
else
if [ ! -f "${1}/pikpak.txt" ]; then
while true; do
INFO "是否继续配置 PikPak 账号密码 [Y/n](默认 n 不配置)"
read -erp "PikPak_Set:" PikPak_Set
[[ -z "${PikPak_Set}" ]] && PikPak_Set="n"
if [[ ${PikPak_Set} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${PikPak_Set} == [Yy] ]]; then
enter_pikpak_account "${1}"
fi
fi
fi
}
function enter_ali2115() {
touch ${1}/ali2115.txt
if [ -f "${1}/115_cookie.txt" ] && check_115_cookie "${1}"; then
INFO "自动获取 115 Cookie!"
set_115_cookie="$(cat ${1}/115_cookie.txt | head -n1)"
else
while true; do
INFO "输入你的 115 Cookie"
read -erp "Cookie:" set_115_cookie
if [ -n "${set_115_cookie}" ]; then
break
fi
done
fi
while true; do
INFO "是否自动删除115转存文件 [Y/n](默认 Y)"
read -erp "purge_pan115_temp:" purge_pan115_temp
[[ -z "${purge_pan115_temp}" ]] && purge_pan115_temp="y"
if [[ ${purge_pan115_temp} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
while true; do
INFO "是否自动删除阿里云盘转存文件 [Y/n](默认 Y)"
read -erp "purge_ali_temp:" purge_ali_temp
[[ -z "${purge_ali_temp}" ]] && purge_ali_temp="y"
if [[ ${purge_ali_temp} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
INFO "输入你的 115 转存文件夹 id(默认 0)"
read -erp "dir_id:" dir_id
[[ -z "${dir_id}" ]] && dir_id=0
if [[ ${purge_pan115_temp} == [Yy] ]]; then
purge_pan115_temp=true
else
purge_pan115_temp=false
fi
if [[ ${purge_ali_temp} == [Yy] ]]; then
purge_ali_temp=true
else
purge_ali_temp=false
fi
echo -e "purge_ali_temp=${purge_ali_temp}\ncookie=\"${set_115_cookie}\"\npurge_pan115_temp=${purge_pan115_temp}\ndir_id=${dir_id}" > ${1}/ali2115.txt
}
function settings_ali2115() {
if [ "${2}" == "force" ]; then
enter_ali2115 "${1}"
else
if [ ! -f "${1}/ali2115.txt" ]; then
while true; do
INFO "是否配置 阿里转存115播放(ali2115.txt) [Y/n](默认 n 不配置)"
read -erp "ali2115:" ali2115_set
[[ -z "${ali2115_set}" ]] && ali2115_set="n"
if [[ ${ali2115_set} == [YyNn] ]]; then
break
else
ERROR "非法输入,请输入 [Y/n]"
fi
done
if [[ ${ali2115_set} == [Yy] ]]; then
enter_ali2115 "${1}"
fi
fi
fi
}
function get_aliyunpan_folder_id() {
clear_qrcode_container
cpu_arch=$(uname -m)
case $cpu_arch in
"x86_64" | *"amd64"* | "aarch64" | *"arm64"* | *"armv8"* | *"arm/v8"*)
INFO "阿里云盘 folder id 自动获取"
pull_glue_python_ddsrem
docker run -i --rm \
-v "${1}:/data" \
-e LANG=C.UTF-8 \
ddsderek/xiaoya-glue:python \
bash /get_folder_id/get_folder_id.sh
;;
*)
WARN "目前阿里云盘 folder id 自动获取只支持amd64和arm64架构,你的架构是:$cpu_arch"
;;
esac
}
function get_config_dir() {
local xiaoya_config_dir DEFAULT_CONFIG_DIR