Merge branch 'dev' into nomadic

This commit is contained in:
Mike Macgirvin 2024-04-17 16:18:02 +10:00
commit 8cb1b343f1
14 changed files with 81 additions and 15844 deletions

View file

@ -27,7 +27,7 @@ use Code\Lib\Url;
*/
const REPOSITORY_ID = 'streams';
const DB_UPDATE_VERSION = 1277;
const DB_UPDATE_VERSION = 1278;
const PROJECT_BASE = __DIR__;
const ACTIVITYPUB_ENABLED = true;
const NOMAD_PROTOCOL_VERSION = '13.3';

View file

@ -12,12 +12,6 @@
"activitypub"
],
"homepage": "http://codeberg.org/streams/streams/",
"repositories": [
{
"type": "vcs",
"url": "https://codeberg.org/streams/php-jcs"
}
],
"require": {
"php": ">=8.1",
"ext-curl": "*",
@ -52,7 +46,6 @@
"indieweb/rel-me": "^0.1.1",
"minishlink/web-push": "^8.0",
"stephenhill/base58": "^1.1",
"streams/php-jcs": "^1.0.1",
"phpmailer/phpmailer": "^6.9",
"league/oauth2-google": "^4.0",
"decomplexity/sendoauth2": "^3.0",
@ -82,7 +75,8 @@
"symfony/serializer": "^6.4",
"league/oauth2-server-bundle": "^0.8.0",
"symfony/messenger": "^6.4",
"symfony/notifier": "^6.4"
"symfony/notifier": "^6.4",
"root23/php-json-canonicalization": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "@stable",

15813
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -14,12 +14,7 @@ Note, in many cases this must be the same as the authenticated user email config
![Streams site settings](/doc/admin/en/images/site-settings.webp "Streams site settings")
## Step 2: Enable PHPMAILER
Navigate to the Streams root folder on the command line. Then enable the PHPMAILER plugin using this command:
```
./util/addons install phpmailer
```
## Step 3: Configure PHPMAILER
## Step 2: Configure PHPMAILER
The configuration depends on the SMTP service you are using. Here is a basic example:
<pre>// PHPMailer addon

View file

@ -148,7 +148,7 @@ function get_feed_for($channel, $observer_hash, $params)
'top' => $params['top'],
'cat' => $params['cat'],
'compat' => $params['compat'],
'noadd' => true
'noadd' => $params['noadd']
],
$channel,
$observer_hash,

View file

@ -248,6 +248,8 @@ function html2bbcode($message)
node2bbcode($doc, 'a', array('href' => '/(.+)/'), '[url=$1]', '[/url]');
node2bbcode($doc, 'img', array('src' => '/(.+)/', 'width' => '/(\d+)/', 'height' => '/(\d+)/', 'alt' => '/(.+)/'), '[img width=\'$2\' height=\'$3\' src=\'$1\' alt=\'$4\']', '[/img]');
node2bbcode($doc, 'img', array('src' => '/(.+)/', 'alt' => '/(.+)/'), '[img src=\'$1\' alt=\'$2\']', '[/img]');
node2bbcode($doc, 'img', array('src' => '/(.+)/', 'width' => '/(\d+)/', 'height' => '/(\d+)/'), '[img=$2x$3]$1', '[/img]');
node2bbcode($doc, 'img', array('src' => '/(.+)/'), '[img]$1', '[/img]');

View file

