decentralized and customizable links page on top of atproto

refactor: use absolute imports

Changed files
+28 -24
src
+2 -1
src/atproto/__init__.py
··· 6 6 from aiodns import error as dns_error 7 7 from aiohttp.client import ClientResponse, ClientSession 8 8 9 - from ..security import is_safe_url 9 + from src.security import is_safe_url 10 + 10 11 from .kv import KV, nokv 11 12 from .validator import is_valid_authserver_meta 12 13
+7 -5
src/atproto/oauth.py
··· 1 - from typing import Any, Callable, NamedTuple 2 - import time 3 1 import json 4 - from aiohttp.client import ClientSession, ClientResponse 5 - from authlib.jose import JsonWebKey, Key, jwt 2 + import time 3 + from typing import Any, Callable, NamedTuple 4 + 5 + from aiohttp.client import ClientResponse, ClientSession 6 6 from authlib.common.security import generate_token 7 + from authlib.jose import JsonWebKey, Key, jwt 7 8 from authlib.oauth2.rfc7636 import create_s256_code_challenge 8 9 10 + from src.security import hardened_http, is_safe_url 11 + 9 12 from . import fetch_authserver_meta 10 13 from .types import OAuthAuthRequest, OAuthSession 11 - from ..security import is_safe_url, hardened_http 12 14 13 15 14 16 class OAuthTokens(NamedTuple):
+3 -2
src/auth.py
··· 1 + from typing import NamedTuple, TypeVar 2 + 1 3 from flask import current_app 2 4 from flask.sessions import SessionMixin 3 - from typing import NamedTuple, TypeVar 4 5 5 - from .atproto.types import OAuthAuthRequest, OAuthSession 6 + from src.atproto.types import OAuthAuthRequest, OAuthSession 6 7 7 8 8 9 def save_auth_request(session: SessionMixin, request: OAuthAuthRequest):
+4 -4
src/db.py
··· 1 - from flask import Flask, g 1 + import sqlite3 2 2 from logging import Logger 3 + from sqlite3 import Connection 3 4 from typing import override 4 5 5 - import sqlite3 6 - from sqlite3 import Connection 6 + from flask import Flask, g 7 7 8 - from .atproto.kv import KV as BaseKV 8 + from src.atproto.kv import KV as BaseKV 9 9 10 10 11 11 class KV(BaseKV):
+6 -6
src/main.py
··· 7 7 from flask_htmx import HTMX 8 8 from flask_htmx import make_response as htmx_response 9 9 10 - from .atproto import ( 10 + from src.atproto import ( 11 11 PdsUrl, 12 12 get_record, 13 13 is_valid_did, 14 14 resolve_did_from_handle, 15 15 resolve_pds_from_did, 16 16 ) 17 - from .atproto.oauth import pds_authed_req 18 - from .atproto.types import OAuthSession 19 - from .auth import get_auth_session, save_auth_session 20 - from .db import KV, close_db_connection, get_db, init_db 21 - from .oauth import oauth 17 + from src.atproto.oauth import pds_authed_req 18 + from src.atproto.types import OAuthSession 19 + from src.auth import get_auth_session, save_auth_session 20 + from src.db import KV, close_db_connection, get_db, init_db 21 + from src.oauth import oauth 22 22 23 23 app = Flask(__name__) 24 24 _ = app.config.from_prefixed_env()
+6 -6
src/oauth.py
··· 5 5 from authlib.jose import JsonWebKey, Key 6 6 from flask import Blueprint, current_app, jsonify, redirect, request, session, url_for 7 7 8 - from .atproto import ( 8 + from src.atproto import ( 9 9 fetch_authserver_meta, 10 10 is_valid_did, 11 11 is_valid_handle, ··· 13 13 resolve_authserver_from_pds, 14 14 resolve_identity, 15 15 ) 16 - from .atproto.oauth import initial_token_request, send_par_auth_request 17 - from .atproto.types import OAuthAuthRequest, OAuthSession 18 - from .auth import ( 16 + from src.atproto.oauth import initial_token_request, send_par_auth_request 17 + from src.atproto.types import OAuthAuthRequest, OAuthSession 18 + from src.auth import ( 19 19 delete_auth_request, 20 20 get_auth_request, 21 21 save_auth_request, 22 22 save_auth_session, 23 23 ) 24 - from .db import KV, get_db 25 - from .security import is_safe_url 24 + from src.db import KV, get_db 25 + from src.security import is_safe_url 26 26 27 27 oauth = Blueprint("oauth", __name__, url_prefix="/oauth") 28 28