diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index e18dfb6028bc6..99e731b594cda 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -78,6 +78,7 @@ use OCP\ITempManager; use OCP\IURLGenerator; use OCP\Lock\ILockingProvider; +use OCP\Notification\IManager; use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -114,6 +115,8 @@ class CheckSetupController extends Controller { private $connection; /** @var ITempManager */ private $tempManager; + /** @var IManager */ + private $manager; public function __construct($AppName, IRequest $request, @@ -131,7 +134,8 @@ public function __construct($AppName, ISecureRandom $secureRandom, IniGetWrapper $iniGetWrapper, IDBConnection $connection, - ITempManager $tempManager) { + ITempManager $tempManager, + IManager $manager) { parent::__construct($AppName, $request); $this->config = $config; $this->clientService = $clientService; @@ -148,6 +152,15 @@ public function __construct($AppName, $this->iniGetWrapper = $iniGetWrapper; $this->connection = $connection; $this->tempManager = $tempManager; + $this->manager = $manager; + } + + /** + * Check if is fair use of free push service + * @return bool + */ + private function isFairUseOfFreePushService(): bool { + return $this->manager->isFairUseOfFreePushService(); } /** @@ -761,6 +774,7 @@ public function check() { 'suggestedOverwriteCliURL' => $this->getSuggestedOverwriteCliURL(), 'cronInfo' => $this->getLastCronInfo(), 'cronErrors' => $this->getCronErrors(), + 'isFairUseOfFreePushService' => $this->isFairUseOfFreePushService(), 'serverHasInternetConnectionProblems' => $this->hasInternetConnectivityProblems(), 'isMemcacheConfigured' => $this->isMemcacheConfigured(), 'memcacheDocs' => $this->urlGenerator->linkToDocs('admin-performance'), diff --git a/core/js/setupchecks.js b/core/js/setupchecks.js index a16f50e122aec..067b43048d483 100644 --- a/core/js/setupchecks.js +++ b/core/js/setupchecks.js @@ -254,6 +254,12 @@ type: OC.SetupChecks.MESSAGE_TYPE_ERROR }); } + if (!data.isFairUseOfFreePushService) { + messages.push({ + msg: t('core', 'This is the unsupported community build of Nextcloud, not designed to for performance, reliability and scalability at the size of this instance. Push notifications have been disabled to not overload our free service. Learn more on nextcloud.com/enterprise about the benefits of Nextcloud Enterprise.'), + type: OC.SetupChecks.MESSAGE_TYPE_ERROR + }); + } if (data.serverHasInternetConnectionProblems) { messages.push({ msg: t('core', 'This server has no working internet connection: Multiple endpoints could not be reached. This means that some of the features like mounting external storage, notifications about updates or installation of third-party apps will not work. Accessing files remotely and sending of notification emails might not work, either. Establish a connection from this server to the internet to enjoy all features.'), diff --git a/core/js/tests/specs/setupchecksSpec.js b/core/js/tests/specs/setupchecksSpec.js index 82f9c26224c39..451c49fb2e963 100644 --- a/core/js/tests/specs/setupchecksSpec.js +++ b/core/js/tests/specs/setupchecksSpec.js @@ -230,6 +230,7 @@ describe('OC.SetupChecks tests', function() { hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', isRandomnessSecure: true, + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: true, memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance', forwardedForHeadersWorking: true, @@ -287,6 +288,7 @@ describe('OC.SetupChecks tests', function() { hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', isRandomnessSecure: true, + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: true, memcacheDocs: 'https://docs.nextcloud.com/server/go.php?to=admin-performance', forwardedForHeadersWorking: true, @@ -345,6 +347,7 @@ describe('OC.SetupChecks tests', function() { hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', isRandomnessSecure: true, + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: true, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -401,6 +404,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: false, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -455,6 +459,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -509,6 +514,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -564,6 +570,7 @@ describe('OC.SetupChecks tests', function() { hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', isRandomnessSecure: true, + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: false, @@ -618,6 +625,7 @@ describe('OC.SetupChecks tests', function() { hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', isRandomnessSecure: true, + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -672,6 +680,7 @@ describe('OC.SetupChecks tests', function() { hasValidTransactionIsolationLevel: true, suggestedOverwriteCliURL: '', isRandomnessSecure: true, + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -747,6 +756,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -802,6 +812,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -857,6 +868,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -912,6 +924,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -967,6 +980,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -1025,6 +1039,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -1080,6 +1095,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -1132,6 +1148,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -1186,6 +1203,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true, @@ -1240,6 +1258,7 @@ describe('OC.SetupChecks tests', function() { suggestedOverwriteCliURL: '', isRandomnessSecure: true, securityDocs: 'https://docs.nextcloud.com/myDocs.html', + isFairUseOfFreePushService: true, serverHasInternetConnectionProblems: false, isMemcacheConfigured: true, forwardedForHeadersWorking: true,