Fix API key passing

This commit is contained in:
2026-03-17 12:41:18 +01:00
parent 211418c6c4
commit 59a430938b

View File

@@ -33,6 +33,12 @@ class action_plugin_luxtools extends ActionPlugin
$this, $this,
"addScripts", "addScripts",
); );
$controller->register_hook(
"DOKUWIKI_STARTED",
"AFTER",
$this,
"provideJsInfo",
);
$controller->register_hook( $controller->register_hook(
"RENDERER_CONTENT_POSTPROCESS", "RENDERER_CONTENT_POSTPROCESS",
"BEFORE", "BEFORE",
@@ -132,8 +138,20 @@ class action_plugin_luxtools extends ActionPlugin
"src" => $base . $script, "src" => $base . $script,
]; ];
} }
}
// Pass OMDb API key to client-side JavaScript. /**
* Pass plugin data to client-side JavaScript via JSINFO.
*
* Must run before TPL_METAHEADER_OUTPUT because JSINFO is serialized
* during tpl_metaheaders() before that event fires.
*
* @param Event $event
* @param mixed $param
* @return void
*/
public function provideJsInfo(Event $event, $param)
{
// Intentional: the key is exposed to the browser for direct OMDb lookups. // Intentional: the key is exposed to the browser for direct OMDb lookups.
global $JSINFO; global $JSINFO;
$JSINFO['luxtools_omdb_apikey'] = (string)$this->getConf('omdb_apikey'); $JSINFO['luxtools_omdb_apikey'] = (string)$this->getConf('omdb_apikey');