human-machine-swapper 1.4.0 → 1.4.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "human-machine-swapper",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"description": "A web component that adds a Human / Machine pill to any website. Machine shows the site's llms.txt, the plain-text reading written for language models, rendered in place. One file, about 6 KB gzipped, no dependencies and no build step.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"llms.txt",
|
|
@@ -50,7 +50,8 @@
|
|
|
50
50
|
"sideEffects": true,
|
|
51
51
|
"scripts": {
|
|
52
52
|
"test": "node --test test/*.test.mjs",
|
|
53
|
-
"test:wp": "php wordpress/test/generator-test.php"
|
|
53
|
+
"test:wp": "php wordpress/test/generator-test.php",
|
|
54
|
+
"test:wp:integration": "node wordpress/test/integration.mjs"
|
|
54
55
|
},
|
|
55
56
|
"engines": {
|
|
56
57
|
"node": ">=18"
|
|
@@ -71,7 +71,10 @@
|
|
|
71
71
|
|
|
72
72
|
for (const path of PROBE_PATHS) {
|
|
73
73
|
try {
|
|
74
|
-
|
|
74
|
+
// same-origin, not omit: behind a login (a Vercel preview, an intranet) a cookieless
|
|
75
|
+
// request is bounced to the login page, the probe fails, and the pill never appears.
|
|
76
|
+
// Cookies still never go to another origin.
|
|
77
|
+
const response = await fetch(path, { method: "HEAD", credentials: "same-origin" });
|
|
75
78
|
if (response.ok) {
|
|
76
79
|
try {
|
|
77
80
|
window.sessionStorage.setItem(cacheKey, path);
|
|
@@ -472,7 +475,9 @@
|
|
|
472
475
|
|
|
473
476
|
if (!this._text) {
|
|
474
477
|
try {
|
|
475
|
-
|
|
478
|
+
// same-origin: see the probe above. With "omit", a protected deployment bounced this
|
|
479
|
+
// to its login page, the fetch failed, and the reader fell back to the raw file.
|
|
480
|
+
const response = await fetch(href, { credentials: "same-origin" });
|
|
476
481
|
if (!response.ok) throw new Error(String(response.status));
|
|
477
482
|
this._text = await response.text();
|
|
478
483
|
} catch (error) {
|