Fossil

Check-in [18dee26e]
Login

Check-in [18dee26e]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:/wikiedit preview AJAX route tentatively no longer requires WrWiki access, as being discussed over at pikchr:/forumpost/195000ac2f.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 18dee26eee8da7156c3510ca97aaa4c637741a14dd53b2860c9214d4ab8ecc39
User & Date: stephan 2020-09-13 01:15:51
Context
2020-09-13
11:31
Update pikchr.c to a version that avoids using the " " entity. ... (check-in: 931f782f user: drh tags: trunk)
01:15
/wikiedit preview AJAX route tentatively no longer requires WrWiki access, as being discussed over at pikchr:/forumpost/195000ac2f. ... (check-in: 18dee26e user: stephan tags: trunk)
00:50
pikchrshow: added 'p' as alias for 'content' URL parameter in the interest of simplifying linking directly to small scripts from the pikchr user manual. ... (check-in: a34e88e0 user: stephan tags: trunk)
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/wiki.c.

933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
}

/*
** Ajax route handler for /wikiajax/preview.
**
** URL params:
**
**  page = wiki page name. This is only needed for authorization
**  checking.
**  mimetype = the wiki page mimetype (determines rendering style)
**  content = the wiki page content
*/
static void wiki_ajax_route_preview(void){
  const char * zPageName = P("page");
  const char * zContent = P("content");

  if(!wiki_ajax_can_write(zPageName, 0)){
    return;
  }else if( zContent==0 ){
    ajax_route_error(400,"Missing content to preview.");
    return;
  }else{
    Blob content = empty_blob;
    const char * zMimetype = PD("mimetype","text/x-fossil-wiki");

    blob_init(&content, zContent, -1);







<
<




<


<
<
|







933
934
935
936
937
938
939


940
941
942
943

944
945


946
947
948
949
950
951
952
953
}

/*
** Ajax route handler for /wikiajax/preview.
**
** URL params:
**


**  mimetype = the wiki page mimetype (determines rendering style)
**  content = the wiki page content
*/
static void wiki_ajax_route_preview(void){

  const char * zContent = P("content");



  if( zContent==0 ){
    ajax_route_error(400,"Missing content to preview.");
    return;
  }else{
    Blob content = empty_blob;
    const char * zMimetype = PD("mimetype","text/x-fossil-wiki");

    blob_init(&content, zContent, -1);
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
  AjaxRoute routeName = {0,0,0,0};
  const AjaxRoute * pRoute = 0;
  const AjaxRoute routes[] = {
  /* Keep these sorted by zName (for bsearch()) */
  {"diff", wiki_ajax_route_diff, 1, 1},
  {"fetch", wiki_ajax_route_fetch, 0, 0},
  {"list", wiki_ajax_route_list, 0, 0},
  {"preview", wiki_ajax_route_preview, 0, 1}
  /* preview access mode: whether or not wiki-write mode is needed
     really depends on multiple factors. e.g. the sandbox page does
     not normally require more than anonymous access. We set its
     write-mode to false and do those checks manually in that route's
     handler.
  */,
  {"save", wiki_ajax_route_save, 1, 1}
  };

  if(zName==0 || zName[0]==0){
    ajax_route_error(400,"Missing required [route] 'name' parameter.");
    return;
  }







|
<
<
<
<
<
<







1038
1039
1040
1041
1042
1043
1044
1045






1046
1047
1048
1049
1050
1051
1052
  AjaxRoute routeName = {0,0,0,0};
  const AjaxRoute * pRoute = 0;
  const AjaxRoute routes[] = {
  /* Keep these sorted by zName (for bsearch()) */
  {"diff", wiki_ajax_route_diff, 1, 1},
  {"fetch", wiki_ajax_route_fetch, 0, 0},
  {"list", wiki_ajax_route_list, 0, 0},
  {"preview", wiki_ajax_route_preview, 0, 1},






  {"save", wiki_ajax_route_save, 1, 1}
  };

  if(zName==0 || zName[0]==0){
    ajax_route_error(400,"Missing required [route] 'name' parameter.");
    return;
  }