diff --git a/docker-compose.yaml b/docker-compose.yaml index 7a26027..a697a67 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -18,6 +18,7 @@ services: - ./yunzai/genshin_config:/app/Miao-Yunzai/plugins/genshin/config # 公共Cookie,云崽功能配置文件 - ./yunzai/logs:/app/Miao-Yunzai/logs # 日志文件 - ./yunzai/data:/app/Miao-Yunzai/data # 数据文件 + - ./yunzai/temp:/app/Miao-Yunzai/temp # 临时文件 # 以下目录是插件目录,安装完插件后需要手动添加映射(如有其他插件请自行添加) # 映射格式:./yunzai/plugins/<插件目录名>:/app/Miao-Yunzai/plugins/<插件目录名> # - ./yunzai/plugins/example:/app/Miao-Yunzai/plugins/example # 单js插件目录 diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index be14404..022bdc2 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -91,10 +91,10 @@ if [ -d $PY_PLUGIN_PATH"/.git" ]; then echo -e " ${Warn} ${YellowBG} 当前工作区有修改,尝试暂存后更新。${Font}" git add . git stash - git pull origin main --allow-unrelated-histories --rebase + git pull origin v3 --allow-unrelated-histories --rebase git stash pop else - git pull origin main --allow-unrelated-histories + git pull origin v3 --allow-unrelated-histories fi if [[ ! -f "$HOME/.ovo/py.ok" ]]; then @@ -184,4 +184,11 @@ fi echo -e "\n ================ \n ${Info} ${GreenBG} 启动 Miao-Yunzai ${Font} \n ================ \n" +set +e node app +EXIT_CODE=$? + +if [[ $EXIT_CODE != 0 ]]; then + echo -e "\n ================ \n ${Warn} ${YellowBG} 启动 Miao-Yunzai 失败 ${Font} \n ================ \n" + tail -f /dev/null +fi diff --git a/plugins/genshin/model/user.js b/plugins/genshin/model/user.js index 7dd5ca9..d32940d 100644 --- a/plugins/genshin/model/user.js +++ b/plugins/genshin/model/user.js @@ -424,9 +424,15 @@ export default class User extends base { } await user.save() if (fs.existsSync(`./data/MysCookie/${qq}.yaml`)) { - fs.rename(`./data/MysCookie/${qq}.yaml`, `./temp/MysCookieBak/${qq}.yaml`, (err) => { - if (err) console.log(err) - }) + try { + let src = `./data/MysCookie/${qq}.yaml`; + let dest = `./temp/MysCookieBak/${qq}.yaml`; + await fs.promises.unlink(dest).catch((_) => { }); + await fs.promises.copyFile(src, dest); + await fs.promises.unlink(src); + } catch (err) { + console.log(err); + } } count++ }