diff --git a/bot/bot.py b/bot/bot.py index 528385e..5eb1150 100644 --- a/bot/bot.py +++ b/bot/bot.py @@ -34,7 +34,7 @@ user_sessions = {} login_state = {} message_history = {} user_cache = {} -CACHE_FILE = "/app/user_cache.pkl" +CACHE_FILE = os.getenv("BOT_CACHE_FILE", "/app/cache/user_cache.pkl") intents = discord.Intents.default() intents.message_content = True @@ -227,6 +227,7 @@ def loadCache(): def saveCache(): try: + os.makedirs(os.path.dirname(CACHE_FILE), exist_ok=True) with open(CACHE_FILE, "wb") as f: pickle.dump(user_cache, f) except Exception as e: diff --git a/docker-compose.yml b/docker-compose.yml index 39b575b..ac822c8 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -42,6 +42,8 @@ services: depends_on: app: condition: service_started + volumes: + - botcache:/app/cache client: build: @@ -56,3 +58,4 @@ services: volumes: pgdata: + botcache: diff --git a/synculous-client/src/app/login/page.tsx b/synculous-client/src/app/login/page.tsx index b5ce6ed..9bfa2c4 100644 --- a/synculous-client/src/app/login/page.tsx +++ b/synculous-client/src/app/login/page.tsx @@ -9,7 +9,7 @@ export default function LoginPage() { const [isLogin, setIsLogin] = useState(true); const [username, setUsername] = useState(''); const [password, setPassword] = useState(''); - const [trustDevice, setTrustDevice] = useState(false); + const [trustDevice, setTrustDevice] = useState(true); const [error, setError] = useState(''); const [isLoading, setIsLoading] = useState(false); const { login, register } = useAuth();