]> source.dussan.org Git - nextcloud-server.git/commitdiff
Show warning on admin settings page
authorVitor Mattos <vitor@php.rio>
Wed, 20 Oct 2021 18:24:45 +0000 (15:24 -0300)
committerJoas Schilling <coding@schilljs.com>
Fri, 22 Oct 2021 22:54:50 +0000 (00:54 +0200)
Signed-off-by: Vitor Mattos <vitor@php.rio>
apps/settings/lib/Controller/CheckSetupController.php
core/js/setupchecks.js
core/js/tests/specs/setupchecksSpec.js

index e18dfb6028bc6333cfbff03c760d3dedb46a60fa..99e731b594cda691217a8f3d78b3ebc714527865 100644 (file)
@@ -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'),
index a16f50e122aecaafe5b9a1173fbbda8d2d3d3122..f5f48fdf384901aa9e60a8ddee41580787bff201 100644 (file)
                                                        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.'),
index 82f9c26224c39d90141a882a5625ab2b036c3c03..451c49fb2e9631db3239bc46f4792c7a4d08deeb 100644 (file)
@@ -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,