7
7
8
8
from readthedocs .builds .constants import EXTERNAL
9
9
from readthedocs .core .mixins import CDNCacheControlMixin
10
+ from readthedocs .core .resolver import resolver
10
11
from readthedocs .core .unresolver import unresolver
11
12
12
13
log = structlog .get_logger (__name__ ) # noqa
@@ -28,8 +29,9 @@ def get(self, request):
28
29
build = version .builds .last ()
29
30
30
31
# 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.
33
35
data = {
34
36
"comment" : (
35
37
"THIS RESPONSE IS IN ALPHA FOR TEST PURPOSES ONLY"
@@ -73,7 +75,23 @@ def get(self, request):
73
75
)
74
76
),
75
77
},
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
+ },
77
95
"flyout" : {
78
96
"translations" : [],
79
97
"versions" : [
0 commit comments