Merge branch 'dev' into release

This commit is contained in:
Mike Macgirvin 2024-08-27 07:00:25 +10:00
commit ac87d73468
11 changed files with 101 additions and 99 deletions

View file

@ -2739,35 +2739,11 @@ function xchan_query(&$items, $abook = true, $effective_uid = 0)
}
}
function xchan_mail_query(&$item)
{
$arr = [];
$chans = null;
if ($item) {
if ($item['from_xchan'] && (! in_array("'" . dbesc($item['from_xchan']) . "'", $arr))) {
$arr[] = "'" . dbesc($item['from_xchan']) . "'";
}
if ($item['to_xchan'] && (! in_array("'" . dbesc($item['to_xchan']) . "'", $arr))) {
$arr[] = "'" . dbesc($item['to_xchan']) . "'";
}
}
if (count($arr)) {
$chans = q("select xchan.*,hubloc.* from xchan left join hubloc on hubloc_hash = xchan_hash
where xchan_hash in (" . protect_sprintf(implode(',', $arr)) . ") and hubloc_primary = 1 and hubloc_deleted = 0");
}
if ($chans) {
$item['from'] = find_xchan_in_array($item['from_xchan'], $chans);
$item['to'] = find_xchan_in_array($item['to_xchan'], $chans);
}
}
function find_xchan_in_array($xchan, $arr)
{
if (count($arr)) {
foreach ($arr as $x) {
if ($x['xchan_hash'] === $xchan) {
if (strtolower($x['xchan_hash']) === strtolower($xchan)) {
return $x;
}
}

View file

@ -26,10 +26,7 @@ class Poller implements DaemonInterface
}
}
$interval = intval(get_config('system', 'poll_interval'));
if (! $interval) {
$interval = ((get_config('system', 'delivery_interval') === false) ? 3 : intval(get_config('system', 'delivery_interval')));
}
$interval = intval(get_config('system', 'poll_interval', 3));
// Check for a lockfile. If it exists, but is over an hour old, it's stale. Ignore it.
$lockfile = 'cache/poller';

View file

@ -2440,6 +2440,7 @@ class Activity
return;
}
$actorIdUrl = $url;
$actorId = new ActorId($url);
$url = $actorId->getId();
$isDid = in_array($actorId->getType(), [ActorId::ACTORID_TYPE_DIDKEY, ActorId::ACTORID_TYPE_DIDWEB]);
@ -2621,7 +2622,7 @@ class Activity
// create a new record
xchan_store_lowlevel( [
'xchan_hash' => $url,
'xchan_guid' => $url,
'xchan_guid' => $actorIdUrl,
'xchan_pubkey' => $pubkey,
'xchan_epubkey' => $epubkey,
'xchan_addr' => $webfingerAddress,

View file

@ -264,13 +264,15 @@ class ActivityPub
$orig_follow_type = get_abconfig($x['sender']['channel_id'], $x['recipient']['xchan_hash'], 'activitypub', 'their_follow_type');
$locations = Activity::get_actor_hublocs($x['recipient']['xchan_hash'], 'activitypub, not_deleted');
$isNomadic = PConfig::Get($x['sender']['channel_id'], 'system', 'nomadicAP');
$rootPath = (($isNomadic) ? Channel::getDidResolver($x['sender']) : z_root());
if ($locations) {
foreach ($locations as $location) {
$msg = array_merge(
Activity::ap_context(),
[
'id' => z_root() . '/follow/' . $x['recipient']['abook_id'] . (($orig_follow) ? '/' . md5($orig_follow) : EMPTY_STR),
'id' => $rootPath . '/follow/' . $x['recipient']['abook_id'] . (($orig_follow) ? '/' . md5($orig_follow) : EMPTY_STR),
'type' => (($orig_follow_type) ?: 'Follow'),
'actor' => $p,
'object' => $location['hubloc_id_url'],
@ -339,20 +341,21 @@ class ActivityPub
if (!$p) {
return;
}
$isNomadic = PConfig::Get($x['sender']['channel_id'], 'system', 'nomadicAP');
$rootPath = (($isNomadic) ? Channel::getDidResolver($x['sender']) : z_root());
$msg = array_merge(
Activity::ap_context(),
[
'id' => z_root() . '/follow/' . $x['recipient']['abook_id'] . '/' . md5($accept),
'id' => $rootPath . '/follow/' . $x['recipient']['abook_id'] . '/' . md5($accept),
'type' => 'Accept',
'actor' => $p,
'object' => [
'type' => (($follow_type) ?: 'Follow'),
'id' => $accept,
'actor' => $x['recipient']['xchan_hash'],
'actor' => $x['recipient']['xchan_guid'],
'object' => Channel::getDidResolver($x['sender'], true)
],
'to' => [$x['recipient']['xchan_hash']],
'to' => [$x['recipient']['xchan_guid']],
'cc' => []
]
);
@ -384,15 +387,17 @@ class ActivityPub
return;
}
$isNomadic = PConfig::Get($x['sender']['channel_id'], 'system', 'nomadicAP');
$msg = array_merge(
Activity::ap_context(),
[
'id' => z_root() . '/channel/' . $x['sender']['channel_address'] . '#update',
'id' => Channel::getDidResolver($x['sender'], true) . '#update',
'type' => 'Update',
'updated' => Time::convert(format: ISO8601),
'actor' => $p,
'object' => z_root() . '/channel/' . $x['sender']['channel_address'],
'to' => [z_root() . '/followers/' . $x['sender']['channel_address']],
'object' => Channel::getDidResolver($x['sender'], true),
'to' => [($isNomadic) ? Channel::getDidResolver($x['sender']) . 'actor/followers' : z_root() . '/followers/' . $x['sender']['channel_address']],
'cc' => [ACTIVITY_PUBLIC_INBOX]
]
);
@ -439,6 +444,9 @@ class ActivityPub
return;
}
$isNomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP');
$rootPath = (($isNomadic) ? Channel::getDidResolver($channel) : z_root());
// send an unfollow activity to the followee's inbox
$orig_activity = get_abconfig($recip[0]['abook_channel'], $recip[0]['xchan_hash'], 'activitypub', 'follow_id');
@ -446,19 +454,20 @@ class ActivityPub
if ($orig_activity && $recip[0]['abook_pending']) {
// was never approved
$msg = array_merge(
Activity::ap_context(),
[
'id' => z_root() . '/follow/' . $recip[0]['abook_id'] . '/' . md5($orig_activity) . '?operation=reject',
'id' => $rootPath . '/follow/' . $recip[0]['abook_id'] . '/' . md5($orig_activity) . '?operation=reject',
'type' => 'Reject',
'actor' => $p,
'object' => [
'type' => 'Follow',
'id' => $orig_activity,
'actor' => $recip[0]['xchan_hash'],
'actor' => $recip[0]['xchan_guid'],
'object' => $p
],
'to' => [$recip[0]['xchan_hash']],
'to' => [$recip[0]['xchan_guid']],
'cc' => []
]
);
@ -469,16 +478,16 @@ class ActivityPub
$msg = array_merge(
Activity::ap_context(),
[
'id' => z_root() . '/follow/' . $recip[0]['abook_id'] . (($orig_activity) ? '/' . md5($orig_activity) : EMPTY_STR) . '?operation=unfollow',
'id' => $rootPath . '/follow/' . $recip[0]['abook_id'] . (($orig_activity) ? '/' . md5($orig_activity) : EMPTY_STR) . '?operation=unfollow',
'type' => 'Undo',
'actor' => $p,
'object' => [
'id' => z_root() . '/follow/' . $recip[0]['abook_id'] . (($orig_activity) ? '/' . md5($orig_activity) : EMPTY_STR),
'id' => $rootPath . '/follow/' . $recip[0]['abook_id'] . (($orig_activity) ? '/' . md5($orig_activity) : EMPTY_STR),
'type' => 'Follow',
'actor' => $p,
'object' => $recip[0]['xchan_hash']
'object' => $recip[0]['xchan_guid']
],
'to' => [$recip[0]['xchan_hash']],
'to' => [$recip[0]['xchan_guid']],
'cc' => []
]
);

View file

@ -2080,10 +2080,13 @@ class Channel
return self::getDid($channel);
}
public static function getVerifier($channel)
public static function getVerifier($channel, $id = '')
{
$pubkey = (new Multibase())->publicKey($channel['channel_epubkey']);
$nomadic = PConfig::Get($channel['channel_id'], 'system', 'nomadicAP');
if (!str_contains($id, '/.well-known/apgateway/')) {
$nomadic = false;
}
return (($nomadic) ? Channel::getDid($channel) : Channel::url($channel) . '#' . $pubkey);
}

View file

@ -26,7 +26,7 @@ class JcsEddsa2022
'type' => 'DataIntegrityProof',
'cryptosuite' => 'eddsa-jcs-2022',
'created' => Time::convert(format: ISO8601),
'verificationMethod' => Channel::getVerifier($channel),
'verificationMethod' => Channel::getVerifier($channel, $data['id'] ?? ''),
'proofPurpose' => 'assertionMethod',
];

View file

@ -3,6 +3,7 @@
namespace Code\Module;
use App;
use Code\Lib\PConfig;
use Code\Web\Controller;
use Code\Lib\Libsync;
use Code\Lib\ActivityStreams;
@ -48,12 +49,13 @@ class Follow extends Controller
$orig_follow = get_abconfig($chan['channel_id'], $r[0]['xchan_hash'], 'activitypub', 'their_follow_id');
$orig_follow_type = get_abconfig($chan['channel_id'], $r[0]['xchan_hash'], 'activitypub', 'their_follow_type');
$isNomadic = PConfig::Get($chan['channel_id'], 'system', 'nomadicAP');
$rootPath = (($isNomadic) ? Channel::getDidResolver($chan) : z_root());
as_return_and_die([
'id' => z_root() . '/follow/' . $r[0]['abook_id'] . (($orig_follow) ? '/' . md5($orig_follow) : EMPTY_STR),
'id' => $rootPath . '/follow/' . $r[0]['abook_id'] . (($orig_follow) ? '/' . md5($orig_follow) : EMPTY_STR),
'type' => (($orig_follow_type) ?: 'Follow'),
'actor' => $actor,
'object' => $r[0]['xchan_url']
'object' => $r[0]['xchan_guid']
], $chan);
}
@ -146,7 +148,7 @@ class Follow extends Controller
info(t('Connection added.') . EOL);
Channel::abook_sync($channel, $result['abook']);
$can_view_stream = their_perms_contains($channel['channel_id'], $clone['abook_xchan'], 'view_stream');
$can_view_stream = their_perms_contains($channel['channel_id'], $result['abook']['abook_xchan'], 'view_stream');
// If we can view their stream, pull in some posts

View file

@ -0,0 +1,14 @@
<?php
namespace Code\Module;
use Code\Web\Controller;
class Privacy_policy extends Controller
{
public function init()
{
goaway('/legal');
}
}

View file

@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: 24.08.20\n"
"Project-Id-Version: 24.08.27\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-20 16:51+1000\n"
"POT-Creation-Date: 2024-08-27 06:59+1000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -42,7 +42,7 @@ msgstr ""
msgid "Login"
msgstr ""
#: boot.php:1128 src/Module/Rmagic.php:88 src/Lib/Channel.php:2205
#: boot.php:1128 src/Module/Rmagic.php:88 src/Lib/Channel.php:2208
msgid "Remote Authentication"
msgstr ""
@ -892,7 +892,7 @@ msgstr ""
#: include/conversation.php:959 include/attach.php:1380 include/attach.php:1401
#: src/Module/Embedphotos.php:380 src/Module/Photos.php:856
#: src/Module/Photos.php:1324 src/Module/Cdav.php:877 src/Module/Cdav.php:878
#: src/Module/Cdav.php:884 src/Lib/Activity.php:2459 src/Lib/Apps.php:1261
#: src/Module/Cdav.php:884 src/Lib/Activity.php:2460 src/Lib/Apps.php:1261
#: src/Lib/Apps.php:1352 src/Widget/Portfolio.php:110 src/Widget/Album.php:100
#: src/Storage/Browser.php:183
msgid "Unknown"
@ -1418,8 +1418,8 @@ msgstr ""
msgid "Visible to specific connections."
msgstr ""
#: include/items.php:3093 include/misc.php:1720 include/misc.php:3217
#: src/Lib/Activity.php:4067
#: include/items.php:3093 include/misc.php:1720 include/misc.php:3193
#: src/Lib/Activity.php:4068
#, php-format
msgid "%1$s (%2$s)"
msgstr ""
@ -1480,17 +1480,17 @@ msgstr ""
msgid "profile photo"
msgstr ""
#: include/items.php:4907
#: include/items.php:4909
#, php-format
msgid "[Edited %s]"
msgstr ""
#: include/items.php:4907
#: include/items.php:4909
msgctxt "edit_activity"
msgid "Post"
msgstr ""
#: include/items.php:4907
#: include/items.php:4909
msgctxt "edit_activity"
msgid "Comment"
msgstr ""
@ -2341,97 +2341,97 @@ msgstr ""
msgid "a-z, 0-9, -, and _ only"
msgstr ""
#: include/misc.php:2911
#: include/misc.php:2887
msgid "Design Tools"
msgstr ""
#: include/misc.php:2914 src/Module/Blocks.php:167
#: include/misc.php:2890 src/Module/Blocks.php:167
msgid "Blocks"
msgstr ""
#: include/misc.php:2915 src/Module/Menu.php:177
#: include/misc.php:2891 src/Module/Menu.php:177
msgid "Menus"
msgstr ""
#: include/misc.php:2916 src/Module/Layouts.php:200
#: include/misc.php:2892 src/Module/Layouts.php:200
msgid "Layouts"
msgstr ""
#: include/misc.php:2917
#: include/misc.php:2893
msgid "Pages"
msgstr ""
#: include/misc.php:2939 src/Module/Cal.php:352
#: include/misc.php:2915 src/Module/Cal.php:352
msgid "Import"
msgstr ""
#: include/misc.php:2940
#: include/misc.php:2916
msgid "Import website..."
msgstr ""
#: include/misc.php:2941
#: include/misc.php:2917
msgid "Select folder to import"
msgstr ""
#: include/misc.php:2942
#: include/misc.php:2918
msgid "Import from a zipped folder:"
msgstr ""
#: include/misc.php:2943
#: include/misc.php:2919
msgid "Import from cloud files:"
msgstr ""
#: include/misc.php:2944
#: include/misc.php:2920
msgid "/cloud/channel/path/to/folder"
msgstr ""
#: include/misc.php:2945
#: include/misc.php:2921
msgid "Enter path to website files"
msgstr ""
#: include/misc.php:2946
#: include/misc.php:2922
msgid "Select folder"
msgstr ""
#: include/misc.php:2947
#: include/misc.php:2923
msgid "Export website..."
msgstr ""
#: include/misc.php:2948
#: include/misc.php:2924
msgid "Export to a zip file"
msgstr ""
#: include/misc.php:2949
#: include/misc.php:2925
msgid "website.zip"
msgstr ""
#: include/misc.php:2950
#: include/misc.php:2926
msgid "Enter a name for the zip file."
msgstr ""
#: include/misc.php:2951
#: include/misc.php:2927
msgid "Export to cloud files"
msgstr ""
#: include/misc.php:2952
#: include/misc.php:2928
msgid "/path/to/export/folder"
msgstr ""
#: include/misc.php:2953
#: include/misc.php:2929
msgid "Enter a path to a cloud files destination."
msgstr ""
#: include/misc.php:2954
#: include/misc.php:2930
msgid "Specify folder"
msgstr ""
#: include/misc.php:3360 src/Module/Directory.php:455 src/Module/Manage.php:85
#: include/misc.php:3336 src/Module/Directory.php:455 src/Module/Manage.php:85
#: src/Module/Manage.php:198 src/Module/Manage.php:211
#: src/Storage/Browser.php:149
msgid "Collection"
msgstr ""
#: include/misc.php:3673 src/Module/Admin/Site.php:204
#: include/misc.php:3649 src/Module/Admin/Site.php:204
#: view/theme/fresh/php/config.php:22 view/theme/redbasic/php/config.php:22
msgid "Default"
msgstr ""
@ -3350,7 +3350,7 @@ msgstr ""
msgid "Restricted or Premium Channel"
msgstr ""
#: src/Module/Follow.php:146
#: src/Module/Follow.php:148
msgid "Connection added."
msgstr ""
@ -3449,7 +3449,7 @@ msgstr ""
msgid "Profile Visibility Editor"
msgstr ""
#: src/Module/Profperm.php:131 src/Lib/Activity.php:3407 src/Lib/Apps.php:439
#: src/Module/Profperm.php:131 src/Lib/Activity.php:3408 src/Lib/Apps.php:439
#: src/Lib/Libprofile.php:753
msgid "Profile"
msgstr ""
@ -7470,11 +7470,11 @@ msgstr ""
msgid "Authentication failed."
msgstr ""
#: src/Module/Rmagic.php:89 src/Lib/Channel.php:2206
#: src/Module/Rmagic.php:89 src/Lib/Channel.php:2209
msgid "Enter your channel address (e.g. channel@example.com)"
msgstr ""
#: src/Module/Rmagic.php:92 src/Lib/Channel.php:2207
#: src/Module/Rmagic.php:92 src/Lib/Channel.php:2210
msgid "Authenticate"
msgstr ""
@ -9860,51 +9860,51 @@ msgstr ""
msgid "Quoted post"
msgstr ""
#: src/Lib/Activity.php:3405
#: src/Lib/Activity.php:3406
msgid "Activity"
msgstr ""
#: src/Lib/Activity.php:3413
#: src/Lib/Activity.php:3414
#, php-format
msgid "Likes %1$s's %2$s"
msgstr ""
#: src/Lib/Activity.php:3416
#: src/Lib/Activity.php:3417
#, php-format
msgid "Doesn't like %1$s's %2$s"
msgstr ""
#: src/Lib/Activity.php:3419
#: src/Lib/Activity.php:3420
#, php-format
msgid "Flagged %1$s's %2$s"
msgstr ""
#: src/Lib/Activity.php:3422
#: src/Lib/Activity.php:3423
#, php-format
msgid "Blocked %1$s's %2$s"
msgstr ""
#: src/Lib/Activity.php:3428
#: src/Lib/Activity.php:3429
#, php-format
msgid "Will attend %s's event"
msgstr ""
#: src/Lib/Activity.php:3431
#: src/Lib/Activity.php:3432
#, php-format
msgid "Will not attend %s's event"
msgstr ""
#: src/Lib/Activity.php:3434
#: src/Lib/Activity.php:3435
#, php-format
msgid "May attend %s's event"
msgstr ""
#: src/Lib/Activity.php:3437
#: src/Lib/Activity.php:3438
#, php-format
msgid "May not attend %s's event"
msgstr ""
#: src/Lib/Activity.php:3443
#: src/Lib/Activity.php:3444
#, php-format
msgid "&#x1f4e2; Repeated %1$s's %2$s"
msgstr ""

View file

@ -1,2 +1,2 @@
<?php
define ('STD_VERSION', '24.08.22');
define ('STD_VERSION', '24.08.27');