superbrain-server 1.0.21 → 1.0.22
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 +13 -13
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(encoding='utf-8', data="".join(lines))
|
|
402
|
+
API_KEYS.write_text(encoding='utf-8', errors='replace', 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(encoding='utf-8', data=model)
|
|
650
|
+
whisper_cfg.write_text(encoding='utf-8', errors='replace', 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,16 +689,16 @@ 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(encoding='utf-8', data="enabled")
|
|
692
|
+
NGROK_ENABLED.write_text(encoding='utf-8', errors='replace', data="enabled")
|
|
693
693
|
|
|
694
|
-
existing_token = NGROK_TOKEN.read_text().strip() if NGROK_TOKEN.exists() else ""
|
|
694
|
+
existing_token = NGROK_TOKEN.read_text(encoding='utf-8', errors='ignore').strip() if NGROK_TOKEN.exists() else ""
|
|
695
695
|
print(f"\n {YELLOW}Please paste your ngrok Authtoken.{RESET}")
|
|
696
696
|
if existing_token:
|
|
697
697
|
print(f" {DIM}(Leave blank to keep existing token){RESET}")
|
|
698
698
|
|
|
699
699
|
auth_token = ask("Authtoken", default=existing_token, paste=True)
|
|
700
700
|
if auth_token.strip():
|
|
701
|
-
NGROK_TOKEN.write_text(encoding='utf-8', data=auth_token.strip())
|
|
701
|
+
NGROK_TOKEN.write_text(encoding='utf-8', errors='replace', 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.")
|
|
@@ -711,7 +711,7 @@ def setup_token_and_db():
|
|
|
711
711
|
|
|
712
712
|
# Token
|
|
713
713
|
if TOKEN_FILE.exists():
|
|
714
|
-
token = TOKEN_FILE.read_text().strip()
|
|
714
|
+
token = TOKEN_FILE.read_text(encoding='utf-8', errors='ignore').strip()
|
|
715
715
|
if token and len(token) == 8 and token.isalnum():
|
|
716
716
|
ok(f"Access Token already exists: {BOLD}{token}{RESET}")
|
|
717
717
|
if not ask_yn("Generate a new Access Token?", default=False):
|
|
@@ -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(encoding='utf-8', data=new_token)
|
|
726
|
+
TOKEN_FILE.write_text(encoding='utf-8', errors='replace', 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}")
|
|
@@ -752,7 +752,7 @@ def _start_ngrok(port: int) -> str | None:
|
|
|
752
752
|
import pyngrok
|
|
753
753
|
from pyngrok import ngrok
|
|
754
754
|
|
|
755
|
-
token = NGROK_TOKEN.read_text().strip() if NGROK_TOKEN.exists() else None
|
|
755
|
+
token = NGROK_TOKEN.read_text(encoding='utf-8', errors='ignore').strip() if NGROK_TOKEN.exists() else None
|
|
756
756
|
if token:
|
|
757
757
|
ngrok.set_auth_token(token)
|
|
758
758
|
|
|
@@ -802,7 +802,7 @@ def _start_localtunnel(port: int, timeout: int = 25) -> str | None:
|
|
|
802
802
|
info("Starting localtunnel in background...")
|
|
803
803
|
try:
|
|
804
804
|
LOCALTUNNEL_LOG.parent.mkdir(parents=True, exist_ok=True)
|
|
805
|
-
LOCALTUNNEL_LOG.write_text(encoding='utf-8', data="")
|
|
805
|
+
LOCALTUNNEL_LOG.write_text(encoding='utf-8', errors='replace', data="")
|
|
806
806
|
log_handle = open(LOCALTUNNEL_LOG, "a", encoding="utf-8", buffering=1)
|
|
807
807
|
kwargs = {
|
|
808
808
|
"start_new_session": True,
|
|
@@ -867,7 +867,7 @@ def _start_localtunnel(port: int, timeout: int = 25) -> str | None:
|
|
|
867
867
|
info("Starting localtunnel in background...")
|
|
868
868
|
try:
|
|
869
869
|
LOCALTUNNEL_LOG.parent.mkdir(parents=True, exist_ok=True)
|
|
870
|
-
LOCALTUNNEL_LOG.write_text(encoding='utf-8', data="")
|
|
870
|
+
LOCALTUNNEL_LOG.write_text(encoding='utf-8', errors='replace', data="")
|
|
871
871
|
log_handle = open(LOCALTUNNEL_LOG, "a", encoding="utf-8", buffering=1)
|
|
872
872
|
kwargs = {
|
|
873
873
|
"start_new_session": True,
|
|
@@ -1256,7 +1256,7 @@ def launch_backend():
|
|
|
1256
1256
|
info(f"Try manually: kill -9 {pid}")
|
|
1257
1257
|
sys.exit(1)
|
|
1258
1258
|
|
|
1259
|
-
token = TOKEN_FILE.read_text().strip() if TOKEN_FILE.exists() else "—"
|
|
1259
|
+
token = TOKEN_FILE.read_text(encoding='utf-8', errors='ignore').strip() if TOKEN_FILE.exists() else "—"
|
|
1260
1260
|
local_ip = _detect_local_ip()
|
|
1261
1261
|
|
|
1262
1262
|
# tunnel startup
|
|
@@ -1264,7 +1264,7 @@ def launch_backend():
|
|
|
1264
1264
|
tunnel_type: str = ""
|
|
1265
1265
|
|
|
1266
1266
|
if NGROK_ENABLED.exists():
|
|
1267
|
-
token_txt = NGROK_TOKEN.read_text().strip() if NGROK_TOKEN.exists() else ""
|
|
1267
|
+
token_txt = NGROK_TOKEN.read_text(encoding='utf-8', errors='ignore').strip() if NGROK_TOKEN.exists() else ""
|
|
1268
1268
|
if not token_txt:
|
|
1269
1269
|
warn("Ngrok is enabled but no Authtoken was found.")
|
|
1270
1270
|
setup_remote_access()
|
|
@@ -1439,7 +1439,7 @@ def main():
|
|
|
1439
1439
|
sys.exit(1)
|
|
1440
1440
|
|
|
1441
1441
|
# Mark setup done
|
|
1442
|
-
SETUP_DONE.write_text(encoding='utf-8', data="ok")
|
|
1442
|
+
SETUP_DONE.write_text(encoding='utf-8', errors='replace', data="ok")
|
|
1443
1443
|
|
|
1444
1444
|
nl()
|
|
1445
1445
|
print(f" {GREEN}{BOLD}{'═'*60}{RESET}")
|