superbrain-server 1.0.19 → 1.0.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/payload/start.py +19 -8
package/package.json
CHANGED
package/payload/start.py
CHANGED
|
@@ -399,7 +399,7 @@ def setup_api_keys():
|
|
|
399
399
|
f"INSTAGRAM_USERNAME={ig_user}\n",
|
|
400
400
|
f"INSTAGRAM_PASSWORD={ig_pass}\n",
|
|
401
401
|
]
|
|
402
|
-
API_KEYS.write_text("".join(lines))
|
|
402
|
+
API_KEYS.write_text(encoding='utf-8', data="".join(lines))
|
|
403
403
|
ok(f"Keys saved to {API_KEYS}")
|
|
404
404
|
|
|
405
405
|
# ══════════════════════════════════════════════════════════════════════════════
|
|
@@ -647,7 +647,7 @@ def setup_whisper():
|
|
|
647
647
|
# ── Save model choice to config ─────────────────────────────────────────
|
|
648
648
|
whisper_cfg = BASE_DIR / "config" / "whisper_model.txt"
|
|
649
649
|
(BASE_DIR / "config").mkdir(exist_ok=True)
|
|
650
|
-
whisper_cfg.write_text(model)
|
|
650
|
+
whisper_cfg.write_text(encoding='utf-8', data=model)
|
|
651
651
|
ok(f"Whisper model set to '{model}' (saved to config/whisper_model.txt)")
|
|
652
652
|
|
|
653
653
|
h2(f"Pre-downloading Whisper '{model}' model …")
|
|
@@ -689,7 +689,7 @@ def setup_remote_access():
|
|
|
689
689
|
|
|
690
690
|
ok("ngrok auto-start enabled")
|
|
691
691
|
NGROK_ENABLED.parent.mkdir(parents=True, exist_ok=True)
|
|
692
|
-
NGROK_ENABLED.write_text("enabled")
|
|
692
|
+
NGROK_ENABLED.write_text(encoding='utf-8', data="enabled")
|
|
693
693
|
|
|
694
694
|
existing_token = NGROK_TOKEN.read_text().strip() if NGROK_TOKEN.exists() else ""
|
|
695
695
|
print(f"\n {YELLOW}Please paste your ngrok Authtoken.{RESET}")
|
|
@@ -698,7 +698,7 @@ def setup_remote_access():
|
|
|
698
698
|
|
|
699
699
|
auth_token = ask("Authtoken", default=existing_token, paste=True)
|
|
700
700
|
if auth_token.strip():
|
|
701
|
-
NGROK_TOKEN.write_text(auth_token.strip())
|
|
701
|
+
NGROK_TOKEN.write_text(encoding='utf-8', data=auth_token.strip())
|
|
702
702
|
ok("ngrok token saved.")
|
|
703
703
|
else:
|
|
704
704
|
warn("No ngrok token provided. ngrok may disconnect. To fix, re-run setup.")
|
|
@@ -723,7 +723,7 @@ def setup_token_and_db():
|
|
|
723
723
|
|
|
724
724
|
alphabet = string.ascii_uppercase + string.digits
|
|
725
725
|
new_token = ''.join(secrets.choice(alphabet) for _ in range(8))
|
|
726
|
-
TOKEN_FILE.write_text(new_token)
|
|
726
|
+
TOKEN_FILE.write_text(encoding='utf-8', data=new_token)
|
|
727
727
|
ok(f"Access Token saved: {BOLD}{GREEN}{new_token}{RESET}")
|
|
728
728
|
nl()
|
|
729
729
|
print(f" {YELLOW}Copy this token into the mobile app → Settings → Access Token.{RESET}")
|
|
@@ -738,6 +738,17 @@ def setup_token_and_db():
|
|
|
738
738
|
# ══════════════════════════════════════════════════════════════════════════════
|
|
739
739
|
def _start_ngrok(port: int) -> str | None:
|
|
740
740
|
try:
|
|
741
|
+
# Dynamically inject the venv site-packages to import pyngrok since start.py is run by global python
|
|
742
|
+
import sys
|
|
743
|
+
if IS_WINDOWS:
|
|
744
|
+
sp = VENV_DIR / "Lib" / "site-packages"
|
|
745
|
+
else:
|
|
746
|
+
sp_list = list(VENV_DIR.glob("lib/python*/site-packages"))
|
|
747
|
+
sp = sp_list[0] if sp_list else VENV_DIR / "lib" / "python3" / "site-packages"
|
|
748
|
+
|
|
749
|
+
if str(sp) not in sys.path:
|
|
750
|
+
sys.path.insert(0, str(sp))
|
|
751
|
+
|
|
741
752
|
import pyngrok
|
|
742
753
|
from pyngrok import ngrok
|
|
743
754
|
|
|
@@ -791,7 +802,7 @@ def _start_localtunnel(port: int, timeout: int = 25) -> str | None:
|
|
|
791
802
|
info("Starting localtunnel in background...")
|
|
792
803
|
try:
|
|
793
804
|
LOCALTUNNEL_LOG.parent.mkdir(parents=True, exist_ok=True)
|
|
794
|
-
LOCALTUNNEL_LOG.write_text("")
|
|
805
|
+
LOCALTUNNEL_LOG.write_text(encoding='utf-8', data="")
|
|
795
806
|
log_handle = open(LOCALTUNNEL_LOG, "a", encoding="utf-8", buffering=1)
|
|
796
807
|
kwargs = {
|
|
797
808
|
"start_new_session": True,
|
|
@@ -856,7 +867,7 @@ def _start_localtunnel(port: int, timeout: int = 25) -> str | None:
|
|
|
856
867
|
info("Starting localtunnel in background...")
|
|
857
868
|
try:
|
|
858
869
|
LOCALTUNNEL_LOG.parent.mkdir(parents=True, exist_ok=True)
|
|
859
|
-
LOCALTUNNEL_LOG.write_text("")
|
|
870
|
+
LOCALTUNNEL_LOG.write_text(encoding='utf-8', data="")
|
|
860
871
|
log_handle = open(LOCALTUNNEL_LOG, "a", encoding="utf-8", buffering=1)
|
|
861
872
|
kwargs = {
|
|
862
873
|
"start_new_session": True,
|
|
@@ -1428,7 +1439,7 @@ def main():
|
|
|
1428
1439
|
sys.exit(1)
|
|
1429
1440
|
|
|
1430
1441
|
# Mark setup done
|
|
1431
|
-
SETUP_DONE.write_text("ok")
|
|
1442
|
+
SETUP_DONE.write_text(encoding='utf-8', data="ok")
|
|
1432
1443
|
|
|
1433
1444
|
nl()
|
|
1434
1445
|
print(f" {GREEN}{BOLD}{'═'*60}{RESET}")
|