1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
|
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
|
-
-
-
+
+
+
+
+
-
+
+
+
+
-
+
|
** array for each line of text.
**
** **Warning:** This is an internal-use-only interface that is subject to
** change at any moment. External application should not use this interface
** since the application will break when this interface changes, and this
** interface will undoubtedly change.
**
** This page is intended to be used in an XHR from javascript on a diff
** page, to return unseen context to fill in additional context when the
** user clicks on the appropriate button.
** This page is intended to be used in an XHR from javascript on a
** diff page, to return unseen context to fill in additional context
** when the user clicks on the appropriate button. The response is
** always in JSON form and errors are reported as documented for
** ajax_route_error().
*/
void jtext_page(void){
int rid = 0;
const char *zName = PD("name", "");
int iFrom = atoi(PD("from","0"));
int iTo = atoi(PD("to","0"));
int ln;
int go = 1;
const char *zSep;
Blob content;
Blob line;
Blob *pOut;
login_check_credentials();
if( !g.perm.Read ){ login_needed(g.anon.Read); return; }
if( !g.perm.Read ){
ajax_route_error(403, "Access requires Read permissions.");
return;
}
#if 0
/* Re-enable this block once this code is integrated somewhere into
the UI. */
rid = db_int(0, "SELECT rid FROM blob WHERE uuid=%Q", zName);
if( rid==0 ){
ajax_route_error(404, "Unknown artifact: %h", zName);
return;
}
#else
/* This impl is only to simplify "manual" testing via the JS
console. */
rid = symbolic_name_to_rid(zName, "*");
if( rid==0 ){
ajax_route_error(404, "Unknown artifact: %h", zName);
return;
}else if( rid<0 ){
ajax_route_error(404, "Ambiguous artifact name: %h", zName);
ajax_route_error(418, "Ambiguous artifact name: %h", zName);
return;
}
#endif
if( iFrom<1 || iTo<iFrom ){
ajax_route_error(500, "Invalid line range from=%d, to=%d.",
iFrom, iTo);
return;
|