Skip to content

Commit 0f89186

Browse files
committed
doc-diff object returned
1 parent 53366aa commit 0f89186

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

readthedocs/proxito/views/hosting.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from readthedocs.builds.constants import EXTERNAL
99
from readthedocs.core.mixins import CDNCacheControlMixin
10+
from readthedocs.core.resolver import resolver
1011
from readthedocs.core.unresolver import unresolver
1112

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

3031
# TODO: define how it will be the exact JSON object returned here
31-
# NOTE: we could use the APIv3 serializers for some of these objects if we want to keep consistency.
32-
# However, those may require some extra db calls that we probably want to avoid.
32+
# NOTE: we could use the APIv3 serializers for some of these objects
33+
# if we want to keep consistency. However, those may require some
34+
# extra db calls that we probably want to avoid.
3335
data = {
3436
"comment": (
3537
"THIS RESPONSE IS IN ALPHA FOR TEST PURPOSES ONLY"
@@ -73,7 +75,23 @@ def get(self, request):
7375
)
7476
),
7577
},
76-
"doc_diff": True,
78+
"doc_diff": {
79+
"enabled": True,
80+
# "http://test-builds-local.devthedocs.org/en/latest/index.html"
81+
"base_url": f"""{resolver.resolve(
82+
project=project,
83+
version_slug=project.get_default_version(),
84+
language=project.language,
85+
filename=unresolved_url.filename,
86+
)}""",
87+
"root_selector": "[role=main]",
88+
"inject_styles": True,
89+
# NOTE: `base_host` and `base_page` are not required, since
90+
# we are constructing the `base_url` in the backend instead
91+
# of the frontend, as the doc-diff extension does.
92+
"base_host": "",
93+
"base_page": "",
94+
},
7795
"flyout": {
7896
"translations": [],
7997
"versions": [

0 commit comments

Comments
 (0)