Install the sync server from this repo now that the separate installer is gone.
This commit is contained in:
1 parent
1030bac79e
commit
3665f7941e
7 files changed
+3
-178
No files matched your search
@@ -4,7 +4,6 @@
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import secrets
|
||||
import sqlite3
|
||||
import sys
|
||||
import threading
|
||||
@@ -53,16 +52,6 @@ def listen_port():
|
||||
return 8787
|
||||
|
||||
|
||||
def token_path():
|
||||
configured = os.environ.get("PITLOG_TOKEN_FILE")
|
||||
if configured:
|
||||
return configured
|
||||
home = os.environ.get("HOME", "")
|
||||
if home:
|
||||
return os.path.join(home, ".pitlog-token")
|
||||
return "/etc/pitlog/token"
|
||||
|
||||
|
||||
def legacy_token():
|
||||
inline = os.environ.get("PITLOG_TOKEN", "").strip().lower()
|
||||
if inline:
|
||||
@@ -199,27 +188,6 @@ def connect():
|
||||
_spaces[path] = _db
|
||||
|
||||
|
||||
def token():
|
||||
inline = os.environ.get("PITLOG_TOKEN", "").strip()
|
||||
if inline:
|
||||
return inline
|
||||
path = token_path()
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as handle:
|
||||
saved = handle.read().strip()
|
||||
except FileNotFoundError:
|
||||
saved = ""
|
||||
if saved:
|
||||
return saved
|
||||
generated = secrets.token_hex(32)
|
||||
folder = os.path.dirname(path)
|
||||
if folder:
|
||||
os.makedirs(folder, exist_ok=True)
|
||||
with open(path, "w", encoding="utf-8") as handle:
|
||||
handle.write(generated)
|
||||
return generated
|
||||
|
||||
|
||||
def current_rev(db):
|
||||
return int(db.execute("SELECT value FROM meta WHERE key = 'rev'").fetchone()["value"])
|
||||
|
||||
|
||||
Reference in new issue
Block a user