Skip to content

Commit

Permalink
doc-diff object returned
Browse files Browse the repository at this point in the history
  • Loading branch information
humitos committed Mar 16, 2023
1 parent 53366aa commit 0f89186
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions readthedocs/proxito/views/hosting.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

from readthedocs.builds.constants import EXTERNAL
from readthedocs.core.mixins import CDNCacheControlMixin
from readthedocs.core.resolver import resolver
from readthedocs.core.unresolver import unresolver

log = structlog.get_logger(__name__) # noqa
Expand All @@ -28,8 +29,9 @@ def get(self, request):
build = version.builds.last()

# TODO: define how it will be the exact JSON object returned here
# NOTE: we could use the APIv3 serializers for some of these objects if we want to keep consistency.
# However, those may require some extra db calls that we probably want to avoid.
# NOTE: we could use the APIv3 serializers for some of these objects
# if we want to keep consistency. However, those may require some
# extra db calls that we probably want to avoid.
data = {
"comment": (
"THIS RESPONSE IS IN ALPHA FOR TEST PURPOSES ONLY"
Expand Down Expand Up @@ -73,7 +75,23 @@ def get(self, request):
)
),
},
"doc_diff": True,
"doc_diff": {
"enabled": True,
# "http://test-builds-local.devthedocs.org/en/latest/index.html"
"base_url": f"""{resolver.resolve(
project=project,
version_slug=project.get_default_version(),
language=project.language,
filename=unresolved_url.filename,
)}""",
"root_selector": "[role=main]",
"inject_styles": True,
# NOTE: `base_host` and `base_page` are not required, since
# we are constructing the `base_url` in the backend instead
# of the frontend, as the doc-diff extension does.
"base_host": "",
"base_page": "",
},
"flyout": {
"translations": [],
"versions": [
Expand Down

0 comments on commit 0f89186

Please sign in to comment.