Skip to content

Commit

Permalink
finalize pack in exportActorProfile + use json instead csv in importA…
Browse files Browse the repository at this point in the history
…ctorProfile
  • Loading branch information
0marSalah authored and dmitrizagidulin committed Dec 2, 2024
1 parent c8a75d7 commit d345b53
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit d345b53

Please sign in to comment.