2022-05-25 04:19:25 +00:00
|
|
|
|
#!/usr/bin/with-contenv bash
|
|
|
|
|
|
|
|
|
|
welcome () {
|
|
|
|
|
echo
|
|
|
|
|
echo "欢迎进入 PagerMaid-Pyro Docker 。"
|
|
|
|
|
echo "配置即将开始"
|
|
|
|
|
echo
|
|
|
|
|
sleep 2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
configure () {
|
|
|
|
|
local config_file=config.yml
|
|
|
|
|
|
|
|
|
|
echo "生成配置文件中 . . ."
|
|
|
|
|
cp config.gen.yml $config_file
|
2023-02-01 04:20:58 +00:00
|
|
|
|
sed -i "s/127.0.0.1/0.0.0.0/" $config_file
|
2022-11-26 03:01:51 +00:00
|
|
|
|
printf "请输入应用程序 api_id(不懂请直接回车):"
|
2022-05-25 04:19:25 +00:00
|
|
|
|
read -r api_id <&1
|
|
|
|
|
sed -i "s/ID_HERE/$api_id/" $config_file
|
2022-11-26 03:01:51 +00:00
|
|
|
|
printf "请输入应用程序 api_hash(不懂请直接回车):"
|
2022-05-25 04:19:25 +00:00
|
|
|
|
read -r api_hash <&1
|
|
|
|
|
sed -i "s/HASH_HERE/$api_hash/" $config_file
|
2023-06-20 09:02:18 +00:00
|
|
|
|
printf "控制台二维码扫码登录?(避免无法收到验证码) [Y/n]"
|
|
|
|
|
read -r choi <&1
|
2023-01-20 13:57:30 +00:00
|
|
|
|
if [ "$choi" == "y" ] || [ "$choi" == "Y" ]; then
|
|
|
|
|
sed -i "s/qrcode_login: \"False\"/qrcode_login: \"True\"/" $config_file
|
|
|
|
|
fi
|
2023-01-23 14:15:07 +00:00
|
|
|
|
printf "请输入应用程序语言(默认:zh-cn):"
|
2022-05-25 04:19:25 +00:00
|
|
|
|
read -r application_language <&1
|
|
|
|
|
if [ -z "$application_language" ]
|
|
|
|
|
then
|
|
|
|
|
echo "语言设置为 简体中文"
|
|
|
|
|
else
|
|
|
|
|
sed -i "s/zh-cn/$application_language/" $config_file
|
|
|
|
|
fi
|
|
|
|
|
printf "请输入应用程序地区(默认:China):"
|
|
|
|
|
read -r application_region <&1
|
|
|
|
|
if [ -z "$application_region" ]
|
|
|
|
|
then
|
|
|
|
|
echo "地区设置为 中国"
|
|
|
|
|
else
|
|
|
|
|
sed -i "s/China/$application_region/" $config_file
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
login () {
|
|
|
|
|
echo
|
|
|
|
|
echo "下面进行程序运行。"
|
|
|
|
|
echo "请在账户授权完毕后,按 Ctrl + C 使 Docker 在后台模式下运行。"
|
2023-06-20 09:02:18 +00:00
|
|
|
|
echo "如果已开启网页登录,请直接使用 Ctrl + C 使 Docker 在后台模式下运行。"
|
2022-05-25 04:19:25 +00:00
|
|
|
|
echo
|
2023-12-12 12:29:22 +00:00
|
|
|
|
echo "Hello world!" > /pagermaid/workdir/data/install.lock
|
2023-06-20 09:02:18 +00:00
|
|
|
|
sleep 2
|
2022-05-25 04:19:25 +00:00
|
|
|
|
python -m pagermaid
|
|
|
|
|
exit 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main () {
|
2023-06-20 09:02:18 +00:00
|
|
|
|
cd /pagermaid/workdir || exit
|
2023-12-12 15:42:02 +00:00
|
|
|
|
mkdir -p /pagermaid/workdir/data
|
2023-12-12 12:51:22 +00:00
|
|
|
|
if [ -f "/pagermaid/workdir/install.lock" ]; then
|
|
|
|
|
echo "Hello world!" > /pagermaid/workdir/data/install.lock
|
|
|
|
|
fi
|
2023-12-12 12:29:22 +00:00
|
|
|
|
if [ ! -s "/pagermaid/workdir/data/install.lock" ]; then
|
2022-05-25 04:19:25 +00:00
|
|
|
|
welcome
|
|
|
|
|
configure
|
|
|
|
|
login
|
|
|
|
|
else
|
2023-12-12 12:29:22 +00:00
|
|
|
|
if [ ! -f "/pagermaid/workdir/data/pagermaid.session" ]; then
|
2022-09-06 09:40:52 +00:00
|
|
|
|
welcome
|
|
|
|
|
configure
|
2022-05-25 04:19:25 +00:00
|
|
|
|
fi
|
2022-09-06 09:40:52 +00:00
|
|
|
|
login
|
2022-05-25 04:19:25 +00:00
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
main
|