Skip to content

Reorganize codebase

Izalia Mae requested to merge (removed):rework into master

In order to make the relay easier to work on, I'm making a ton of changes.

  • General:

    • Web views have been moved into their own file as views.py
    • Processing functions have been moved into processors.py
    • The 'request' function was created for making GETs and POSTs and put in misc.py
    • All functions in http_signaturese where moved into misc.py
    • Directly import the logging module instead of importing from logging.py
    • Set the log level via 'LOG_LEVEL' environmental variable
    • Use 'X-Forwarded-For' header to determine remote IP address for access log
    • DB and Config are attached to an aiohttp.web.Application in order to set the config path via cli
    • If installed via pip, the relay can be ran via activityrelay
  • Management:

    • No need to call relay.manage
    • Commands to manage banlists and whitelist
    • Setup command to configure a new server
  • Routes:

    • Only enable '/stats' route and aiohttp.TraceConfig if the logging level is set to DEBUG
    • Treat 'POST /actor' as an inbox so only one url needs to be used for all software
  • Docker:

    • Moved relay to /opt/activityrelay and data to /data
    • Created docker.sh script for easy management
  • RelayConfig: a class that manages loading and saving of relay.yaml

    • Access to config options as attributes or dict items
    • Functions to check if an instance is banned or whitelisted
    • Properties for various urls used throughout the relay (actor, inbox, and keyid)
    • If a database file is not specified, it will be named after the config file
  • RelayDatabase: class for db management

    • Removed the public key from the database since it can be generated on startup
    • Properties for public and private keys as string (lowercase) and RSA (uppercase) objects
    • Save to disk when adding or removing an inbox instead of every 30 seconds
Edited by Izalia Mae

Merge request reports