diff options
author | Vitor Mattos <vitor@php.rio> | 2021-10-20 15:24:45 -0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-10-23 00:54:50 +0200 |
commit | e55ceb2bb1c22105cd46533f8b41157c52e5da2d (patch) | |
tree | 9bbbb194ad85fdec4dc0234226d8910a12b6f473 | |
parent | d613b320451516c466fca7b408414a0193139602 (diff) | |
download | nextcloud-server-e55ceb2bb1c22105cd46533f8b41157c52e5da2d.tar.gz nextcloud-server-e55ceb2bb1c22105cd46533f8b41157c52e5da2d.zip |
Show warning on admin settings page
Signed-off-by: Vitor Mattos <vitor@php.rio>
-rw-r--r-- | apps/settings/lib/Controller/CheckSetupController.php | 16 | ||||
-rw-r--r-- | core/js/setupchecks.js | 6 | ||||
-rw-r--r-- | core/js/tests/specs/setupchecksSpec.js | 19 |
3 files changed, 40 insertions, 1 deletions
diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index e18dfb6028b..99e731b594c 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -78,6 +78,7 @@ use OCP\IRequest; 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 @@ class CheckSetupController extends Controller { 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 @@ class CheckSetupController extends Controller { $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 @@ Raw output '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 a16f50e122a..f5f48fdf384 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. Given the size of this instance, performance, reliability and scalability cannot be guaranteed. Push notifications have been disabled to avoid overloading our free service. Learn more about the benefits of Nextcloud Enterprise at nextcloud.com/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 82f9c26224c..451c49fb2e9 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, |