From d345b53347f1819ee11209d71a0ffa7e0141eafe Mon Sep 17 00:00:00 2001 From: Omar Salah Date: Wed, 27 Nov 2024 21:06:09 +0200 Subject: [PATCH] finalize pack in exportActorProfile + use json instead csv in importActorProfile --- src/index.ts | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/src/index.ts b/src/index.ts index 9487f1a..99ec37e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -123,34 +123,47 @@ export function exportActorProfile({ } if (lists) { - manifest.contents.activitypub.contents['lists.csv'] = { + manifest.contents.activitypub.contents['lists.json'] = { url: 'https://docs.joinmastodon.org/user/moving/#export' } - pack.entry({ name: 'activitypub/lists.csv' }, lists) + pack.entry( + { name: 'activitypub/lists.json' }, + JSON.stringify(lists, null, 2) + ) } if (blockedAccounts) { - manifest.contents.activitypub.contents['blocked_accounts.csv'] = { + manifest.contents.activitypub.contents['blocked_accounts.json'] = { url: 'https://docs.joinmastodon.org/user/moving/#export' } - pack.entry({ name: 'activitypub/blocked_accounts.csv' }, blockedAccounts) + pack.entry( + { name: 'activitypub/blocked_accounts.json' }, + JSON.stringify(blockedAccounts, null, 2) + ) } if (blockedDomains) { - manifest.contents.activitypub.contents['blocked_domains.csv'] = { + manifest.contents.activitypub.contents['blocked_domains.json'] = { url: 'https://docs.joinmastodon.org/user/moving/#export' } - pack.entry({ name: 'activitypub/blocked_domains.csv' }, blockedDomains) + pack.entry( + { name: 'activitypub/blocked_domains.csv' }, + JSON.stringify(blockedDomains, null, 2) + ) } if (mutedAccounts) { - manifest.contents.activitypub.contents['muted_accounts.csv'] = { + manifest.contents.activitypub.contents['muted_accounts.json'] = { url: 'https://docs.joinmastodon.org/user/moving/#export' } - pack.entry({ name: 'activitypub/muted_accounts.csv' }, mutedAccounts) + pack.entry( + { name: 'activitypub/muted_accounts.json' }, + JSON.stringify(mutedAccounts, null, 2) + ) } pack.entry({ name: 'manifest.yaml' }, YAML.stringify(manifest)) + pack.finalize() return pack }