1
0
Fork 0
mirror of synced 2024-05-20 04:12:30 +12:00

add django-signal-webhooks

This commit is contained in:
Nick Sweeting 2024-05-06 06:58:03 -07:00
parent 3805a1730d
commit c7fc9c004f
No known key found for this signature in database
5 changed files with 36 additions and 3 deletions

View file

@ -18,6 +18,7 @@ from ..config import (
CUSTOM_TEMPLATES_DIR,
SQL_INDEX_FILENAME,
OUTPUT_DIR,
ARCHIVE_DIR,
LOGS_DIR,
TIMEZONE,
@ -63,6 +64,7 @@ INSTALLED_APPS = [
'core',
'api',
'signal_webhooks',
'django_extensions',
]
@ -253,6 +255,23 @@ CACHES = {
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
STORAGES = {
"archive": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
"OPTIONS": {
"base_url": "/archive/",
"location": ARCHIVE_DIR,
},
},
# "personas": {
# "BACKEND": "django.core.files.storage.FileSystemStorage",
# "OPTIONS": {
# "base_url": "/personas/",
# "location": PERSONAS_DIR,
# },
# },
}
################################################################################
### Security Settings
################################################################################
@ -379,3 +398,15 @@ LOGGING = {
}
},
}
# Add default webhook configuration to the User model
SIGNAL_WEBHOOKS = {
"HOOKS": {
"django.contrib.auth.models.User": ...,
"core.models.Snapshot": "...",
"core.models.ArchiveResult": "...",
"core.models.Tag": "...",
"api.models.APIToken": "...",
},
}

View file

@ -4,6 +4,7 @@ WARNING: THIS FILE IS ALL LEGACY CODE TO BE REMOVED.
DO NOT ADD ANY NEW FEATURES TO THIS FILE, NEW CODE GOES HERE: core/models.py
These are the old types we used to use before ArchiveBox v0.4 (before we switched to Django).
"""
__package__ = 'archivebox.index'

View file

@ -230,7 +230,7 @@ def version(quiet: bool=False,
p = platform.uname()
print(
'ArchiveBox v{}'.format(get_version(CONFIG)),
*((f'COMMIT_HASH={COMMIT_HASH[:7]}',) if COMMIT_HASH else ()),
f'COMMIT_HASH={COMMIT_HASH[:7] if COMMIT_HASH else 'unknown'}',
f'BUILD_TIME={BUILD_TIME}',
)
print(
@ -1356,7 +1356,7 @@ def manage(args: Optional[List[str]]=None, out_dir: Path=OUTPUT_DIR) -> None:
if (args and "createsuperuser" in args) and (IN_DOCKER and not IS_TTY):
stderr('[!] Warning: you need to pass -it to use interactive commands in docker', color='lightyellow')
stderr(' docker run -it archivebox manage {}'.format(' '.join(args or ['...'])), color='lightyellow')
stderr()
stderr('')
execute_from_command_line([f'{ARCHIVEBOX_BINARY} manage', *(args or ['help'])])

View file

@ -7,7 +7,7 @@ if __name__ == '__main__':
# versions of ./manage.py commands whenever possible. When that's not possible
# (e.g. makemigrations), you can comment out this check temporarily
if not ('makemigrations' in sys.argv or 'migrate' in sys.argv):
if not ('makemigrations' in sys.argv or 'migrate' in sys.argv or 'startapp' in sys.argv):
print("[X] Don't run ./manage.py directly (unless you are a developer running makemigrations):")
print()
print(' Hint: Use these archivebox CLI commands instead of the ./manage.py equivalents:')

View file

@ -35,6 +35,7 @@ dependencies = [
# - gallery-dl
# - scihubdl
# - See Github issues for more...
"django-signal-webhooks>=0.3.0",
]
homepage = "https://github.com/ArchiveBox/ArchiveBox"