sforkowany z mirror/social
align upstream
commit
195d6f54f8
33
Makefile
33
Makefile
|
@ -11,9 +11,7 @@ package_name=$(app_name)
|
||||||
cert_dir=$(HOME)/.nextcloud/certificates
|
cert_dir=$(HOME)/.nextcloud/certificates
|
||||||
github_account=nextcloud
|
github_account=nextcloud
|
||||||
branch=master
|
branch=master
|
||||||
version+=0.4.2
|
version+=0.5.0-beta3
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
all: dev-setup lint build-js-production composer test
|
all: dev-setup lint build-js-production composer test
|
||||||
|
@ -65,6 +63,7 @@ clean-dev:
|
||||||
rm -rf node_modules
|
rm -rf node_modules
|
||||||
|
|
||||||
composer:
|
composer:
|
||||||
|
<<<<<<< HEAD
|
||||||
composer install --prefer-dist --ignore-platform-req=ext-gd
|
composer install --prefer-dist --ignore-platform-req=ext-gd
|
||||||
composer update --prefer-dist --ignore-platform-req=ext-gd
|
composer update --prefer-dist --ignore-platform-req=ext-gd
|
||||||
|
|
||||||
|
@ -86,12 +85,30 @@ github-upload:
|
||||||
--tag v$(version) \
|
--tag v$(version) \
|
||||||
--name "$(app_name)-$(version).tar.gz" \
|
--name "$(app_name)-$(version).tar.gz" \
|
||||||
--file $(build_dir)/$(app_name)-$(version).tar.gz
|
--file $(build_dir)/$(app_name)-$(version).tar.gz
|
||||||
|
=======
|
||||||
|
composer install --prefer-dist --no-dev
|
||||||
|
composer upgrade --prefer-dist --no-dev
|
||||||
|
|
||||||
|
composer-dev:
|
||||||
|
composer install --prefer-dist --dev
|
||||||
|
composer upgrade --prefer-dist --dev
|
||||||
|
|
||||||
|
release: appstore
|
||||||
|
>>>>>>> 72be81700039485ac4ef71fecd62eee969bc4a91
|
||||||
|
|
||||||
# creating .tar.gz + signature
|
# creating .tar.gz + signature
|
||||||
appstore: dev-setup lint build-js-production
|
appstore: dev-setup lint build-js-production composer
|
||||||
mkdir -p $(sign_dir)
|
mkdir -p $(sign_dir)
|
||||||
rsync -a \
|
rsync -a \
|
||||||
--exclude=/build \
|
--exclude=/build \
|
||||||
|
--exclude=/babel.config.js \
|
||||||
|
--exclude=/cypress.json \
|
||||||
|
--exclude=/.php-cs-fixer.cache \
|
||||||
|
--exclude=/.nextcloudignore \
|
||||||
|
--exclude=/.php-cs-fixer.dist.php \
|
||||||
|
--exclude=/psalm.xml \
|
||||||
|
--exclude=/cypress.json \
|
||||||
|
--exclude=/cypress \
|
||||||
--exclude=/docs \
|
--exclude=/docs \
|
||||||
--exclude=/translationfiles \
|
--exclude=/translationfiles \
|
||||||
--exclude=/.tx \
|
--exclude=/.tx \
|
||||||
|
@ -111,6 +128,7 @@ appstore: dev-setup lint build-js-production
|
||||||
--exclude=/l10n/l10n.pl \
|
--exclude=/l10n/l10n.pl \
|
||||||
--exclude=/CONTRIBUTING.md \
|
--exclude=/CONTRIBUTING.md \
|
||||||
--exclude=/issue_template.md \
|
--exclude=/issue_template.md \
|
||||||
|
--exclude=/krankerl.toml \
|
||||||
--exclude=/README.md \
|
--exclude=/README.md \
|
||||||
--exclude=/.gitattributes \
|
--exclude=/.gitattributes \
|
||||||
--exclude=/.gitignore \
|
--exclude=/.gitignore \
|
||||||
|
@ -118,9 +136,6 @@ appstore: dev-setup lint build-js-production
|
||||||
--exclude=/.travis.yml \
|
--exclude=/.travis.yml \
|
||||||
--exclude=/Makefile \
|
--exclude=/Makefile \
|
||||||
$(project_dir)/ $(sign_dir)/$(app_name)
|
$(project_dir)/ $(sign_dir)/$(app_name)
|
||||||
tar -czf $(build_dir)/$(app_name)-$(version).tar.gz \
|
tar -czf $(build_dir)/$(app_name).tar.gz \
|
||||||
-C $(sign_dir) $(app_name)
|
-C $(sign_dir) $(app_name)
|
||||||
@if [ -f $(cert_dir)/$(app_name).key ]; then \
|
|
||||||
echo "Signing package…"; \
|
|
||||||
openssl dgst -sha512 -sign $(cert_dir)/$(app_name).key $(build_dir)/$(app_name)-$(version).tar.gz | openssl base64; \
|
|
||||||
fi
|
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
**🕸 Open standards:** We use the established ActivityPub standard!
|
**🕸 Open standards:** We use the established ActivityPub standard!
|
||||||
]]></description>
|
]]></description>
|
||||||
<version>0.5.0-beta</version>
|
<version>0.5.0-beta3</version>
|
||||||
<licence>agpl</licence>
|
<licence>agpl</licence>
|
||||||
<author mail="maxence@artificial-owl.com" homepage="https://artificial-owl.com/">Maxence Lange</author>
|
<author mail="maxence@artificial-owl.com" homepage="https://artificial-owl.com/">Maxence Lange</author>
|
||||||
<author mail="jus@bitgrid.net">Julius Härtl</author>
|
<author mail="jus@bitgrid.net">Julius Härtl</author>
|
||||||
|
|
|
@ -70,6 +70,7 @@ return [
|
||||||
['name' => 'OAuth#nodeinfo2', 'url' => '/.well-known/nodeinfo/2.0', 'verb' => 'GET'],
|
['name' => 'OAuth#nodeinfo2', 'url' => '/.well-known/nodeinfo/2.0', 'verb' => 'GET'],
|
||||||
['name' => 'OAuth#apps', 'url' => '/api/v1/apps', 'verb' => 'POST'],
|
['name' => 'OAuth#apps', 'url' => '/api/v1/apps', 'verb' => 'POST'],
|
||||||
['name' => 'OAuth#authorize', 'url' => '/oauth/authorize', 'verb' => 'GET'],
|
['name' => 'OAuth#authorize', 'url' => '/oauth/authorize', 'verb' => 'GET'],
|
||||||
|
['name' => 'OAuth#authorizing', 'url' => '/oauth/authorize', 'verb' => 'POST'],
|
||||||
['name' => 'OAuth#token', 'url' => '/oauth/token', 'verb' => 'POST'],
|
['name' => 'OAuth#token', 'url' => '/oauth/token', 'verb' => 'POST'],
|
||||||
|
|
||||||
// Api for 3rd party
|
// Api for 3rd party
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[package]
|
|
||||||
before_cmds = [
|
|
||||||
'npm ci',
|
|
||||||
'npm run build'
|
|
||||||
]
|
|
|
@ -48,6 +48,7 @@ OC.L10N.register(
|
||||||
"Delete" : "Löschen",
|
"Delete" : "Löschen",
|
||||||
"Edit" : "Bearbeiten",
|
"Edit" : "Bearbeiten",
|
||||||
"No description added" : "Keine Beschreibung hinzugefügt",
|
"No description added" : "Keine Beschreibung hinzugefügt",
|
||||||
|
"Describe for the visually impaired" : "Für Sehbehinderte beschreiben",
|
||||||
"Close" : "Schließen",
|
"Close" : "Schließen",
|
||||||
"Unfollow" : "Entfolgen",
|
"Unfollow" : "Entfolgen",
|
||||||
"Follow" : "Folgen",
|
"Follow" : "Folgen",
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
"Delete" : "Löschen",
|
"Delete" : "Löschen",
|
||||||
"Edit" : "Bearbeiten",
|
"Edit" : "Bearbeiten",
|
||||||
"No description added" : "Keine Beschreibung hinzugefügt",
|
"No description added" : "Keine Beschreibung hinzugefügt",
|
||||||
|
"Describe for the visually impaired" : "Für Sehbehinderte beschreiben",
|
||||||
"Close" : "Schließen",
|
"Close" : "Schließen",
|
||||||
"Unfollow" : "Entfolgen",
|
"Unfollow" : "Entfolgen",
|
||||||
"Follow" : "Folgen",
|
"Follow" : "Folgen",
|
||||||
|
|
|
@ -91,7 +91,7 @@ OC.L10N.register(
|
||||||
"User not found" : "Utilisateur introuvable",
|
"User not found" : "Utilisateur introuvable",
|
||||||
"Sorry, we could not find the account of {userId}" : "Désolé, impossible de trouver l'utilisateur {userId}",
|
"Sorry, we could not find the account of {userId}" : "Désolé, impossible de trouver l'utilisateur {userId}",
|
||||||
"Nextcloud becomes part of the federated social networks!" : "Nextcloud fait maintenant partie des réseaux sociaux fédérés !",
|
"Nextcloud becomes part of the federated social networks!" : "Nextcloud fait maintenant partie des réseaux sociaux fédérés !",
|
||||||
"We automatically created a Social account for you. Your Social ID is the same as your Federated Cloud ID:" : "Nous avons automatiquement créé un compte social pour vous. Votre identifiant social est le même que votre identifiant de cloud fédéré :",
|
"We automatically created a Social account for you. Your Social ID is the same as your Federated Cloud ID:" : "Nous avons automatiquement créé un compte social pour vous. Votre identifiant social est le même que votre ID de Cloud Fédéré :",
|
||||||
"Since you are new to Social, start by following the official Nextcloud account so you don't miss any news" : "Comme vous êtes nouveau dans Social, commencez par suivre le compte officiel de Nextcloud afin de ne manquer aucune nouvelle",
|
"Since you are new to Social, start by following the official Nextcloud account so you don't miss any news" : "Comme vous êtes nouveau dans Social, commencez par suivre le compte officiel de Nextcloud afin de ne manquer aucune nouvelle",
|
||||||
"Follow Nextcloud on mastodon.xyz" : "Suivre Nextcloud sur mastodon.xyz",
|
"Follow Nextcloud on mastodon.xyz" : "Suivre Nextcloud sur mastodon.xyz",
|
||||||
"You haven't receive any notifications yet" : "Vous n'avez pas encore reçu de notification",
|
"You haven't receive any notifications yet" : "Vous n'avez pas encore reçu de notification",
|
||||||
|
|
|
@ -89,7 +89,7 @@
|
||||||
"User not found" : "Utilisateur introuvable",
|
"User not found" : "Utilisateur introuvable",
|
||||||
"Sorry, we could not find the account of {userId}" : "Désolé, impossible de trouver l'utilisateur {userId}",
|
"Sorry, we could not find the account of {userId}" : "Désolé, impossible de trouver l'utilisateur {userId}",
|
||||||
"Nextcloud becomes part of the federated social networks!" : "Nextcloud fait maintenant partie des réseaux sociaux fédérés !",
|
"Nextcloud becomes part of the federated social networks!" : "Nextcloud fait maintenant partie des réseaux sociaux fédérés !",
|
||||||
"We automatically created a Social account for you. Your Social ID is the same as your Federated Cloud ID:" : "Nous avons automatiquement créé un compte social pour vous. Votre identifiant social est le même que votre identifiant de cloud fédéré :",
|
"We automatically created a Social account for you. Your Social ID is the same as your Federated Cloud ID:" : "Nous avons automatiquement créé un compte social pour vous. Votre identifiant social est le même que votre ID de Cloud Fédéré :",
|
||||||
"Since you are new to Social, start by following the official Nextcloud account so you don't miss any news" : "Comme vous êtes nouveau dans Social, commencez par suivre le compte officiel de Nextcloud afin de ne manquer aucune nouvelle",
|
"Since you are new to Social, start by following the official Nextcloud account so you don't miss any news" : "Comme vous êtes nouveau dans Social, commencez par suivre le compte officiel de Nextcloud afin de ne manquer aucune nouvelle",
|
||||||
"Follow Nextcloud on mastodon.xyz" : "Suivre Nextcloud sur mastodon.xyz",
|
"Follow Nextcloud on mastodon.xyz" : "Suivre Nextcloud sur mastodon.xyz",
|
||||||
"You haven't receive any notifications yet" : "Vous n'avez pas encore reçu de notification",
|
"You haven't receive any notifications yet" : "Vous n'avez pas encore reçu de notification",
|
||||||
|
|
|
@ -75,7 +75,7 @@ class AccountCreate extends Base {
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$userId = $input->getArgument('userId');
|
$userId = $input->getArgument('userId');
|
||||||
|
|
||||||
if (($handle = $input->getOption('handle')) === null) {
|
if (($handle = $input->getOption('handle')) === null) {
|
||||||
|
@ -87,5 +87,7 @@ class AccountCreate extends Base {
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->accountService->createActor($userId, $handle);
|
$this->accountService->createActor($userId, $handle);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ class AccountFollowing extends Base {
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$userId = $input->getArgument('userId');
|
$userId = $input->getArgument('userId');
|
||||||
$account = $input->getArgument('account');
|
$account = $input->getArgument('account');
|
||||||
|
|
||||||
|
@ -91,5 +91,7 @@ class AccountFollowing extends Base {
|
||||||
} else {
|
} else {
|
||||||
$this->followService->followAccount($actor, $account);
|
$this->followService->followAccount($actor, $account);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ class CacheRefresh extends Base {
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$result = $this->accountService->blindKeyRotation();
|
$result = $this->accountService->blindKeyRotation();
|
||||||
$output->writeLn($result . ' key pairs refreshed');
|
$output->writeLn($result . ' key pairs refreshed');
|
||||||
|
|
||||||
|
@ -85,5 +85,7 @@ class CacheRefresh extends Base {
|
||||||
|
|
||||||
$result = $this->hashtagService->manageHashtags();
|
$result = $this->hashtagService->manageHashtags();
|
||||||
$output->writeLn($result . ' hashtags updated');
|
$output->writeLn($result . ' hashtags updated');
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Social\Command;
|
namespace OCA\Social\Command;
|
||||||
|
|
||||||
use OCA\Social\Tools\Traits\TArrayTools;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use OC\Core\Command\Base;
|
use OC\Core\Command\Base;
|
||||||
use OCA\Social\Db\StreamDestRequest;
|
use OCA\Social\Db\StreamDestRequest;
|
||||||
|
@ -42,6 +41,7 @@ use OCA\Social\Service\CheckService;
|
||||||
use OCA\Social\Service\ConfigService;
|
use OCA\Social\Service\ConfigService;
|
||||||
use OCA\Social\Service\MiscService;
|
use OCA\Social\Service\MiscService;
|
||||||
use OCA\Social\Service\PushService;
|
use OCA\Social\Service\PushService;
|
||||||
|
use OCA\Social\Tools\Traits\TArrayTools;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
use Symfony\Component\Console\Helper\ProgressBar;
|
use Symfony\Component\Console\Helper\ProgressBar;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -97,9 +97,9 @@ class CheckInstall extends Base {
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
if ($this->askRegenerateIndex($input, $output)) {
|
if ($this->askRegenerateIndex($input, $output)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($this->checkPushApp($input, $output)) {
|
// if ($this->checkPushApp($input, $output)) {
|
||||||
|
@ -114,6 +114,8 @@ class CheckInstall extends Base {
|
||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
$output->writeln('- Your current configuration: ');
|
$output->writeln('- Your current configuration: ');
|
||||||
$output->writeln(json_encode($this->configService->getConfig(), JSON_PRETTY_PRINT));
|
$output->writeln(json_encode($this->configService->getConfig(), JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -58,8 +58,8 @@ class Fediverse extends Base {
|
||||||
parent::configure();
|
parent::configure();
|
||||||
$this->setName('social:fediverse')
|
$this->setName('social:fediverse')
|
||||||
->addOption(
|
->addOption(
|
||||||
'type', 't', InputArgument::OPTIONAL,
|
'type', 't', InputArgument::OPTIONAL,
|
||||||
'Change the type of access management', ''
|
'Change the type of access management', ''
|
||||||
)
|
)
|
||||||
->addArgument('action', InputArgument::OPTIONAL, 'add/remove/test address', '')
|
->addArgument('action', InputArgument::OPTIONAL, 'add/remove/test address', '')
|
||||||
->addArgument('address', InputArgument::OPTIONAL, 'address/host', '')
|
->addArgument('address', InputArgument::OPTIONAL, 'address/host', '')
|
||||||
|
@ -69,11 +69,11 @@ class Fediverse extends Base {
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$this->output = $output;
|
$this->output = $output;
|
||||||
|
|
||||||
if ($this->typeAccess($input->getOption('type'))) {
|
if ($this->typeAccess($input->getOption('type'))) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->output->writeln(
|
$this->output->writeln(
|
||||||
|
@ -108,6 +108,8 @@ class Fediverse extends Base {
|
||||||
default:
|
default:
|
||||||
throw new Exception('specify action: add, remove, list, reset');
|
throw new Exception('specify action: add, remove, list, reset');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,10 +119,10 @@ class MigrateAlpha3 extends Base {
|
||||||
$this->setName('social:migrate:alpha3')
|
$this->setName('social:migrate:alpha3')
|
||||||
->setDescription('Trying to migrate old data to Alpha3')
|
->setDescription('Trying to migrate old data to Alpha3')
|
||||||
->addOption(
|
->addOption(
|
||||||
'remove-migrated-tables', '', InputOption::VALUE_NONE, 'Remove old table once copy is done'
|
'remove-migrated-tables', '', InputOption::VALUE_NONE, 'Remove old table once copy is done'
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'force-remove-old-tables', '', InputOption::VALUE_NONE, 'Force remove old tables'
|
'force-remove-old-tables', '', InputOption::VALUE_NONE, 'Force remove old tables'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ class MigrateAlpha3 extends Base {
|
||||||
/**
|
/**
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$tables = $this->checkTables();
|
$tables = $this->checkTables();
|
||||||
|
|
||||||
if ($input->getOption('force-remove-old-tables')) {
|
if ($input->getOption('force-remove-old-tables')) {
|
||||||
|
@ -138,13 +138,13 @@ class MigrateAlpha3 extends Base {
|
||||||
$this->dropTable($table);
|
$this->dropTable($table);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($tables)) {
|
if (empty($tables)) {
|
||||||
$output->writeln('Nothing to migrate.');
|
$output->writeln('Nothing to migrate.');
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$defTables = '';
|
$defTables = '';
|
||||||
|
@ -157,7 +157,7 @@ class MigrateAlpha3 extends Base {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$this->confirmExecute($input, $output)) {
|
if (!$this->confirmExecute($input, $output)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->done = [];
|
$this->done = [];
|
||||||
|
@ -166,6 +166,8 @@ class MigrateAlpha3 extends Base {
|
||||||
if ($input->getOption('remove-migrated-tables')) {
|
if ($input->getOption('remove-migrated-tables')) {
|
||||||
$this->dropDeprecatedTables($input, $output);
|
$this->dropDeprecatedTables($input, $output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -85,7 +85,7 @@ class NoteBoost extends Base {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$userId = $input->getArgument('user_id');
|
$userId = $input->getArgument('user_id');
|
||||||
$noteId = $input->getArgument('note_id');
|
$noteId = $input->getArgument('note_id');
|
||||||
|
|
||||||
|
@ -101,5 +101,7 @@ class NoteBoost extends Base {
|
||||||
|
|
||||||
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
|
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
|
||||||
echo 'token: ' . $token . "\n";
|
echo 'token: ' . $token . "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,18 +96,18 @@ class NoteCreate extends Base {
|
||||||
parent::configure();
|
parent::configure();
|
||||||
$this->setName('social:note:create')
|
$this->setName('social:note:create')
|
||||||
->addOption(
|
->addOption(
|
||||||
'replyTo', 'r', InputOption::VALUE_OPTIONAL, 'in reply to an existing thread'
|
'replyTo', 'r', InputOption::VALUE_OPTIONAL, 'in reply to an existing thread'
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'to', 't', InputOption::VALUE_OPTIONAL, 'mentioning people'
|
'to', 't', InputOption::VALUE_OPTIONAL, 'mentioning people'
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'type', 'y', InputOption::VALUE_OPTIONAL,
|
'type', 'y', InputOption::VALUE_OPTIONAL,
|
||||||
'type: public (default), followers, unlisted, direct'
|
'type: public (default), followers, unlisted, direct'
|
||||||
)
|
)
|
||||||
->addOption(
|
->addOption(
|
||||||
'hashtag', 'g', InputOption::VALUE_OPTIONAL,
|
'hashtag', 'g', InputOption::VALUE_OPTIONAL,
|
||||||
'hashtag, without the leading #'
|
'hashtag, without the leading #'
|
||||||
)
|
)
|
||||||
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
->addArgument('user_id', InputArgument::REQUIRED, 'userId of the author')
|
||||||
->addArgument('content', InputArgument::REQUIRED, 'content of the post')
|
->addArgument('content', InputArgument::REQUIRED, 'content of the post')
|
||||||
|
@ -121,7 +121,7 @@ class NoteCreate extends Base {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$userId = $input->getArgument('userid');
|
$userId = $input->getArgument('userid');
|
||||||
$content = $input->getArgument('content');
|
$content = $input->getArgument('content');
|
||||||
$to = $input->getOption('to');
|
$to = $input->getOption('to');
|
||||||
|
@ -142,5 +142,7 @@ class NoteCreate extends Base {
|
||||||
|
|
||||||
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
|
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
|
||||||
echo 'token: ' . $token . "\n";
|
echo 'token: ' . $token . "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ class NoteLike extends Base {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$userId = $input->getArgument('user_id');
|
$userId = $input->getArgument('user_id');
|
||||||
$noteId = $input->getArgument('note_id');
|
$noteId = $input->getArgument('note_id');
|
||||||
|
|
||||||
|
@ -113,5 +113,7 @@ class NoteLike extends Base {
|
||||||
|
|
||||||
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
|
echo 'object: ' . json_encode($activity, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . "\n";
|
||||||
echo 'token: ' . $token . "\n";
|
echo 'token: ' . $token . "\n";
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -87,12 +87,13 @@ class QueueProcess extends Base {
|
||||||
* @param InputInterface $input
|
* @param InputInterface $input
|
||||||
* @param OutputInterface $output
|
* @param OutputInterface $output
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$output->writeLn('processing requests queue');
|
$output->writeLn('processing requests queue');
|
||||||
$this->processRequestQueue($output);
|
$this->processRequestQueue($output);
|
||||||
|
|
||||||
$output->writeLn('processing stream queue');
|
$output->writeLn('processing stream queue');
|
||||||
$this->processStreamQueue($output);
|
$this->processStreamQueue($output);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class QueueStatus extends Base {
|
||||||
parent::configure();
|
parent::configure();
|
||||||
$this->setName('social:queue:status')
|
$this->setName('social:queue:status')
|
||||||
->addOption(
|
->addOption(
|
||||||
'token', 't', InputOption::VALUE_OPTIONAL, 'token of a request'
|
'token', 't', InputOption::VALUE_OPTIONAL, 'token of a request'
|
||||||
)
|
)
|
||||||
->setDescription('Return status on the request queue');
|
->setDescription('Return status on the request queue');
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class QueueStatus extends Base {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$token = $input->getOption('token');
|
$token = $input->getOption('token');
|
||||||
|
|
||||||
if ($token === null) {
|
if ($token === null) {
|
||||||
|
@ -97,5 +97,7 @@ class QueueStatus extends Base {
|
||||||
foreach ($requests as $request) {
|
foreach ($requests as $request) {
|
||||||
$output->writeLn(json_encode($request));
|
$output->writeLn(json_encode($request));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,7 @@ class Reset extends Base {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$helper = $this->getHelper('question');
|
$helper = $this->getHelper('question');
|
||||||
$output->writeln(
|
$output->writeln(
|
||||||
'<error>Beware, this operation will delete all content from the Social App.</error>'
|
'<error>Beware, this operation will delete all content from the Social App.</error>'
|
||||||
|
@ -102,7 +102,7 @@ class Reset extends Base {
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!$helper->ask($input, $output, $question)) {
|
if (!$helper->ask($input, $output, $question)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$question = new ConfirmationQuestion(
|
$question = new ConfirmationQuestion(
|
||||||
|
@ -110,7 +110,7 @@ class Reset extends Base {
|
||||||
'/^(y|Y)/i'
|
'/^(y|Y)/i'
|
||||||
);
|
);
|
||||||
if (!$helper->ask($input, $output, $question)) {
|
if (!$helper->ask($input, $output, $question)) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -124,7 +124,7 @@ class Reset extends Base {
|
||||||
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ class Reset extends Base {
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
$output->writeln('<error>' . $e->getMessage() . '</error>');
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->checkService->checkInstallationStatus(true);
|
$this->checkService->checkInstallationStatus(true);
|
||||||
|
@ -152,13 +152,15 @@ class Reset extends Base {
|
||||||
$newCloudAddress = $helper->ask($input, $output, $question);
|
$newCloudAddress = $helper->ask($input, $output, $question);
|
||||||
|
|
||||||
if ($newCloudAddress === $cloudAddress) {
|
if ($newCloudAddress === $cloudAddress) {
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->configService->setCloudUrl($newCloudAddress);
|
$this->configService->setCloudUrl($newCloudAddress);
|
||||||
|
|
||||||
$output->writeln('');
|
$output->writeln('');
|
||||||
$output->writeln('New address: <info>' . $newCloudAddress . '</info>');
|
$output->writeln('New address: <info>' . $newCloudAddress . '</info>');
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ class StreamDetails extends ExtendedBase {
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected function execute(InputInterface $input, OutputInterface $output) {
|
protected function execute(InputInterface $input, OutputInterface $output): int {
|
||||||
$output = new ConsoleOutput();
|
$output = new ConsoleOutput();
|
||||||
$this->output = $output->section();
|
$this->output = $output->section();
|
||||||
|
|
||||||
|
@ -110,7 +110,7 @@ class StreamDetails extends ExtendedBase {
|
||||||
if ($this->asJson) {
|
if ($this->asJson) {
|
||||||
$this->output->writeln(json_encode($details, JSON_PRETTY_PRINT));
|
$this->output->writeln(json_encode($details, JSON_PRETTY_PRINT));
|
||||||
|
|
||||||
return;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->outputStream($stream);
|
$this->outputStream($stream);
|
||||||
|
@ -133,5 +133,7 @@ class StreamDetails extends ExtendedBase {
|
||||||
$this->output->writeln('* <info>Direct</info>: ' . json_encode($direct, JSON_PRETTY_PRINT));
|
$this->output->writeln('* <info>Direct</info>: ' . json_encode($direct, JSON_PRETTY_PRINT));
|
||||||
$this->output->writeln('* <info>Public</info>: ' . ($details->isPublic() ? 'true' : 'false'));
|
$this->output->writeln('* <info>Public</info>: ' . ($details->isPublic() ? 'true' : 'false'));
|
||||||
$this->output->writeln('* <info>Federated</info>: ' . ($details->isFederated() ? 'true' : 'false'));
|
$this->output->writeln('* <info>Federated</info>: ' . ($details->isFederated() ? 'true' : 'false'));
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,11 @@ namespace OCA\Social\Command;
|
||||||
use Exception;
|
use Exception;
|
||||||
use OCA\Social\Db\StreamRequest;
|
use OCA\Social\Db\StreamRequest;
|
||||||
use OCA\Social\Exceptions\UnknownTimelineException;
|
use OCA\Social\Exceptions\UnknownTimelineException;
|
||||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
|
||||||
use OCA\Social\Model\ActivityPub\Stream;
|
use OCA\Social\Model\ActivityPub\Stream;
|
||||||
use OCA\Social\Model\Client\Options\TimelineOptions;
|
use OCA\Social\Model\Client\Options\TimelineOptions;
|
||||||
use OCA\Social\Service\AccountService;
|
use OCA\Social\Service\AccountService;
|
||||||
use OCA\Social\Service\ConfigService;
|
use OCA\Social\Service\ConfigService;
|
||||||
|
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||||
use OCP\IUserManager;
|
use OCP\IUserManager;
|
||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
|
@ -145,18 +145,12 @@ class Timeline extends ExtendedBase {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Person $actor
|
* @param TimelineOptions $options
|
||||||
* @param string $timeline
|
|
||||||
*
|
*
|
||||||
* @throws Exception
|
* @throws DateTimeException
|
||||||
*/
|
*/
|
||||||
private function displayUnsupportedStream(TimelineOptions $options) {
|
private function displayUnsupportedStream(TimelineOptions $options) {
|
||||||
switch ($options->getTimeline()) {
|
switch ($options->getTimeline()) {
|
||||||
case 'direct':
|
|
||||||
$stream = $this->streamRequest->getTimelineDirect(0, $options->getLimit());
|
|
||||||
$this->outputStreams($stream);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'notifications':
|
case 'notifications':
|
||||||
$stream = $this->streamRequest->getTimelineNotifications(0, $options->getLimit());
|
$stream = $this->streamRequest->getTimelineNotifications(0, $options->getLimit());
|
||||||
$this->outputStreams($stream);
|
$this->outputStreams($stream);
|
||||||
|
|
|
@ -45,6 +45,8 @@ use OCP\AppFramework\Controller;
|
||||||
use OCP\AppFramework\Http;
|
use OCP\AppFramework\Http;
|
||||||
use OCP\AppFramework\Http\DataResponse;
|
use OCP\AppFramework\Http\DataResponse;
|
||||||
use OCP\AppFramework\Http\Response;
|
use OCP\AppFramework\Http\Response;
|
||||||
|
use OCP\AppFramework\Http\TemplateResponse;
|
||||||
|
use OCP\AppFramework\Services\IInitialState;
|
||||||
use OCP\IRequest;
|
use OCP\IRequest;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use OCP\IUserSession;
|
use OCP\IUserSession;
|
||||||
|
@ -59,6 +61,7 @@ class OAuthController extends Controller {
|
||||||
private ClientService $clientService;
|
private ClientService $clientService;
|
||||||
private ConfigService $configService;
|
private ConfigService $configService;
|
||||||
private LoggerInterface $logger;
|
private LoggerInterface $logger;
|
||||||
|
private IInitialState $initialState;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
IRequest $request,
|
IRequest $request,
|
||||||
|
@ -69,7 +72,8 @@ class OAuthController extends Controller {
|
||||||
CacheActorService $cacheActorService,
|
CacheActorService $cacheActorService,
|
||||||
ClientService $clientService,
|
ClientService $clientService,
|
||||||
ConfigService $configService,
|
ConfigService $configService,
|
||||||
LoggerInterface $logger
|
LoggerInterface $logger,
|
||||||
|
IInitialState $initialState
|
||||||
) {
|
) {
|
||||||
parent::__construct(Application::APP_NAME, $request);
|
parent::__construct(Application::APP_NAME, $request);
|
||||||
|
|
||||||
|
@ -81,6 +85,7 @@ class OAuthController extends Controller {
|
||||||
$this->clientService = $clientService;
|
$this->clientService = $clientService;
|
||||||
$this->configService = $configService;
|
$this->configService = $configService;
|
||||||
$this->logger = $logger;
|
$this->logger = $logger;
|
||||||
|
$this->initialState = $initialState;
|
||||||
|
|
||||||
$body = file_get_contents('php://input');
|
$body = file_get_contents('php://input');
|
||||||
$logger->debug('[OAuthController] input: ' . $body);
|
$logger->debug('[OAuthController] input: ' . $body);
|
||||||
|
@ -115,6 +120,7 @@ class OAuthController extends Controller {
|
||||||
"protocols" => [
|
"protocols" => [
|
||||||
"activitypub"
|
"activitypub"
|
||||||
],
|
],
|
||||||
|
"rootUrl" => rtrim($this->urlGenerator->linkToRouteAbsolute('social.Navigation.navigate'), '/'),
|
||||||
"usage" => $usage,
|
"usage" => $usage,
|
||||||
"openRegistrations" => $openReg
|
"openRegistrations" => $openReg
|
||||||
];
|
];
|
||||||
|
@ -172,13 +178,47 @@ class OAuthController extends Controller {
|
||||||
string $redirect_uri,
|
string $redirect_uri,
|
||||||
string $response_type,
|
string $response_type,
|
||||||
string $scope = 'read'
|
string $scope = 'read'
|
||||||
|
): Response {
|
||||||
|
$user = $this->userSession->getUser();
|
||||||
|
|
||||||
|
// check actor exists
|
||||||
|
$this->accountService->getActorFromUserId($user->getUID());
|
||||||
|
|
||||||
|
if ($response_type !== 'code') {
|
||||||
|
throw new ClientNotFoundException('invalid response type');
|
||||||
|
}
|
||||||
|
|
||||||
|
// check client exists in db
|
||||||
|
$client = $this->clientService->getFromClientId($client_id);
|
||||||
|
$this->initialState->provideInitialState('appName', $client->getAppName());
|
||||||
|
|
||||||
|
return new TemplateResponse(Application::APP_NAME, 'oauth2', [
|
||||||
|
'request' =>
|
||||||
|
[
|
||||||
|
'clientId' => $client_id,
|
||||||
|
'redirectUri' => $redirect_uri,
|
||||||
|
'responseType' => $response_type,
|
||||||
|
'scope' => $scope
|
||||||
|
]
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
*/
|
||||||
|
public function authorizing(
|
||||||
|
string $client_id,
|
||||||
|
string $redirect_uri,
|
||||||
|
string $response_type,
|
||||||
|
string $scope = 'read'
|
||||||
): DataResponse {
|
): DataResponse {
|
||||||
try {
|
try {
|
||||||
$user = $this->userSession->getUser();
|
$user = $this->userSession->getUser();
|
||||||
$account = $this->accountService->getActorFromUserId($user->getUID());
|
$account = $this->accountService->getActorFromUserId($user->getUID());
|
||||||
|
|
||||||
if ($response_type !== 'code') {
|
if ($response_type !== 'code') {
|
||||||
return new DataResponse(['error' => 'invalid_type'], Http::STATUS_BAD_REQUEST);
|
throw new ClientNotFoundException('invalid response type');
|
||||||
}
|
}
|
||||||
|
|
||||||
$client = $this->clientService->getFromClientId($client_id);
|
$client = $this->clientService->getFromClientId($client_id);
|
||||||
|
@ -204,18 +244,12 @@ class OAuthController extends Controller {
|
||||||
|
|
||||||
// TODO : finalize result if no redirect_url
|
// TODO : finalize result if no redirect_url
|
||||||
return new DataResponse(
|
return new DataResponse(
|
||||||
[
|
['code' => $code], Http::STATUS_OK
|
||||||
'code' => $code,
|
|
||||||
// 'access_token' => '',
|
|
||||||
// "token_type" => "Bearer",
|
|
||||||
// "scope" => "read write follow push",
|
|
||||||
// "created_at" => 1573979017
|
|
||||||
], Http::STATUS_OK
|
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
$this->logger->notice($e->getMessage() . ' ' . get_class($e));
|
$this->logger->notice($e->getMessage() . ' ' . get_class($e));
|
||||||
|
|
||||||
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_UNAUTHORIZED);
|
return new DataResponse(['error' => $e->getMessage()], Http::STATUS_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,70 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nextcloud - Social Support
|
|
||||||
*
|
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
|
||||||
* later. See the COPYING file.
|
|
||||||
*
|
|
||||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace OCA\Social\Cron;
|
|
||||||
|
|
||||||
use OCP\AppFramework\Utility\ITimeFactory;
|
|
||||||
use OCP\BackgroundJob\TimedJob;
|
|
||||||
use OCA\Social\Service\ConfigService;
|
|
||||||
use OCP\AppFramework\QueryException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Queue
|
|
||||||
*
|
|
||||||
* @package OCA\Social\Cron
|
|
||||||
*/
|
|
||||||
class Chunk extends TimedJob {
|
|
||||||
private ConfigService $configService;
|
|
||||||
|
|
||||||
public function __construct(ITimeFactory $time, ConfigService $configService) {
|
|
||||||
parent::__construct($time);
|
|
||||||
$this->setInterval(12 * 3600); // 12 hours
|
|
||||||
$this->configService = $configService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param mixed $argument
|
|
||||||
*
|
|
||||||
* @throws QueryException
|
|
||||||
*/
|
|
||||||
protected function run($argument) {
|
|
||||||
$size = (int)$this->configService->getAppValue(ConfigService::DATABASE_CHUNK_SIZE);
|
|
||||||
$this->morphChunks($size);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param int $size
|
|
||||||
*/
|
|
||||||
private function morphChunks(int $size): void {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -53,13 +53,13 @@ class ActorsRequest extends ActorsRequestBuilder {
|
||||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||||
->setValue('avatar_version', $qb->createNamedParameter($actor->getAvatarVersion()))
|
->setValue('avatar_version', $qb->createNamedParameter($actor->getAvatarVersion()))
|
||||||
->setValue(
|
->setValue(
|
||||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||||
)
|
)
|
||||||
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
->setValue('public_key', $qb->createNamedParameter($actor->getPublicKey()))
|
||||||
->setValue('private_key', $qb->createNamedParameter($actor->getPrivateKey()))
|
->setValue('private_key', $qb->createNamedParameter($actor->getPrivateKey()))
|
||||||
->setValue(
|
->setValue(
|
||||||
'creation',
|
'creation',
|
||||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||||
);
|
);
|
||||||
|
|
||||||
$qb->executeStatement();
|
$qb->executeStatement();
|
||||||
|
|
|
@ -121,7 +121,7 @@ class ActorsRequestBuilder extends CoreRequestBuilder {
|
||||||
->setLocal(true)
|
->setLocal(true)
|
||||||
->setAvatarVersion($this->getInt('avatar_version', $data, -1))
|
->setAvatarVersion($this->getInt('avatar_version', $data, -1))
|
||||||
->setAccount(
|
->setAccount(
|
||||||
$actor->getPreferredUsername() . '@' . $this->configService->getSocialAddress()
|
$actor->getPreferredUsername() . '@' . $this->configService->getSocialAddress()
|
||||||
);
|
);
|
||||||
$actor->setUrlSocial($root)
|
$actor->setUrlSocial($root)
|
||||||
->setUrl($actor->getId());
|
->setUrl($actor->getId());
|
||||||
|
|
|
@ -59,7 +59,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
||||||
->setValue('featured', $qb->createNamedParameter($actor->getFeatured()))
|
->setValue('featured', $qb->createNamedParameter($actor->getFeatured()))
|
||||||
->setValue('url', $qb->createNamedParameter($actor->getUrl()))
|
->setValue('url', $qb->createNamedParameter($actor->getUrl()))
|
||||||
->setValue(
|
->setValue(
|
||||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||||
)
|
)
|
||||||
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
->setValue('name', $qb->createNamedParameter($actor->getName()))
|
||||||
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
->setValue('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||||
|
@ -112,7 +112,7 @@ class CacheActorsRequest extends CacheActorsRequestBuilder {
|
||||||
->set('featured', $qb->createNamedParameter($actor->getFeatured()))
|
->set('featured', $qb->createNamedParameter($actor->getFeatured()))
|
||||||
->set('url', $qb->createNamedParameter($actor->getUrl()))
|
->set('url', $qb->createNamedParameter($actor->getUrl()))
|
||||||
->set(
|
->set(
|
||||||
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
'preferred_username', $qb->createNamedParameter($actor->getPreferredUsername())
|
||||||
)
|
)
|
||||||
->set('name', $qb->createNamedParameter($actor->getName()))
|
->set('name', $qb->createNamedParameter($actor->getName()))
|
||||||
->set('summary', $qb->createNamedParameter($actor->getSummary()))
|
->set('summary', $qb->createNamedParameter($actor->getSummary()))
|
||||||
|
|
|
@ -77,7 +77,7 @@ class CacheActorsRequestBuilder extends CoreRequestBuilder {
|
||||||
|
|
||||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||||
$qb->select(
|
$qb->select(
|
||||||
'ca.nid', 'ca.id', 'ca.account', 'ca.following', 'ca.followers', 'ca.inbox', 'ca.shared_inbox',
|
'ca.id', 'ca.account', 'ca.following', 'ca.followers', 'ca.inbox', 'ca.shared_inbox',
|
||||||
'ca.outbox', 'ca.featured', 'ca.url', 'ca.type', 'ca.preferred_username', 'ca.name', 'ca.summary',
|
'ca.outbox', 'ca.featured', 'ca.url', 'ca.type', 'ca.preferred_username', 'ca.name', 'ca.summary',
|
||||||
'ca.public_key', 'ca.local', 'ca.details', 'ca.source', 'ca.creation'
|
'ca.public_key', 'ca.local', 'ca.details', 'ca.source', 'ca.creation'
|
||||||
)
|
)
|
||||||
|
|
|
@ -56,7 +56,7 @@ class ClientRequest extends ClientRequestBuilder {
|
||||||
$qb->setValue('app_name', $qb->createNamedParameter($client->getAppName()))
|
$qb->setValue('app_name', $qb->createNamedParameter($client->getAppName()))
|
||||||
->setValue('app_website', $qb->createNamedParameter($client->getAppWebsite()))
|
->setValue('app_website', $qb->createNamedParameter($client->getAppWebsite()))
|
||||||
->setValue(
|
->setValue(
|
||||||
'app_redirect_uris', $qb->createNamedParameter(json_encode($client->getAppRedirectUris()))
|
'app_redirect_uris', $qb->createNamedParameter(json_encode($client->getAppRedirectUris()))
|
||||||
)
|
)
|
||||||
->setValue('app_client_id', $qb->createNamedParameter($client->getAppClientId()))
|
->setValue('app_client_id', $qb->createNamedParameter($client->getAppClientId()))
|
||||||
->setValue('app_client_secret', $qb->createNamedParameter($client->getAppClientSecret()))
|
->setValue('app_client_secret', $qb->createNamedParameter($client->getAppClientSecret()))
|
||||||
|
|
|
@ -48,6 +48,7 @@ use OCA\Social\Service\MiscService;
|
||||||
use OCP\DB\QueryBuilder\IQueryBuilder;
|
use OCP\DB\QueryBuilder\IQueryBuilder;
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
|
use OCP\Server;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,26 +57,26 @@ use Psr\Log\LoggerInterface;
|
||||||
* @package OCA\Social\Db
|
* @package OCA\Social\Db
|
||||||
*/
|
*/
|
||||||
class CoreRequestBuilder {
|
class CoreRequestBuilder {
|
||||||
public const TABLE_REQUEST_QUEUE = 'social_3_req_queue';
|
public const TABLE_REQUEST_QUEUE = 'social_req_queue';
|
||||||
public const TABLE_INSTANCE = 'social_3_instance';
|
public const TABLE_INSTANCE = 'social_instance';
|
||||||
|
|
||||||
public const TABLE_ACTORS = 'social_3_actor';
|
public const TABLE_ACTORS = 'social_actor';
|
||||||
public const TABLE_STREAM = 'social_3_stream';
|
public const TABLE_STREAM = 'social_stream';
|
||||||
public const TABLE_STREAM_DEST = 'social_3_stream_dest';
|
public const TABLE_STREAM_DEST = 'social_stream_dest';
|
||||||
public const TABLE_STREAM_TAGS = 'social_3_stream_tag';
|
public const TABLE_STREAM_TAGS = 'social_stream_tag';
|
||||||
public const TABLE_STREAM_QUEUE = 'social_3_stream_queue';
|
public const TABLE_STREAM_QUEUE = 'social_stream_queue';
|
||||||
public const TABLE_STREAM_ACTIONS = 'social_3_stream_act';
|
public const TABLE_STREAM_ACTIONS = 'social_stream_act';
|
||||||
|
|
||||||
public const TABLE_HASHTAGS = 'social_3_hashtag';
|
public const TABLE_HASHTAGS = 'social_hashtag';
|
||||||
public const TABLE_FOLLOWS = 'social_3_follow';
|
public const TABLE_FOLLOWS = 'social_follow';
|
||||||
public const TABLE_ACTIONS = 'social_3_action';
|
public const TABLE_ACTIONS = 'social_action';
|
||||||
|
|
||||||
public const TABLE_CACHE_ACTORS = 'social_3_cache_actor';
|
public const TABLE_CACHE_ACTORS = 'social_cache_actor';
|
||||||
public const TABLE_CACHE_DOCUMENTS = 'social_3_cache_doc';
|
public const TABLE_CACHE_DOCUMENTS = 'social_cache_doc';
|
||||||
|
|
||||||
public const TABLE_CLIENT = 'social_3_client';
|
public const TABLE_CLIENT = 'social_client';
|
||||||
public const TABLE_CLIENT_AUTH = 'social_3_client_auth';
|
public const TABLE_CLIENT_AUTH = 'social_client_auth';
|
||||||
public const TABLE_CLIENT_TOKEN = 'social_3_client_token';
|
public const TABLE_CLIENT_TOKEN = 'social_client_token';
|
||||||
|
|
||||||
|
|
||||||
private array $tables = [
|
private array $tables = [
|
||||||
|
@ -105,7 +106,10 @@ class CoreRequestBuilder {
|
||||||
protected ?string $defaultSelectAlias = null;
|
protected ?string $defaultSelectAlias = null;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
IDBConnection $connection, LoggerInterface $logger, IURLGenerator $urlGenerator, ConfigService $configService,
|
IDBConnection $connection,
|
||||||
|
LoggerInterface $logger,
|
||||||
|
IURLGenerator $urlGenerator,
|
||||||
|
ConfigService $configService,
|
||||||
MiscService $miscService
|
MiscService $miscService
|
||||||
) {
|
) {
|
||||||
$this->dbConnection = $connection;
|
$this->dbConnection = $connection;
|
||||||
|
@ -736,8 +740,7 @@ class CoreRequestBuilder {
|
||||||
|
|
||||||
$pf = (($alias === '') ? $this->defaultSelectAlias : $alias);
|
$pf = (($alias === '') ? $this->defaultSelectAlias : $alias);
|
||||||
$qb->from(self::TABLE_CACHE_ACTORS, $pf);
|
$qb->from(self::TABLE_CACHE_ACTORS, $pf);
|
||||||
$qb->selectAlias($pf . '.nid', 'cacheactor_nid')
|
$qb->selectAlias($pf . '.id', 'cacheactor_id')
|
||||||
->selectAlias($pf . '.id', 'cacheactor_id')
|
|
||||||
->selectAlias($pf . '.type', 'cacheactor_type')
|
->selectAlias($pf . '.type', 'cacheactor_type')
|
||||||
->selectAlias($pf . '.account', 'cacheactor_account')
|
->selectAlias($pf . '.account', 'cacheactor_account')
|
||||||
->selectAlias($pf . '.following', 'cacheactor_following')
|
->selectAlias($pf . '.following', 'cacheactor_following')
|
||||||
|
@ -777,8 +780,7 @@ class CoreRequestBuilder {
|
||||||
|
|
||||||
$pf = ($alias === '') ? $this->defaultSelectAlias : $alias;
|
$pf = ($alias === '') ? $this->defaultSelectAlias : $alias;
|
||||||
|
|
||||||
$qb->selectAlias('ca.nid', 'cacheactor_nid')
|
$qb->selectAlias('ca.id', 'cacheactor_id')
|
||||||
->selectAlias('ca.id', 'cacheactor_id')
|
|
||||||
->selectAlias('ca.type', 'cacheactor_type')
|
->selectAlias('ca.type', 'cacheactor_type')
|
||||||
->selectAlias('ca.account', 'cacheactor_account')
|
->selectAlias('ca.account', 'cacheactor_account')
|
||||||
->selectAlias('ca.following', 'cacheactor_following')
|
->selectAlias('ca.following', 'cacheactor_following')
|
||||||
|
@ -1052,8 +1054,8 @@ class CoreRequestBuilder {
|
||||||
->selectAlias($prefix . '_f.follow_id', $prefix . '_follow_id')
|
->selectAlias($prefix . '_f.follow_id', $prefix . '_follow_id')
|
||||||
->selectAlias($prefix . '_f.creation', $prefix . '_creation')
|
->selectAlias($prefix . '_f.creation', $prefix . '_creation')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
$this->defaultSelectAlias, CoreRequestBuilder::TABLE_FOLLOWS, $prefix . '_f',
|
$this->defaultSelectAlias, CoreRequestBuilder::TABLE_FOLLOWS, $prefix . '_f',
|
||||||
$andX
|
$andX
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1129,7 +1131,7 @@ class CoreRequestBuilder {
|
||||||
*/
|
*/
|
||||||
public function emptyAll() {
|
public function emptyAll() {
|
||||||
/** @var ISchemaWrapper|SchemaWrapper $schema */
|
/** @var ISchemaWrapper|SchemaWrapper $schema */
|
||||||
$schema = new SchemaWrapper($this->dbConnection);
|
$schema = new SchemaWrapper(Server::get(OC\DB\Connection::class));
|
||||||
foreach ($this->tables as $table) {
|
foreach ($this->tables as $table) {
|
||||||
if ($schema->hasTable($table)) {
|
if ($schema->hasTable($table)) {
|
||||||
$qb = $this->dbConnection->getQueryBuilder();
|
$qb = $this->dbConnection->getQueryBuilder();
|
||||||
|
@ -1145,7 +1147,7 @@ class CoreRequestBuilder {
|
||||||
*/
|
*/
|
||||||
public function uninstallSocialTables() {
|
public function uninstallSocialTables() {
|
||||||
/** @var ISchemaWrapper|SchemaWrapper $schema */
|
/** @var ISchemaWrapper|SchemaWrapper $schema */
|
||||||
$schema = new SchemaWrapper($this->dbConnection);
|
$schema = new SchemaWrapper(Server::get(OC\DB\Connection::class));
|
||||||
foreach ($this->tables as $table) {
|
foreach ($this->tables as $table) {
|
||||||
if ($schema->hasTable($table)) {
|
if ($schema->hasTable($table)) {
|
||||||
$schema->dropTable($table);
|
$schema->dropTable($table);
|
||||||
|
|
|
@ -66,9 +66,9 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
|
||||||
->setValue('author', $qb->createNamedParameter($queue->getAuthor()))
|
->setValue('author', $qb->createNamedParameter($queue->getAuthor()))
|
||||||
->setValue('activity', $qb->createNamedParameter($queue->getActivity()))
|
->setValue('activity', $qb->createNamedParameter($queue->getActivity()))
|
||||||
->setValue(
|
->setValue(
|
||||||
'instance', $qb->createNamedParameter(
|
'instance', $qb->createNamedParameter(
|
||||||
json_encode($queue->getInstance(), JSON_UNESCAPED_SLASHES)
|
json_encode($queue->getInstance(), JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setValue('priority', $qb->createNamedParameter($queue->getPriority()))
|
->setValue('priority', $qb->createNamedParameter($queue->getPriority()))
|
||||||
->setValue('status', $qb->createNamedParameter($queue->getStatus()))
|
->setValue('status', $qb->createNamedParameter($queue->getStatus()))
|
||||||
|
@ -133,8 +133,8 @@ class RequestQueueRequest extends RequestQueueRequestBuilder {
|
||||||
$qb = $this->getRequestQueueUpdateSql();
|
$qb = $this->getRequestQueueUpdateSql();
|
||||||
$qb->set('status', $qb->createNamedParameter(RequestQueue::STATUS_RUNNING))
|
$qb->set('status', $qb->createNamedParameter(RequestQueue::STATUS_RUNNING))
|
||||||
->set(
|
->set(
|
||||||
'last',
|
'last',
|
||||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||||
);
|
);
|
||||||
$this->limitToId($qb, $queue->getId());
|
$this->limitToId($qb, $queue->getId());
|
||||||
$this->limitToStatus($qb, RequestQueue::STATUS_STANDBY);
|
$this->limitToStatus($qb, RequestQueue::STATUS_STANDBY);
|
||||||
|
|
|
@ -34,7 +34,6 @@ namespace OCA\Social\Db;
|
||||||
use OCA\Social\Tools\Db\ExtendedQueryBuilder;
|
use OCA\Social\Tools\Db\ExtendedQueryBuilder;
|
||||||
use OC\SystemConfig;
|
use OC\SystemConfig;
|
||||||
use OCA\Social\Model\ActivityPub\Actor\Person;
|
use OCA\Social\Model\ActivityPub\Actor\Person;
|
||||||
use OCP\DB\QueryBuilder\ICompositeExpression;
|
|
||||||
use OCP\IDBConnection;
|
use OCP\IDBConnection;
|
||||||
use OCP\IURLGenerator;
|
use OCP\IURLGenerator;
|
||||||
use Psr\Log\LoggerInterface;
|
use Psr\Log\LoggerInterface;
|
||||||
|
@ -47,7 +46,6 @@ use Psr\Log\LoggerInterface;
|
||||||
class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
|
class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
|
||||||
protected IURLGenerator $urlGenerator;
|
protected IURLGenerator $urlGenerator;
|
||||||
private ?Person $viewer = null;
|
private ?Person $viewer = null;
|
||||||
private int $chunk = 0;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
IDBConnection $connection, SystemConfig $systemConfig, LoggerInterface $logger, IURLGenerator $urlGenerator
|
IDBConnection $connection, SystemConfig $systemConfig, LoggerInterface $logger, IURLGenerator $urlGenerator
|
||||||
|
@ -57,32 +55,6 @@ class SocialCoreQueryBuilder extends ExtendedQueryBuilder {
|
||||||
$this->urlGenerator = $urlGenerator;
|
$this->urlGenerator = $urlGenerator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setChunk(int $chunk): self {
|
|
||||||
$this->chunk = $chunk;
|
|
||||||
$this->inChunk();
|
|
||||||
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function getChunk(): int {
|
|
||||||
return $this->chunk;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Limit the request to a chunk
|
|
||||||
*/
|
|
||||||
public function inChunk(string $alias = '', ?ICompositeExpression $expr = null): void {
|
|
||||||
if ($this->getChunk() === 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($expr !== null) {
|
|
||||||
$expr->add($this->exprLimitToDBFieldInt('chunk', $this->getChunk(), $alias));
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$this->limitToDBFieldInt('chunk', $this->getChunk(), $alias);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function hasViewer(): bool {
|
public function hasViewer(): bool {
|
||||||
return ($this->viewer !== null);
|
return ($this->viewer !== null);
|
||||||
|
|
|
@ -56,7 +56,6 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
||||||
|
|
||||||
if ($aliasDest !== '') {
|
if ($aliasDest !== '') {
|
||||||
$this->from(CoreRequestBuilder::TABLE_STREAM_DEST, $aliasDest);
|
$this->from(CoreRequestBuilder::TABLE_STREAM_DEST, $aliasDest);
|
||||||
// $this->inChunk($aliasDest);
|
|
||||||
}
|
}
|
||||||
if ($aliasFollowing !== '') {
|
if ($aliasFollowing !== '') {
|
||||||
$this->from(CoreRequestBuilder::TABLE_FOLLOWS, $aliasFollowing);
|
$this->from(CoreRequestBuilder::TABLE_FOLLOWS, $aliasFollowing);
|
||||||
|
@ -109,8 +108,7 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
||||||
$this->from(CoreRequestBuilder::TABLE_CACHE_ACTORS, $pf);
|
$this->from(CoreRequestBuilder::TABLE_CACHE_ACTORS, $pf);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->selectAlias($pf . '.nid', 'cacheactor_nid')
|
$this->selectAlias($pf . '.id', 'cacheactor_id')
|
||||||
->selectAlias($pf . '.id', 'cacheactor_id')
|
|
||||||
->selectAlias($pf . '.type', 'cacheactor_type')
|
->selectAlias($pf . '.type', 'cacheactor_type')
|
||||||
->selectAlias($pf . '.account', 'cacheactor_account')
|
->selectAlias($pf . '.account', 'cacheactor_account')
|
||||||
->selectAlias($pf . '.following', 'cacheactor_following')
|
->selectAlias($pf . '.following', 'cacheactor_following')
|
||||||
|
@ -185,8 +183,8 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
||||||
->selectAlias('cd.error', 'cachedocument_error')
|
->selectAlias('cd.error', 'cachedocument_error')
|
||||||
->selectAlias('cd.creation', 'cachedocument_creation')
|
->selectAlias('cd.creation', 'cachedocument_creation')
|
||||||
->leftJoin(
|
->leftJoin(
|
||||||
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CACHE_DOCUMENTS, 'cd',
|
$this->getDefaultSelectAlias(), CoreRequestBuilder::TABLE_CACHE_DOCUMENTS, 'cd',
|
||||||
$expr->eq($func->lower($pf . '.' . $fieldDocumentId), $func->lower('cd.id'))
|
$expr->eq($func->lower($pf . '.' . $fieldDocumentId), $func->lower('cd.id'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +275,6 @@ class SocialCrossQueryBuilder extends SocialCoreQueryBuilder {
|
||||||
$orX->add($expr->eq($alias . '.stream_id_prim', $pf . '.object_id_prim'));
|
$orX->add($expr->eq($alias . '.stream_id_prim', $pf . '.object_id_prim'));
|
||||||
|
|
||||||
$on = $expr->andX();
|
$on = $expr->andX();
|
||||||
// $this->inChunk('sa', $on);
|
|
||||||
$viewer = $this->getViewer();
|
$viewer = $this->getViewer();
|
||||||
$idPrim = $this->prim($viewer->getId());
|
$idPrim = $this->prim($viewer->getId());
|
||||||
|
|
||||||
|
|
|
@ -56,9 +56,9 @@ class StreamActionsRequest extends StreamActionsRequestBuilder {
|
||||||
->setValue('stream_id', $qb->createNamedParameter($action->getStreamId()))
|
->setValue('stream_id', $qb->createNamedParameter($action->getStreamId()))
|
||||||
->setValue('stream_id_prim', $qb->createNamedParameter($this->prim($action->getStreamId())))
|
->setValue('stream_id_prim', $qb->createNamedParameter($this->prim($action->getStreamId())))
|
||||||
->setValue(
|
->setValue(
|
||||||
'values', $qb->createNamedParameter(
|
'values', $qb->createNamedParameter(
|
||||||
json_encode($values, JSON_UNESCAPED_SLASHES)
|
json_encode($values, JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setValue('liked', $qb->createNamedParameter(($liked) ? 1 : 0))
|
->setValue('liked', $qb->createNamedParameter(($liked) ? 1 : 0))
|
||||||
->setValue('boosted', $qb->createNamedParameter(($boosted) ? 1 : 0))
|
->setValue('boosted', $qb->createNamedParameter(($boosted) ? 1 : 0))
|
||||||
|
|
|
@ -110,8 +110,8 @@ class StreamQueueRequest extends StreamQueueRequestBuilder {
|
||||||
$qb = $this->getStreamQueueUpdateSql();
|
$qb = $this->getStreamQueueUpdateSql();
|
||||||
$qb->set('status', $qb->createNamedParameter(StreamQueue::STATUS_RUNNING))
|
$qb->set('status', $qb->createNamedParameter(StreamQueue::STATUS_RUNNING))
|
||||||
->set(
|
->set(
|
||||||
'last',
|
'last',
|
||||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||||
);
|
);
|
||||||
$this->limitToId($qb, $queue->getId());
|
$this->limitToId($qb, $queue->getId());
|
||||||
$this->limitToStatus($qb, StreamQueue::STATUS_STANDBY);
|
$this->limitToStatus($qb, StreamQueue::STATUS_STANDBY);
|
||||||
|
|
|
@ -77,9 +77,9 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
/** @var Note $stream */
|
/** @var Note $stream */
|
||||||
$qb->setValue('hashtags', $qb->createNamedParameter(json_encode($stream->getHashtags())))
|
$qb->setValue('hashtags', $qb->createNamedParameter(json_encode($stream->getHashtags())))
|
||||||
->setValue(
|
->setValue(
|
||||||
'attachments', $qb->createNamedParameter(
|
'attachments', $qb->createNamedParameter(
|
||||||
json_encode($stream->getAttachments(), JSON_UNESCAPED_SLASHES)
|
json_encode($stream->getAttachments(), JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -334,22 +334,33 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
public function getTimeline(TimelineOptions $options): array {
|
public function getTimeline(TimelineOptions $options): array {
|
||||||
switch (strtolower($options->getTimeline())) {
|
switch (strtolower($options->getTimeline())) {
|
||||||
case 'home':
|
case 'home':
|
||||||
return $this->getTimelineHome($options);
|
$result = $this->getTimelineHome($options);
|
||||||
|
break;
|
||||||
|
case 'direct':
|
||||||
|
$result = $this->getTimelineDirect($options);
|
||||||
|
break;
|
||||||
case 'public':
|
case 'public':
|
||||||
$options->setLocal(false);
|
$options->setLocal(false);
|
||||||
|
$result = $this->getTimelinePublic($options);
|
||||||
return $this->getTimelinePublic($options);
|
break;
|
||||||
case 'local':
|
case 'local':
|
||||||
$options->setLocal(true);
|
$options->setLocal(true);
|
||||||
|
$result = $this->getTimelinePublic($options);
|
||||||
|
break;
|
||||||
|
|
||||||
return $this->getTimelinePublic($options);
|
default:
|
||||||
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
if ($options->isInverted()) {
|
||||||
|
$result = array_reverse($result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should returns:
|
* Should return:
|
||||||
* * Own posts,
|
* * Own posts,
|
||||||
* * Followed accounts
|
* * Followed accounts
|
||||||
*
|
*
|
||||||
|
@ -357,9 +368,8 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
*
|
*
|
||||||
* @return Stream[]
|
* @return Stream[]
|
||||||
*/
|
*/
|
||||||
public function getTimelineHome(TimelineOptions $options): array {
|
private function getTimelineHome(TimelineOptions $options): array {
|
||||||
$qb = $this->getStreamSelectSql($options->getFormat());
|
$qb = $this->getStreamSelectSql($options->getFormat());
|
||||||
$qb->setChunk(1);
|
|
||||||
|
|
||||||
$qb->filterType(SocialAppNotification::TYPE);
|
$qb->filterType(SocialAppNotification::TYPE);
|
||||||
$qb->paginate($options);
|
$qb->paginate($options);
|
||||||
|
@ -370,17 +380,37 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
$qb->leftJoinStreamAction('sa');
|
$qb->leftJoinStreamAction('sa');
|
||||||
$qb->filterDuplicate();
|
$qb->filterDuplicate();
|
||||||
|
|
||||||
$result = $this->getStreamsFromRequest($qb);
|
return $this->getStreamsFromRequest($qb);
|
||||||
if ($options->isInverted()) {
|
|
||||||
$result = array_reverse($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should returns:
|
* Should return:
|
||||||
|
* * Private message.
|
||||||
|
* - group messages. (not yet)
|
||||||
|
*
|
||||||
|
* @param TimelineOptions $options
|
||||||
|
*
|
||||||
|
* @return Stream[]
|
||||||
|
*/
|
||||||
|
private function getTimelineDirect(TimelineOptions $options): array {
|
||||||
|
$qb = $this->getStreamSelectSql();
|
||||||
|
|
||||||
|
$qb->filterType(SocialAppNotification::TYPE);
|
||||||
|
$qb->paginate($options);
|
||||||
|
|
||||||
|
$qb->linkToCacheActors('ca', 's.attributed_to_prim');
|
||||||
|
|
||||||
|
$viewer = $qb->getViewer();
|
||||||
|
$qb->selectDestFollowing('sd', '');
|
||||||
|
$qb->limitToDest($viewer->getId(), 'dm', '', 'sd');
|
||||||
|
|
||||||
|
return $this->getStreamsFromRequest($qb);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should return:
|
||||||
* * Own posts,
|
* * Own posts,
|
||||||
* * Followed accounts
|
* * Followed accounts
|
||||||
*
|
*
|
||||||
|
@ -396,7 +426,6 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
int $since = 0, int $limit = 5, int $format = Stream::FORMAT_ACTIVITYPUB
|
int $since = 0, int $limit = 5, int $format = Stream::FORMAT_ACTIVITYPUB
|
||||||
): array {
|
): array {
|
||||||
$qb = $this->getStreamSelectSql($format);
|
$qb = $this->getStreamSelectSql($format);
|
||||||
$qb->setChunk(1);
|
|
||||||
|
|
||||||
$qb->filterType(SocialAppNotification::TYPE);
|
$qb->filterType(SocialAppNotification::TYPE);
|
||||||
$qb->limitPaginate($since, $limit);
|
$qb->limitPaginate($since, $limit);
|
||||||
|
@ -412,7 +441,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should returns:
|
* Should return:
|
||||||
* * Public/Unlisted/Followers-only post where current $actor is tagged,
|
* * Public/Unlisted/Followers-only post where current $actor is tagged,
|
||||||
* - Events: (not yet)
|
* - Events: (not yet)
|
||||||
* - people liking or re-posting your posts (not yet)
|
* - people liking or re-posting your posts (not yet)
|
||||||
|
@ -444,7 +473,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should returns:
|
* Should return:
|
||||||
* * public message from actorId.
|
* * public message from actorId.
|
||||||
* - to followers-only if follower is logged. (not yet (check ?))
|
* - to followers-only if follower is logged. (not yet (check ?))
|
||||||
*
|
*
|
||||||
|
@ -474,7 +503,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should returns:
|
* Should return:
|
||||||
* * Private message.
|
* * Private message.
|
||||||
* - group messages. (not yet)
|
* - group messages. (not yet)
|
||||||
*
|
*
|
||||||
|
@ -484,7 +513,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
* @return Stream[]
|
* @return Stream[]
|
||||||
* @throws DateTimeException
|
* @throws DateTimeException
|
||||||
*/
|
*/
|
||||||
public function getTimelineDirect(int $since = 0, int $limit = 5): array {
|
public function getTimelineDirect_dep(int $since = 0, int $limit = 5): array {
|
||||||
$qb = $this->getStreamSelectSql();
|
$qb = $this->getStreamSelectSql();
|
||||||
|
|
||||||
$qb->filterType(SocialAppNotification::TYPE);
|
$qb->filterType(SocialAppNotification::TYPE);
|
||||||
|
@ -506,9 +535,8 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
* @param TimelineOptions $options
|
* @param TimelineOptions $options
|
||||||
*
|
*
|
||||||
* @return Stream[]
|
* @return Stream[]
|
||||||
* @throws DateTimeException
|
|
||||||
*/
|
*/
|
||||||
public function getTimelinePublic(TimelineOptions $options): array {
|
private function getTimelinePublic(TimelineOptions $options): array {
|
||||||
$qb = $this->getStreamSelectSql($options->getFormat());
|
$qb = $this->getStreamSelectSql($options->getFormat());
|
||||||
$qb->paginate($options);
|
$qb->paginate($options);
|
||||||
|
|
||||||
|
@ -524,12 +552,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
$qb->innerJoinSteamDest('recipient', 'id_prim', 'sd', 's');
|
$qb->innerJoinSteamDest('recipient', 'id_prim', 'sd', 's');
|
||||||
$qb->limitToDest(ACore::CONTEXT_PUBLIC, 'recipient', 'to', 'sd');
|
$qb->limitToDest(ACore::CONTEXT_PUBLIC, 'recipient', 'to', 'sd');
|
||||||
|
|
||||||
$result = $this->getStreamsFromRequest($qb);
|
return $this->getStreamsFromRequest($qb);
|
||||||
if ($options->isInverted()) {
|
|
||||||
$result = array_reverse($result);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -598,7 +621,7 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should returns:
|
* Should return:
|
||||||
* - All public post related to a tag (not yet)
|
* - All public post related to a tag (not yet)
|
||||||
* - direct message related to a tag (not yet)
|
* - direct message related to a tag (not yet)
|
||||||
* - message to followers related to a tag (not yet)
|
* - message to followers related to a tag (not yet)
|
||||||
|
@ -709,19 +732,19 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
->setValue('subtype', $qb->createNamedParameter($stream->getSubType()))
|
->setValue('subtype', $qb->createNamedParameter($stream->getSubType()))
|
||||||
->setValue('to', $qb->createNamedParameter($stream->getTo()))
|
->setValue('to', $qb->createNamedParameter($stream->getTo()))
|
||||||
->setValue(
|
->setValue(
|
||||||
'to_array', $qb->createNamedParameter(
|
'to_array', $qb->createNamedParameter(
|
||||||
json_encode($stream->getToArray(), JSON_UNESCAPED_SLASHES)
|
json_encode($stream->getToArray(), JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setValue(
|
->setValue(
|
||||||
'cc', $qb->createNamedParameter(
|
'cc', $qb->createNamedParameter(
|
||||||
json_encode($stream->getCcArray(), JSON_UNESCAPED_SLASHES)
|
json_encode($stream->getCcArray(), JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setValue(
|
->setValue(
|
||||||
'bcc', $qb->createNamedParameter(
|
'bcc', $qb->createNamedParameter(
|
||||||
json_encode($stream->getBccArray(), JSON_UNESCAPED_SLASHES)
|
json_encode($stream->getBccArray(), JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setValue('content', $qb->createNamedParameter($stream->getContent()))
|
->setValue('content', $qb->createNamedParameter($stream->getContent()))
|
||||||
->setValue('summary', $qb->createNamedParameter($stream->getSummary()))
|
->setValue('summary', $qb->createNamedParameter($stream->getSummary()))
|
||||||
|
@ -737,13 +760,13 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
->setValue('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())))
|
->setValue('details', $qb->createNamedParameter(json_encode($stream->getDetailsAll())))
|
||||||
->setValue('cache', $qb->createNamedParameter($cache))
|
->setValue('cache', $qb->createNamedParameter($cache))
|
||||||
->setValue(
|
->setValue(
|
||||||
'filter_duplicate',
|
'filter_duplicate',
|
||||||
$qb->createNamedParameter(($stream->isFilterDuplicate()) ? '1' : '0')
|
$qb->createNamedParameter(($stream->isFilterDuplicate()) ? '1' : '0')
|
||||||
)
|
)
|
||||||
->setValue(
|
->setValue(
|
||||||
'instances', $qb->createNamedParameter(
|
'instances', $qb->createNamedParameter(
|
||||||
json_encode($stream->getInstancePaths(), JSON_UNESCAPED_SLASHES)
|
json_encode($stream->getInstancePaths(), JSON_UNESCAPED_SLASHES)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
->setValue('local', $qb->createNamedParameter(($stream->isLocal()) ? '1' : '0'));
|
->setValue('local', $qb->createNamedParameter(($stream->isLocal()) ? '1' : '0'));
|
||||||
|
|
||||||
|
@ -754,8 +777,8 @@ class StreamRequest extends StreamRequestBuilder {
|
||||||
'published_time', $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
|
'published_time', $qb->createNamedParameter($dTime, IQueryBuilder::PARAM_DATE)
|
||||||
)
|
)
|
||||||
->setValue(
|
->setValue(
|
||||||
'creation',
|
'creation',
|
||||||
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
$qb->createNamedParameter(new DateTime('now'), IQueryBuilder::PARAM_DATE)
|
||||||
);
|
);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,10 +92,10 @@ class StreamRequestBuilder extends CoreRequestBuilder {
|
||||||
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
/** @noinspection PhpMethodParametersCountMismatchInspection */
|
||||||
$qb->selectDistinct('s.id')
|
$qb->selectDistinct('s.id')
|
||||||
->addSelect(
|
->addSelect(
|
||||||
's.nid', 's.type', 's.subtype', 's.to', 's.to_array', 's.cc', 's.bcc', 's.content',
|
's.nid', 's.type', 's.subtype', 's.to', 's.to_array', 's.cc', 's.bcc', 's.content',
|
||||||
's.summary', 's.attachments', 's.published', 's.published_time', 's.cache',
|
's.summary', 's.attachments', 's.published', 's.published_time', 's.cache',
|
||||||
's.object_id', 's.attributed_to', 's.in_reply_to', 's.source', 's.local',
|
's.object_id', 's.attributed_to', 's.in_reply_to', 's.source', 's.local',
|
||||||
's.instances', 's.creation', 's.filter_duplicate', 's.details', 's.hashtags'
|
's.instances', 's.creation', 's.filter_duplicate', 's.details', 's.hashtags'
|
||||||
)
|
)
|
||||||
->from(self::TABLE_STREAM, 's');
|
->from(self::TABLE_STREAM, 's');
|
||||||
|
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nextcloud - Social Support
|
|
||||||
*
|
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
|
||||||
* later. See the COPYING file.
|
|
||||||
*
|
|
||||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace OCA\Social\Migration;
|
|
||||||
|
|
||||||
use OCA\Social\Service\CheckService;
|
|
||||||
use OCP\Migration\IOutput;
|
|
||||||
use OCP\Migration\IRepairStep;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class CheckInstallation
|
|
||||||
*
|
|
||||||
* @package OCA\Social\Migration
|
|
||||||
*/
|
|
||||||
class CheckInstallation implements IRepairStep {
|
|
||||||
protected CheckService $checkService;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* CheckInstallation constructor.
|
|
||||||
*
|
|
||||||
* @param CheckService $checkService
|
|
||||||
*/
|
|
||||||
public function __construct(CheckService $checkService) {
|
|
||||||
$this->checkService = $checkService;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns the step's name
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
* @since 9.1.0
|
|
||||||
*/
|
|
||||||
public function getName() {
|
|
||||||
return 'Check the installation of the Social app.';
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IOutput $output
|
|
||||||
*/
|
|
||||||
public function run(IOutput $output) {
|
|
||||||
$this->checkService->checkInstallationStatus(true);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,96 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nextcloud - Social Support
|
|
||||||
*
|
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
|
||||||
* later. See the COPYING file.
|
|
||||||
*
|
|
||||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace OCA\Social\Migration;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Doctrine\DBAL\DBALException;
|
|
||||||
use Doctrine\DBAL\Schema\SchemaException;
|
|
||||||
use Exception;
|
|
||||||
use OCP\DB\ISchemaWrapper;
|
|
||||||
use OCP\IDBConnection;
|
|
||||||
use OCP\Migration\IOutput;
|
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Version0003Date20200823023910
|
|
||||||
*
|
|
||||||
* @package OCA\Social\Migration
|
|
||||||
*/
|
|
||||||
class Version0003Date20200823023900 extends SimpleMigrationStep {
|
|
||||||
private IDBConnection $connection;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IDBConnection $connection
|
|
||||||
*/
|
|
||||||
public function __construct(IDBConnection $connection) {
|
|
||||||
$this->connection = $connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IOutput $output
|
|
||||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return ISchemaWrapper
|
|
||||||
* @throws SchemaException
|
|
||||||
* @throws DBALException
|
|
||||||
*/
|
|
||||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper {
|
|
||||||
/** @var ISchemaWrapper $schema */
|
|
||||||
$schema = $schemaClosure();
|
|
||||||
|
|
||||||
if ($schema->hasTable('social_3_cache_actor')) {
|
|
||||||
$table = $schema->getTable('social_3_cache_actor');
|
|
||||||
if ($table->hasPrimaryKey()) {
|
|
||||||
$kc = $table->getPrimaryKeyColumns();
|
|
||||||
if (count($kc) === 1 && $kc[0] === 'id_prim') {
|
|
||||||
$table->dropPrimaryKey();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $schema;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IOutput $output
|
|
||||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,451 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nextcloud - Social Support
|
|
||||||
*
|
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
|
||||||
* later. See the COPYING file.
|
|
||||||
*
|
|
||||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace OCA\Social\Migration;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Doctrine\DBAL\Schema\SchemaException;
|
|
||||||
use Doctrine\DBAL\Types\Type;
|
|
||||||
use Exception;
|
|
||||||
use OCP\DB\ISchemaWrapper;
|
|
||||||
use OCP\IDBConnection;
|
|
||||||
use OCP\Migration\IOutput;
|
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Version0003Date20200823023911
|
|
||||||
*
|
|
||||||
* @package OCA\Social\Migration
|
|
||||||
*/
|
|
||||||
class Version0003Date20200823023911 extends SimpleMigrationStep {
|
|
||||||
private IDBConnection $connection;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IDBConnection $connection
|
|
||||||
*/
|
|
||||||
public function __construct(IDBConnection $connection) {
|
|
||||||
$this->connection = $connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IOutput $output
|
|
||||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return ISchemaWrapper
|
|
||||||
* @throws SchemaException
|
|
||||||
*/
|
|
||||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options
|
|
||||||
): ISchemaWrapper {
|
|
||||||
/** @var ISchemaWrapper $schema */
|
|
||||||
$schema = $schemaClosure();
|
|
||||||
|
|
||||||
$this->fixStreamNid($schema);
|
|
||||||
$this->fixCacheActorNid($schema);
|
|
||||||
|
|
||||||
$this->createClient($schema);
|
|
||||||
$this->createInstance($schema);
|
|
||||||
|
|
||||||
$this->addChunkToTable($schema, 'social_3_stream', '');
|
|
||||||
$this->addChunkToTable($schema, 'social_3_stream_act', '_act');
|
|
||||||
$this->addChunkToTable($schema, 'social_3_stream_dest', '_dest');
|
|
||||||
|
|
||||||
return $schema;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IOutput $output
|
|
||||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
public function postSchemaChange(IOutput $output, Closure $schemaClosure, array $options) {
|
|
||||||
$qb = $this->connection->getQueryBuilder();
|
|
||||||
|
|
||||||
$qb->select('*')
|
|
||||||
->from('social_3_stream')
|
|
||||||
->orderBy('creation', 'asc');
|
|
||||||
|
|
||||||
$result = $qb->execute();
|
|
||||||
$nid = 0;
|
|
||||||
while ($row = $result->fetch()) {
|
|
||||||
$nid++;
|
|
||||||
if (is_int($row['nid']) and $row['nid'] > 0) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$update = $this->connection->getQueryBuilder();
|
|
||||||
$expr = $update->expr();
|
|
||||||
|
|
||||||
$update->update('social_3_stream');
|
|
||||||
$update->set('nid', $update->createNamedParameter($nid));
|
|
||||||
$update->where($expr->eq('id_prim', $update->createNamedParameter($row['id_prim'])));
|
|
||||||
$update->execute();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ISchemaWrapper $schema
|
|
||||||
*/
|
|
||||||
private function fixStreamNid(ISchemaWrapper $schema) {
|
|
||||||
try {
|
|
||||||
$table = $schema->getTable('social_3_stream');
|
|
||||||
} catch (SchemaException $e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($table->hasColumn('nid')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->addColumn(
|
|
||||||
'nid', 'bigint',
|
|
||||||
[
|
|
||||||
'length' => 11,
|
|
||||||
'unsigned' => true,
|
|
||||||
'notnull' => false,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ISchemaWrapper $schema
|
|
||||||
*/
|
|
||||||
private function fixCacheActorNid(ISchemaWrapper $schema) {
|
|
||||||
try {
|
|
||||||
$table = $schema->getTable('social_3_cache_actor');
|
|
||||||
} catch (SchemaException $e) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($table->hasColumn('nid')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->addColumn(
|
|
||||||
'nid', 'bigint',
|
|
||||||
[
|
|
||||||
'autoincrement' => true,
|
|
||||||
'length' => 11,
|
|
||||||
'unsigned' => true,
|
|
||||||
'customSchemaOptions' => [
|
|
||||||
'unique' => true
|
|
||||||
]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->addUniqueIndex(['id_prim']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ISchemaWrapper $schema
|
|
||||||
*/
|
|
||||||
private function createClient(ISchemaWrapper $schema) {
|
|
||||||
if ($schema->hasTable('social_3_client')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = $schema->createTable('social_3_client');
|
|
||||||
$table->addColumn(
|
|
||||||
'id', 'integer',
|
|
||||||
[
|
|
||||||
'autoincrement' => true,
|
|
||||||
'notnull' => true,
|
|
||||||
'length' => 7,
|
|
||||||
'unsigned' => true,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'app_name', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 127,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'app_website', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 255,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'app_redirect_uris', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'app_client_id', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 63,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'app_client_secret', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 63,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'app_scopes', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->addColumn(
|
|
||||||
'auth_scopes', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'auth_account', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 127,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'auth_user_id', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 127,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'auth_code', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 127,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'token', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 127,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'last_update', 'datetime',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'creation', 'datetime',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->setPrimaryKey(['id']);
|
|
||||||
$table->addUniqueIndex(['auth_code', 'token', 'app_client_id', 'app_client_secret']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ISchemaWrapper $schema
|
|
||||||
*/
|
|
||||||
private function createInstance(ISchemaWrapper $schema) {
|
|
||||||
if ($schema->hasTable('social_3_instance')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = $schema->createTable('social_3_instance');
|
|
||||||
$table->addColumn(
|
|
||||||
'local', 'smallint',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 1,
|
|
||||||
'default' => 0,
|
|
||||||
'unsigned' => true
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'uri', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 255,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'title', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 255,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'version', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 31,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'short_description', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'description', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'email', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 255,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'urls', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => '[]'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'stats', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => '[]'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'usage', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => '[]'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'image', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 255,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'languages', 'text',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'default' => '[]'
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'contact', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 127,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'account_prim', 'string',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
'length' => 128,
|
|
||||||
'default' => ''
|
|
||||||
]
|
|
||||||
);
|
|
||||||
$table->addColumn(
|
|
||||||
'creation', 'datetime',
|
|
||||||
[
|
|
||||||
'notnull' => false,
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
$table->setPrimaryKey(['uri']);
|
|
||||||
$table->addIndex(['local', 'uri', 'account_prim']);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param ISchemaWrapper $schema
|
|
||||||
* @param string $tableName
|
|
||||||
* @param string $indexName
|
|
||||||
*
|
|
||||||
* @throws SchemaException
|
|
||||||
*/
|
|
||||||
private function addChunkToTable(ISchemaWrapper $schema, string $tableName, string $indexName) {
|
|
||||||
if (!$schema->hasTable($tableName)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table = $schema->getTable($tableName);
|
|
||||||
if ($table->hasColumn('chunk')) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$table->addColumn(
|
|
||||||
'chunk', Type::SMALLINT,
|
|
||||||
[
|
|
||||||
'default' => 1,
|
|
||||||
'length' => 1,
|
|
||||||
'unsigned' => true
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!$table->hasIndex('chunk' . $indexName)) {
|
|
||||||
$table->addIndex(['chunk'], 'chunk' . $indexName);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,86 +0,0 @@
|
||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Nextcloud - Social Support
|
|
||||||
*
|
|
||||||
* This file is licensed under the Affero General Public License version 3 or
|
|
||||||
* later. See the COPYING file.
|
|
||||||
*
|
|
||||||
* @author Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @copyright 2018, Maxence Lange <maxence@artificial-owl.com>
|
|
||||||
* @license GNU AGPL version 3 or any later version
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
namespace OCA\Social\Migration;
|
|
||||||
|
|
||||||
use Closure;
|
|
||||||
use Doctrine\DBAL\Schema\SchemaException;
|
|
||||||
use OCP\DB\ISchemaWrapper;
|
|
||||||
use OCP\IDBConnection;
|
|
||||||
use OCP\Migration\IOutput;
|
|
||||||
use OCP\Migration\SimpleMigrationStep;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class Version0003Date20200921103342
|
|
||||||
*
|
|
||||||
* @package OCA\Social\Migration
|
|
||||||
*/
|
|
||||||
class Version0003Date20200921103342 extends SimpleMigrationStep {
|
|
||||||
private IDBConnection $connection;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IDBConnection $connection
|
|
||||||
*/
|
|
||||||
public function __construct(IDBConnection $connection) {
|
|
||||||
$this->connection = $connection;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param IOutput $output
|
|
||||||
* @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
|
|
||||||
* @param array $options
|
|
||||||
*
|
|
||||||
* @return ISchemaWrapper
|
|
||||||
* @throws SchemaException
|
|
||||||
*/
|
|
||||||
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options
|
|
||||||
): ISchemaWrapper {
|
|
||||||
/** @var ISchemaWrapper $schema */
|
|
||||||
$schema = $schemaClosure();
|
|
||||||
|
|
||||||
$table = $schema->getTable('social_3_stream');
|
|
||||||
|
|
||||||
$column = $table->getColumn('nid');
|
|
||||||
if (!$column->getAutoincrement()) {
|
|
||||||
$table->changeColumn(
|
|
||||||
'nid', [
|
|
||||||
'autoincrement' => true, 'customSchemaOptions' => [
|
|
||||||
'unique' => true
|
|
||||||
]
|
|
||||||
]
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $schema;
|
|
||||||
}
|
|
||||||
}
|
|
Plik diff jest za duży
Load Diff
|
@ -55,7 +55,6 @@ class ConfigService {
|
||||||
public const CLOUD_URL = 'cloud_url';
|
public const CLOUD_URL = 'cloud_url';
|
||||||
public const SOCIAL_URL = 'social_url';
|
public const SOCIAL_URL = 'social_url';
|
||||||
public const SOCIAL_ADDRESS = 'social_address';
|
public const SOCIAL_ADDRESS = 'social_address';
|
||||||
public const DATABASE_CHUNK_SIZE = 'db_chunk_size';
|
|
||||||
|
|
||||||
public const SOCIAL_SERVICE = 'service';
|
public const SOCIAL_SERVICE = 'service';
|
||||||
public const SOCIAL_MAX_SIZE = 'max_size';
|
public const SOCIAL_MAX_SIZE = 'max_size';
|
||||||
|
@ -78,8 +77,7 @@ class ConfigService {
|
||||||
self::SOCIAL_MAX_SIZE => 10,
|
self::SOCIAL_MAX_SIZE => 10,
|
||||||
self::SOCIAL_ACCESS_TYPE => 'all_but',
|
self::SOCIAL_ACCESS_TYPE => 'all_but',
|
||||||
self::SOCIAL_ACCESS_LIST => '[]',
|
self::SOCIAL_ACCESS_LIST => '[]',
|
||||||
self::SOCIAL_SELF_SIGNED => '0',
|
self::SOCIAL_SELF_SIGNED => '0'
|
||||||
self::DATABASE_CHUNK_SIZE => 10000
|
|
||||||
];
|
];
|
||||||
|
|
||||||
public array $accessTypeList = [
|
public array $accessTypeList = [
|
||||||
|
|
|
@ -30,13 +30,6 @@ declare(strict_types=1);
|
||||||
|
|
||||||
namespace OCA\Social\Service;
|
namespace OCA\Social\Service;
|
||||||
|
|
||||||
use OCA\Social\Tools\Exceptions\DateTimeException;
|
|
||||||
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
|
||||||
use OCA\Social\Tools\Exceptions\RequestContentException;
|
|
||||||
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
|
||||||
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
|
||||||
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
|
||||||
use OCA\Social\Tools\Exceptions\RequestServerException;
|
|
||||||
use Exception;
|
use Exception;
|
||||||
use OCA\Social\Db\StreamRequest;
|
use OCA\Social\Db\StreamRequest;
|
||||||
use OCA\Social\Exceptions\InvalidOriginException;
|
use OCA\Social\Exceptions\InvalidOriginException;
|
||||||
|
@ -53,6 +46,13 @@ use OCA\Social\Model\ActivityPub\Object\Note;
|
||||||
use OCA\Social\Model\ActivityPub\Stream;
|
use OCA\Social\Model\ActivityPub\Stream;
|
||||||
use OCA\Social\Model\Client\Options\TimelineOptions;
|
use OCA\Social\Model\Client\Options\TimelineOptions;
|
||||||
use OCA\Social\Model\InstancePath;
|
use OCA\Social\Model\InstancePath;
|
||||||
|
use OCA\Social\Tools\Exceptions\DateTimeException;
|
||||||
|
use OCA\Social\Tools\Exceptions\MalformedArrayException;
|
||||||
|
use OCA\Social\Tools\Exceptions\RequestContentException;
|
||||||
|
use OCA\Social\Tools\Exceptions\RequestNetworkException;
|
||||||
|
use OCA\Social\Tools\Exceptions\RequestResultNotJsonException;
|
||||||
|
use OCA\Social\Tools\Exceptions\RequestResultSizeException;
|
||||||
|
use OCA\Social\Tools\Exceptions\RequestServerException;
|
||||||
|
|
||||||
class StreamService {
|
class StreamService {
|
||||||
private StreamRequest $streamRequest;
|
private StreamRequest $streamRequest;
|
||||||
|
@ -400,7 +400,10 @@ class StreamService {
|
||||||
* @throws DateTimeException
|
* @throws DateTimeException
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function getStreamHome(int $since = 0, int $limit = 5, int $format = Stream::FORMAT_ACTIVITYPUB
|
public function getStreamHome(
|
||||||
|
int $since = 0,
|
||||||
|
int $limit = 5,
|
||||||
|
int $format = Stream::FORMAT_ACTIVITYPUB
|
||||||
): array {
|
): array {
|
||||||
return $this->streamRequest->getTimelineHome_dep($since, $limit, $format);
|
return $this->streamRequest->getTimelineHome_dep($since, $limit, $format);
|
||||||
}
|
}
|
||||||
|
@ -451,7 +454,7 @@ class StreamService {
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
public function getStreamDirect(int $since = 0, int $limit = 5): array {
|
public function getStreamDirect(int $since = 0, int $limit = 5): array {
|
||||||
return $this->streamRequest->getTimelineDirect($since, $limit);
|
return $this->streamRequest->getTimelineDirect_dep($since, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -71,12 +71,12 @@ trait TNCLogger {
|
||||||
|
|
||||||
$this->logger()
|
$this->logger()
|
||||||
->log(
|
->log(
|
||||||
$level,
|
$level,
|
||||||
$message,
|
$message,
|
||||||
[
|
[
|
||||||
'app' => $this->setup('app'),
|
'app' => $this->setup('app'),
|
||||||
'exception' => $t
|
'exception' => $t
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,12 +111,12 @@ trait TNCLogger {
|
||||||
|
|
||||||
$this->logger()
|
$this->logger()
|
||||||
->log(
|
->log(
|
||||||
$level,
|
$level,
|
||||||
$message,
|
$message,
|
||||||
[
|
[
|
||||||
'app' => $this->setup('app'),
|
'app' => $this->setup('app'),
|
||||||
'exception' => $e
|
'exception' => $e
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Plik diff jest za duży
Load Diff
12
package.json
12
package.json
|
@ -33,15 +33,15 @@
|
||||||
"@nextcloud/dialogs": "^3.2.0",
|
"@nextcloud/dialogs": "^3.2.0",
|
||||||
"@nextcloud/initial-state": "^2.0.0",
|
"@nextcloud/initial-state": "^2.0.0",
|
||||||
"@nextcloud/l10n": "^1.6.0",
|
"@nextcloud/l10n": "^1.6.0",
|
||||||
"@nextcloud/logger": "^2.2.1",
|
"@nextcloud/logger": "^2.4.0",
|
||||||
"@nextcloud/moment": "^1.2.1",
|
"@nextcloud/moment": "^1.2.1",
|
||||||
"@nextcloud/router": "^1.2.0",
|
"@nextcloud/router": "^2.0.0",
|
||||||
"@nextcloud/stylelint-config": "^2.2.0",
|
"@nextcloud/stylelint-config": "^2.2.0",
|
||||||
"@nextcloud/vue": "^7.0.1",
|
"@nextcloud/vue": "^7.0.1",
|
||||||
"@nextcloud/vue-richtext": "^2.0.4",
|
"@nextcloud/vue-richtext": "^2.0.4",
|
||||||
"he": "^1.2.0",
|
"he": "^1.2.0",
|
||||||
"linkifyjs": "^2.1.8",
|
"linkifyjs": "^2.1.8",
|
||||||
"sass": "^1.56.0",
|
"sass": "^1.56.1",
|
||||||
"tributejs": "^3.7.3",
|
"tributejs": "^3.7.3",
|
||||||
"twemoji": "12.0.1",
|
"twemoji": "12.0.1",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
"vue-infinite-loading": "^2.4.4",
|
"vue-infinite-loading": "^2.4.4",
|
||||||
"vue-material-design-icons": "^5.0.0",
|
"vue-material-design-icons": "^5.0.0",
|
||||||
"vue-router": "^3.5.3",
|
"vue-router": "^3.5.3",
|
||||||
"vue-tribute": "^1.0.6",
|
"vue-tribute": "^1.0.7",
|
||||||
"vue-twemoji": "^1.0.1",
|
"vue-twemoji": "^1.0.1",
|
||||||
"vuetrend": "^0.3.4",
|
"vuetrend": "^0.3.4",
|
||||||
"vuex": "^3.6.2",
|
"vuex": "^3.6.2",
|
||||||
|
@ -71,9 +71,9 @@
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@nextcloud/babel-config": "^1.0.0",
|
"@nextcloud/babel-config": "^1.0.0",
|
||||||
"@nextcloud/browserslist-config": "^2.3.0",
|
"@nextcloud/browserslist-config": "^2.3.0",
|
||||||
"@nextcloud/eslint-config": "^8.0.0",
|
"@nextcloud/eslint-config": "^8.1.4",
|
||||||
"@nextcloud/webpack-vue-config": "^5.4.0",
|
"@nextcloud/webpack-vue-config": "^5.4.0",
|
||||||
"jest": "^29.2.2",
|
"jest": "^29.3.1",
|
||||||
"jest-serializer-vue": "^2.0.2",
|
"jest-serializer-vue": "^2.0.2",
|
||||||
"vue-template-compiler": "^2.7.10"
|
"vue-template-compiler": "^2.7.10"
|
||||||
},
|
},
|
||||||
|
|
|
@ -25,6 +25,7 @@
|
||||||
<UndefinedClass>
|
<UndefinedClass>
|
||||||
<errorLevel type="suppress">
|
<errorLevel type="suppress">
|
||||||
<referencedClass name="OC" />
|
<referencedClass name="OC" />
|
||||||
|
<referencedClass name="OC\DB\Connection" />
|
||||||
</errorLevel>
|
</errorLevel>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
<UndefinedDocblockClass>
|
<UndefinedDocblockClass>
|
||||||
|
@ -33,6 +34,7 @@
|
||||||
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
|
<referencedClass name="Doctrine\DBAL\Schema\SchemaException" />
|
||||||
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
|
<referencedClass name="Doctrine\DBAL\Driver\Statement" />
|
||||||
<referencedClass name="Doctrine\DBAL\Schema\Table" />
|
<referencedClass name="Doctrine\DBAL\Schema\Table" />
|
||||||
|
<referencedClass name="OC\DB\Connection" />
|
||||||
</errorLevel>
|
</errorLevel>
|
||||||
</UndefinedDocblockClass>
|
</UndefinedDocblockClass>
|
||||||
</issueHandlers>
|
</issueHandlers>
|
||||||
|
|
|
@ -0,0 +1,38 @@
|
||||||
|
/**
|
||||||
|
* @copyright 2022 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import Vue from 'vue'
|
||||||
|
import OAuth2Authorize from './views/OAuth2Authorize.vue'
|
||||||
|
|
||||||
|
// CSP config for webpack dynamic chunk loading
|
||||||
|
// eslint-disable-next-line
|
||||||
|
__webpack_nonce__ = btoa(OC.requestToken)
|
||||||
|
|
||||||
|
// Correct the root of the app for chunk loading
|
||||||
|
// OC.linkTo matches the apps folders
|
||||||
|
// eslint-disable-next-line
|
||||||
|
__webpack_public_path__ = OC.linkTo('social', 'js/')
|
||||||
|
|
||||||
|
Vue.prototype.t = t
|
||||||
|
Vue.prototype.n = n
|
||||||
|
Vue.prototype.OC = OC
|
||||||
|
Vue.prototype.OCA = OCA
|
||||||
|
|
||||||
|
new Vue({
|
||||||
|
render: h => h(OAuth2Authorize),
|
||||||
|
}).$mount('#social-oauth2')
|
|
@ -0,0 +1,98 @@
|
||||||
|
<!--
|
||||||
|
- @copyright 2022 Carl Schwan <carl@carlschwan.eu>
|
||||||
|
- @license GNU AGPL version 3 or any later version
|
||||||
|
-
|
||||||
|
- This program is free software: you can redistribute it and/or modify
|
||||||
|
- it under the terms of the GNU Affero General Public License as
|
||||||
|
- published by the Free Software Foundation, either version 3 of the
|
||||||
|
- License, or (at your option) any later version.
|
||||||
|
-
|
||||||
|
- This program is distributed in the hope that it will be useful,
|
||||||
|
- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
- GNU Affero General Public License for more details.
|
||||||
|
-
|
||||||
|
- You should have received a copy of the GNU Affero General Public License
|
||||||
|
- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<template>
|
||||||
|
<div class="wrapper">
|
||||||
|
<form class="guest-box" method="post">
|
||||||
|
<h1>{{ t('social', 'Authorization required') }}</h1>
|
||||||
|
<p>
|
||||||
|
{{ t('social', '{appDisplayName} would like permission to access your account. It is a third party application.', {appDisplayName: appName}) }}
|
||||||
|
<b>{{ t('social', 'If you do not trust it, then you should not authorize it.') }}</b>
|
||||||
|
</p>
|
||||||
|
<input type="hidden"
|
||||||
|
name="requesttoken"
|
||||||
|
:value="OC.requestToken">
|
||||||
|
<div class="button-row">
|
||||||
|
<NcButton type="primary" nativeType="submit">
|
||||||
|
{{ t('social', 'Authorize') }}
|
||||||
|
</NcButton>
|
||||||
|
<NcButton type="error" :href="homeUrl">
|
||||||
|
{{ t('social', 'Deny') }}
|
||||||
|
</NcButton>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
|
||||||
|
import { loadState } from '@nextcloud/initial-state'
|
||||||
|
import { generateUrl } from '@nextcloud/router'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: 'OAuth2Authorize',
|
||||||
|
components: {
|
||||||
|
NcButton,
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
appName: loadState('social', 'appName'),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
homeUrl() {
|
||||||
|
return generateUrl('/apps/social/')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scopped>
|
||||||
|
.wrapper {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
.guest-box {
|
||||||
|
color: var(--color-main-text);
|
||||||
|
background-color: var(--color-main-background);
|
||||||
|
padding: 1rem;
|
||||||
|
border-radius: var(--border-radius-large);
|
||||||
|
box-shadow: 0 0 10px var(--color-box-shadow);
|
||||||
|
display: inline-block;
|
||||||
|
max-width: 600px;
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
font-weight: bold;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 20px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
line-height: 140%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-row {
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
flex-direction: row;
|
||||||
|
margin-top: 1rem;
|
||||||
|
justify-content: end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (c) 2019 Julius Härtl <jus@bitgrid.net>
|
||||||
|
*
|
||||||
|
* @author Jonas Sulzer <jonas@violoncello.ch>
|
||||||
|
* @author Julius Härtl <jus@bitgrid.net>
|
||||||
|
*
|
||||||
|
* @license GNU AGPL version 3 or any later version
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
\OCP\Util::addScript('social', 'social-oauth');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="social-oauth2"></div>
|
|
@ -1,22 +1,10 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<files psalm-version="4.29.0@7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3">
|
<files psalm-version="4.26.0@6998fabb2bf528b65777bf9941920888d23c03ac">
|
||||||
<file src="lib/AP.php">
|
<file src="lib/AP.php">
|
||||||
<InvalidScalarArgument occurrences="1">
|
<InvalidScalarArgument occurrences="1">
|
||||||
<code>$level</code>
|
<code>$level</code>
|
||||||
</InvalidScalarArgument>
|
</InvalidScalarArgument>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Migration/Version0003Date20200823023900.php">
|
|
||||||
<UndefinedDocblockClass occurrences="1">
|
|
||||||
<code>DBALException</code>
|
|
||||||
</UndefinedDocblockClass>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Migration/Version0003Date20200823023911.php">
|
|
||||||
<UndefinedClass occurrences="3">
|
|
||||||
<code>SchemaException</code>
|
|
||||||
<code>SchemaException</code>
|
|
||||||
<code>Type</code>
|
|
||||||
</UndefinedClass>
|
|
||||||
</file>
|
|
||||||
<file src="lib/Model/ActivityPub/ACore.php">
|
<file src="lib/Model/ActivityPub/ACore.php">
|
||||||
<InvalidArgument occurrences="1">
|
<InvalidArgument occurrences="1">
|
||||||
<code>['a', 'p', 'span', 'br']</code>
|
<code>['a', 'p', 'span', 'br']</code>
|
||||||
|
@ -138,10 +126,4 @@
|
||||||
<code>HintException</code>
|
<code>HintException</code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
<file src="lib/Tools/Traits/TNCRequest.php">
|
|
||||||
<InvalidArgument occurrences="21">
|
|
||||||
<code>$curl</code>
|
|
||||||
</InvalidArgument>
|
|
||||||
<InvalidReturnType occurrences="1"/>
|
|
||||||
</file>
|
|
||||||
</files>
|
</files>
|
||||||
|
|
|
@ -8,7 +8,8 @@ webpackConfig.entry = {
|
||||||
social: path.join(__dirname, 'src', 'main.js'),
|
social: path.join(__dirname, 'src', 'main.js'),
|
||||||
ostatus: path.join(__dirname, 'src', 'ostatus.js'),
|
ostatus: path.join(__dirname, 'src', 'ostatus.js'),
|
||||||
profilePage: path.join(__dirname, 'src', 'profile.js'),
|
profilePage: path.join(__dirname, 'src', 'profile.js'),
|
||||||
dashboard: path.join(__dirname, 'src', 'dashboard.js'),
|
dashboard: path.join(__dirname, 'src', 'dashboard.js'),
|
||||||
|
oauth: path.join(__dirname, 'src', 'oauth.js'),
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = webpackConfig
|
module.exports = webpackConfig
|
||||||
|
|
Ładowanie…
Reference in New Issue