's'
This commit is contained in:
@@ -550,6 +550,7 @@ install_android_panel() {
|
||||
fi
|
||||
python3 - <<PY
|
||||
from pathlib import Path
|
||||
import os
|
||||
path = Path(r"$ANDROID_PANEL_DIR/app.py")
|
||||
text = path.read_text(encoding="utf-8")
|
||||
if "import os" not in text:
|
||||
@@ -558,6 +559,35 @@ text = text.replace(
|
||||
"socketio.run(app, host='0.0.0.0', port=5000)",
|
||||
"socketio.run(app, host='0.0.0.0', port=int(os.environ.get('ANDROID_PANEL_PORT', '5000')), allow_unsafe_werkzeug=True)",
|
||||
)
|
||||
mark = "# LIVE_ANDROID_PANEL_PATCH"
|
||||
if mark not in text and "app = Flask(__name__)" in text:
|
||||
text = text.replace(
|
||||
"app = Flask(__name__)",
|
||||
"app = Flask(__name__)\n\n"
|
||||
+ mark
|
||||
+ "\n@app.after_request\ndef _live_allow_embed(resp):\n resp.headers.pop('X-Frame-Options', None)\n return resp\n",
|
||||
1,
|
||||
)
|
||||
old_block = (
|
||||
" if scpy_ctx is not None:\n"
|
||||
" print(f'reject connection, client {scpy_ctx} is already connected')\n"
|
||||
" return False\n"
|
||||
" else:\n"
|
||||
" client_sid = request.sid\n"
|
||||
)
|
||||
new_block = (
|
||||
" if scpy_ctx is not None:\n"
|
||||
" print('live-android-panel: replacing previous scrcpy session (embed / multi-tab)')\n"
|
||||
" try:\n"
|
||||
" scpy_ctx.scrcpy_stop()\n"
|
||||
" except Exception as _e:\n"
|
||||
" print('live-android-panel: stop previous', _e)\n"
|
||||
" scpy_ctx = None\n"
|
||||
" client_sid = None\n"
|
||||
" client_sid = request.sid\n"
|
||||
)
|
||||
if old_block in text:
|
||||
text = text.replace(old_block, new_block, 1)
|
||||
path.write_text(text, encoding="utf-8")
|
||||
PY
|
||||
chown -R live:live "$ANDROID_PANEL_DIR"
|
||||
|
||||
@@ -585,7 +585,7 @@ service_neko_firefox_status() {
|
||||
kv host "${HOSTNAME_ALIAS}.local"
|
||||
kv port "${NEKO_FF_HTTP_PORT:-9201}"
|
||||
kv url "http://${HOSTNAME_ALIAS}.local:${NEKO_FF_HTTP_PORT:-9201}"
|
||||
kv detail "Neko Firefox (第二浏览器); 口令与 Chromium 实例相同(NEKO_USER_PASS / NEKO_ADMIN_PASS)"
|
||||
kv detail "Neko Firefox(第二桌面)可选:Firefox arm64/x86 多架构;ENABLE_NEKO_FF=1。登录策略与 Chromium 相同:昵称任意,密码须为 NEKO_USER_PASS/NEKO_ADMIN_PASS(勿用 live/live)。"
|
||||
}
|
||||
|
||||
service_neko_firefox_start() {
|
||||
|
||||
Reference in New Issue
Block a user