Files
minisrv/zefie_wtvp_minisrv/includes/ServiceVault/wtv-tricks/add-to-scrapbook.js
2025-08-12 19:03:04 -04:00

16 lines
588 B
JavaScript

const minisrv_service_file = true;
request_is_async = true;
function handleError(reason) {
const errpage = wtvshared.doErrorPage(400, reason);
sendToClient(socket, errpage[0], errpage[1]);
}
if (!request_headers.query.url && !request_headers.query.mediaPath) {
handleError('No URL provided');
} else {
const mediaURL = request_headers.query.url || request_headers.query.mediaPath;
const targetURL = 'wtv-author:/scrapbook-add?mediaPath=' + encodeURIComponent(mediaURL);
sendToClient(socket, {'Status': 302, 'Location': targetURL, 'wtv-visit': targetURL}, '');
}