@fabiofiorita/porcelain 0.59.1 → 0.59.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
package/main/daemon/server.js
CHANGED
|
@@ -14772,7 +14772,7 @@ function daemonIdentity(host = process.env.PORCELAIN_DAEMON_HOST?.trim() || (0,
|
|
|
14772
14772
|
|
|
14773
14773
|
// ../daemon/src/net/daemon-version.ts
|
|
14774
14774
|
function daemonVersion() {
|
|
14775
|
-
return "0.59.
|
|
14775
|
+
return "0.59.2";
|
|
14776
14776
|
}
|
|
14777
14777
|
|
|
14778
14778
|
// ../daemon/src/daemon-composition/daemon-operations.ts
|
|
@@ -15049,15 +15049,20 @@ function writePlainText2(res, status, body) {
|
|
|
15049
15049
|
res.end(body);
|
|
15050
15050
|
}
|
|
15051
15051
|
var VIEWPORT_META = '<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover">';
|
|
15052
|
+
var FILE_PREVIEW_SELECTION_BRIDGE = `<script>(function(){
|
|
15053
|
+
function send(){var text=String(getSelection&&getSelection()||'').trim();if(!text)return;parent.postMessage({source:'porcelain-file-preview',type:'selection',text:text.slice(0,2000)},'*')}
|
|
15054
|
+
document.addEventListener('mouseup',send,true);document.addEventListener('contextmenu',send,true)
|
|
15055
|
+
})()</script>`;
|
|
15052
15056
|
function responsivePreviewDocument(html) {
|
|
15053
|
-
|
|
15057
|
+
const withBridge = /<\/body\s*>/i.test(html) ? html.replace(/<\/body\s*>/i, `${FILE_PREVIEW_SELECTION_BRIDGE}</body>`) : html + FILE_PREVIEW_SELECTION_BRIDGE;
|
|
15058
|
+
if (/<meta\b[^>]*\bname\s*=\s*["']viewport["']/i.test(withBridge)) return withBridge;
|
|
15054
15059
|
const head = /<head\b[^>]*>/i;
|
|
15055
|
-
if (head.test(
|
|
15060
|
+
if (head.test(withBridge)) return withBridge.replace(head, (tag) => tag + VIEWPORT_META);
|
|
15056
15061
|
const htmlTag = /<html\b[^>]*>/i;
|
|
15057
|
-
if (htmlTag.test(
|
|
15058
|
-
return
|
|
15062
|
+
if (htmlTag.test(withBridge)) {
|
|
15063
|
+
return withBridge.replace(htmlTag, (tag) => `${tag}<head>${VIEWPORT_META}</head>`);
|
|
15059
15064
|
}
|
|
15060
|
-
return `<!doctype html><html><head>${VIEWPORT_META}</head><body>${
|
|
15065
|
+
return `<!doctype html><html><head>${VIEWPORT_META}</head><body>${withBridge}</body></html>`;
|
|
15061
15066
|
}
|
|
15062
15067
|
async function handleFilePreviewRequest(req, res, deps) {
|
|
15063
15068
|
if (req.method !== "GET" && req.method !== "HEAD") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabiofiorita/porcelain",
|
|
3
|
-
"version": "0.59.
|
|
3
|
+
"version": "0.59.2",
|
|
4
4
|
"description": "Headless Porcelain daemon — plain Node backend for remote machines (npx @fabiofiorita/porcelain@latest serve)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fabio Fiorita <fabiolfp@gmail.com>",
|