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].
Commit
18dee26eee8da7156c3510ca97aaa4c637741a14dd53b2860c9214d4ab8ecc39
Parent
a34e88e007cab1d…
1 file changed
+2
-13
+2
-13
| --- src/wiki.c | ||
| +++ src/wiki.c | ||
| @@ -935,22 +935,17 @@ | ||
| 935 | 935 | /* |
| 936 | 936 | ** Ajax route handler for /wikiajax/preview. |
| 937 | 937 | ** |
| 938 | 938 | ** URL params: |
| 939 | 939 | ** |
| 940 | -** page = wiki page name. This is only needed for authorization | |
| 941 | -** checking. | |
| 942 | 940 | ** mimetype = the wiki page mimetype (determines rendering style) |
| 943 | 941 | ** content = the wiki page content |
| 944 | 942 | */ |
| 945 | 943 | static void wiki_ajax_route_preview(void){ |
| 946 | - const char * zPageName = P("page"); | |
| 947 | 944 | const char * zContent = P("content"); |
| 948 | 945 | |
| 949 | - if(!wiki_ajax_can_write(zPageName, 0)){ | |
| 950 | - return; | |
| 951 | - }else if( zContent==0 ){ | |
| 946 | + if( zContent==0 ){ | |
| 952 | 947 | ajax_route_error(400,"Missing content to preview."); |
| 953 | 948 | return; |
| 954 | 949 | }else{ |
| 955 | 950 | Blob content = empty_blob; |
| 956 | 951 | const char * zMimetype = PD("mimetype","text/x-fossil-wiki"); |
| @@ -1045,17 +1040,11 @@ | ||
| 1045 | 1040 | const AjaxRoute routes[] = { |
| 1046 | 1041 | /* Keep these sorted by zName (for bsearch()) */ |
| 1047 | 1042 | {"diff", wiki_ajax_route_diff, 1, 1}, |
| 1048 | 1043 | {"fetch", wiki_ajax_route_fetch, 0, 0}, |
| 1049 | 1044 | {"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}, | |
| 1057 | 1046 | {"save", wiki_ajax_route_save, 1, 1} |
| 1058 | 1047 | }; |
| 1059 | 1048 | |
| 1060 | 1049 | if(zName==0 || zName[0]==0){ |
| 1061 | 1050 | ajax_route_error(400,"Missing required [route] 'name' parameter."); |
| 1062 | 1051 |
| --- 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 |