Merge remote-tracking branch 'upstream/2019.12-rc' into api-account

This commit is contained in:
Michael 2019-12-11 05:23:17 +00:00
commit 67b909922d
4 changed files with 37 additions and 4 deletions

View File

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 2019.12-dev (Dalmatian Bellflower)
-- DB_UPDATE_VERSION 1324
-- Friendica 2019.12-rc (Dalmatian Bellflower)
-- DB_UPDATE_VERSION 1325
-- ------------------------------------------
@ -66,6 +66,9 @@ CREATE TABLE IF NOT EXISTS `apcontact` (
`pubkey` text COMMENT '',
`baseurl` varchar(255) COMMENT 'baseurl of the ap contact',
`generator` varchar(255) COMMENT 'Name of the contact\'s system',
`following_count` int unsigned DEFAULT 0 COMMENT 'Number of following contacts',
`followers_count` int unsigned DEFAULT 0 COMMENT 'Number of followers',
`statuses_count` int unsigned DEFAULT 0 COMMENT 'Number of posts',
`updated` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT '',
PRIMARY KEY(`url`),
INDEX `addr` (`addr`(32)),

View File

@ -203,6 +203,33 @@ class APContact extends BaseObject
$apcontact['generator'] = JsonLD::fetchElement($compacted['as:generator'], 'as:name', '@value');
}
if (!empty($apcontact['following'])) {
$data = ActivityPub::fetchContent($apcontact['following']);
if (!empty($data)) {
if (!empty($data['totalItems'])) {
$apcontact['following_count'] = $data['totalItems'];
}
}
}
if (!empty($apcontact['followers'])) {
$data = ActivityPub::fetchContent($apcontact['followers']);
if (!empty($data)) {
if (!empty($data['totalItems'])) {
$apcontact['followers_count'] = $data['totalItems'];
}
}
}
if (!empty($apcontact['outbox'])) {
$data = ActivityPub::fetchContent($apcontact['outbox']);
if (!empty($data)) {
if (!empty($data['totalItems'])) {
$apcontact['statuses_count'] = $data['totalItems'];
}
}
}
// To-Do
// Unhandled

View File

@ -64,7 +64,7 @@ class Verify extends BaseModule
'$errors_label' => L10n::tt('Error', 'Errors', count(self::$errors)),
'$errors' => self::$errors,
'$recovery_message' => L10n::t('Dont have your phone? <a href="%s">Enter a two-factor recovery code</a>', '2fa/recovery'),
'$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'number'],
'$verify_code' => ['verify_code', L10n::t('Please enter a code from your authentication app'), '', '', 'required', 'autofocus placeholder="000000"', 'tel'],
'$verify_label' => L10n::t('Verify code and complete login'),
]);
}

View File

@ -34,7 +34,7 @@
use Friendica\Database\DBA;
if (!defined('DB_UPDATE_VERSION')) {
define('DB_UPDATE_VERSION', 1324);
define('DB_UPDATE_VERSION', 1325);
}
return [
@ -102,6 +102,9 @@ return [
"pubkey" => ["type" => "text", "comment" => ""],
"baseurl" => ["type" => "varchar(255)", "comment" => "baseurl of the ap contact"],
"generator" => ["type" => "varchar(255)", "comment" => "Name of the contact's system"],
"following_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of following contacts"],
"followers_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of followers"],
"statuses_count" => ["type" => "int unsigned", "default" => 0, "comment" => "Number of posts"],
"updated" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => ""]
],
"indexes" => [