gramps-webapi 3.25.1__tar.gz → 3.25.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/PKG-INFO +1 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/_version.py +1 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/__init__.py +12 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/cache.py +24 -4
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/file.py +10 -8
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/image.py +6 -4
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/__init__.py +8 -3
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/tools.py +5 -3
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/media.py +4 -4
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/base.py +21 -8
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/citations.py +1 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/dna.py +7 -2
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/oidc.py +7 -4
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/util.py +4 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/s3.py +2 -2
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/search/text.py +3 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/tasks.py +8 -3
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/app.py +9 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/auth/oidc.py +10 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/config.py +3 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/util/celery.py +25 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/PKG-INFO +1 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/SOURCES.txt +2 -0
- gramps_webapi-3.25.3/tests/test_celery_logging.py +53 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_etag.py +11 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_file.py +26 -1
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_filters.py +52 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_oidc.py +63 -8
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_post.py +26 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_transactions.py +27 -2
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_file.py +15 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_import_util.py +24 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_oidc_auth.py +53 -0
- gramps_webapi-3.25.3/tests/test_proxy_fix.py +104 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_search_text.py +9 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.devcontainer/Dockerfile +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.devcontainer/devcontainer.json +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.devcontainer/docker-compose.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.dockerignore +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.editorconfig +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.flake8 +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/ISSUE_TEMPLATE/bug_report.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/ISSUE_TEMPLATE/config.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/workflows/base-image-pr.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/workflows/base-image.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/workflows/image.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/workflows/pypi.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.github/workflows/test.yml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.gitignore +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.pre-commit-config.yaml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.pylintrc +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.vscode/extensions.json +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.vscode/launch.json +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.vscode/settings.json +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/.vscode/tasks.json +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/AGENTS.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/CLAUDE.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/CODE_OF_CONDUCT.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/CONTRIBUTING.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/Dockerfile +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/Dockerfile.base +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/LICENSE +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/MANIFEST.in +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/README.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/ROADMAP.md +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic.ini +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/README +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/env.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/script.py.mako +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/2082445b0769_add_oidc_accounts_table_for_secure_.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/22c8d1fba959_add_trees_enabled.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/4b7f9d2e6c01_add_web_push_subscriptions.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/66e56620891a_add_trees_table.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/6d8f3cb50b71_add_persistent_access_tokens_table.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/7b2e9f4c1a63_allow_several_access_tokens_per_scope.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/84960b7d968c_use_bigint_for_quota_media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/9c4d2e7a5b18_track_task_lifecycle.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/a8e57fe0d82e_add_columns_for_ai_quota.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/b0582f54029c_use_bigint_for_usage_media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/b2c3d4e5f6a7_add_tree_config_column.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/b6f1d3a9c2e4_add_token_version_to_user.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/c1d2e3f4a5b6_merge_task_tree_and_tree_config.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/c89728e71264_.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/d4e9a1c7b3f2_drop_unique_constraint_on_user_email.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/e176543c72a8_add_tree_column_to_user.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/e5e738d09fa7_added_configuration_table.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/alembic_users/versions/f3a1c8e92b47_add_task_tree_table.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/docker-entrypoint.sh +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/__main__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/access/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/access/db.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/access/policy.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/access/sanitize.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/auth.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/backup.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/backup_store.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/blueprint.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/check.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/deprecations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/dna.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/emails.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/export.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/faces.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/html.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/agent.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/deps.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/llm/render.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/media_importer.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/people_families_cache.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/ratelimiter.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/report.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/access_tokens.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/anniversaries.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/backups.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/bookmarks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/chat.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/config.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/db_backend.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/delete.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/emit.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/events.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/export_media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/exporters.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/face_detection.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/facts.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/families.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/file.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/filter_param_types.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/filters.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/history.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/holidays.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/import_media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/importers.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/living.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/match.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/merge.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/metadata.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/name_formats.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/name_groups.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/notes.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/object_query.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/objects.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/ocr.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/oidc_accounts.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/people.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/places.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/push_subscriptions.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/relations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/reports.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/repositories.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/restore.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/schemas.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/search.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/sort.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/sources.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/tags.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/tasks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/timeline.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/token.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/transactions.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/translations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/trees.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/types.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/user.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/verify.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/resources/ydna.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/search/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/search/indexer.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/search/query.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/search/schema.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/snapshot.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/telemetry.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/api/util.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/auth/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/auth/const.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/auth/oidc_helpers.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/auth/passwords.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/auth/sql_guid.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/celery.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/const.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/data/empty_gramps_auth.cfg +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/data/example_gramps_auth.cfg +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/data/face_detection_yunet_2023mar.onnx +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/data/test_auth.cfg +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/dbloader.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/dbmanager.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/future_gramps/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/future_gramps/alive.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/future_gramps/relationship.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/logging_utils.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/profiler.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/sentry.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/static/index.html +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/templates/confirmation.html +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/templates/reset_password.html +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/templates/reset_password_base.html +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/templates/reset_password_error.html +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/translogger.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/types.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/undodb.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/util/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/util/task_state.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/verify_lib.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/webpush.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi/wsgi.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/dependency_links.txt +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/requires.txt +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/gramps_webapi.egg-info/top_level.txt +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/mypy.ini +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/pyproject.toml +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/requirements-dev.txt +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/scripts/s3_rename.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/scripts/search_benchmark.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/scripts/start_dev_container.sh +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/setup.cfg +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/setup.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/conftest.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_access.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_check.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_cli.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_close_db.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_db.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_delete.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_deprecations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_dna_match_parser.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/__init__.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/checks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_access_tokens.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_anniversaries_ics.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_backups.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_bookmarks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_chat.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_citations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_config.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_db_handle.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_delete.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_dna.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_events.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_exporters.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_facts.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_families.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_history.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_holidays.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_import_media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_importers.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_list_paging.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_living.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_media.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_media_archive.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_media_usage_sync.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_merge.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_metadata.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_name_formats.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_name_groups.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_notes.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_object_query.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_object_query_where_tree.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_ocr.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_oidc_accounts.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_oidc_link.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_paging_sort.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_people.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_people_query.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_place_coordinates.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_places.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_profiler.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_push_subscriptions.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_put.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_ready.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_relations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_repair.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_reports.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_repositories.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_restore.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_s3.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_search.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_sources.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_tags.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_tasks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_timelines.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_token.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_token_revocation.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_token_sync.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_translations.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_treeless_admin.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_trees.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_types.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_upload.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_user.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_verify.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_webpush_delivery.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/test_ydna.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_endpoints/util.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_face_detection.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_future_gramps_alive.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_future_gramps_relationship.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_image.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_jwt.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_limiter.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_llm_agent.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_llm_errors.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_llm_history.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_llm_render.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_llm_tools.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_logging_utils.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_map_tile.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_media_importer.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_media_prefix_tree.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_migrate_grampsdb.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_missing_references.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_object_query_parsing.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_openapi_operation_ids.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_password.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_postgres_driver.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_privacy_canary.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_private_proxy.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_private_proxy_backlinks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_s3.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_search_api_updates.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_search_index.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_search_oracle.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_sentry.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_server_locale.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_shared_postgresql.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_snapshot.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_sort_raw_data.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_sort_sql.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_sqlauth.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_static_files.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_task_error.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_task_state.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_tasks.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_telemetry.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_undodb.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_user_db_migration.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_util.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_verify_lib.py +0 -0
- {gramps_webapi-3.25.1 → gramps_webapi-3.25.3}/tests/test_version.py +0 -0
|
@@ -1033,6 +1033,16 @@ def get_thumbnail(args, handle, size):
|
|
|
1033
1033
|
return handler.send_thumbnail(size=size, square=args["square"])
|
|
1034
1034
|
|
|
1035
1035
|
|
|
1036
|
+
def _abort_if_invalid_crop(x1: int, y1: int, x2: int, y2: int) -> None:
|
|
1037
|
+
"""Abort unless the crop region (in percent) lies within the image.
|
|
1038
|
+
|
|
1039
|
+
Pillow pads crops outside the image, so unchecked coordinates could
|
|
1040
|
+
allocate an arbitrarily large image.
|
|
1041
|
+
"""
|
|
1042
|
+
if not (0 <= x1 < x2 <= 100 and 0 <= y1 < y2 <= 100):
|
|
1043
|
+
abort_with_message(400, "Crop region must lie within 0 and 100 percent")
|
|
1044
|
+
|
|
1045
|
+
|
|
1036
1046
|
@api_blueprint.route(
|
|
1037
1047
|
"/media/<string:handle>/cropped/<int:x1>/<int:y1>/<int:x2>/<int:y2>"
|
|
1038
1048
|
)
|
|
@@ -1049,6 +1059,7 @@ def get_thumbnail(args, handle, size):
|
|
|
1049
1059
|
@thumbnail_cache_decorator
|
|
1050
1060
|
def get_cropped(args, handle: str, x1: int, y1: int, x2: int, y2: int):
|
|
1051
1061
|
"""Get the thumbnail of a cropped file."""
|
|
1062
|
+
_abort_if_invalid_crop(x1, y1, x2, y2)
|
|
1052
1063
|
tree = get_tree_from_jwt()
|
|
1053
1064
|
db_handle = get_db_handle()
|
|
1054
1065
|
handler = get_media_handler(db_handle, tree=tree).get_file_handler(
|
|
@@ -1075,6 +1086,7 @@ def get_thumbnail_cropped(
|
|
|
1075
1086
|
args, handle: str, x1: int, y1: int, x2: int, y2: int, size: int
|
|
1076
1087
|
):
|
|
1077
1088
|
"""Get the thumbnail of a cropped file."""
|
|
1089
|
+
_abort_if_invalid_crop(x1, y1, x2, y2)
|
|
1078
1090
|
tree = get_tree_from_jwt()
|
|
1079
1091
|
db_handle = get_db_handle()
|
|
1080
1092
|
handler = get_media_handler(db_handle, tree=tree).get_file_handler(
|
|
@@ -141,8 +141,22 @@ def skip_cache_missing_media(*args, **kwargs) -> bool:
|
|
|
141
141
|
return g.cached_media is None
|
|
142
142
|
|
|
143
143
|
|
|
144
|
+
def is_cacheable_response(rv) -> bool:
|
|
145
|
+
"""Only cache successful responses.
|
|
146
|
+
|
|
147
|
+
Since Flask-Caching 2.5.0, an exception raised by `abort()` is cached as
|
|
148
|
+
well. An error can depend on the server rather than the tree or the file
|
|
149
|
+
(e.g. an addon or OpenCV that isn't installed yet), so it must not be served
|
|
150
|
+
until the tree changes, or for good from the thumbnail cache.
|
|
151
|
+
The view may return something other than a `Response`, e.g. a string.
|
|
152
|
+
"""
|
|
153
|
+
return getattr(rv, "status_code", 200) < 400
|
|
154
|
+
|
|
155
|
+
|
|
144
156
|
_request_cached = request_cache.cached(
|
|
145
|
-
make_cache_key=make_cache_key_request,
|
|
157
|
+
make_cache_key=make_cache_key_request,
|
|
158
|
+
unless=skip_cache_condition_request,
|
|
159
|
+
response_filter=is_cacheable_response,
|
|
146
160
|
)
|
|
147
161
|
|
|
148
162
|
|
|
@@ -168,7 +182,9 @@ def request_cache_decorator(f: Callable) -> Callable:
|
|
|
168
182
|
|
|
169
183
|
|
|
170
184
|
thumbnail_cache_decorator = thumbnail_cache.cached(
|
|
171
|
-
make_cache_key=make_cache_key_thumbnails,
|
|
185
|
+
make_cache_key=make_cache_key_thumbnails,
|
|
186
|
+
unless=skip_cache_missing_media,
|
|
187
|
+
response_filter=is_cacheable_response,
|
|
172
188
|
)
|
|
173
189
|
|
|
174
190
|
|
|
@@ -235,7 +251,9 @@ def make_cache_key_tiles(*args, **kwargs):
|
|
|
235
251
|
|
|
236
252
|
|
|
237
253
|
tile_cache_decorator = thumbnail_cache.cached(
|
|
238
|
-
make_cache_key=make_cache_key_tiles,
|
|
254
|
+
make_cache_key=make_cache_key_tiles,
|
|
255
|
+
unless=skip_cache_missing_media,
|
|
256
|
+
response_filter=is_cacheable_response,
|
|
239
257
|
)
|
|
240
258
|
|
|
241
259
|
|
|
@@ -258,7 +276,9 @@ def make_cache_key_face_detection(*args, **kwargs):
|
|
|
258
276
|
|
|
259
277
|
|
|
260
278
|
face_detection_cache_decorator = thumbnail_cache.cached(
|
|
261
|
-
make_cache_key=make_cache_key_face_detection,
|
|
279
|
+
make_cache_key=make_cache_key_face_detection,
|
|
280
|
+
unless=skip_cache_missing_media,
|
|
281
|
+
response_filter=is_cacheable_response,
|
|
262
282
|
)
|
|
263
283
|
|
|
264
284
|
|
|
@@ -22,16 +22,17 @@
|
|
|
22
22
|
import hashlib
|
|
23
23
|
import json
|
|
24
24
|
import os
|
|
25
|
+
import shutil
|
|
26
|
+
import tempfile
|
|
25
27
|
from io import BytesIO
|
|
26
28
|
from pathlib import Path
|
|
27
|
-
from typing import Any, BinaryIO, Optional, Tuple, Union
|
|
29
|
+
from typing import IO, Any, BinaryIO, Optional, Tuple, Union
|
|
28
30
|
|
|
29
31
|
from flask import jsonify, make_response, send_file, send_from_directory, current_app
|
|
30
32
|
from gramps.gen.db.base import DbReadBase
|
|
31
33
|
from gramps.gen.errors import HandleError
|
|
32
34
|
from gramps.gen.lib import Media
|
|
33
35
|
from PIL import Image
|
|
34
|
-
from werkzeug.datastructures import FileStorage
|
|
35
36
|
|
|
36
37
|
from gramps_webapi.const import MIME_AVIF, MIME_PNG
|
|
37
38
|
|
|
@@ -326,7 +327,7 @@ class LocalFileHandler(FileHandler):
|
|
|
326
327
|
|
|
327
328
|
|
|
328
329
|
def upload_file_local(
|
|
329
|
-
base_dir: FilenameOrPath, rel_path: FilenameOrPath, stream:
|
|
330
|
+
base_dir: FilenameOrPath, rel_path: FilenameOrPath, stream: IO[bytes]
|
|
330
331
|
) -> None:
|
|
331
332
|
"""Upload a file from a stream to a path inside the base directory.
|
|
332
333
|
|
|
@@ -339,8 +340,8 @@ def upload_file_local(
|
|
|
339
340
|
raise ValueError(f"File {path} is not within the base directory.")
|
|
340
341
|
# create folders if necessary
|
|
341
342
|
os.makedirs(path.parent, exist_ok=True)
|
|
342
|
-
|
|
343
|
-
|
|
343
|
+
with open(path, "wb") as out:
|
|
344
|
+
shutil.copyfileobj(stream, out)
|
|
344
345
|
|
|
345
346
|
|
|
346
347
|
def get_checksum(fp) -> str:
|
|
@@ -358,10 +359,11 @@ def get_checksum(fp) -> str:
|
|
|
358
359
|
return md5sum
|
|
359
360
|
|
|
360
361
|
|
|
361
|
-
def process_file(stream: Union[Any, BinaryIO]) -> Tuple[str, int,
|
|
362
|
+
def process_file(stream: Union[Any, BinaryIO]) -> Tuple[str, int, IO[bytes]]:
|
|
362
363
|
"""Process a file from a stream that has a read method."""
|
|
363
|
-
|
|
364
|
-
fp.
|
|
364
|
+
# copy in chunks, spilling to disk, instead of holding the body in memory twice
|
|
365
|
+
fp = tempfile.SpooledTemporaryFile(max_size=10 * 1024 * 1024)
|
|
366
|
+
shutil.copyfileobj(stream, fp)
|
|
365
367
|
fp.seek(0)
|
|
366
368
|
checksum = get_checksum(fp)
|
|
367
369
|
size = fp.tell()
|
|
@@ -75,11 +75,13 @@ def _fix_xmp(image: ImageType) -> None:
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def exif_transpose(image: ImageType) -> ImageType:
|
|
78
|
-
"""
|
|
78
|
+
"""Rotate the image in place according to its EXIF orientation and return it.
|
|
79
|
+
|
|
80
|
+
Pillow's default returns a full copy even when no rotation is needed.
|
|
81
|
+
"""
|
|
79
82
|
_fix_xmp(image)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
return transposed
|
|
83
|
+
ImageOps.exif_transpose(image, in_place=True)
|
|
84
|
+
return image
|
|
83
85
|
|
|
84
86
|
|
|
85
87
|
def open_image(fp: Union[BinaryIO, FilenameOrPath]) -> ImageType:
|
|
@@ -240,7 +240,8 @@ def answer_with_agent(
|
|
|
240
240
|
|
|
241
241
|
messages: list[ModelMessage] = []
|
|
242
242
|
try:
|
|
243
|
-
|
|
243
|
+
# never log the prompt or the answer, they contain private chat content
|
|
244
|
+
logger.debug("Running Pydantic AI agent")
|
|
244
245
|
with capture_run_messages() as messages:
|
|
245
246
|
result = agent.run_sync(
|
|
246
247
|
prompt,
|
|
@@ -254,7 +255,7 @@ def answer_with_agent(
|
|
|
254
255
|
else None
|
|
255
256
|
),
|
|
256
257
|
)
|
|
257
|
-
logger.debug("Agent
|
|
258
|
+
logger.debug("Agent finished with reason: %s", result.response.finish_reason)
|
|
258
259
|
if result.response.finish_reason == "length":
|
|
259
260
|
logger.warning(
|
|
260
261
|
"AI answer cut off at the output token limit, see "
|
|
@@ -295,7 +296,11 @@ def answer_with_agent(
|
|
|
295
296
|
abort_with_message(
|
|
296
297
|
400, "The AI model's response exceeded its output token limit."
|
|
297
298
|
)
|
|
298
|
-
|
|
299
|
+
# str(e) can include the model's response body
|
|
300
|
+
logger.error(
|
|
301
|
+
"Pydantic AI error: %s",
|
|
302
|
+
e.message if isinstance(e, UnexpectedModelBehavior) else type(e).__name__,
|
|
303
|
+
)
|
|
299
304
|
abort_with_message(500, "Error communicating with the AI model")
|
|
300
305
|
except Exception:
|
|
301
306
|
logger.exception("Unexpected error in agent")
|
|
@@ -143,7 +143,10 @@ def _apply_gramps_filter(
|
|
|
143
143
|
filter_dict["function"] = logic
|
|
144
144
|
|
|
145
145
|
filter_rules = json.dumps(filter_dict)
|
|
146
|
-
|
|
146
|
+
# rule values come from the chat, so only log the rule names
|
|
147
|
+
logger.debug(
|
|
148
|
+
"%s filter rules: %s", namespace, [rule["name"] for rule in rules]
|
|
149
|
+
)
|
|
147
150
|
|
|
148
151
|
args = {"rules": filter_rules}
|
|
149
152
|
matching_handles = apply_filter(
|
|
@@ -404,10 +407,9 @@ def search_genealogy_database(
|
|
|
404
407
|
if len(context_parts) < total:
|
|
405
408
|
result += f"\n\n---\nShowing {len(context_parts)} of {total} matches."
|
|
406
409
|
logger.debug(
|
|
407
|
-
"Tool search_genealogy_database returned %d results (%d chars)
|
|
410
|
+
"Tool search_genealogy_database returned %d results (%d chars)",
|
|
408
411
|
len(context_parts),
|
|
409
412
|
len(result),
|
|
410
|
-
query,
|
|
411
413
|
)
|
|
412
414
|
return result
|
|
413
415
|
|
|
@@ -26,7 +26,7 @@ import os
|
|
|
26
26
|
import time
|
|
27
27
|
import zipfile
|
|
28
28
|
from pathlib import Path
|
|
29
|
-
from typing import
|
|
29
|
+
from typing import IO, TYPE_CHECKING, Callable, List, Optional, Set
|
|
30
30
|
|
|
31
31
|
from flask import current_app
|
|
32
32
|
from flask_jwt_extended import get_jwt_identity
|
|
@@ -159,7 +159,7 @@ class MediaHandlerBase:
|
|
|
159
159
|
|
|
160
160
|
def upload_file(
|
|
161
161
|
self,
|
|
162
|
-
stream:
|
|
162
|
+
stream: IO[bytes],
|
|
163
163
|
checksum: str,
|
|
164
164
|
mime: str,
|
|
165
165
|
path: Optional[FilenameOrPath] = None,
|
|
@@ -203,7 +203,7 @@ class MediaHandlerLocal(MediaHandlerBase):
|
|
|
203
203
|
|
|
204
204
|
def upload_file(
|
|
205
205
|
self,
|
|
206
|
-
stream:
|
|
206
|
+
stream: IO[bytes],
|
|
207
207
|
checksum: str,
|
|
208
208
|
mime: str,
|
|
209
209
|
path: Optional[FilenameOrPath] = None,
|
|
@@ -347,7 +347,7 @@ class MediaHandlerS3(MediaHandlerBase):
|
|
|
347
347
|
|
|
348
348
|
def upload_file(
|
|
349
349
|
self,
|
|
350
|
-
stream:
|
|
350
|
+
stream: IO[bytes],
|
|
351
351
|
checksum: str,
|
|
352
352
|
mime: str,
|
|
353
353
|
path: Optional[FilenameOrPath] = None,
|
|
@@ -672,19 +672,32 @@ class GrampsObjectsResource(GrampsObjectResourceHelper, Resource):
|
|
|
672
672
|
objects.append(self.full_object(obj, args, locale=locale))
|
|
673
673
|
return self.response(200, objects, args, total_items=total_items)
|
|
674
674
|
|
|
675
|
-
# load all objects to memory
|
|
676
|
-
objects_name = GRAMPS_OBJECT_PLURAL[self.gramps_class_name]
|
|
677
|
-
iter_objects_method = self.db_handle.method("iter_%s", objects_name)
|
|
678
|
-
assert iter_objects_method is not None # type checker
|
|
679
675
|
# ordered by handle, so ties are broken like in sort_handles_by_raw_data
|
|
680
|
-
objects = sorted(iter_objects_method(), key=lambda obj: obj.handle)
|
|
681
|
-
|
|
682
676
|
if "filter" in args or "rules" in args:
|
|
683
|
-
handles
|
|
677
|
+
# filter the handles before loading objects, so that only the
|
|
678
|
+
# matching objects are loaded (rules evaluated in SQL, like
|
|
679
|
+
# MatchesQuery, load no other object at all)
|
|
680
|
+
handles = sorted(query_method())
|
|
684
681
|
matching = set(
|
|
685
682
|
apply_filter(self.db_handle, args, self.gramps_class_name, handles)
|
|
686
683
|
)
|
|
687
|
-
objects = [
|
|
684
|
+
objects = []
|
|
685
|
+
for handle in handles:
|
|
686
|
+
if handle not in matching:
|
|
687
|
+
continue
|
|
688
|
+
try:
|
|
689
|
+
obj = self.get_object_from_handle(handle)
|
|
690
|
+
except HandleError:
|
|
691
|
+
# object was deleted after the handles were fetched
|
|
692
|
+
continue
|
|
693
|
+
if obj is not None:
|
|
694
|
+
objects.append(obj)
|
|
695
|
+
else:
|
|
696
|
+
# load all objects to memory
|
|
697
|
+
objects_name = GRAMPS_OBJECT_PLURAL[self.gramps_class_name]
|
|
698
|
+
iter_objects_method = self.db_handle.method("iter_%s", objects_name)
|
|
699
|
+
assert iter_objects_method is not None # type checker
|
|
700
|
+
objects = sorted(iter_objects_method(), key=lambda obj: obj.handle)
|
|
688
701
|
|
|
689
702
|
if "gql" in args:
|
|
690
703
|
try:
|
|
@@ -50,7 +50,7 @@ class CitationResourceHelper(GrampsObjectResourceHelper):
|
|
|
50
50
|
"""Extend citation attributes as needed."""
|
|
51
51
|
if "profile" in args:
|
|
52
52
|
obj.profile = get_citation_profile_for_object(
|
|
53
|
-
self.db_handle, obj, args["profile"]
|
|
53
|
+
self.db_handle, obj, args["profile"], locale=locale
|
|
54
54
|
)
|
|
55
55
|
if "extend" in args:
|
|
56
56
|
obj.extended = get_extended_attributes(self.db_handle, obj, args)
|
|
@@ -87,8 +87,13 @@ class PersonDnaMatchesResource(ProtectedResource):
|
|
|
87
87
|
abort(404)
|
|
88
88
|
raise AssertionError # for type checker
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
90
|
+
# caching the whole tree is only worth it if there are matches to compute
|
|
91
|
+
if any(
|
|
92
|
+
association.get_relation() == "DNA"
|
|
93
|
+
for association in person.get_person_ref_list()
|
|
94
|
+
):
|
|
95
|
+
db_handle.cache_people()
|
|
96
|
+
db_handle.cache_families()
|
|
92
97
|
|
|
93
98
|
locale = get_locale_for_language(args["locale"], default=True)
|
|
94
99
|
|
|
@@ -142,11 +142,13 @@ def _validate_tree_id(tree_id: str | None) -> str | None:
|
|
|
142
142
|
|
|
143
143
|
Mirrors the checks the registration endpoint applies, so that an OIDC login
|
|
144
144
|
cannot create an account somewhere a registration could not.
|
|
145
|
+
|
|
146
|
+
The tree is optional even in a multi-tree setup: an identity that is already
|
|
147
|
+
linked to an account logs into that account's tree. Only creating a new
|
|
148
|
+
account needs one, which create_or_update_oidc_user() enforces.
|
|
145
149
|
"""
|
|
146
150
|
is_multi = current_app.config["TREE"] == TREE_MULTI
|
|
147
151
|
if not tree_id:
|
|
148
|
-
if is_multi:
|
|
149
|
-
abort_with_message(422, "tree is required")
|
|
150
152
|
return None
|
|
151
153
|
if not is_multi:
|
|
152
154
|
# In a single-tree setup TREE holds the tree *name*, not the tree ID.
|
|
@@ -384,8 +386,9 @@ class OIDCLoginQueryArgs(Schema):
|
|
|
384
386
|
required=False,
|
|
385
387
|
metadata={
|
|
386
388
|
"description": (
|
|
387
|
-
"ID of the tree to associate with the OIDC login.
|
|
388
|
-
"
|
|
389
|
+
"ID of the tree to associate with the OIDC login. In multi-tree"
|
|
390
|
+
" installations, required to create a new account, but not to"
|
|
391
|
+
" log into an existing one. Optional in single-tree ones."
|
|
389
392
|
" Ignored when linking."
|
|
390
393
|
)
|
|
391
394
|
},
|
|
@@ -2247,8 +2247,11 @@ def run_import(
|
|
|
2247
2247
|
if delete:
|
|
2248
2248
|
os.remove(file_name)
|
|
2249
2249
|
if not result:
|
|
2250
|
+
# The importers report unreadable input (corrupt file, invalid
|
|
2251
|
+
# XML, unsupported version) via notify_error and an empty
|
|
2252
|
+
# result, so this is the client's file, not a server fault.
|
|
2250
2253
|
abort_with_message(
|
|
2251
|
-
|
|
2254
|
+
422, "\n\n".join(["Import failed", *user.error_messages])
|
|
2252
2255
|
)
|
|
2253
2256
|
return truncate_import_report(user.error_messages + user.info_messages)
|
|
2254
2257
|
return []
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"""Object storage (e.g. S3) handling utilities."""
|
|
21
21
|
|
|
22
22
|
from io import BytesIO
|
|
23
|
-
from typing import BinaryIO, Dict, Optional
|
|
23
|
+
from typing import IO, BinaryIO, Dict, Optional
|
|
24
24
|
|
|
25
25
|
from flask import current_app, redirect, send_file
|
|
26
26
|
from gramps.gen.db.base import DbReadBase
|
|
@@ -210,7 +210,7 @@ class ObjectStorageFileHandler(FileHandler):
|
|
|
210
210
|
|
|
211
211
|
def upload_file_s3(
|
|
212
212
|
bucket_name: str,
|
|
213
|
-
stream:
|
|
213
|
+
stream: IO[bytes],
|
|
214
214
|
checksum: str,
|
|
215
215
|
mime: str,
|
|
216
216
|
prefix: Optional[str] = None,
|
|
@@ -241,7 +241,9 @@ def _collect(
|
|
|
241
241
|
spec = FIELD_SPECS[data["_class"]]
|
|
242
242
|
is_private = is_private or bool(data.get("private"))
|
|
243
243
|
strings = private if is_private else public
|
|
244
|
-
|
|
244
|
+
# Gramps does not enforce types, so data written by other tools can hold
|
|
245
|
+
# e.g. a postal code as a number
|
|
246
|
+
strings += [str(data[key]) for key in spec.text if data.get(key)]
|
|
245
247
|
strings += [_type_string(data.get(key), False) for key in spec.types]
|
|
246
248
|
strings += [_type_string(data.get(key), True) for key in spec.custom_types]
|
|
247
249
|
for key in spec.children:
|
|
@@ -922,9 +922,14 @@ def process_transactions(
|
|
|
922
922
|
message: str = "Raw transaction",
|
|
923
923
|
):
|
|
924
924
|
"""Process a set of database transactions, updating search indices as needed."""
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
925
|
+
try:
|
|
926
|
+
trans_dict = apply_transactions(
|
|
927
|
+
tree=tree, user_id=user_id, payload=payload, force=force, message=message
|
|
928
|
+
)
|
|
929
|
+
except ValueError as exc:
|
|
930
|
+
# a rejected transaction is the client's error, as in the synchronous
|
|
931
|
+
# endpoint; aborting makes the task report it as a 400 rejection
|
|
932
|
+
abort_with_message(400, str(exc))
|
|
928
933
|
update_search_indices_from_transaction(
|
|
929
934
|
trans_dict=trans_dict, tree=tree, user_id=user_id
|
|
930
935
|
)
|
|
@@ -35,6 +35,7 @@ from gramps.gen.config import set as setconfig
|
|
|
35
35
|
from gramps.gen.db.utils import get_dbid_from_path
|
|
36
36
|
from gramps.gen.errors import HandleError
|
|
37
37
|
from PIL import Image
|
|
38
|
+
from werkzeug.middleware.proxy_fix import ProxyFix
|
|
38
39
|
|
|
39
40
|
from .api import api_blueprint
|
|
40
41
|
from .api.cache import persistent_cache, request_cache, thumbnail_cache
|
|
@@ -112,6 +113,14 @@ def create_app(config: Optional[Dict[str, Any]] = None, config_from_env: bool =
|
|
|
112
113
|
if not app.config.get(option):
|
|
113
114
|
raise ValueError(f"{option} must be specified")
|
|
114
115
|
|
|
116
|
+
# trust X-Forwarded-For from this many reverse proxies, so that
|
|
117
|
+
# request.remote_addr (used e.g. as rate limiting key) is the client's IP;
|
|
118
|
+
# x_proto defaults to 1 in ProxyFix, so disable it explicitly
|
|
119
|
+
if proxy_fix_x_for := int(app.config.get("PROXY_FIX_X_FOR") or 0):
|
|
120
|
+
app.wsgi_app = ProxyFix( # type: ignore[method-assign]
|
|
121
|
+
app.wsgi_app, x_for=proxy_fix_x_for, x_proto=0
|
|
122
|
+
)
|
|
123
|
+
|
|
115
124
|
# pin the driver once, so every user of the config gets psycopg2
|
|
116
125
|
app.config["USER_DB_URI"] = pin_postgres_driver(app.config["USER_DB_URI"])
|
|
117
126
|
|
|
@@ -384,6 +384,16 @@ def create_or_update_oidc_user(
|
|
|
384
384
|
return existing_user_id
|
|
385
385
|
|
|
386
386
|
# Step 2: Create new user account (email linking removed for security)
|
|
387
|
+
|
|
388
|
+
# In a multi-tree setup a new account must belong to a tree, and only the
|
|
389
|
+
# login request can say which one (e.g. from a tree's registration link).
|
|
390
|
+
# Without it, refuse rather than create an account that belongs to no tree.
|
|
391
|
+
if not tree_id and current_app.config["TREE"] == TREE_MULTI:
|
|
392
|
+
raise ValueError(
|
|
393
|
+
"No account is linked to this identity. To create a new account,"
|
|
394
|
+
" use the registration link of your family tree."
|
|
395
|
+
)
|
|
396
|
+
|
|
387
397
|
logger.info(f"Creating new OIDC user for {provider_id}:{subject_id}")
|
|
388
398
|
|
|
389
399
|
# Generate a clean username - for custom providers use the display username as-is,
|
|
@@ -52,6 +52,9 @@ class DefaultConfig(object):
|
|
|
52
52
|
EMAIL_USE_STARTTLS = None
|
|
53
53
|
DEFAULT_FROM_EMAIL = ""
|
|
54
54
|
BASE_URL = "http://localhost/"
|
|
55
|
+
# number of trusted reverse proxies setting X-Forwarded-For; only set this
|
|
56
|
+
# if the app is reachable exclusively through them, else IPs can be spoofed
|
|
57
|
+
PROXY_FIX_X_FOR = 0
|
|
55
58
|
CORS_EXPOSE_HEADERS = ["X-Total-Count"]
|
|
56
59
|
STATIC_PATH = "static"
|
|
57
60
|
REQUEST_CACHE_CONFIG = {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"""Utility functions for celery."""
|
|
2
2
|
|
|
3
|
+
import logging
|
|
4
|
+
|
|
3
5
|
from celery import Task
|
|
4
6
|
from celery import current_app as current_celery_app
|
|
5
7
|
from werkzeug.exceptions import HTTPException
|
|
@@ -22,8 +24,31 @@ class TaskRejection(TaskError):
|
|
|
22
24
|
"""
|
|
23
25
|
|
|
24
26
|
|
|
27
|
+
class HideTaskResultFilter(logging.Filter):
|
|
28
|
+
"""Hide task return values in Celery's "Task ... succeeded" log records.
|
|
29
|
+
|
|
30
|
+
Results can contain private tree data, e.g. OCR text or AI chat answers.
|
|
31
|
+
Celery has no setting for this, but passes the log context as ``data`` in
|
|
32
|
+
``extra`` for custom handlers, so the value is replaced there too.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
def filter(self, record: logging.LogRecord) -> bool:
|
|
36
|
+
context = record.args
|
|
37
|
+
if isinstance(context, dict) and "return_value" in context:
|
|
38
|
+
context = {**context, "return_value": "<hidden>"}
|
|
39
|
+
record.args = context
|
|
40
|
+
if isinstance(getattr(record, "data", None), dict):
|
|
41
|
+
record.data = context
|
|
42
|
+
return True
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
_hide_task_result_filter = HideTaskResultFilter()
|
|
46
|
+
|
|
47
|
+
|
|
25
48
|
def create_celery(app):
|
|
26
49
|
"""App factory for celery."""
|
|
50
|
+
# no-op if already added, create_celery runs once per app
|
|
51
|
+
logging.getLogger("celery.app.trace").addFilter(_hide_task_result_filter)
|
|
27
52
|
celery = current_celery_app
|
|
28
53
|
celery.conf.name = app.import_name
|
|
29
54
|
celery.conf.update(app.config["CELERY_CONFIG"])
|
|
@@ -208,6 +208,7 @@ scripts/start_dev_container.sh
|
|
|
208
208
|
tests/__init__.py
|
|
209
209
|
tests/conftest.py
|
|
210
210
|
tests/test_access.py
|
|
211
|
+
tests/test_celery_logging.py
|
|
211
212
|
tests/test_check.py
|
|
212
213
|
tests/test_cli.py
|
|
213
214
|
tests/test_close_db.py
|
|
@@ -242,6 +243,7 @@ tests/test_postgres_driver.py
|
|
|
242
243
|
tests/test_privacy_canary.py
|
|
243
244
|
tests/test_private_proxy.py
|
|
244
245
|
tests/test_private_proxy_backlinks.py
|
|
246
|
+
tests/test_proxy_fix.py
|
|
245
247
|
tests/test_s3.py
|
|
246
248
|
tests/test_search_api_updates.py
|
|
247
249
|
tests/test_search_index.py
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Gramps Web API - A RESTful API for the Gramps genealogy program
|
|
3
|
+
#
|
|
4
|
+
# Copyright (C) 2026 David Straub
|
|
5
|
+
#
|
|
6
|
+
# This program is free software; you can redistribute it and/or modify
|
|
7
|
+
# it under the terms of the GNU Affero General Public License as published by
|
|
8
|
+
# the Free Software Foundation; either version 3 of the License, or
|
|
9
|
+
# (at your option) any later version.
|
|
10
|
+
#
|
|
11
|
+
# This program is distributed in the hope that it will be useful,
|
|
12
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
# GNU Affero General Public License for more details.
|
|
15
|
+
#
|
|
16
|
+
# You should have received a copy of the GNU Affero General Public License
|
|
17
|
+
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
18
|
+
#
|
|
19
|
+
|
|
20
|
+
"""Tests that Celery does not log task return values."""
|
|
21
|
+
|
|
22
|
+
import logging
|
|
23
|
+
|
|
24
|
+
from celery import shared_task
|
|
25
|
+
from celery.app.trace import build_tracer
|
|
26
|
+
|
|
27
|
+
from gramps_webapi.app import create_app
|
|
28
|
+
from gramps_webapi.const import ENV_CONFIG_FILE, TEST_AUTH_CONFIG
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@shared_task()
|
|
32
|
+
def _ocr_task():
|
|
33
|
+
return "secret OCR text"
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def test_task_result_not_logged(monkeypatch, caplog):
|
|
37
|
+
monkeypatch.setenv(ENV_CONFIG_FILE, TEST_AUTH_CONFIG)
|
|
38
|
+
create_app(config={"TESTING": True})
|
|
39
|
+
create_app(config={"TESTING": True})
|
|
40
|
+
trace_logger = logging.getLogger("celery.app.trace")
|
|
41
|
+
assert len(trace_logger.filters) == 1
|
|
42
|
+
with caplog.at_level(logging.INFO, logger="celery.app.trace"):
|
|
43
|
+
# the tracer checks the log level when it is built
|
|
44
|
+
tracer = build_tracer(
|
|
45
|
+
_ocr_task.name, _ocr_task, app=_ocr_task._get_app(), eager=True
|
|
46
|
+
)
|
|
47
|
+
retval = tracer("some-id", (), {}, {})
|
|
48
|
+
assert retval.retval == "secret OCR text"
|
|
49
|
+
records = [r for r in caplog.records if "succeeded" in r.getMessage()]
|
|
50
|
+
assert len(records) == 1
|
|
51
|
+
assert records[0].getMessage().endswith(": <hidden>")
|
|
52
|
+
assert records[0].data["return_value"] == "<hidden>"
|
|
53
|
+
assert "secret OCR text" not in caplog.text
|
|
@@ -116,6 +116,17 @@ class TestRequestCacheETag(unittest.TestCase):
|
|
|
116
116
|
self._get_etag(path, self.headers_user),
|
|
117
117
|
)
|
|
118
118
|
|
|
119
|
+
def test_error_not_cached(self):
|
|
120
|
+
"""An error response is not served from the cache once its cause is
|
|
121
|
+
gone, e.g. an addon filter rule that was installed after the error."""
|
|
122
|
+
rules = '{"rules":[{"name":"HasIdOf","values":["N0000"]}]}'
|
|
123
|
+
path = f"/api/notes/?rules={rules}"
|
|
124
|
+
with patch("gramps_webapi.api.resources.filters.get_rule_map", return_value={}):
|
|
125
|
+
rv = self.client.get(path, headers=self.headers_admin)
|
|
126
|
+
self.assertEqual(rv.status_code, 404)
|
|
127
|
+
rv = self.client.get(path, headers=self.headers_admin)
|
|
128
|
+
self.assertEqual(rv.status_code, 200)
|
|
129
|
+
|
|
119
130
|
def test_etag_without_timestamp(self):
|
|
120
131
|
"""Without a last change timestamp, the ETag is the hash of the body."""
|
|
121
132
|
path = f"/api/notes/{self.handle}"
|