re-author plugins

This commit is contained in:
Nick Sweeting 2024-10-15 01:00:21 -07:00
parent 01ba6d49d3
commit 654bd22bd0
No known key found for this signature in database
19 changed files with 42 additions and 31 deletions

View file

@ -56,7 +56,7 @@ from .config.paths import PACKAGE_DIR, DATA_DIR, ARCHIVE_DIR # noqa
from .config.version import VERSION # noqa from .config.version import VERSION # noqa
__version__ = VERSION __version__ = VERSION
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__license__ = 'MIT' __license__ = 'MIT'
ASCII_ICON = """ ASCII_ICON = """

View file

@ -1,9 +1,10 @@
__package__ = 'plugins_auth.ldap' __package__ = 'plugins_auth.ldap'
__label__ = 'ldap' __id__ = 'ldap'
__label__ = 'LDAP'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/django-auth-ldap/django-auth-ldap' __homepage__ = 'https://github.com/django-auth-ldap/django-auth-ldap'
# __dependencies__ = ['pip'] __dependencies__ = ['pip']
import abx import abx
@ -11,22 +12,24 @@ import abx
@abx.hookimpl @abx.hookimpl
def get_PLUGIN(): def get_PLUGIN():
return { return {
'ldap': { __id__: {
'PACKAGE': __package__, 'id': __id__,
'LABEL': __label__, 'package': __package__,
'VERSION': __version__, 'label': __label__,
'AUTHOR': __author__, 'version': __version__,
'HOMEPAGE': __homepage__, 'author': __author__,
# 'DEPENDENCIES': __dependencies__, 'homepage': __homepage__,
'dependencies': __dependencies__,
} }
} }
@abx.hookimpl @abx.hookimpl
def get_CONFIG(): def get_CONFIG():
from .config import LDAP_CONFIG from .config import LDAP_CONFIG
return { return {
'ldap': LDAP_CONFIG __id__: LDAP_CONFIG
} }
@abx.hookimpl @abx.hookimpl
@ -39,6 +42,11 @@ def get_BINARIES():
def create_superuser_from_ldap_user(sender, user=None, ldap_user=None, **kwargs): def create_superuser_from_ldap_user(sender, user=None, ldap_user=None, **kwargs):
"""
Invoked after LDAP authenticates a user, but before they have a local User account created.
ArchiveBox requires staff/superuser status to view the admin at all, so we must create a user
+ set staff and superuser when LDAP authenticates a new person.
"""
from django.conf import settings from django.conf import settings
if user is None: if user is None:
@ -53,9 +61,12 @@ def create_superuser_from_ldap_user(sender, user=None, ldap_user=None, **kwargs)
@abx.hookimpl @abx.hookimpl
def ready(): def ready():
"""
Called at AppConfig.ready() time (settings + models are all loaded)
"""
from django.conf import settings from django.conf import settings
if settings.CONFIGS.ldap.LDAP_ENABLED: if settings.CONFIGS.ldap.LDAP_ENABLED:
# tell django-auth-ldap to call our function when a user is authenticated via LDAP
import django_auth_ldap.backend import django_auth_ldap.backend
django_auth_ldap.backend.populate_user.connect(create_superuser_from_ldap_user) django_auth_ldap.backend.populate_user.connect(create_superuser_from_ldap_user)

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.archivedotorg' __package__ = 'plugins_extractor.archivedotorg'
__label__ = 'archivedotorg' __label__ = 'archivedotorg'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://archive.org' __homepage__ = 'https://archive.org'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.chrome' __package__ = 'plugins_extractor.chrome'
__label__ = 'chrome' __label__ = 'chrome'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/ArchiveBox/ArchiveBox/tree/main/archivebox/plugins_extractor/chrome' __homepage__ = 'https://github.com/ArchiveBox/ArchiveBox/tree/main/archivebox/plugins_extractor/chrome'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.curl' __package__ = 'plugins_extractor.curl'
__label__ = 'curl' __label__ = 'curl'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/curl/curl' __homepage__ = 'https://github.com/curl/curl'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.favicon' __package__ = 'plugins_extractor.favicon'
__label__ = 'favicon' __label__ = 'favicon'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/ArchiveBox/archivebox' __homepage__ = 'https://github.com/ArchiveBox/archivebox'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.git' __package__ = 'plugins_extractor.git'
__label__ = 'git' __label__ = 'git'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/git/git' __homepage__ = 'https://github.com/git/git'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.mercury' __package__ = 'plugins_extractor.mercury'
__label__ = 'mercury' __label__ = 'mercury'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/postlight/mercury-parser' __homepage__ = 'https://github.com/postlight/mercury-parser'
__dependencies__ = ['npm'] __dependencies__ = ['npm']

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.readability' __package__ = 'plugins_extractor.readability'
__label__ = 'readability' __label__ = 'readability'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/ArchiveBox/readability-extractor' __homepage__ = 'https://github.com/ArchiveBox/readability-extractor'
__dependencies__ = ['npm'] __dependencies__ = ['npm']

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.singlefile' __package__ = 'plugins_extractor.singlefile'
__label__ = 'singlefile' __label__ = 'singlefile'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/gildas-lormeau/singlefile' __homepage__ = 'https://github.com/gildas-lormeau/singlefile'
__dependencies__ = ['npm'] __dependencies__ = ['npm']

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.wget' __package__ = 'plugins_extractor.wget'
__label__ = 'wget' __label__ = 'wget'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/ArchiveBox/ArchiveBox/tree/main/archivebox/plugins_extractor/wget' __homepage__ = 'https://github.com/ArchiveBox/ArchiveBox/tree/main/archivebox/plugins_extractor/wget'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_extractor.ytdlp' __package__ = 'plugins_extractor.ytdlp'
__label__ = 'YT-DLP' __label__ = 'YT-DLP'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/yt-dlp/yt-dlp' __homepage__ = 'https://github.com/yt-dlp/yt-dlp'
import abx import abx

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_pkg.npm' __package__ = 'plugins_pkg.npm'
__label__ = 'npm' __label__ = 'npm'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://www.npmjs.com/' __homepage__ = 'https://www.npmjs.com/'
import abx import abx

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_pkg.pip' __package__ = 'plugins_pkg.pip'
__label__ = 'pip' __label__ = 'pip'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/pypa/pip' __homepage__ = 'https://github.com/pypa/pip'
import abx import abx

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_pkg.playwright' __package__ = 'plugins_pkg.playwright'
__label__ = 'playwright' __label__ = 'playwright'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/microsoft/playwright-python' __homepage__ = 'https://github.com/microsoft/playwright-python'
import abx import abx

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_pkg.puppeteer' __package__ = 'plugins_pkg.puppeteer'
__label__ = 'puppeteer' __label__ = 'puppeteer'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/puppeteer/puppeteer' __homepage__ = 'https://github.com/puppeteer/puppeteer'
__dependencies__ = ['npm'] __dependencies__ = ['npm']

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_search.ripgrep' __package__ = 'plugins_search.ripgrep'
__label__ = 'ripgrep' __label__ = 'ripgrep'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/BurntSushi/ripgrep' __homepage__ = 'https://github.com/BurntSushi/ripgrep'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_search.sonic' __package__ = 'plugins_search.sonic'
__label__ = 'sonic' __label__ = 'sonic'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/valeriansaliou/sonic' __homepage__ = 'https://github.com/valeriansaliou/sonic'
__dependencies__ = [] __dependencies__ = []

View file

@ -1,7 +1,7 @@
__package__ = 'plugins_search.sqlitefts' __package__ = 'plugins_search.sqlitefts'
__label__ = 'sqlitefts' __label__ = 'sqlitefts'
__version__ = '2024.10.14' __version__ = '2024.10.14'
__author__ = 'Nick Sweeting' __author__ = 'ArchiveBox'
__homepage__ = 'https://github.com/ArchiveBox/archivebox' __homepage__ = 'https://github.com/ArchiveBox/archivebox'
__dependencies__ = [] __dependencies__ = []