SHA256
Исправить восстановление сессии после переподключения
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { buildAvatarReference } from './avatar-reference.js';
|
||||
import { WsJsonClient } from './ws-client.js';
|
||||
import { invalidateConnectionsGraphCache } from './connections-graph-cache.js';
|
||||
import {
|
||||
@@ -727,14 +728,8 @@ function composeChannelMetaText({ title = '', description = '', avatar = null }
|
||||
const cleanDescription = normalizeChannelMetaDescription(description);
|
||||
const rows = [];
|
||||
if (cleanTitle) rows.push(`<S:title;v=1;${cleanTitle}>`);
|
||||
if (avatar?.sha256 || avatar?.sha256Hex) {
|
||||
const size = Number(avatar.size || 0);
|
||||
const sha256 = String(avatar.sha256 || avatar.sha256Hex || '').trim().toLowerCase();
|
||||
const ar = String(avatar.ar || '').trim();
|
||||
if (!Number.isInteger(size) || size <= 0) throw new Error('Некорректный размер аватара.');
|
||||
if (!/^[0-9a-f]{64}$/u.test(sha256)) throw new Error('Некорректный SHA-256 аватара.');
|
||||
if (ar && !/^[A-Za-z0-9_-]{43}$/u.test(ar)) throw new Error('Некорректный Arweave txId аватара.');
|
||||
rows.push(`<S:ava;v=1;sz=${size};sha256=${sha256}${ar ? `;ar=${ar}` : ''}>`);
|
||||
if (avatar?.pr) {
|
||||
rows.push(buildAvatarReference({ size: avatar.size, pr: avatar.pr, ar: avatar.ar }));
|
||||
}
|
||||
if (cleanDescription) rows.push(cleanDescription);
|
||||
return rows.join('\n');
|
||||
|
||||
Reference in New Issue
Block a user