SHA256
Перевести вложения DM на R2 и обновить файловый API
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { validatePublicPiecesRoot } from '../js/services/public-pieces-root.js';
|
||||
|
||||
const source = await readFile(new URL('../js/services/attachment-format.js', import.meta.url), 'utf8');
|
||||
|
||||
@@ -52,7 +53,7 @@ function loadRenderer() {
|
||||
.replace(/^import .*;\s*$/gm, '')
|
||||
.replace(/^export /gm, '');
|
||||
const factory = new Function('t', 'th', 'formatNumber', 'openMediaViewer', 'buildArweaveDataUrl',
|
||||
'validateArweaveTxId', 'validateSha256Hex', 'resolvePublicFileUrl', 'document', 'window', 'fetch',
|
||||
'validateArweaveTxId', 'validateSha256Hex', 'resolvePublicFileUrl', 'validatePublicPiecesRoot', 'document', 'window', 'fetch',
|
||||
`${normalized}\nreturn { getAttachmentKind, createAttachmentCarouselElement, parseMessageAttachments };`);
|
||||
const api = factory(
|
||||
(key) => key,
|
||||
@@ -63,6 +64,7 @@ function loadRenderer() {
|
||||
(id) => /^[A-Za-z0-9_-]{43}$/.test(id),
|
||||
(id) => /^[a-f0-9]{64}$/.test(id),
|
||||
async ({ pr, sha256 }) => pr ? `https://files.shineup.me/${pr}` : `https://old.example/files/${sha256}`,
|
||||
validatePublicPiecesRoot,
|
||||
{ createElement: (tag) => new TestElement(tag) },
|
||||
{ location: { origin: 'https://shineup.me' }, open() {} },
|
||||
async () => ({ ok: true }),
|
||||
|
||||
Reference in New Issue
Block a user