mirror of
				https://github.com/arcan1s/ahriman.git
				synced 2025-11-03 23:33:41 +00:00 
			
		
		
		
	fix: drop debug toolbar
This commit is contained in:
		
							
								
								
									
										2
									
								
								.github/workflows/setup.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.github/workflows/setup.sh
									
									
									
									
										vendored
									
									
								
							@ -18,7 +18,7 @@ if [[ -z $MINIMAL_INSTALL ]]; then
 | 
			
		||||
    # VCS support
 | 
			
		||||
    pacman -Sy --noconfirm breezy darcs mercurial subversion
 | 
			
		||||
    # web server
 | 
			
		||||
    pacman -Sy --noconfirm python-aioauth-client python-aiohttp python-aiohttp-apispec-git python-aiohttp-cors python-aiohttp-debugtoolbar python-aiohttp-jinja2 python-aiohttp-security python-aiohttp-session python-cryptography python-jinja
 | 
			
		||||
    pacman -Sy --noconfirm python-aioauth-client python-aiohttp python-aiohttp-apispec-git python-aiohttp-cors python-aiohttp-jinja2 python-aiohttp-security python-aiohttp-session python-cryptography python-jinja
 | 
			
		||||
    # additional features
 | 
			
		||||
    pacman -Sy --noconfirm gnupg python-boto3 rsync
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
@ -36,7 +36,7 @@ RUN pacman -Sy --noconfirm --asdeps devtools git pyalpm python-cerberus python-i
 | 
			
		||||
    pacman -Sy --noconfirm --asdeps python-build python-flit python-installer python-wheel && \
 | 
			
		||||
    pacman -Sy --noconfirm --asdeps breezy git mercurial python-aiohttp python-aiohttp-cors python-boto3 python-cryptography python-jinja python-requests-unixsocket python-systemd rsync subversion && \
 | 
			
		||||
    runuser -u build -- install-aur-package python-aioauth-client python-aiohttp-apispec-git python-aiohttp-jinja2  \
 | 
			
		||||
                                            python-aiohttp-debugtoolbar python-aiohttp-session python-aiohttp-security
 | 
			
		||||
                                            python-aiohttp-session python-aiohttp-security
 | 
			
		||||
 | 
			
		||||
## FIXME since 1.0.4 devtools requires dbus to be run, which doesn't work now in container
 | 
			
		||||
COPY "docker/systemd-nspawn.sh" "/usr/local/bin/systemd-nspawn"
 | 
			
		||||
 | 
			
		||||
@ -363,7 +363,6 @@ Web application requires the following python packages to be installed:
 | 
			
		||||
 | 
			
		||||
* Core part requires ``aiohttp`` (application itself), ``aiohttp_jinja2`` and ``Jinja2`` (HTML generation from templates).
 | 
			
		||||
* Additional web features also require ``aiohttp-apispec`` (autogenerated documentation), ``aiohttp_cors`` (CORS support, required by documentation).
 | 
			
		||||
* In addition, ``aiohttp_debugtoolbar`` is required for debug panel. Please note that this option does not work together with authorization and basically must not be used in production.
 | 
			
		||||
* In addition, authorization feature requires ``aiohttp_security``, ``aiohttp_session`` and ``cryptography``.
 | 
			
		||||
* In addition to base authorization dependencies, OAuth2 also requires ``aioauth-client`` library.
 | 
			
		||||
* In addition if you would like to disable authorization for local access (recommended way in order to run the application itself with reporting support), the ``requests-unixsocket`` library is required.
 | 
			
		||||
 | 
			
		||||
@ -121,9 +121,6 @@ Reporting to web service related settings. In most cases there is fallback to we
 | 
			
		||||
Web server settings. This feature requires ``aiohttp`` libraries to be installed.
 | 
			
		||||
 | 
			
		||||
* ``address`` - optional address in form ``proto://host:port`` (``port`` can be omitted in case of default ``proto`` ports), will be used instead of ``http://{host}:{port}`` in case if set, string, optional. This option is required in case if ``OAuth`` provider is used.
 | 
			
		||||
* ``debug`` - enable debug toolbar, boolean, optional, default ``no``.
 | 
			
		||||
* ``debug_check_host`` - check hosts to access debug toolbar, boolean, optional, default ``no``.
 | 
			
		||||
* ``debug_allowed_hosts`` - allowed hosts to get access to debug toolbar, space separated list of string, optional.
 | 
			
		||||
* ``enable_archive_upload`` - allow to upload packages via HTTP (i.e. call of ``/api/v1/service/upload`` uri), boolean, optional, default ``no``.
 | 
			
		||||
* ``host`` - host to bind, string, optional.
 | 
			
		||||
* ``index_url`` - full url of the repository index page, string, optional.
 | 
			
		||||
 | 
			
		||||
