export identity records

This commit is contained in:
Mike Macgirvin 2024-06-29 08:45:11 +10:00
parent 982ff915f3
commit e74a1f4232
4 changed files with 26 additions and 4 deletions

View file

@ -1669,6 +1669,9 @@ class Activity
if ($nomadic && !$extended) {
return Channel::getDidResolver($channel, true);
}
if ($export) {
$nomadic = true;
}
}

View file

@ -154,8 +154,8 @@ class Channel extends Controller
http_status_exit(403, 'Permission denied');
}
}
as_return_and_die(Activity::actorEncode($channel, extended: true, activitypub: true, legacy: $this->legacy), $channel);
$export = !empty($_REQUEST['export']);
as_return_and_die(Activity::actorEncode($channel, extended: true, activitypub: true, export: $export, legacy: $this->legacy), $channel);
}
// handle zot6 channel discovery

View file

@ -3,6 +3,8 @@
namespace Code\Module;
use App;
use Code\Lib\Activity;
use Code\Lib\Multibase;
use Code\Lib\Time;
use Code\Web\Controller;
use Code\Lib\Channel;
@ -36,6 +38,16 @@ class Uexport extends Controller
$flags = JSON_INVALID_UTF8_SUBSTITUTE;
if (argc() > 1 && argv(1) === 'activitypub') {
echo json_encode(Activity::actorEncode($channel, extended: true, activitypub: true, export: true, legacy: false), JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES);
killme();
}
if (argc() > 1 && argv(1) === 'identity-key') {
echo (new Multibase())->secretKey($channel['channel_eprvkey']);
killme();
}
if ($year) {
echo json_encode(Channel::export_year(local_channel(), $year, $month), $flags);
killme();
@ -70,7 +82,8 @@ class Uexport extends Controller
'$basic' => t('Export your basic channel information to a file. This acts as a backup of your connections, permissions, profile and basic data, which can be used to import your data to a new server hub, but does not contain your content.'),
'$fulltitle' => t('Export Content'),
'$full' => t('Export your channel information and recent content to a JSON backup that can be restored or imported to another server hub. This backs up all of your connections, permissions, profile data and several months of posts. This file may be VERY large. Please be patient - it may take several minutes for this download to begin.'),
'$activitypub' => t('Export your portable digital identity record.'),
'$privatekey' => t('Export the private key for your portable digital identity record.'),
'$by_year' => t('Export your posts from a given year.'),
'$extra' => t('You may also export your posts and conversations for a particular year or month. Adjust the date in your browser location bar to select other dates. If the export fails (possibly due to memory exhaustion on your server hub), please try again selecting a more limited date range.'),

View file

@ -3,7 +3,13 @@
<h2>{{$title}}</h2>
</div>
<div class="section-content-wrapper">
<b><a href="uexport/basic">{{$basictitle}}</a></b></p>
<p>
<b><a href="uexport/activitypub">{{$activitypub}}</a></b>
</p>
<p>
<b><a href="uexport/identity-key">{{$privatekey}}</a></b>
</p>
<b><a href="uexport/basic">{{$basictitle}}</a></b>
<p>{{$basic}}</p>
<p><b><a href="uexport/complete">{{$fulltitle}}</a></b></p>