From 5012ecf5d7fb73d02fab17a0311166a6710ca670 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 24 Jul 2023 14:39:48 +0530 Subject: [PATCH 1/4] jisti link --- patches/029-add-jitsi-link.patch | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 patches/029-add-jitsi-link.patch diff --git a/patches/029-add-jitsi-link.patch b/patches/029-add-jitsi-link.patch new file mode 100644 index 00000000..2ebb56cb --- /dev/null +++ b/patches/029-add-jitsi-link.patch @@ -0,0 +1,32 @@ +From: Avinash Gusain +Date: Mon, 24 July 2023 11:50:00 +0530 +Subject: [PATCH] Add jitsi link in location + +This patch creates a jitsi link in location if it is empty and attendee is added + +--- apps/dav/lib/CalDAV/CalDavBackend.php 2023-07-24 14:32:46.692916758 +0530 ++++ apps/dav/lib/CalDAV/CalDavBackend-new.php 2023-07-24 13:59:24.132918240 +0530 +@@ -1217,6 +1217,23 @@ + * @return string + */ + public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { ++ // If attendee exist and ++ if (strpos($calendarData, 'ATTENDEE;') !== false && strpos($calendarData, 'LOCATION:') === false) { ++ $url = 'https://meet.jit.si/'; ++ $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; ++ $result = ''; ++ $length = strlen($chars); ++ for ($i = $length; $i > 0; --$i) { ++ $result .= $chars[rand(0, strlen($chars) - 1)]; ++ } ++ ++ $todaynow = new DateTime(); ++ $randomString = $result . $todaynow->format('d') . $todaynow->format('m') . substr($todaynow->format('Y'), -2); ++ ++ $url = $url . $randomString; ++ $calendarData = preg_replace('/(SUMMARY:[^\r\n]*)/', "$1\nLOCATION: $url", $calendarData); ++ } ++ + $extraData = $this->getDenormalizedData($calendarData); + + // Try to detect duplicates -- GitLab From b21bd165c5efb3e2754ae792d35ce87d398c61e0 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Mon, 24 Jul 2023 15:43:50 +0530 Subject: [PATCH 2/4] jisti link --- patches/029-add-jitsi-link.patch | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/patches/029-add-jitsi-link.patch b/patches/029-add-jitsi-link.patch index 2ebb56cb..4fdea28e 100644 --- a/patches/029-add-jitsi-link.patch +++ b/patches/029-add-jitsi-link.patch @@ -1,11 +1,11 @@ From: Avinash Gusain -Date: Mon, 24 July 2023 11:50:00 +0530 +Date: Mon, 24 July 2023 15:43:00 +0530 Subject: [PATCH] Add jitsi link in location This patch creates a jitsi link in location if it is empty and attendee is added --- apps/dav/lib/CalDAV/CalDavBackend.php 2023-07-24 14:32:46.692916758 +0530 -+++ apps/dav/lib/CalDAV/CalDavBackend-new.php 2023-07-24 13:59:24.132918240 +0530 ++++ apps/dav/lib/CalDAV/CalDavBackend-new.php 2023-07-24 15:42:17.292918142 +0530 @@ -1217,6 +1217,23 @@ * @return string */ @@ -15,7 +15,7 @@ This patch creates a jitsi link in location if it is empty and attendee is added + $url = 'https://meet.jit.si/'; + $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; + $result = ''; -+ $length = strlen($chars); ++ $length = 8; + for ($i = $length; $i > 0; --$i) { + $result .= $chars[rand(0, strlen($chars) - 1)]; + } -- GitLab From 5080cff8b4c7e04a3ff646ccc27cb7259e461bc1 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 25 Jul 2023 14:50:51 +0530 Subject: [PATCH 3/4] added jitsi link --- Dockerfile | 1 + patches/029-add-jitsi-link.patch | 45 +++++++++++++++----------------- 2 files changed, 22 insertions(+), 24 deletions(-) diff --git a/Dockerfile b/Dockerfile index b87db1c7..a5e19bb8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -192,6 +192,7 @@ RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/user_ldap/lib/User_LDAP.php -i $ RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/025-optimize-get-by-email.patch RUN patch -u ${BASE_DIR}/apps/dav/lib/Connector/Sabre/Principal.php -i ${TMP_PATCH_DIR}/027-displayname-user-leak-dav.patch RUN patch -u ${BASE_DIR}/apps/dav/lib/HookManager.php -i ${TMP_PATCH_DIR}/028-default-task-calendar.patch +RUN patch -u ${BASE_DIR}/3rdparty/sabre/dav/lib/CalDAV/Plugin.php -i ${TMP_PATCH_DIR}/029-add-jitsi-link.patch RUN rm -rf ${TMP_PATCH_DIR} RUN curl -fsSL -o ldap_write_support.tar.gz \ diff --git a/patches/029-add-jitsi-link.patch b/patches/029-add-jitsi-link.patch index 4fdea28e..d78aeb76 100644 --- a/patches/029-add-jitsi-link.patch +++ b/patches/029-add-jitsi-link.patch @@ -4,29 +4,26 @@ Subject: [PATCH] Add jitsi link in location This patch creates a jitsi link in location if it is empty and attendee is added ---- apps/dav/lib/CalDAV/CalDavBackend.php 2023-07-24 14:32:46.692916758 +0530 -+++ apps/dav/lib/CalDAV/CalDavBackend-new.php 2023-07-24 15:42:17.292918142 +0530 -@@ -1217,6 +1217,23 @@ - * @return string - */ - public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { -+ // If attendee exist and -+ if (strpos($calendarData, 'ATTENDEE;') !== false && strpos($calendarData, 'LOCATION:') === false) { -+ $url = 'https://meet.jit.si/'; -+ $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; -+ $result = ''; -+ $length = 8; -+ for ($i = $length; $i > 0; --$i) { -+ $result .= $chars[rand(0, strlen($chars) - 1)]; -+ } -+ -+ $todaynow = new DateTime(); -+ $randomString = $result . $todaynow->format('d') . $todaynow->format('m') . substr($todaynow->format('Y'), -2); -+ -+ $url = $url . $randomString; -+ $calendarData = preg_replace('/(SUMMARY:[^\r\n]*)/', "$1\nLOCATION: $url", $calendarData); -+ } +--- 3rdparty/sabre/dav/lib/CalDAV/Plugin.php 2023-07-25 13:25:07.893734832 +0530 ++++ 3rdparty/sabre/dav/lib/CalDAV/Plugin-new.php 2023-07-25 13:26:31.933735174 +0530 +@@ -787,6 +787,20 @@ + $data = stream_get_contents($data); + } + ++ // If attendee exist and ++ if (strpos($data, 'ATTENDEE;') !== false && strpos($data, 'LOCATION:') === false) { ++ $url = 'https://meet.jit.si/'; ++ $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; ++ $result = ''; ++ $length = 8; ++ for ($i = $length; $i > 0; --$i) { ++ $result .= $chars[rand(0, strlen($chars) - 1)]; ++ } ++ $randomString = $result . date('dmy'); ++ $url = $url . $randomString; ++ $data = preg_replace('/(SUMMARY:[^\r\n]*)/', "$1\nLOCATION: $url", $data); ++ } + - $extraData = $this->getDenormalizedData($calendarData); + $before = $data; - // Try to detect duplicates + try { -- GitLab From bcf58d04682b87e0badf0fa8318ed85d101e11b5 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 25 Jul 2023 14:53:40 +0530 Subject: [PATCH 4/4] added jitsi link --- patches/029-add-jitsi-link.patch | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/029-add-jitsi-link.patch b/patches/029-add-jitsi-link.patch index d78aeb76..fbed6b1f 100644 --- a/patches/029-add-jitsi-link.patch +++ b/patches/029-add-jitsi-link.patch @@ -10,7 +10,7 @@ This patch creates a jitsi link in location if it is empty and attendee is added $data = stream_get_contents($data); } -+ // If attendee exist and ++ // If attendee exist and location not exist + if (strpos($data, 'ATTENDEE;') !== false && strpos($data, 'LOCATION:') === false) { + $url = 'https://meet.jit.si/'; + $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; -- GitLab