add mod_followlist and filestorage fix

This commit is contained in:
nobody 2020-11-01 15:16:16 -08:00
parent 45f8693c50
commit 8d29bd5e07
3 changed files with 67 additions and 1 deletions

View file

@ -75,7 +75,7 @@ class Filestorage extends Controller {
attach_change_permissions($channel_id, $resource, $x['allow_cid'], $x['allow_gid'], $x['deny_cid'], $x['deny_gid'], $recurse, true);
$sync = attach_export_data($channel,$resource,true);
$sync = attach_export_data($channel,$resource,false);
if ($sync) {
Libsync::build_sync_packet($channel_id,array('file' => array($sync)));
}

View file

@ -0,0 +1,58 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\ASCollection;
use Zotlabs\Lib\Connect;
class Followlist extends Controller {
function post() {
if (! local_channel()) {
return;
}
$max_records = get_config('system','max_imported_channels',1000);
$importer = App::get_channel();
$url = $_GET['url'];
if ($importer && $url) {
$obj = new ASCollection($url, $importer, 0, $max_records);
$actors = $obj->get();
if ($actors) {
foreach ($actors as $actor) {
if (is_array($actor)) {
$result = Connect::connect($importer,$actor['id']);
}
else {
$result = Connect::connect($importer,$actor);
}
if (! $result['success']) {
notice ( t('Connect failed: ') . $url . t(' Reason: ') . $result['message']);
}
}
}
}
}
function get() {
if (! local_channel()) {
return login();
}
return replace_macros(get_markup_template('followlist.tpl'), [
'$page_title' => t('Followlist'),
'$notes' => t('Enter the URL of an ActivityPub followers/following collection to import'),
'$url' => [ 'url', t('URL of followers/following list'), '', '' ],
'$submit' => t('Submit')
]);
}
}

8
view/tpl/followlist.tpl Normal file
View file

@ -0,0 +1,8 @@
<h3>{{$page_title}}</h3>
<div class="descriptive-text">{{$notes}}</div>
<form action="followlist" method="post">
{{include file="field_input.tpl" field=$url}}
<input type="submit" name="submit" value="{{$submit}}" >
</form>
<br>
<br>