Fossil SCM

/wikiedit preview AJAX route tentatively no longer requires WrWiki access, as being discussed over at [https://pikchr.org/home/forumpost/195000ac2f | pikchr:/forumpost/195000ac2f].

stephan 2020-09-13 01:15 trunk
Commit 18dee26eee8da7156c3510ca97aaa4c637741a14dd53b2860c9214d4ab8ecc39
1 file changed +2 -13
+2 -13
--- src/wiki.c
+++ src/wiki.c
@@ -935,22 +935,17 @@
935935
/*
936936
** Ajax route handler for /wikiajax/preview.
937937
**
938938
** URL params:
939939
**
940
-** page = wiki page name. This is only needed for authorization
941
-** checking.
942940
** mimetype = the wiki page mimetype (determines rendering style)
943941
** content = the wiki page content
944942
*/
945943
static void wiki_ajax_route_preview(void){
946
- const char * zPageName = P("page");
947944
const char * zContent = P("content");
948945
949
- if(!wiki_ajax_can_write(zPageName, 0)){
950
- return;
951
- }else if( zContent==0 ){
946
+ if( zContent==0 ){
952947
ajax_route_error(400,"Missing content to preview.");
953948
return;
954949
}else{
955950
Blob content = empty_blob;
956951
const char * zMimetype = PD("mimetype","text/x-fossil-wiki");
@@ -1045,17 +1040,11 @@
10451040
const AjaxRoute routes[] = {
10461041
/* Keep these sorted by zName (for bsearch()) */
10471042
{"diff", wiki_ajax_route_diff, 1, 1},
10481043
{"fetch", wiki_ajax_route_fetch, 0, 0},
10491044
{"list", wiki_ajax_route_list, 0, 0},
1050
- {"preview", wiki_ajax_route_preview, 0, 1}
1051
- /* preview access mode: whether or not wiki-write mode is needed
1052
- really depends on multiple factors. e.g. the sandbox page does
1053
- not normally require more than anonymous access. We set its
1054
- write-mode to false and do those checks manually in that route's
1055
- handler.
1056
- */,
1045
+ {"preview", wiki_ajax_route_preview, 0, 1},
10571046
{"save", wiki_ajax_route_save, 1, 1}
10581047
};
10591048
10601049
if(zName==0 || zName[0]==0){
10611050
ajax_route_error(400,"Missing required [route] 'name' parameter.");
10621051
--- src/wiki.c
+++ src/wiki.c
@@ -935,22 +935,17 @@
935 /*
936 ** Ajax route handler for /wikiajax/preview.
937 **
938 ** URL params:
939 **
940 ** page = wiki page name. This is only needed for authorization
941 ** checking.
942 ** mimetype = the wiki page mimetype (determines rendering style)
943 ** content = the wiki page content
944 */
945 static void wiki_ajax_route_preview(void){
946 const char * zPageName = P("page");
947 const char * zContent = P("content");
948
949 if(!wiki_ajax_can_write(zPageName, 0)){
950 return;
951 }else if( zContent==0 ){
952 ajax_route_error(400,"Missing content to preview.");
953 return;
954 }else{
955 Blob content = empty_blob;
956 const char * zMimetype = PD("mimetype","text/x-fossil-wiki");
@@ -1045,17 +1040,11 @@
1045 const AjaxRoute routes[] = {
1046 /* Keep these sorted by zName (for bsearch()) */
1047 {"diff", wiki_ajax_route_diff, 1, 1},
1048 {"fetch", wiki_ajax_route_fetch, 0, 0},
1049 {"list", wiki_ajax_route_list, 0, 0},
1050 {"preview", wiki_ajax_route_preview, 0, 1}
1051 /* preview access mode: whether or not wiki-write mode is needed
1052 really depends on multiple factors. e.g. the sandbox page does
1053 not normally require more than anonymous access. We set its
1054 write-mode to false and do those checks manually in that route's
1055 handler.
1056 */,
1057 {"save", wiki_ajax_route_save, 1, 1}
1058 };
1059
1060 if(zName==0 || zName[0]==0){
1061 ajax_route_error(400,"Missing required [route] 'name' parameter.");
1062
--- src/wiki.c
+++ src/wiki.c
@@ -935,22 +935,17 @@
935 /*
936 ** Ajax route handler for /wikiajax/preview.
937 **
938 ** URL params:
939 **
 
 
940 ** mimetype = the wiki page mimetype (determines rendering style)
941 ** content = the wiki page content
942 */
943 static void wiki_ajax_route_preview(void){
 
944 const char * zContent = P("content");
945
946 if( zContent==0 ){
 
 
947 ajax_route_error(400,"Missing content to preview.");
948 return;
949 }else{
950 Blob content = empty_blob;
951 const char * zMimetype = PD("mimetype","text/x-fossil-wiki");
@@ -1045,17 +1040,11 @@
1040 const AjaxRoute routes[] = {
1041 /* Keep these sorted by zName (for bsearch()) */
1042 {"diff", wiki_ajax_route_diff, 1, 1},
1043 {"fetch", wiki_ajax_route_fetch, 0, 0},
1044 {"list", wiki_ajax_route_list, 0, 0},
1045 {"preview", wiki_ajax_route_preview, 0, 1},
 
 
 
 
 
 
1046 {"save", wiki_ajax_route_save, 1, 1}
1047 };
1048
1049 if(zName==0 || zName[0]==0){
1050 ajax_route_error(400,"Missing required [route] 'name' parameter.");
1051

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button