mirror of
https://github.com/sbrl/Pepperminty-Wiki.git
synced 2024-11-26 05:32:59 +00:00
Add setting to disable external renderer support
This commit is contained in:
parent
9d2be94f64
commit
fe4071fe05
3 changed files with 9 additions and 1 deletions
|
@ -337,7 +337,7 @@
|
||||||
"version": "0.10",
|
"version": "0.10",
|
||||||
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
"author": "Emanuil Rusev & Starbeamrainbowlabs",
|
||||||
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
|
"description": "An upgraded (now default!) parser based on Emanuil Rusev's Parsedown Extra PHP library (https:\/\/github.com\/erusev\/parsedown-extra), which is licensed MIT. Please be careful, as this module adds some weight to your installation.",
|
||||||
"lastupdate": 1571604819,
|
"lastupdate": 1571605152,
|
||||||
"optional": false,
|
"optional": false,
|
||||||
"extra_data": {
|
"extra_data": {
|
||||||
"Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php",
|
"Parsedown.php": "https:\/\/raw.githubusercontent.com\/erusev\/parsedown\/fe7a50eceb4a3c867cc9fa9c0aa906b1067d1955\/Parsedown.php",
|
||||||
|
|
|
@ -55,6 +55,13 @@ register_module([
|
||||||
add_action("parsedown-render-ext", function() {
|
add_action("parsedown-render-ext", function() {
|
||||||
global $settings, $env, $paths;
|
global $settings, $env, $paths;
|
||||||
|
|
||||||
|
if(!$settings->parser_ext_renderers_enabled) {
|
||||||
|
http_response_code(403);
|
||||||
|
header("content-type: image/png");
|
||||||
|
imagepng(errorimage("Error: External diagram renderer support\nhas been disabled on $settings->sitename.\nTry contacting {$settings->admindetails_name}, $settings->sitename's administrator."));
|
||||||
|
exit();
|
||||||
|
}
|
||||||
|
|
||||||
if(!isset($_GET["source"])) {
|
if(!isset($_GET["source"])) {
|
||||||
http_response_code(400);
|
http_response_code(400);
|
||||||
header("content-type: image/png");
|
header("content-type: image/png");
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"parser": { "type": "text", "description": "The parser to use when rendering pages. Defaults to an extended version of parsedown (http://parsedown.org/)", "default": "parsedown" },
|
"parser": { "type": "text", "description": "The parser to use when rendering pages. Defaults to an extended version of parsedown (http://parsedown.org/)", "default": "parsedown" },
|
||||||
"parser_cache": { "type": "checkbox", "description": "Whether parser output should be cached to speed things up. The cache directory is <code>._cache</code> in the data directory - delete it if you experience issues (unlikely).", "default": true },
|
"parser_cache": { "type": "checkbox", "description": "Whether parser output should be cached to speed things up. The cache directory is <code>._cache</code> in the data directory - delete it if you experience issues (unlikely).", "default": true },
|
||||||
"parser_cache_min_size": { "type": "number", "description": "The minimum size a source string must be (in bytes) before it's considered eligible for caching.", "default": 1024 },
|
"parser_cache_min_size": { "type": "number", "description": "The minimum size a source string must be (in bytes) before it's considered eligible for caching.", "default": 1024 },
|
||||||
|
"parser_ext_renderers_enabled": { "type": "checkbox", "description": "Whether to enable external diagram renderer support, which is part of the parsedown parser. See the <code>parser_ext_renderers</code> setting below for more information.", "default": true },
|
||||||
"parser_ext_renderers": { "type": "parserext", "description": "Used by the parsedown parser as an object mapping fenced code block languages to their respective external renderers. Should be in the form <code>language_code</code> → <code>external renderer definition</code>. See the default for examples on how to define an external renderer.", "default": {
|
"parser_ext_renderers": { "type": "parserext", "description": "Used by the parsedown parser as an object mapping fenced code block languages to their respective external renderers. Should be in the form <code>language_code</code> → <code>external renderer definition</code>. See the default for examples on how to define an external renderer.", "default": {
|
||||||
"nomnoml": {
|
"nomnoml": {
|
||||||
"name": "nomnoml",
|
"name": "nomnoml",
|
||||||
|
|
Loading…
Reference in a new issue