Module: main.py
Application: pkg.bio
This document outlines the routes and core logic of main.py, the primary application module for pkg.bio. All routes follow the principles of authenticated user profile management and safe public viewing.
GET /loginPOST /loginGET /signupPOST /signupGET /logoutGET /onboardingPOST /onboardingGET /dashboardGET /dashboard/editPOST /dashboard/editGET /GET /<username>GET /testing/basicSelectGET /testing/activityParsing/<id>login_required: Decorator to protect routes for authenticated users only.get_user_by_username(username): Fetches profile from Supabase by username.get_user_by_id(user_id): Fetches profile from Supabase by user ID.create_or_update_profile(user_id, username, **kwargs): Inserts or updates a user profile record.format_user_data(user_data): Normalizes Supabase data into bio config format for rendering.helper.py functionsparse_activity(user_data): Returns a JSON noramlized format from Lanyard.clean_string(string): Formats strings from the logos.json into readable human strings for rendering.get_discord_activity(user_id): Return parsed activity from lanyard (Used in tandem with parse_activity)@app.before_request – Checks for and refreshes expired Supabase access tokens using a stored refresh token.
SECRET_KEY: Flask session secret (required).SUPABASE_URL: Supabase project base URL.SUPABASE_KEY: Supabase project service key.