Add instance nav prefs, env config UI, and PM2 restart.
P1-P4: configurable nav/section visibility in system settings, full .env editor with restart badges, password change, runtime hot overrides, and single-instance pm2 restart. Works in hub embed iframe. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1226,6 +1226,11 @@ def init_db():
|
||||
(id INTEGER PRIMARY KEY AUTOINCREMENT, transfer_type TEXT, transfer_day TEXT,
|
||||
amount REAL, from_account TEXT, to_account TEXT, status TEXT, message TEXT,
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)''')
|
||||
c.execute(
|
||||
"""CREATE TABLE IF NOT EXISTS app_runtime_settings
|
||||
(key TEXT PRIMARY KEY, value TEXT,
|
||||
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)"""
|
||||
)
|
||||
c.execute('''DROP INDEX IF EXISTS idx_transfer_logs_unique_day''')
|
||||
c.execute('''CREATE UNIQUE INDEX IF NOT EXISTS idx_transfer_logs_auto_daily_unique
|
||||
ON transfer_logs(transfer_type, transfer_day)
|
||||
@@ -7046,6 +7051,7 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
conn.close()
|
||||
from lib.instance.instance_embed_lib import embed_context_extras
|
||||
from lib.instance.instance_settings_lib import settings_page_context
|
||||
from lib.instance.instance_display_prefs_lib import display_prefs_template_context
|
||||
|
||||
template_ctx = dict(
|
||||
page=page,
|
||||
@@ -7137,6 +7143,7 @@ def render_main_page(page="trade", embed_mode=None):
|
||||
has_active_positions=bool(order_list),
|
||||
),
|
||||
**embed_context_extras("gate"),
|
||||
**display_prefs_template_context(get_db),
|
||||
**settings_page_context(
|
||||
page,
|
||||
exchange_key="gate",
|
||||
@@ -7206,6 +7213,12 @@ def risk_policy_page():
|
||||
return render_main_page("risk_policy")
|
||||
|
||||
|
||||
@app.route("/env_config")
|
||||
@login_required
|
||||
def env_config_page():
|
||||
return render_main_page("env_config")
|
||||
|
||||
|
||||
@app.route("/settings")
|
||||
@login_required
|
||||
def settings_page():
|
||||
@@ -9758,6 +9771,21 @@ try:
|
||||
except Exception as _hub_err:
|
||||
print(f"[hub_bridge] gate: {_hub_err}")
|
||||
|
||||
try:
|
||||
from lib.instance.instance_settings_register import register_instance_settings_routes
|
||||
|
||||
register_instance_settings_routes(
|
||||
app,
|
||||
get_db=get_db,
|
||||
login_required_fn=login_required,
|
||||
base_dir=BASE_DIR,
|
||||
exchange_key="gate",
|
||||
username=USERNAME,
|
||||
password=PASSWORD,
|
||||
)
|
||||
except Exception as _settings_err:
|
||||
print(f"[instance_settings] gate: {_settings_err}")
|
||||
|
||||
|
||||
@app.route("/strategy")
|
||||
@login_required
|
||||
|
||||
Reference in New Issue
Block a user