From 59a430938bfeea654f81482ce4acc8c13f949219 Mon Sep 17 00:00:00 2001 From: luxick Date: Tue, 17 Mar 2026 12:41:18 +0100 Subject: [PATCH] Fix API key passing --- action.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/action.php b/action.php index 92a20c6..1092ef0 100644 --- a/action.php +++ b/action.php @@ -33,6 +33,12 @@ class action_plugin_luxtools extends ActionPlugin $this, "addScripts", ); + $controller->register_hook( + "DOKUWIKI_STARTED", + "AFTER", + $this, + "provideJsInfo", + ); $controller->register_hook( "RENDERER_CONTENT_POSTPROCESS", "BEFORE", @@ -132,8 +138,20 @@ class action_plugin_luxtools extends ActionPlugin "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. global $JSINFO; $JSINFO['luxtools_omdb_apikey'] = (string)$this->getConf('omdb_apikey');