This commit is contained in:
@@ -456,7 +456,6 @@ class Output
|
||||
|
||||
$syntax = plugin_load('syntax', 'luxtools');
|
||||
$serviceUrl = $syntax ? trim((string)$syntax->getConf('open_service_url')) : '';
|
||||
$serviceToken = $syntax ? trim((string)$syntax->getConf('open_service_token')) : '';
|
||||
|
||||
// Prepare a DokuWiki-style link.
|
||||
// Use the same icon mechanism as normal media links (via $link['class']).
|
||||
@@ -479,7 +478,6 @@ class Output
|
||||
$link['more'] .= ' data-path="' . hsc($path) . '"';
|
||||
if ($conf['relnofollow']) $link['more'] .= ' rel="nofollow"';
|
||||
if ($serviceUrl !== '') $link['more'] .= ' data-service-url="' . hsc($serviceUrl) . '"';
|
||||
if ($serviceToken !== '') $link['more'] .= ' data-service-token="' . hsc($serviceToken) . '"';
|
||||
$renderer->doc .= $renderer->_formatLink($link);
|
||||
}
|
||||
|
||||
|
||||
4
README
4
README
@@ -15,6 +15,10 @@ Syntax:
|
||||
Please refer to http://www.dokuwiki.org/extensions for additional info
|
||||
on how to install extensions in DokuWiki.
|
||||
|
||||
Development deploy helpers:
|
||||
- Linux/macOS: ./deploy.sh
|
||||
- Windows (PowerShell + WSL): .\deploy.ps1
|
||||
|
||||
----
|
||||
Copyright (C) Gina Häußge, Dokufreaks <gina@foosel.net, freaks@dokuwiki.org>
|
||||
|
||||
|
||||
@@ -18,4 +18,3 @@ $conf['gallery_thumb_scale'] = 1;
|
||||
|
||||
// Local client service used by {{open>...}}.
|
||||
$conf['open_service_url'] = 'http://127.0.0.1:8765';
|
||||
$conf['open_service_token'] = '';
|
||||
|
||||
@@ -18,4 +18,3 @@ $meta['thumb_placeholder'] = array('string');
|
||||
$meta['gallery_thumb_scale'] = array('string');
|
||||
|
||||
$meta['open_service_url'] = array('string');
|
||||
$meta['open_service_token'] = array('string');
|
||||
|
||||
@@ -7,4 +7,3 @@ $lang['thumb_placeholder'] = 'MediaManager-ID für den Platzhalter der Galerie-T
|
||||
$lang['gallery_thumb_scale'] = 'Skalierungsfaktor für Galerie-Thumbnails. 2 erzeugt schärfere Thumbnails auf HiDPI-Displays (Anzeige bleibt 150×150).';
|
||||
|
||||
$lang['open_service_url'] = 'URL des lokalen Client-Dienstes für {{open>...}} (z.B. http://127.0.0.1:8765).';
|
||||
$lang['open_service_token'] = 'Token für den lokalen Client-Dienst (X-Luxtools-Token).';
|
||||
|
||||
@@ -9,4 +9,3 @@ $lang['thumb_placeholder'] = 'MediaManager ID for the gallery thumbnail placehol
|
||||
$lang['gallery_thumb_scale'] = 'Gallery thumbnail scale factor. Use 2 for sharper thumbnails on HiDPI screens (still displayed as 150×150).';
|
||||
|
||||
$lang['open_service_url'] = 'Local client service URL for the {{open>...}} button (e.g. http://127.0.0.1:8765).';
|
||||
$lang['open_service_token'] = 'Token sent to the local client service (X-Luxtools-Token).';
|
||||
|
||||
10
script.js
10
script.js
@@ -51,18 +51,10 @@
|
||||
return url.replace(/\/+$/, '');
|
||||
}
|
||||
|
||||
function getServiceToken(el) {
|
||||
var token = el.getAttribute('data-service-token') || '';
|
||||
return (token || '').trim();
|
||||
}
|
||||
|
||||
function pingOpenViaImage(el, rawPath) {
|
||||
var baseUrl = getServiceUrl(el);
|
||||
if (!baseUrl) return;
|
||||
|
||||
var token = getServiceToken(el);
|
||||
var url = baseUrl + '/open?path=' + encodeURIComponent(rawPath);
|
||||
if (token) url += '&token=' + encodeURIComponent(token);
|
||||
|
||||
// Fire-and-forget without CORS.
|
||||
try {
|
||||
@@ -80,8 +72,6 @@
|
||||
var headers = {
|
||||
'Content-Type': 'application/json'
|
||||
};
|
||||
var token = getServiceToken(el);
|
||||
if (token) headers['X-Luxtools-Token'] = token;
|
||||
|
||||
return window.fetch(baseUrl + '/open', {
|
||||
method: 'POST',
|
||||
|
||||
@@ -74,16 +74,12 @@ class syntax_plugin_luxtools_open extends SyntaxPlugin
|
||||
}
|
||||
|
||||
$serviceUrl = trim((string)$this->getConf('open_service_url'));
|
||||
$serviceToken = trim((string)$this->getConf('open_service_token'));
|
||||
|
||||
$attrs = ' type="button" class="luxtools-open"'
|
||||
. ' data-path="' . hsc($path) . '"';
|
||||
if ($serviceUrl !== '') {
|
||||
$attrs .= ' data-service-url="' . hsc($serviceUrl) . '"';
|
||||
}
|
||||
if ($serviceToken !== '') {
|
||||
$attrs .= ' data-service-token="' . hsc($serviceToken) . '"';
|
||||
}
|
||||
|
||||
$renderer->doc .= '<button' . $attrs . '>' . hsc($caption) . '</button>';
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user