@justai/core 0.16.0 → 0.17.0
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 +1 -1
- package/src/index.js +32 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@justai/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The framework-free heart of the persona shell — the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"repository": {
|
package/src/index.js
CHANGED
|
@@ -894,7 +894,38 @@ export async function childFace(options) {
|
|
|
894
894
|
const put = (id, text) => { const el = document.getElementById(id); if (el && text) el.textContent = text; };
|
|
895
895
|
put("pnName", face.name);
|
|
896
896
|
put("pnHandle", face.handle ? "@" + face.handle : null);
|
|
897
|
-
|
|
897
|
+
|
|
898
|
+
// queries: the child persona shows raw HTML · <span class="mtag"> printed as text · the meta line
|
|
899
|
+
// shows markup · unrendered html in the profile · pnMeta
|
|
900
|
+
//
|
|
901
|
+
// THE META LINE IS MARKUP, AND IT ARRIVES FROM A REGISTRY. A persona's `meta` is a row of chips —
|
|
902
|
+
// `<span class="mtag">Fast</span>…` — and the Profile cut renders the persona's OWN with `set:html`
|
|
903
|
+
// because it is that persona's file. This is the same string coming back over the network, and
|
|
904
|
+
// `textContent` printed it verbatim: three child personas on every host showed a paragraph of angle
|
|
905
|
+
// brackets under the bio.
|
|
906
|
+
//
|
|
907
|
+
// `innerHTML` IS THE OBVIOUS FIX AND IT IS THE WRONG ONE. That would put remote markup into the
|
|
908
|
+
// document on every host in the fleet, and `meta` is written by each persona's own manifest — an
|
|
909
|
+
// `onerror=` in one persona's registry entry would then run inside /me, /files and the feed
|
|
910
|
+
// wherever they are mounted. A child persona is the LAST place to be permissive: it is the surface
|
|
911
|
+
// that shows a person their own vault.
|
|
912
|
+
//
|
|
913
|
+
// So the markup is parsed but never adopted. DOMParser builds an inert document — no scripts, no
|
|
914
|
+
// network — the TEXT of each chip is read out of it, and this file creates the elements itself.
|
|
915
|
+
// Whatever arrives, what reaches the page is spans this code made.
|
|
916
|
+
const meta = document.getElementById("pnMeta");
|
|
917
|
+
if (meta && face.meta) {
|
|
918
|
+
const inert = new DOMParser().parseFromString("<body>" + face.meta + "</body>", "text/html");
|
|
919
|
+
const chips = [...inert.body.querySelectorAll("span, li")].filter((n) => n.textContent.trim());
|
|
920
|
+
meta.textContent = "";
|
|
921
|
+
if (!chips.length) meta.textContent = inert.body.textContent.trim();
|
|
922
|
+
else for (const c of chips) {
|
|
923
|
+
const span = document.createElement("span");
|
|
924
|
+
span.className = "mtag";
|
|
925
|
+
span.textContent = c.textContent.trim();
|
|
926
|
+
meta.append(span);
|
|
927
|
+
}
|
|
928
|
+
}
|
|
898
929
|
if (face.avatar) {
|
|
899
930
|
const slot = document.getElementById("hostGlyph");
|
|
900
931
|
if (slot) slot.innerHTML = '<img class="mk" src="' + face.avatar + '" alt="">';
|