mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-22 03:35:26 +00:00
Merge branch 'dev'
This commit is contained in:
commit
f9c264400b
7 changed files with 71 additions and 41 deletions
|
@ -1020,6 +1020,12 @@ class Activity {
|
|||
if(! $name)
|
||||
$name = t('Unknown');
|
||||
|
||||
$username = $person_obj['preferredUsername'];
|
||||
$h = parse_url($url);
|
||||
if($h && $h['host']) {
|
||||
$username .= '@' . $h['host'];
|
||||
}
|
||||
|
||||
if($person_obj['icon']) {
|
||||
if(is_array($person_obj['icon'])) {
|
||||
if(array_key_exists('url',$person_obj['icon']))
|
||||
|
@ -1075,7 +1081,7 @@ class Activity {
|
|||
'xchan_hash' => $url,
|
||||
'xchan_guid' => $url,
|
||||
'xchan_pubkey' => $pubkey,
|
||||
'xchan_addr' => '',
|
||||
'xchan_addr' => ((strpos($username,'@')) ? $username : ''),
|
||||
'xchan_url' => $profile,
|
||||
'xchan_name' => $name,
|
||||
'xchan_name_date' => datetime_convert(),
|
||||
|
@ -1128,7 +1134,7 @@ class Activity {
|
|||
[
|
||||
'hubloc_guid' => $url,
|
||||
'hubloc_hash' => $url,
|
||||
'hubloc_addr' => '',
|
||||
'hubloc_addr' => ((strpos($username,'@')) ? $username : ''),
|
||||
'hubloc_network' => 'activitypub',
|
||||
'hubloc_url' => $baseurl,
|
||||
'hubloc_host' => $hostname,
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
namespace Zotlabs\Lib;
|
||||
|
||||
use Zotlabs\Lib\LDSignatures;
|
||||
use Zotlabs\Lib\ActivityStreams;
|
||||
use Zotlabs\Lib\Activity;
|
||||
use Zotlabs\Lib\Queue;
|
||||
use Zotlabs\Daemon\Master;
|
||||
|
@ -392,4 +393,27 @@ class ActivityPub {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
static function discover($apurl) {
|
||||
|
||||
$person_obj = null;
|
||||
$ap = ActivityStreams::fetch($apurl);
|
||||
if($ap) {
|
||||
$AS = new ActivityStreams($ap);
|
||||
if($AS->is_valid()) {
|
||||
if(ActivityStreams::is_an_actor($AS->type)) {
|
||||
$person_obj = $AS->data;
|
||||
}
|
||||
elseif($AS->obj && ActivityStreams::is_an_actor($AS->obj['type'])) {
|
||||
$person_obj = $AS->obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($person_obj) {
|
||||
Activity::actor_store($apurl,$person_obj);
|
||||
return $apurl;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -237,6 +237,7 @@ class ActivityStreams {
|
|||
return ((array_key_exists($propname, $base)) ? $base[$propname] : null);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Fetches a property from an URL.
|
||||
*
|
||||
|
@ -268,6 +269,16 @@ class ActivityStreams {
|
|||
return null;
|
||||
}
|
||||
|
||||
static function is_an_actor($s) {
|
||||
return(in_array($s,[ 'Application','Group','Service','Person','Service' ]));
|
||||
}
|
||||
|
||||
|
||||
static function is_an_actor($s) {
|
||||
return(in_array($s,[ 'Application','Group','Service','Person','Service' ]));
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief
|
||||
|
|
|
@ -396,13 +396,13 @@ class Libsync {
|
|||
}
|
||||
|
||||
$disallowed = [
|
||||
'channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey',
|
||||
'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted',
|
||||
'channel_system', 'channel_r_stream', 'channel_r_profile', 'channel_r_abook',
|
||||
'channel_r_storage', 'channel_r_pages', 'channel_w_stream', 'channel_w_wall',
|
||||
'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall',
|
||||
'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish',
|
||||
'channel_a_delegate'
|
||||
'channel_id', 'channel_account_id', 'channel_primary', 'channel_prvkey',
|
||||
'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_deleted',
|
||||
'channel_system', 'channel_r_stream', 'channel_r_profile', 'channel_r_abook',
|
||||
'channel_r_storage', 'channel_r_pages', 'channel_w_stream', 'channel_w_wall',
|
||||
'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall',
|
||||
'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish',
|
||||
'channel_a_delegate', 'channel_moved'
|
||||
];
|
||||
|
||||
$clean = array();
|
||||
|
|
|
@ -531,14 +531,21 @@ class Setup extends \Zotlabs\Web\Controller {
|
|||
$ck_funcs[0]['status'] = false;
|
||||
$ck_funcs[0]['help'] = t('Error: libCURL PHP module required but not installed.');
|
||||
}
|
||||
if(! function_exists('imagecreatefromjpeg')) {
|
||||
if((! function_exists('imagecreatefromjpeg')) || (! class_exists('Imagick'))) {
|
||||
$ck_funcs[1]['status'] = false;
|
||||
$ck_funcs[1]['help'] = t('Error: GD graphics PHP module with JPEG support required but not installed.');
|
||||
$ck_funcs[1]['help'] = t('Error: GD PHP module with JPEG support or ImageMagick graphics library required but not installed.');
|
||||
}
|
||||
if(! function_exists('openssl_public_encrypt')) {
|
||||
$ck_funcs[2]['status'] = false;
|
||||
$ck_funcs[2]['help'] = t('Error: openssl PHP module required but not installed.');
|
||||
}
|
||||
if(class_exists('PDO')) {
|
||||
$x = PDO::getAvailableDrivers();
|
||||
if((! in_array('mysql',$x)) && (! in_array('pgsql',$x))) {
|
||||
$ck_funcs[3]['status'] = false;
|
||||
$ck_funcs[3]['help'] = t('Error: PDO database PHP module missing a driver for either mysql or pgsql.');
|
||||
}
|
||||
}
|
||||
if(! class_exists('PDO')) {
|
||||
$ck_funcs[3]['status'] = false;
|
||||
$ck_funcs[3]['help'] = t('Error: PDO database PHP module required but not installed.');
|
||||
|
|
|
@ -94,7 +94,8 @@ function import_channel($channel, $account_id, $seize, $newname = '') {
|
|||
'channel_w_comment', 'channel_w_mail', 'channel_w_like', 'channel_w_tagwall',
|
||||
'channel_w_chat', 'channel_w_storage', 'channel_w_pages', 'channel_a_republish',
|
||||
'channel_a_delegate', 'perm_limits', 'channel_password', 'channel_salt',
|
||||
'channel_moved'
|
||||
'channel_moved', 'channel_primary', 'channel_removed', 'channel_deleted',
|
||||
'channel_system'
|
||||
];
|
||||
|
||||
$clean = array();
|
||||
|
|
|
@ -1213,41 +1213,22 @@ function discover_by_webbie($webbie, $protocol = '') {
|
|||
}
|
||||
}
|
||||
if($link['rel'] === 'self' && ($link['type'] === 'application/activity+json' || strpos($link['type'],'ld+json') !== false) && ((! $protocol) || (strtolower($protocol) === 'activitypub'))) {
|
||||
$apurl = $link['href'];
|
||||
if(($apurl) && strpos($apurl,'http') === 0) {
|
||||
$person_obj = null;
|
||||
$ap = ActivityStreams::fetch($apurl);
|
||||
if($ap) {
|
||||
$AS = new ActivityStreams($ap);
|
||||
if($AS->is_valid()) {
|
||||
if($AS->type === 'Person') {
|
||||
$person_obj = $AS->data;
|
||||
}
|
||||
elseif($AS->obj && $AS->obj['type'] === 'Person') {
|
||||
$person_obj = $AS->obj;
|
||||
}
|
||||
}
|
||||
}
|
||||
if($person_obj) {
|
||||
Activity::actor_store($apurl,$person_obj);
|
||||
if($address) {
|
||||
q("update xchan set xchan_addr = '%s' where xchan_hash = '%s' and xchan_network = 'activitypub'",
|
||||
dbesc($address),
|
||||
dbesc($apurl)
|
||||
);
|
||||
q("update hubloc set hubloc_addr = '%s' where hubloc_hash = '%s' and hubloc_network = 'activitypub'",
|
||||
dbesc($address),
|
||||
dbesc($apurl)
|
||||
);
|
||||
}
|
||||
return $apurl;
|
||||
}
|
||||
$ap = ActivityPub::discover($link['href']);
|
||||
if($ap) {
|
||||
return $ap;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(strpos($url,'http') === 0) {
|
||||
$ap = ActivityPub::discover($link['href']);
|
||||
if($ap) {
|
||||
return $ap;
|
||||
}
|
||||
}
|
||||
|
||||
logger('webfinger: ' . print_r($x,true), LOGGER_DATA, LOG_INFO);
|
||||
|
||||
$arr = [
|
||||
|
|
Loading…
Reference in a new issue