origins = [
"http://localhost:5173",
"localhost:5173",
+ "http://192.168.1.35:5173",
+ "192.168.1.35:5173"
]
app.add_middleware(
app.include_router(users.router, prefix="/users")
app.include_router(logs.router, prefix="/logs")
-@app.get("/")
-async def root():
- return {"message": "Hello World"}
logger.info("Server started")
\ No newline at end of file
# build jwt
token = create_jwt(user["user_id"], user["username"], derived_key)
- response.set_cookie(key="token", value=token, httponly=True)
+ response.set_cookie(key="token", value=token, httponly=True, samesite="lax")
return {"username": user["username"]}
def create_jwt(user_id, username, derived_key):
let inDuration = 150;
let outDuration = 150;
- let API_URL = dev ? 'http://localhost:8000' : window.location.pathname.replace(/\/+$/, '');
+ let API_URL = dev
+ ? `${window.location.origin.replace(/:5173.*$/gm, '')}:8000`
+ : window.location.pathname.replace(/\/+$/, '');
function logout() {
axios
import { onMount } from 'svelte';
//import { selectedDate } from './calendar.svelte.js';
- let API_URL = dev ? 'http://localhost:8000' : window.location.pathname.replace(/\/+$/, '');
+ let API_URL = dev
+ ? `${window.location.origin.replace(/:5173.*$/gm, '')}:8000`
+ : window.location.pathname.replace(/\/+$/, '');
axios.interceptors.request.use((config) => {
config.withCredentials = true;
let registration_failed_message = $state('');
let is_registering = $state(false);
- let API_URL = dev ? 'http://localhost:8000' : window.location.pathname.replace(/\/+$/, '');
+ let API_URL = dev
+ ? `${window.location.origin.replace(/:5173.*$/gm, '')}:8000`
+ : window.location.pathname.replace(/\/+$/, '');
onMount(() => {
// if params error=440 or error=401, show toast