Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions invenio.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,7 @@ RDM_REQUEST_RECORD_DELETION_CHECKLIST = [
{
"label": _("I want to get a Zenodo DOI for this record"),
"message": _(
'<a href="/support">Contact the Zenodo support team</a> '
"about this record."
'<a href="/support">Contact the Zenodo support team</a> about this record.'
),
},
]
Expand Down Expand Up @@ -1001,8 +1000,10 @@ RATELIMIT_PER_ENDPOINT = {
"invenio_app_rdm.frontpage_view_function": "10 per second",
# Records
"invenio_app_rdm_records.record_thumbnail": "20 per second",
"records.search": "30 per minute",
"community-records.search": "30 per minute",
# OAI-PMH
"invenio_oaiserver.response": "120 per minute",
"invenio_oaiserver.response": "30 per minute",
# 'zenodo_redirector.contact': '10 per second',
# TODO most similar view found was: invenio_redirector.redirect_contact
}
Expand All @@ -1013,7 +1014,7 @@ RATELIMIT_GUEST_USER = "8000 per hour;133 per minute"
"""Rate limits for guest users."""

OAISERVER_RESUMPTION_TOKEN_EXPIRE_TIME = 1 * 120
OAISERVER_PAGE_SIZE = 100
OAISERVER_PAGE_SIZE = 50
OAISERVER_XSL_URL = "/static/oai2.xsl"

RDM_DATACITE_FUNDER_IDENTIFIERS_PRIORITY = ("doi", "ror", "grid", "isni", "gnd")
Expand Down Expand Up @@ -1083,6 +1084,17 @@ PREVIEWER_PREFERENCE = [
]
"""Preferred previewers."""

PREVIEWER_PDF_JS_DOCUMENT_INIT_PARAMS = {
"disableStream": True,
"disableRange": True,
"disableAutoFetch": True,
}
"""PDF.js initialization parameters for document previewer.

We disable range requests and streaming, to avoid overloading the server with
multiple requests per PDF preview.
"""

PREVIEWER_MAX_IMAGE_SIZE_BYTES = 15 * (10**6) # 15 MB
"""Maximum file size in bytes for image files."""

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[project]
name = "zenodo-rdm-app"
version = "21.1.6"
version = "21.1.7"
authors = [
{ name = "CERN" }
]
license = "GPL-3.0"
requires-python = ">=3.9"
dependencies = [
"invenio-app-rdm[opensearch2]~=14.0.0b1.dev2",
"invenio-app-rdm[opensearch2]==14.0.0b1.dev6",
"zenodo-legacy",
"zenodo-rdm",
# "commonmeta-py==0.8.6",
Expand All @@ -31,7 +31,6 @@ zenodo-legacy = { workspace = true }
invenio-swh = { git = "https://github.com/inveniosoftware/invenio-swh", rev = "v0.13.4" }
# User profile fixes
invenio-records-resources = { git = "https://github.com/inveniosoftware/invenio-records-resources", branch = "fix-read-many" }
invenio-previewer = { git = "https://github.com/inveniosoftware/invenio-previewer", branch = "pdfjs-disable-range-stream" }

[tool.uv.workspace]
members = [
Expand Down
11 changes: 10 additions & 1 deletion site/zenodo_rdm/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

from functools import partial

from flask import request
from flask_login import current_user
from invenio_rdm_records.resources.config import RDMSearchRequestArgsSchema
from invenio_rdm_records.services.config import RDMSearchOptions
from invenio_records_resources.services.records.params.base import ParamInterpreter
Expand Down Expand Up @@ -49,7 +51,7 @@ def apply(self, identity, search, params):
try:
community = Community.pid.resolve(slug) # Ensure community's existence
community_ids.append(community.id)
except:
except Exception:
# we show only results from communities that resolve
pass

Expand Down Expand Up @@ -99,6 +101,13 @@ class ZenodoArgsSchema(RDMSearchRequestArgsSchema):
type = fields.String()
subtype = fields.String()

@property
def max_page_size(self):
"""Max page size depending on user authentication."""
if request and current_user.is_authenticated:
return 200
return 100

@pre_load
def load_all_versions(self, data, **kwargs):
"""Load legacy `all_versions` param and feed the new `allversions` one."""
Expand Down
34 changes: 19 additions & 15 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.