@ -4249,12 +4249,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
if (! (isset($arr['include_follow']) && intval($arr['include_follow']))) {
$item_normal .= " and not verb in ( 'Follow' , 'Ignore' ) ";
$item_normal .= " and verb not in ( 'Follow' , 'Ignore' ) ";
}
if (isset($arr['noadd']) && $arr['noadd']) {
$item_normal .= " and not verb in ('Add', 'Remove') ";
}
if (isset($arr['star']) && $arr['star']) {
$sql_options .= " and item_starred = 1 ";
@ -4422,6 +4419,11 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
$item_restrict = '';
}
if (isset($arr['noadd']) && $arr['noadd']) {
$item_restrict .= " and verb not in ('Add', 'Remove') ";
}
if (((isset($arr['compat']) && $arr['compat']) || ((isset($arr['nouveau']) && $arr['nouveau']) && ($client_mode & CLIENT_MODE_LOAD))) && $channel) {
// "New Item View" - show all items unthreaded in reverse created date order

View file

@ -617,8 +617,8 @@ CREATE TABLE IF NOT EXISTS `item` (
`item_delayed` tinyint NOT NULL DEFAULT 0 ,
`item_pending_remove` tinyint NOT NULL DEFAULT 0 ,
`item_blocked` tinyint NOT NULL DEFAULT 0 ,
`lat` float NOT NULL DEFAULT '0',
`lon` float NOT NULL DEFAULT '0',
`lat` double NOT NULL DEFAULT '0',
`lon` double NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
KEY `parent` (`parent`),
KEY `created` (`created`),

View file

@ -631,8 +631,8 @@ CREATE TABLE "item" (
"item_delayed" smallint NOT NULL DEFAULT '0',
"item_pending_remove" smallint NOT NULL DEFAULT '0',
"item_blocked" smallint NOT NULL DEFAULT '0',
"lat" float NOT NULL DEFAULT '0',
"lon" float NOT NULL DEFAULT '0',
"lat" double NOT NULL DEFAULT '0',
"lon" double NOT NULL DEFAULT '0',
"item_search_vector" tsvector,
PRIMARY KEY ("id")
);

View file

@ -889,8 +889,8 @@ class Activity
$place = (new Place())->setType('Place')
->setName(isset($item['location']) ? $item['location'] : null);
if ($item['lat'] || $item['lon']) {
$place->setLatitude(isset($item['lat']) ? $item['lat'] : 0)
->setLongitude(isset($item['lon']) ? $item['lon'] : 0);
$place->setLatitude(isset($item['lat']) ? number_format($item['lat'], 6) : 0)
->setLongitude(isset($item['lon']) ? number_format($item['lon'], 6) : 0);
}
$activity['location'] = $place->toArray();
}
@ -1206,7 +1206,8 @@ class Activity
if ($item['location'] || $item['lat'] || $item['lon']) {
$place = (new Place())->setType('Place')->setName(isset($item['location']) ? $item['location'] : null);
if ($item['lat'] || $item['lon']) {
$place->setLatitude(isset($item['lat']) ? $item['lat'] : 0)->setLongitude(isset($item['lon']) ? $item['lon'] : 0);
$place->setLatitude(isset($item['lat']) ? number_format($item['lat'], 6) : 0)
->setLongitude(isset($item['lon']) ? number_format($item['lon'], 6) : 0);
}
$activity['location'] = $place->toArray();
}

View file

@ -2,9 +2,10 @@
namespace Code\Lib;
use Mmccook\JsonCanonicalizator\JsonCanonicalizatorFactory;
use Root23\JsonCanonicalizer\JsonCanonicalizer;
use StephenHill\Base58;
class JcsEddsa2022
{
@ -94,8 +95,8 @@ class JcsEddsa2022
public function canonicalize($data)
{
$canonicalization = JsonCanonicalizatorFactory::getInstance();
return $canonicalization->canonicalize($data);
$canonicalizer = new JsonCanonicalizer();
return $canonicalizer->canonicalize($data);
}
}

View file

@ -908,6 +908,11 @@ class Libzot
$px = 1;
}
if (! empty($arr['did'])) {
// see if this system supports did and if this channel has been migrated already.
// If not, migrate it.
}
$x = xchan_store_lowlevel(
[
'xchan_hash' => $xchan_hash,
@ -3029,8 +3034,10 @@ class Libzot
// Communication details
$ret['id'] = $e['xchan_guid'];
$ret['id_sig'] = self::sign($e['xchan_guid'], $e['channel_prvkey']);
$ret['did'] = Channel::getDidResolver($e);
$primary = new Primary([
'address' => $e['xchan_addr'],

48
src/Update/_1278.php Normal file
View file

@ -0,0 +1,48 @@
<?php
namespace Code\Update;
class _1278
{
public function run()
{
q("START TRANSACTION");
if (ACTIVE_DBTYPE == DBTYPE_POSTGRES) {
$r1 = q("ALTER TABLE item ALTER COLUMN lat TYPE DOUBLE");
$r2 = q("ALTER TABLE item ALTER COLUMN lon TYPE DOUBLE");
$r = ($r1 && $r2);
}
else {
$r = q("ALTER TABLE `item`
CHANGE `lat` `lat` DOUBLE NOT NULL DEFAULT '0',
CHANGE `lon` `lon` DOUBLE NOT NULL DEFAULT '0'"
);
}
if ($r) {
q("COMMIT");
return UPDATE_SUCCESS;
}
q("ROLLBACK");
return UPDATE_FAILED;
}
public function verify()
{
$columns = db_columns('item');
if (in_array('lat', $columns) && in_array('lon', $columns)) {
return true;
}
return false;
}
}

View file

@ -1,2 +1,2 @@
<?php
define ('STD_VERSION', '24.04.11');
define ('STD_VERSION', '24.04.17');