Browse Source

Show warning on admin settings page

Signed-off-by: Vitor Mattos <vitor@php.rio>
tags/v23.0.0beta2
Vitor Mattos 2 years ago
parent
commit
e55ceb2bb1
No account linked to committer's email address

+ 15
- 1
apps/settings/lib/Controller/CheckSetupController.php View 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'),

+ 6
- 0
core/js/setupchecks.js View File

@@ -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.'),

+ 19
- 0
core/js/tests/specs/setupchecksSpec.js View 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,

Loading…
Cancel
Save