From 1ddb8a39c9aa9dab934e63d59f80093a95b8d696 Mon Sep 17 00:00:00 2001 From: natsoni Date: Tue, 8 Oct 2024 12:50:56 +0900 Subject: [PATCH] Show text inscriptions up to 50kB --- frontend/src/app/components/ord-data/ord-data.component.ts | 3 ++- frontend/src/app/shared/ord/inscription.utils.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/ord-data/ord-data.component.ts b/frontend/src/app/components/ord-data/ord-data.component.ts index ccf8f6eae..0e18750f1 100644 --- a/frontend/src/app/components/ord-data/ord-data.component.ts +++ b/frontend/src/app/components/ord-data/ord-data.component.ts @@ -3,6 +3,7 @@ import { Runestone, Etching } from '../../shared/ord/rune.utils'; export interface Inscription { body?: Uint8Array; + is_cropped?: boolean; body_length?: number; content_type?: Uint8Array; content_type_str?: string; @@ -68,7 +69,7 @@ export class OrdDataComponent implements OnChanges { } // Text / JSON data - if ((key.includes('text') || key.includes('json')) && inscription.body?.length && !this.inscriptionsData[key].text && !this.inscriptionsData[key].json) { + if ((key.includes('text') || key.includes('json')) && !inscription.is_cropped && !this.inscriptionsData[key].text && !this.inscriptionsData[key].json) { const decoder = new TextDecoder('utf-8'); const text = decoder.decode(inscription.body); try { diff --git a/frontend/src/app/shared/ord/inscription.utils.ts b/frontend/src/app/shared/ord/inscription.utils.ts index efa9e8fe8..e62f892d7 100644 --- a/frontend/src/app/shared/ord/inscription.utils.ts +++ b/frontend/src/app/shared/ord/inscription.utils.ts @@ -390,7 +390,8 @@ export function extractInscriptionData(raw: Uint8Array, pointer: number): Inscri return { content_type_str: contentType, - body: combinedData.slice(0, 150), // Limit body to 150 bytes for now + body: combinedData.slice(0, 50_000), // Limit body to 50 kB for now + is_cropped: combinedData.length > 50_000, body_length: combinedData.length, delegate_txid: getKnownFieldValue(fields, knownFields.delegate) ? bytesToHex(getKnownFieldValue(fields, knownFields.delegate).reverse()) : null };