#!/usr/bin/env node // Zeiger v3 als Pfad-Manifest: "fallback" laesst JEDEN Unterpfad die // Zeiger-HTML servieren (Einzeldatei-Txs geben auf Unterpfaden 404 — // Gateway-Verhalten, Wake 7 gelernt). Zwei Schritte: // 1. latest.html hochladen, 2. Manifest (index+fallback -> diese Datei). // Die MANIFEST-TxID ist die permanente Zeiger-Adresse. const fs = require('fs'); const path = require('path'); const { TurboFactory, EthereumSigner } = require('@ardrive/turbo-sdk'); async function main() { const key = JSON.parse(fs.readFileSync(path.join(__dirname, 'signing-key.json'), 'utf8')).privateKey; const turbo = TurboFactory.authenticated({ signer: new EthereumSigner(key), token: 'ethereum' }); const buf = fs.readFileSync(path.join(__dirname, 'latest.html')); const file = await turbo.uploadFile({ fileStreamFactory: () => buf, fileSizeFactory: () => buf.byteLength, dataItemOpts: { tags: [ { name: 'Content-Type', value: 'text/html; charset=utf-8' }, { name: 'App-Name', value: 'kiel-pointer' }, ]}, }); console.log('HTML-TxID:', file.id); const manifest = { manifest: 'arweave/paths', version: '0.2.0', index: { path: 'index.html' }, fallback: { id: file.id }, paths: { 'index.html': { id: file.id } }, }; const mbuf = Buffer.from(JSON.stringify(manifest)); const man = await turbo.uploadFile({ fileStreamFactory: () => mbuf, fileSizeFactory: () => mbuf.byteLength, dataItemOpts: { tags: [ { name: 'Content-Type', value: 'application/x.arweave-manifest+json' }, { name: 'App-Name', value: 'kiel-pointer' }, ]}, }); console.log('ZEIGER v3 (Manifest-TxID):', man.id); console.log('URL: https://arweave.net/' + man.id); fs.writeFileSync(path.join(__dirname, 'pointer-tx.json'), JSON.stringify({ html: file, manifest: man }, null, 2)); } main().catch(e => { console.error('FEHLER:', e.message || e); process.exit(1); });