@ -16,7 +16,6 @@ optdepends=('breezy: -bzr packages support'
 | 
			
		||||
            'python-aiohttp: web server'
 | 
			
		||||
            'python-aiohttp-apispec>=3.0.0: web server'
 | 
			
		||||
            'python-aiohttp-cors: web server'
 | 
			
		||||
            'python-aiohttp-debugtoolbar: web server with enabled debug panel'
 | 
			
		||||
            'python-aiohttp-jinja2: web server'
 | 
			
		||||
            'python-aiohttp-security: web server with authorization'
 | 
			
		||||
            'python-aiohttp-session: web server with authorization'
 | 
			
		||||
 | 
			
		||||
@ -79,9 +79,6 @@ command = rsync --archive --compress --partial --delete
 | 
			
		||||
chunk_size = 8388608
 | 
			
		||||
 | 
			
		||||
[web]
 | 
			
		||||
debug = no
 | 
			
		||||
debug_check_host = no
 | 
			
		||||
debug_allowed_hosts =
 | 
			
		||||
host = 127.0.0.1
 | 
			
		||||
static_path = /usr/share/ahriman/templates/static
 | 
			
		||||
templates = /usr/share/ahriman/templates
 | 
			
		||||
 | 
			
		||||
@ -76,7 +76,6 @@ web = [
 | 
			
		||||
    "aiohttp-apispec",
 | 
			
		||||
    "aiohttp_cors",
 | 
			
		||||
    "aiohttp_jinja2",
 | 
			
		||||
    "aiohttp_debugtoolbar",
 | 
			
		||||
    "aiohttp_session",
 | 
			
		||||
    "aiohttp_security",
 | 
			
		||||
    "cryptography",
 | 
			
		||||
 | 
			
		||||
@ -297,22 +297,6 @@ CONFIGURATION_SCHEMA: ConfigurationSchema = {
 | 
			
		||||
                "empty": False,
 | 
			
		||||
                "is_url": ["http", "https"],
 | 
			
		||||
            },
 | 
			
		||||
            "debug": {
 | 
			
		||||
                "type": "boolean",
 | 
			
		||||
                "coerce": "boolean",
 | 
			
		||||
            },
 | 
			
		||||
            "debug_check_host": {
 | 
			
		||||
                "type": "boolean",
 | 
			
		||||
                "coerce": "boolean",
 | 
			
		||||
            },
 | 
			
		||||
            "debug_allowed_hosts": {
 | 
			
		||||
                "type": "list",
 | 
			
		||||
                "coerce": "list",
 | 
			
		||||
                "schema": {
 | 
			
		||||
                    "type": "string",
 | 
			
		||||
                    "empty": False,
 | 
			
		||||
                },
 | 
			
		||||
            },
 | 
			
		||||
            "enable_archive_upload": {
 | 
			
		||||
                "type": "boolean",
 | 
			
		||||
                "coerce": "boolean",
 | 
			
		||||
 | 
			
		||||
@ -171,16 +171,6 @@ def setup_server(configuration: Configuration, spawner: Spawn, repositories: lis
 | 
			
		||||
    application.logger.info("setup process spawner")
 | 
			
		||||
    application["spawn"] = spawner
 | 
			
		||||
 | 
			
		||||
    # disable debug panel as it is not compatible with python 3.11 at the moment
 | 
			
		||||
    # https://github.com/aio-libs/aiohttp-debugtoolbar/issues/477
 | 
			
		||||
    # application.logger.info("setup debug panel")
 | 
			
		||||
    # debug_enabled = configuration.getboolean("web", "debug", fallback=False)
 | 
			
		||||
    # if debug_enabled:
 | 
			
		||||
    #     import aiohttp_debugtoolbar  # type: ignore[import-untyped]
 | 
			
		||||
    #     aiohttp_debugtoolbar.setup(application,
 | 
			
		||||
    #                                hosts=configuration.getlist("web", "debug_allowed_hosts", fallback=[]),
 | 
			
		||||
    #                                check_host=configuration.getboolean("web", "debug_check_host", fallback=False))
 | 
			
		||||
 | 
			
		||||
    application.logger.info("setup authorization")
 | 
			
		||||
    validator = application["validator"] = Auth.load(configuration, database)
 | 
			
		||||
    if validator.enabled:
 | 
			
		||||
 | 
			
		||||
@ -122,22 +122,6 @@ def test_run_with_auth(application_with_auth: Application, mocker: MockerFixture
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@pytest.mark.skip(reason="https://github.com/aio-libs/aiohttp-debugtoolbar/issues/477")
 | 
			
		||||
def test_run_with_debug(application_with_debug: Application, mocker: MockerFixture) -> None:
 | 
			
		||||
    """
 | 
			
		||||
    must run application with enabled debug panel
 | 
			
		||||
    """
 | 
			
		||||
    port = 8080
 | 
			
		||||
    application_with_debug["configuration"].set_option("web", "port", str(port))
 | 
			
		||||
    run_application_mock = mocker.patch("ahriman.web.web.run_app")
 | 
			
		||||
 | 
			
		||||
    run_server(application_with_debug)
 | 
			
		||||
    run_application_mock.assert_called_once_with(
 | 
			
		||||
        application_with_debug, host="127.0.0.1", port=port, sock=None, handle_signals=True,
 | 
			
		||||
        access_log=pytest.helpers.anyvar(int), access_log_class=FilteredAccessLogger
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def test_run_with_socket(application: Application, mocker: MockerFixture) -> None:
 | 
			
		||||
    """
 | 
			
		||||
    must run application
 | 
			
		||||
 | 
			
		||||
@ -112,9 +112,6 @@ username = arcan1s
 | 
			
		||||
[remote-service]
 | 
			
		||||
 | 
			
		||||
[web]
 | 
			
		||||
debug = no
 | 
			
		||||
debug_check_host = no
 | 
			
		||||
debug_allowed_hosts =
 | 
			
		||||
enable_archive_upload = yes
 | 
			
		||||
host = 127.0.0.1
 | 
			
		||||
static_path = ../web/templates/static
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user