rogerrat 0.8.0 → 0.8.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/dist/account-ui.js +71 -9
- package/dist/discovery.js +1 -1
- package/package.json +1 -1
package/dist/account-ui.js
CHANGED
|
@@ -45,7 +45,12 @@ export function accountHtml() {
|
|
|
45
45
|
tr:last-child td { border-bottom: none; }
|
|
46
46
|
.reveal { background: var(--bg); border: 1px dashed var(--warn); padding: 12px 14px; font-size: 12px; margin-top: 16px; }
|
|
47
47
|
.reveal strong { color: var(--warn); }
|
|
48
|
-
.reveal pre { margin: 8px 0
|
|
48
|
+
.reveal pre { margin: 8px 0; white-space: pre-wrap; word-break: break-all; user-select: all; font-size: 12px; }
|
|
49
|
+
.reveal-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
|
|
50
|
+
.reveal-actions button { background: var(--ink); color: white; padding: 6px 12px; font-size: 12px; font-weight: 500; }
|
|
51
|
+
.reveal-actions button:hover { background: #333; }
|
|
52
|
+
.reveal-actions button.confirm { background: var(--ok); }
|
|
53
|
+
.reveal-actions button.confirm:hover { background: #1f6b2e; }
|
|
49
54
|
.err { color: var(--warn); font-size: 13px; margin: 8px 0; }
|
|
50
55
|
.empty { text-align: center; padding: 28px; color: var(--dim); font-size: 13px; }
|
|
51
56
|
footer { margin-top: 48px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--dim); font-size: 12px; }
|
|
@@ -102,6 +107,10 @@ export function accountHtml() {
|
|
|
102
107
|
<div id="reveal" class="reveal" hidden>
|
|
103
108
|
<strong>Save these now.</strong> They are shown ONLY on this screen. You will not see them again after navigation.
|
|
104
109
|
<div id="reveal-body"></div>
|
|
110
|
+
<div class="reveal-actions">
|
|
111
|
+
<button data-action="download">⬇ Download .txt</button>
|
|
112
|
+
<button data-action="copy">⎘ Copy</button>
|
|
113
|
+
</div>
|
|
105
114
|
</div>
|
|
106
115
|
</div>
|
|
107
116
|
|
|
@@ -145,6 +154,14 @@ export function accountHtml() {
|
|
|
145
154
|
$('gate-err').textContent = err || '';
|
|
146
155
|
}
|
|
147
156
|
|
|
157
|
+
let revealPayload = null; // { filename, text }
|
|
158
|
+
|
|
159
|
+
function showReveal(filename, text) {
|
|
160
|
+
revealPayload = { filename, text };
|
|
161
|
+
$('reveal-body').innerHTML = '<pre>' + esc(text) + '</pre>';
|
|
162
|
+
$('reveal').hidden = false;
|
|
163
|
+
}
|
|
164
|
+
|
|
148
165
|
function showDashboard(account, justCreated) {
|
|
149
166
|
$('gate').hidden = true;
|
|
150
167
|
$('dashboard').hidden = false;
|
|
@@ -153,14 +170,49 @@ export function accountHtml() {
|
|
|
153
170
|
$('account-extra').textContent = account.identities ? '(' + account.identities.length + ' identit' + (account.identities.length === 1 ? 'y' : 'ies') + ')' : '';
|
|
154
171
|
renderIdentities(account.identities || []);
|
|
155
172
|
if (justCreated) {
|
|
156
|
-
const
|
|
157
|
-
'
|
|
158
|
-
'
|
|
159
|
-
|
|
160
|
-
|
|
173
|
+
const text = [
|
|
174
|
+
'RogerRat account credentials',
|
|
175
|
+
'============================',
|
|
176
|
+
'',
|
|
177
|
+
'Service: https://rogerrat.chat',
|
|
178
|
+
'Account ID: ' + justCreated.account_id,
|
|
179
|
+
'Created: ' + new Date().toISOString(),
|
|
180
|
+
'Recovery token: ' + justCreated.recovery_token,
|
|
181
|
+
'Session token: ' + justCreated.session_token,
|
|
182
|
+
'',
|
|
183
|
+
'⚠ Save the recovery_token in a password manager — it is the ONLY way to',
|
|
184
|
+
' recover this account if you lose the session.',
|
|
185
|
+
' The session_token is short-lived; re-issue via /api/account/recover.',
|
|
186
|
+
].join('\\n');
|
|
187
|
+
showReveal('rogerrat-account-' + justCreated.account_id + '.txt', text);
|
|
161
188
|
}
|
|
162
189
|
}
|
|
163
190
|
|
|
191
|
+
document.querySelectorAll('#reveal .reveal-actions button').forEach(btn => {
|
|
192
|
+
btn.addEventListener('click', () => {
|
|
193
|
+
if (!revealPayload) return;
|
|
194
|
+
if (btn.dataset.action === 'download') {
|
|
195
|
+
const blob = new Blob([revealPayload.text.replace(/\\\\n/g, '\\n')], { type: 'text/plain;charset=utf-8' });
|
|
196
|
+
const url = URL.createObjectURL(blob);
|
|
197
|
+
const a = document.createElement('a');
|
|
198
|
+
a.href = url; a.download = revealPayload.filename;
|
|
199
|
+
document.body.appendChild(a); a.click(); a.remove();
|
|
200
|
+
setTimeout(() => URL.revokeObjectURL(url), 1000);
|
|
201
|
+
btn.classList.add('confirm');
|
|
202
|
+
btn.textContent = '✓ Downloaded';
|
|
203
|
+
setTimeout(() => { btn.classList.remove('confirm'); btn.textContent = '⬇ Download .txt'; }, 2000);
|
|
204
|
+
} else if (btn.dataset.action === 'copy') {
|
|
205
|
+
navigator.clipboard.writeText(revealPayload.text.replace(/\\\\n/g, '\\n')).then(() => {
|
|
206
|
+
btn.classList.add('confirm');
|
|
207
|
+
btn.textContent = '✓ Copied';
|
|
208
|
+
setTimeout(() => { btn.classList.remove('confirm'); btn.textContent = '⎘ Copy'; }, 2000);
|
|
209
|
+
}).catch((e) => {
|
|
210
|
+
alert('Copy failed: ' + e.message + '\\n\\nSelect the text manually and Ctrl+C.');
|
|
211
|
+
});
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
});
|
|
215
|
+
|
|
164
216
|
function renderIdentities(idents) {
|
|
165
217
|
const tbody = $('ident-rows');
|
|
166
218
|
if (!idents.length) {
|
|
@@ -269,9 +321,19 @@ export function accountHtml() {
|
|
|
269
321
|
const data = await r.json();
|
|
270
322
|
if (!r.ok) { $('ident-err').textContent = data.error || ('HTTP ' + r.status); return; }
|
|
271
323
|
$('new-callsign').value = '';
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
324
|
+
const text = [
|
|
325
|
+
'RogerRat identity key',
|
|
326
|
+
'=====================',
|
|
327
|
+
'',
|
|
328
|
+
'Service: https://rogerrat.chat',
|
|
329
|
+
'Callsign: ' + data.callsign,
|
|
330
|
+
'Identity key: ' + data.identity_key,
|
|
331
|
+
'Created: ' + new Date().toISOString(),
|
|
332
|
+
'',
|
|
333
|
+
'⚠ Save this key. It is shown ONLY once. Use it as Bearer auth',
|
|
334
|
+
' when joining channels with require_identity=true.',
|
|
335
|
+
].join('\\n');
|
|
336
|
+
showReveal('rogerrat-identity-' + data.callsign + '.txt', text);
|
|
275
337
|
loadAccount();
|
|
276
338
|
} catch (e) {
|
|
277
339
|
$('ident-err').textContent = 'Error: ' + e.message;
|
package/dist/discovery.js
CHANGED
package/package.json
CHANGED