Changeset 65abc85 in Klonkt for src/assets
- Timestamp:
- 07/28/2026 10:40:50 AM (6 weeks ago)
- Branches:
- main
- Children:
- 2708282
- Parents:
- 2a76184
- File:
-
- 1 edited
-
src/assets/js/guardian.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/assets/js/guardian.js
r2a76184 r65abc85 120 120 // ward; only a guardian can open it, and the gate is enforced server-side 121 121 // when the feed is built, so this button is the only thing that moves it. 122 if (w.embeds !== null && w.embeds !== undefined) { 123 var emb = el('button', 'quiet small', (w.embeds ? T.embeds_on : T.embeds_off) || 'Embeds'); 124 emb.addEventListener('click', function () { 125 emb.disabled = true; 126 fetch('/guardian/wards/embeds', { 127 method: 'POST', headers: { 'Content-Type': 'application/json' }, 128 body: JSON.stringify({ uri: w.other_uri, allow: !w.embeds }), 129 }).then(function (r) { return r.json(); }) 130 .then(function () { refresh(); }) 131 .catch(function () { emb.disabled = false; }); 132 }); 133 row.appendChild(emb); 134 } 122 // Shown for EVERY ward, including one on another server. There the value 123 // is unknown (it lives on the ward's server), but proposing is exactly as 124 // possible: the proposal travels, the ward's server tallies the guardians 125 // and enforces. A guardian next door must not have more say than one far 126 // away. 127 var known = w.embeds === true || w.embeds === false; 128 var emb = el('button', 'quiet small', 129 (known ? (w.embeds ? T.embeds_on : T.embeds_off) : T.embeds_propose) || 'Link previews'); 130 emb.addEventListener('click', function () { 131 emb.disabled = true; 132 fetch('/guardian/wards/embeds', { 133 method: 'POST', headers: { 'Content-Type': 'application/json' }, 134 body: JSON.stringify({ uri: w.other_uri, allow: known ? !w.embeds : true }), 135 }).then(function (r) { return r.json(); }) 136 .then(function (j) { 137 // Not settled yet: the other guardians still have to answer. 138 if (j && j.state === 'open') { 139 emb.textContent = (T.embeds_waiting || 'waiting for the other guardians'); 140 emb.disabled = true; 141 return; 142 } 143 refresh(); 144 }) 145 .catch(function () { emb.disabled = false; }); 146 }); 147 row.appendChild(emb); 135 148 var btn = el('button', 'quiet small', T.release); 136 149 // Releasing a ward is heavy and hard to undo (coming back needs a fresh
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)