From b66daccda96bec25f54a5d6debe9ca575ca2a206 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 6 Oct 2022 11:28:24 +0530 Subject: [PATCH 1/5] fair use fix --- Dockerfile | 1 + patches/020-fairuse-notification-fix.patch | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 patches/020-fairuse-notification-fix.patch diff --git a/Dockerfile b/Dockerfile index d10e6b6d..019d3cc0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -134,6 +134,7 @@ RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dav/lib/CalDAV/Schedule/IMipPlug RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-occ-user-setting.patch RUN patch -u ${BASE_DIR}/apps/settings/lib/Sections/Personal/Groupware.php -i ${TMP_PATCH_DIR}/019-groupware.patch +RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch RUN rm -rf ${TMP_PATCH_DIR} # show reset pwd page with a query param diff --git a/patches/020-fairuse-notification-fix.patch b/patches/020-fairuse-notification-fix.patch new file mode 100644 index 00000000..98711136 --- /dev/null +++ b/patches/020-fairuse-notification-fix.patch @@ -0,0 +1,15 @@ +--- ./lib/private/Notification/Manager.php 2022-09-06 21:39:49.735827300 +0530 ++++ ./lib/private/Notification/Manager-new.php 2022-10-06 11:09:37.794640100 +0530 +@@ -311,10 +311,8 @@ + * use of push notifications. If you need this feature, consider using Nextcloud Enterprise. + */ + // TODO Remove time check after 1st March 2022 +- $isFairUse = $this->timeFactory->getTime() < 1646089200 +- || $this->subscription->delegateHasValidSubscription() +- || $this->userManager->countSeenUsers() < 5000; +- $pushAllowed = $isFairUse ? 'yes' : 'no'; ++ ++ $pushAllowed = 'yes'; + $this->cache->set('push_fair_use', $pushAllowed, 3600); + } + return $pushAllowed === 'yes'; -- GitLab From 389709f15c86cc79e49b37983fd4b88a103455e6 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 6 Oct 2022 11:29:06 +0530 Subject: [PATCH 2/5] version bump --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 019d3cc0..bf9559fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,7 +18,7 @@ ARG GOOGLE_INTEGRATION_VERSION="1.0.8" ARG LDAP_WRITE_SUPPORT_VERSION="1.4.0" ARG OIDC_LOGIN_VERSION="2.3.3" -RUN sed -i 's/23,0,9,1/23,0,9,11/' ${BASE_DIR}/version.php +RUN sed -i 's/23,0,9,1/23,0,9,12/' ${BASE_DIR}/version.php COPY custom_entrypoint.sh / RUN chmod +x /custom_entrypoint.sh RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images -- GitLab From 6cfeb0f705cb9874ad9c9cf35083f628024bff26 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 6 Oct 2022 12:32:56 +0530 Subject: [PATCH 3/5] fair use fix --- patches/020-fairuse-notification-fix.patch | 31 +++++++++++++++------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/patches/020-fairuse-notification-fix.patch b/patches/020-fairuse-notification-fix.patch index 98711136..75049ba3 100644 --- a/patches/020-fairuse-notification-fix.patch +++ b/patches/020-fairuse-notification-fix.patch @@ -1,15 +1,26 @@ ---- ./lib/private/Notification/Manager.php 2022-09-06 21:39:49.735827300 +0530 -+++ ./lib/private/Notification/Manager-new.php 2022-10-06 11:09:37.794640100 +0530 -@@ -311,10 +311,8 @@ - * use of push notifications. If you need this feature, consider using Nextcloud Enterprise. - */ - // TODO Remove time check after 1st March 2022 +--- lib/private/Notification/Manager.php 2022-09-06 21:39:49.735827300 +0530 ++++ lib/private/Notification/Manager-new.php 2022-10-06 12:29:29.904640100 +0530 +@@ -303,21 +303,8 @@ + * {@inheritDoc} + */ + public function isFairUseOfFreePushService(): bool { +- $pushAllowed = $this->cache->get('push_fair_use'); +- if ($pushAllowed === null) { +- /** +- * We want to keep offering our push notification service for free, but large +- * users overload our infrastructure. For this reason we have to rate-limit the +- * use of push notifications. If you need this feature, consider using Nextcloud Enterprise. +- */ +- // TODO Remove time check after 1st March 2022 - $isFairUse = $this->timeFactory->getTime() < 1646089200 - || $this->subscription->delegateHasValidSubscription() - || $this->userManager->countSeenUsers() < 5000; - $pushAllowed = $isFairUse ? 'yes' : 'no'; +- $this->cache->set('push_fair_use', $pushAllowed, 3600); +- } +- return $pushAllowed === 'yes'; + -+ $pushAllowed = 'yes'; - $this->cache->set('push_fair_use', $pushAllowed, 3600); - } - return $pushAllowed === 'yes'; ++ return true; + } + + /** -- GitLab From 314810e79c6b917502406b46168f50841808e1d9 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 6 Oct 2022 12:38:44 +0530 Subject: [PATCH 4/5] patch removed --- Dockerfile | 1 - patches/020-fairuse-notification-fix.patch | 26 ---------------------- 2 files changed, 27 deletions(-) delete mode 100644 patches/020-fairuse-notification-fix.patch diff --git a/Dockerfile b/Dockerfile index bf9559fb..1d44f316 100644 --- a/Dockerfile +++ b/Dockerfile @@ -134,7 +134,6 @@ RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dav/lib/CalDAV/Schedule/IMipPlug RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-occ-user-setting.patch RUN patch -u ${BASE_DIR}/apps/settings/lib/Sections/Personal/Groupware.php -i ${TMP_PATCH_DIR}/019-groupware.patch -RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch RUN rm -rf ${TMP_PATCH_DIR} # show reset pwd page with a query param diff --git a/patches/020-fairuse-notification-fix.patch b/patches/020-fairuse-notification-fix.patch deleted file mode 100644 index 75049ba3..00000000 --- a/patches/020-fairuse-notification-fix.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- lib/private/Notification/Manager.php 2022-09-06 21:39:49.735827300 +0530 -+++ lib/private/Notification/Manager-new.php 2022-10-06 12:29:29.904640100 +0530 -@@ -303,21 +303,8 @@ - * {@inheritDoc} - */ - public function isFairUseOfFreePushService(): bool { -- $pushAllowed = $this->cache->get('push_fair_use'); -- if ($pushAllowed === null) { -- /** -- * We want to keep offering our push notification service for free, but large -- * users overload our infrastructure. For this reason we have to rate-limit the -- * use of push notifications. If you need this feature, consider using Nextcloud Enterprise. -- */ -- // TODO Remove time check after 1st March 2022 -- $isFairUse = $this->timeFactory->getTime() < 1646089200 -- || $this->subscription->delegateHasValidSubscription() -- || $this->userManager->countSeenUsers() < 5000; -- $pushAllowed = $isFairUse ? 'yes' : 'no'; -- $this->cache->set('push_fair_use', $pushAllowed, 3600); -- } -- return $pushAllowed === 'yes'; -+ -+ return true; - } - - /** -- GitLab From 117113161b7bb299c1b81c9a930039b475a33efc Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Thu, 6 Oct 2022 15:48:19 +0530 Subject: [PATCH 5/5] patch added --- Dockerfile | 1 + patches/020-fairuse-notification-fix.patch | 25 ++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 patches/020-fairuse-notification-fix.patch diff --git a/Dockerfile b/Dockerfile index 1d44f316..bf9559fb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -134,6 +134,7 @@ RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dav/lib/CalDAV/Schedule/IMipPlug RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch RUN patch -u ${BASE_DIR}/core/Command/User/Setting.php -i ${TMP_PATCH_DIR}/018-occ-user-setting.patch RUN patch -u ${BASE_DIR}/apps/settings/lib/Sections/Personal/Groupware.php -i ${TMP_PATCH_DIR}/019-groupware.patch +RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch RUN rm -rf ${TMP_PATCH_DIR} # show reset pwd page with a query param diff --git a/patches/020-fairuse-notification-fix.patch b/patches/020-fairuse-notification-fix.patch new file mode 100644 index 00000000..84dab625 --- /dev/null +++ b/patches/020-fairuse-notification-fix.patch @@ -0,0 +1,25 @@ +--- lib/private/Notification/Manager.php 2022-09-06 21:39:49.735827300 +0530 ++++ lib/private/Notification/Manager-new.php 2022-10-06 15:44:38.874640100 +0530 +@@ -303,21 +303,7 @@ + * {@inheritDoc} + */ + public function isFairUseOfFreePushService(): bool { +- $pushAllowed = $this->cache->get('push_fair_use'); +- if ($pushAllowed === null) { +- /** +- * We want to keep offering our push notification service for free, but large +- * users overload our infrastructure. For this reason we have to rate-limit the +- * use of push notifications. If you need this feature, consider using Nextcloud Enterprise. +- */ +- // TODO Remove time check after 1st March 2022 +- $isFairUse = $this->timeFactory->getTime() < 1646089200 +- || $this->subscription->delegateHasValidSubscription() +- || $this->userManager->countSeenUsers() < 5000; +- $pushAllowed = $isFairUse ? 'yes' : 'no'; +- $this->cache->set('push_fair_use', $pushAllowed, 3600); +- } +- return $pushAllowed === 'yes'; ++ return true; + } + + /** -- GitLab