Thanks to visit codestin.com
Credit goes to github.com

Skip to content

/admin/config plugin routes not respecting APPLICATION_ROOT #2871

@adb014

Description

@adb014

Whether this is an issue I suppose is a matter of perspective. The routes in /admin/config for the plugins don't include APPLICATION_ROOT. I suppose the routes are given by the plugins themselves and could include the APPLICATION_ROOT, but it seems to me the plugins shouldn't have to know the base CTFd configuration. Ideally CTFd/plugins/__init__.py(register_admin_plugin_menu_bar) should be modified like

    if route.startswith("http"):
        am =Menu(title=title, route=route, link_target=link_target)
    else:
        application_root = current_app.config.get("APPLICATION_ROOT")
        am = Menu(title=title, route=application_root + route, link_target=link_target)
    app.admin_plugin_menu_bar.append(am)

and probably CTFd/plugins/__init__.py(register_user_plugin_menu_bar) likewise. Though this change might mean that CTFd/themes/admin/templates/base.html and CTFd/themes/core/templates/base.html might need to be adapted for the new saved plugin routes. Otherwise, CTFd/themes/core/templates/config.hmlmight be adapted to include the APPLICATION_ROOT.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions