2 Commits

10 changed files with 31 additions and 37 deletions

View File

@@ -27,7 +27,7 @@ PHP modules
The following software packages are *required* for this software to The following software packages are *required* for this software to
run correctly. run correctly.
- PHP 7.3+ - PHP 7.4+
- MariaDB 10.3+ - MariaDB 10.3+
- Web server Apache, lighttpd and nginx will all work. CGI mode is - Web server Apache, lighttpd and nginx will all work. CGI mode is
recommended and also some variant of 'suexec' (or a recommended and also some variant of 'suexec' (or a

View File

@@ -4,7 +4,7 @@
"type": "project", "type": "project",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"require": { "require": {
"php": "^7.3.0", "php": "^7.4.0",
"ext-bcmath": "*", "ext-bcmath": "*",
"ext-ctype": "*", "ext-ctype": "*",
"ext-curl": "*", "ext-curl": "*",

6
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "f7c49732f6b0c37b67e783fc0d5535d2", "content-hash": "ffd21e90500734effbec6791af16994c",
"packages": [ "packages": [
{ {
"name": "alchemy/binary-driver", "name": "alchemy/binary-driver",
@@ -6869,7 +6869,7 @@
"prefer-stable": true, "prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": { "platform": {
"php": "^7.3.0", "php": "^7.4.0",
"ext-bcmath": "*", "ext-bcmath": "*",
"ext-ctype": "*", "ext-ctype": "*",
"ext-curl": "*", "ext-curl": "*",
@@ -6885,7 +6885,7 @@
}, },
"platform-dev": [], "platform-dev": [],
"platform-overrides": { "platform-overrides": {
"php": "7.3.0" "php": "7.4.0"
}, },
"plugin-api-version": "2.0.0" "plugin-api-version": "2.0.0"
} }

View File

@@ -34,7 +34,7 @@ define('GNUSOCIAL_ENGINE', 'GNU social');
define('GNUSOCIAL_ENGINE_URL', 'https://gnusocial.rocks/'); define('GNUSOCIAL_ENGINE_URL', 'https://gnusocial.rocks/');
define('GNUSOCIAL_ENGINE_REPO_URL', 'https://notabug.org/diogo/gnu-social/'); // Change to https://git.gnu.io/gnu/gnu-social define('GNUSOCIAL_ENGINE_REPO_URL', 'https://notabug.org/diogo/gnu-social/'); // Change to https://git.gnu.io/gnu/gnu-social
define('GNUSOCIAL_BASE_VERSION', '2.0.0'); define('GNUSOCIAL_BASE_VERSION', '2.0.1');
define('GNUSOCIAL_LIFECYCLE', 'beta0'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release' define('GNUSOCIAL_LIFECYCLE', 'beta0'); // 'dev', 'alpha[0-9]+', 'beta[0-9]+', 'rc[0-9]+', 'release'
define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE); define('GNUSOCIAL_VERSION', GNUSOCIAL_BASE_VERSION . '-' . GNUSOCIAL_LIFECYCLE);

View File

@@ -112,8 +112,8 @@ abstract class Installer
} }
} }
if (version_compare(PHP_VERSION, '7.3.0', '<')) { if (version_compare(PHP_VERSION, '7.4.0', '<')) {
$this->warning('Require PHP version 7.3.0 or greater.'); $this->warning('Require PHP version 7.4.0 or greater.');
$pass = false; $pass = false;
} }

View File

@@ -27,16 +27,6 @@
defined('GNUSOCIAL') || die; defined('GNUSOCIAL') || die;
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
function password_algos(): array
{
$algos = [PASSWORD_BCRYPT];
defined('PASSWORD_ARGON2I') && $algos[] = PASSWORD_ARGON2I;
defined('PASSWORD_ARGON2ID') && $algos[] = PASSWORD_ARGON2ID;
return $algos;
}
}
class AuthCryptModule extends AuthenticationModule class AuthCryptModule extends AuthenticationModule
{ {
const MODULE_VERSION = '2.0.0'; const MODULE_VERSION = '2.0.0';

View File

@@ -167,12 +167,19 @@ class Activitypub_notice
$act->time = time(); $act->time = time();
$act->actor = $actor_profile->asActivityObject(); $act->actor = $actor_profile->asActivityObject();
$act->context = new ActivityContext(); $act->context = new ActivityContext();
$options = ['source' => 'ActivityPub',
[$note_type, $note_scope] = self::getNotePolicy($object, $actor_profile);
$options = [
'source' => 'ActivityPub',
'uri' => $id, 'uri' => $id,
'url' => $url, 'url' => $url,
'is_local' => self::getNotePolicyType($object, $actor_profile)]; 'is_local' => $note_type,
'scope' => $note_scope,
];
if ($directMessage) { if ($directMessage) {
$options['is_local'] = Notice::GATEWAY;
$options['scope'] = Notice::MESSAGE_SCOPE; $options['scope'] = Notice::MESSAGE_SCOPE;
} }
@@ -364,20 +371,17 @@ class Activitypub_notice
* *
* @param array $note received Note * @param array $note received Note
* @param Profile $actor_profile Note author * @param Profile $actor_profile Note author
* @return int Notice policy type * @return [int NoteType, ?int NoteScope] Notice policy type
* @author Bruno Casteleiro <brunoccast@fc.up.pt> * @author Bruno Casteleiro <brunoccast@fc.up.pt>
*/ */
public static function getNotePolicyType(array $note, Profile $actor_profile): int public static function getNotePolicy(array $note, Profile $actor_profile): array
{ {
$addressee = array_unique(array_merge($note['to'], $note['cc'])); if (in_array('https://www.w3.org/ns/activitystreams#Public', $note['to'])) { // Public: Visible for all, shown in public feeds
if (in_array('https://www.w3.org/ns/activitystreams#Public', $addressee)) { return [$actor_profile->isLocal() ? Notice::LOCAL_PUBLIC : Notice::REMOTE, null];
return $actor_profile->isLocal() ? Notice::LOCAL_PUBLIC : Notice::REMOTE; } elseif (in_array('https://www.w3.org/ns/activitystreams#Public', $note['cc'])) { // Unlisted: Visible for all but not shown in public feeds
} else { return [$actor_profile->isLocal() ? Notice::LOCAL_NONPUBLIC : Notice::GATEWAY, null];
// either an unlisted or followers-only note, we'll handle } else { // Either Followers-only or Direct (but this function isn't used for direct)
// both as a GATEWAY notice since this type is not visible return [$actor_profile->isLocal() ? Notice::LOCAL_NONPUBLIC : Notice::REMOTE, Notice::FOLLOWER_SCOPE];
// from the public timelines, hence partially enough while
// we don't have subscription_policy working.
return Notice::GATEWAY;
} }
} }
} }

View File

@@ -30,7 +30,7 @@ class InstalledVersions
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'cd3a9ec6a9a22fb3b46a293be7223f86b0006f24', 'reference' => '7d8988d50ce24639daaf48608ce14d91291a519d',
'name' => 'gnusocial/gnusocial', 'name' => 'gnusocial/gnusocial',
), ),
'versions' => 'versions' =>
@@ -114,7 +114,7 @@ class InstalledVersions
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'cd3a9ec6a9a22fb3b46a293be7223f86b0006f24', 'reference' => '7d8988d50ce24639daaf48608ce14d91291a519d',
), ),
'guzzlehttp/psr7' => 'guzzlehttp/psr7' =>
array ( array (

View File

@@ -6,7 +6,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'cd3a9ec6a9a22fb3b46a293be7223f86b0006f24', 'reference' => '7d8988d50ce24639daaf48608ce14d91291a519d',
'name' => 'gnusocial/gnusocial', 'name' => 'gnusocial/gnusocial',
), ),
'versions' => 'versions' =>
@@ -90,7 +90,7 @@
'aliases' => 'aliases' =>
array ( array (
), ),
'reference' => 'cd3a9ec6a9a22fb3b46a293be7223f86b0006f24', 'reference' => '7d8988d50ce24639daaf48608ce14d91291a519d',
), ),
'guzzlehttp/psr7' => 'guzzlehttp/psr7' =>
array ( array (

View File

@@ -4,8 +4,8 @@
$issues = array(); $issues = array();
if (!(PHP_VERSION_ID >= 70300)) { if (!(PHP_VERSION_ID >= 70400)) {
$issues[] = 'Your Composer dependencies require a PHP version ">= 7.3.0". You are running ' . PHP_VERSION . '.'; $issues[] = 'Your Composer dependencies require a PHP version ">= 7.4.0". You are running ' . PHP_VERSION . '.';
} }
if ($issues) { if ($issues) {