Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

video_calls: Add Nextcloud Talk as a video call provider.

The Dance54ce6751eab8
diff --git a/api_docs/changelog.md b/api_docs/changelog.md
index 1400aab57f4..089a3cb59ff 100644
--- a/api_docs/changelog.md
+++ b/api_docs/changelog.md
@@ -20,6 +20,14 @@ format used by the Zulip server that they are interacting with.
## Changes in Zulip 12.0
+**Feature level 465**
+
+* [`POST /register`](/api/register-queue), [`GET /events`](/api/get-events),
+ `PATCH /realm`: Nextcloud Talk integration added as an option
+ for the realm setting `video_chat_provider`.
+* [`POST /calls/nextcloud_talk/create`](/api/create-nextcloud-talk-video-call):
+ Added a new endpoint to create a Nextcloud Talk video call URL.
+
**Feature level 464**
* [`GET /events`](/api/get-events): The server now sends a
diff --git a/api_docs/include/rest-endpoints.md b/api_docs/include/rest-endpoints.md
index 2c25d012dbe..c55652bfe63 100644
--- a/api_docs/include/rest-endpoints.md
+++ b/api_docs/include/rest-endpoints.md
@@ -171,4 +171,5 @@
* [Remove an FCM registration token](/api/remove-fcm-token)
* [Create BigBlueButton video call](/api/create-big-blue-button-video-call)
* [Create Constructor Groups video call](/api/create-constructor-groups-video-call)
+* [Create Nextcloud Talk video call](/api/create-nextcloud-talk-video-call)
* [Outgoing webhook payloads](/api/outgoing-webhook-payload)
diff --git a/docs/production/securing-your-zulip-server.md b/docs/production/securing-your-zulip-server.md
index 4303e25bd65..8ca78dc502e 100644
--- a/docs/production/securing-your-zulip-server.md
+++ b/docs/production/securing-your-zulip-server.md
@@ -94,7 +94,7 @@ system. Reading the following guides will give you a good starting point:
- Inline image previews in messages (enabled by default, but can be disabled)
- Inline webpage previews and embeds (must be configured to be enabled)
- Twitter message previews (must be configured to be enabled)
- - BigBlueButton, Constructor Groups, and Zoom API requests
+ - BigBlueButton, Constructor Groups, Nextcloud Talk and Zoom API requests
(must be configured to be enabled)
- Mobile push notifications (must be configured to be enabled)
diff --git a/docs/production/video-calls.md b/docs/production/video-calls.md
index 2ae1874b534..45f2b34a297 100644
--- a/docs/production/video-calls.md
+++ b/docs/production/video-calls.md
@@ -10,6 +10,7 @@ supported by Zulip are:
- [Zoom](https://zulip.com/integrations/zoom)
- [BigBlueButton](https://zulip.com/integrations/big-blue-button)
- [Constructor Groups](https://zulip.com/integrations/category/video-calling)
+- [Nextcloud Talk](https://zulip.com/integrations/category/video-calling)
By default, Zulip uses the [cloud version of Jitsi Meet](https://meet.jit.si/)
as its call provider. This page documents the configurations required to support
@@ -186,3 +187,11 @@ To use the [Constructor Groups](https://constructor.tech/products/learning/group
video call integration on a self-hosted Zulip installation, you'll need to
have a Constructor Groups account. See documentation to configure the Constructor
Groups video call integration [here](https://zulip.com/integrations/category/video-calling).
+
+## Nextcloud Talk
+
+To use the [Nextcloud Talk](https://nextcloud.com/talk/) video call
+integration on a self-hosted Zulip installation, you'll need to have access
+to a Nextcloud server (version 22+) with the Talk app enabled. See
+documentation to configure the Nextcloud Talk video call integration
+[here](https://zulip.com/integrations/category/video-calling).
diff --git a/starlight_help/src/content/docs/configure-call-provider.mdx b/starlight_help/src/content/docs/configure-call-provider.mdx
index 9937f104e49..b9be2a646df 100644
--- a/starlight_help/src/content/docs/configure-call-provider.mdx
+++ b/starlight_help/src/content/docs/configure-call-provider.mdx
@@ -20,6 +20,7 @@ supported by Zulip are:
* [Zoom integration](/integrations/zoom)
* [BigBlueButton integration](/integrations/big-blue-button)
* [Constructor Groups integration](/integrations/constructor-groups)
+* [Nextcloud Talk integration](/integrations/nextcloud-talk)
<ZulipTip>
You can disable the video and voice call buttons for your organization
@@ -60,3 +61,4 @@ instance of Jitsi Meet.
* [Zoom integration](/integrations/zoom)
* [BigBlueButton integration](/integrations/big-blue-button)
* [Constructor Groups integration](/integrations/constructor-groups)
+* [Nextcloud Talk integration](/integrations/nextcloud-talk)
diff --git a/starlight_help/src/content/docs/start-a-call.mdx b/starlight_help/src/content/docs/start-a-call.mdx
index c1e6ffa91b8..b90c29d2db0 100644
--- a/starlight_help/src/content/docs/start-a-call.mdx
+++ b/starlight_help/src/content/docs/start-a-call.mdx
@@ -96,4 +96,5 @@ you can unlink it.
* [Zoom integration](/integrations/zoom)
* [BigBlueButton integration](/integrations/big-blue-button)
* [Constructor Groups integration](/integrations/constructor-groups)
+* [Nextcloud Talk integration](/integrations/nextcloud-talk)
* [Insert a link](/help/insert-a-link)
diff --git a/static/images/integrations/bot_avatars/nextcloud-talk.png b/static/images/integrations/bot_avatars/nextcloud-talk.png
new file mode 100644
index 00000000000..ac168a1d3dc
Binary files /dev/null and b/static/images/integrations/bot_avatars/nextcloud-talk.png differ
diff --git a/static/images/integrations/logos/nextcloud-talk.svg b/static/images/integrations/logos/nextcloud-talk.svg
new file mode 100644
index 00000000000..c752c890032
--- /dev/null
+++ b/static/images/integrations/logos/nextcloud-talk.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xml:space="preserve" width="160" height="160" viewBox="0 0 150 150"><defs><linearGradient id="a"><stop offset="0" style="stop-color:#0082c9;stop-opacity:1"/><stop offset="1" style="stop-color:#1cafff;stop-opacity:1"/></linearGradient><linearGradient xlink:href="#a" id="b" x1="18.23" x2="150" y1="150" y2="0" gradientUnits="userSpaceOnUse"/></defs><path d="M0 0h150v150H0z" style="opacity:1;fill:url(#b);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:.1;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/><path d="M75.087 37.288c-11.805 0-21.811 8.003-24.913 18.846-2.695-5.751-8.536-9.78-15.263-9.78-9.252 0-16.857 7.604-16.857 16.856s7.605 16.86 16.857 16.86c6.727 0 12.568-4.031 15.263-9.784 3.102 10.845 13.108 18.85 24.913 18.85 11.718 0 21.673-7.885 24.853-18.606 2.745 5.621 8.514 9.54 15.146 9.54 9.251 0 16.86-7.608 16.86-16.86s-7.609-16.857-16.86-16.857c-6.632 0-12.4 3.917-15.146 9.538-3.18-10.721-13.135-18.603-24.853-18.603m0 9.895c8.911 0 16.03 7.116 16.03 16.027s-7.119 16.031-16.03 16.031a15.954 15.954 0 0 1-16.027-16.03 15.95 15.95 0 0 1 16.027-16.028M34.91 56.249c3.904 0 6.965 3.057 6.965 6.961s-3.06 6.965-6.965 6.965-6.962-3.06-6.962-6.965 3.058-6.961 6.962-6.961m80.175 0c3.904 0 6.965 3.057 6.965 6.961s-3.061 6.965-6.965 6.965-6.962-3.06-6.962-6.965 3.057-6.961 6.962-6.961" style="color:#000;font-style:normal;font-variant:normal;font-weight:400;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;baseline-shift:baseline;text-anchor:start;white-space:normal;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000;solid-opacity:1;fill:#fff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:5.56590033;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:10;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto"/><path d="M29.915 96.956c-.33 0-.472.188-.472.518v13.642c0 .33.142.515.472.515h.377c.33 0 .515-.186.515-.515V99.787l7.447 11.558c.033.05.068.084.103.121.011.013.018.026.03.037.032.029.067.044.1.062.02.01.035.024.056.032.015.005.03.002.046.006.052.013.106.027.17.027h.374c.33 0 .472-.185.472-.515V97.473c0-.329-.142-.517-.472-.517h-.375c-.33 0-.517.188-.517.517v11.33l-7.447-11.558c-.026-.04-.057-.063-.085-.094-.086-.122-.222-.195-.417-.195zm89.42.188c-.33 0-.188.188-.188.517v4.658c0 .47.046.798.046.798h-.046s-.894-2.069-3.387-2.069c-2.728 0-4.658 2.164-4.564 5.363 0 3.198 1.74 5.41 4.516 5.41 2.681 0 3.575-2.165 3.575-2.165h.048s-.094.283-.094.66v.798c0 .33.188.471.517.471h.33c.329 0 .469-.188.469-.517V97.661c0-.33-.518-.517-.847-.517zm-36.55.048c-.33 0-.14.188-.14.517v11.524c0 2.258 1.504 2.54 2.35 2.54.377 0 .518-.188.518-.517v-.33c0-.329-.188-.469-.423-.469-.47-.047-1.08-.189-1.08-1.506V97.71c0-.329-.518-.517-.847-.517zm-16.886 1.222c-.33 0-.517.188-.517.517v8.938c0 2.446 1.365 3.81 3.623 3.81.423 0 .563-.14.563-.469v-.284c0-.376-.14-.47-.563-.517-.8-.047-2.259-.33-2.259-2.728v-5.175h2.117c.33 0 .517-.14.517-.469v-.142c0-.329-.188-.517-.517-.517h-2.117v-2.447c0-.329-.14-.517-.47-.517zm-18.735 2.634c-2.822 0-5.082 2.024-5.129 5.41 0 3.2 2.353 5.409 5.41 5.409a5.83 5.83 0 0 0 3.434-1.128c.235-.189.283-.424.142-.66l-.142-.233c-.141-.282-.375-.33-.657-.142-.47.376-1.413.94-2.73.94-2.117 0-3.952-1.505-3.999-4.14h7.48a.52.52 0 0 0 .517-.517c0-2.963-1.55-4.939-4.326-4.939m29.224 0c-3.057 0-5.41 2.258-5.456 5.457 0 3.198 2.353 5.41 5.41 5.41a5.8 5.8 0 0 0 3.669-1.318c.235-.235.28-.423.14-.705l-.14-.188c-.188-.282-.377-.33-.66-.142a4.35 4.35 0 0 1-2.915 1.083c-2.258 0-4.046-1.694-4.046-4.14 0-2.493 1.788-4.186 4.046-4.186 1.223 0 2.116.611 2.586.94.283.188.517.189.705-.093l.142-.236c.235-.282.187-.517-.048-.705-.517-.423-1.645-1.176-3.433-1.176m15.9 0c-3.011 0-5.457 2.305-5.457 5.363 0 3.104 2.446 5.456 5.456 5.456s5.457-2.352 5.457-5.456c0-3.058-2.446-5.363-5.457-5.363m-30.43.158c-.116.019-.227.096-.332.222l-1.905 2.268-1.423 1.699-2.158-2.57-1.17-1.397a.52.52 0 0 0-.35-.206.53.53 0 0 0-.38.142l-.288.243c-.253.212-.24.446-.028.698l1.904 2.268 1.58 1.884-2.312 2.753-.005.006-1.167 1.389c-.211.252-.188.518.064.73l.289.24c.252.212.481.159.693-.093l1.902-2.269 1.426-1.698 2.158 2.573.005.005 1.165 1.391c.211.252.477.274.73.062l.288-.24c.252-.212.24-.446.027-.698l-1.904-2.27-1.579-1.882L61.4 103.7l.004-.006 1.167-1.389c.212-.252.189-.518-.064-.73l-.288-.24q-.188-.158-.362-.128m38.662.078c-.33 0-.472.188-.472.518v6.067c0 2.68 1.976 3.998 4.422 3.998s4.422-1.317 4.422-3.998v-6.067c.047-.33-.14-.518-.47-.518h-.377c-.33 0-.517.188-.517.518v5.691c0 1.6-1.035 3.058-3.058 3.058-1.976 0-3.058-1.458-3.058-3.058v-5.691c0-.33-.188-.518-.517-.518zm-53.404.94c1.505 0 2.822 1.082 2.916 3.246h-6.49c.329-2.117 1.834-3.245 3.574-3.245m45.171.095c2.211 0 3.999 1.74 3.999 4.092 0 2.446-1.788 4.234-3.999 4.234-2.21 0-3.999-1.835-4.046-4.234 0-2.305 1.836-4.092 4.046-4.092m23.567 0c2.21 0 3.293 2.023 3.293 4.14 0 2.963-1.6 4.186-3.341 4.186-1.929 0-3.244-1.646-3.291-4.186 0-2.634 1.504-4.14 3.339-4.14" style="fill:#fff;fill-opacity:1;stroke-width:.47038522"/></svg>
\ No newline at end of file
diff --git a/templates/zerver/integrations/big-blue-button.md b/templates/zerver/integrations/big-blue-button.md
index a02cd4184ad..67933fb9a91 100644
--- a/templates/zerver/integrations/big-blue-button.md
+++ b/templates/zerver/integrations/big-blue-button.md
@@ -48,3 +48,4 @@ as your call provider instead.
- [Zoom integration](/integrations/zoom)
- [Constructor Groups integration](/integrations/constructor-groups)
* [BigBlueButton server configuration](https://docs.bigbluebutton.org/administration/customize/#other-configuration-changes)
+- [Nextcloud Talk integration](/integrations/nextcloud-talk)
diff --git a/templates/zerver/integrations/constructor-groups.md b/templates/zerver/integrations/constructor-groups.md
index d403dc7a694..ac6fde94b1d 100644
--- a/templates/zerver/integrations/constructor-groups.md
+++ b/templates/zerver/integrations/constructor-groups.md
@@ -52,6 +52,7 @@ source video conferencing solution. You can configure Zulip to use
- [Jitsi Meet integration](/integrations/jitsi)
- [Zoom integration](/integrations/zoom)
- [BigBlueButton integration](/integrations/big-blue-button)
+- [Nextcloud Talk integration](/integrations/nextcloud-talk)
[constructor-groups-api-docs]: https://developer.perculus.com/v2-en
[constructor-groups]: https://constructor.tech/products/learning/groups
diff --git a/templates/zerver/integrations/jitsi.md b/templates/zerver/integrations/jitsi.md
index 2b9c2d31bd8..e3efa7ec537 100644
--- a/templates/zerver/integrations/jitsi.md
+++ b/templates/zerver/integrations/jitsi.md
@@ -33,3 +33,4 @@ instance of Jitsi Meet.
- [Zoom integration](/integrations/zoom)
- [BigBlueButton integration](/integrations/big-blue-button)
- [Constructor Groups integration](/integrations/constructor-groups)
+- [Nextcloud Talk integration](/integrations/nextcloud-talk)
diff --git a/templates/zerver/integrations/nextcloud-talk.md b/templates/zerver/integrations/nextcloud-talk.md
new file mode 100644
index 00000000000..ccbf6973919
--- /dev/null
+++ b/templates/zerver/integrations/nextcloud-talk.md
@@ -0,0 +1,65 @@
+# Use Nextcloud Talk as your call provider in Zulip
+
+You can configure Nextcloud Talk as the call provider for your organization.
+Users will be able to start a Nextcloud Talk call and invite others using the
+**add video call** (<i class="zulip-icon zulip-icon-video-call"></i>) button
+[in the compose box](/help/start-a-call).
+
+You'll need a Nextcloud server with the Talk app enabled.
+
+!!! warn ""
+
+ **Note:** This integration is not available in Zulip Cloud.
+
+## Configure Nextcloud Talk as your call provider
+
+By default, Zulip integrates with
+[Jitsi Meet](https://jitsi.org/jitsi-meet/), a fully-encrypted, 100% open
+source video conferencing solution. You can configure Zulip to use Nextcloud
+Talk as your call provider instead.
+
+!!! warn ""
+
+ **Note:** Zulip creates public Nextcloud Talk conversations with guest
+ access, allowing anyone to join by visiting a URL and entering their
+ name. This ensures that all Zulip users can join calls regardless of
+ whether they have Nextcloud accounts.
+
+{start_tabs}
+
+1. Log in to your Nextcloud server with the user account that will be
+ used for creating video call rooms. Using a dedicated account for
+ this purpose is recommended.
+
+1. Generate an app password in Nextcloud Talk for API access:
+ - Go to your **Settings**, select **Personal Security** and navigate to
+ the **Devices & sessions** section.
+ - Set the **App name** to a name of your choice, such as `Zulip`.
+ - Click **Create new app password**, and copy the generated password.
+
+1. In `/etc/zulip/zulip-secrets.conf`, set `NEXTCLOUD_TALK_USERNAME` to your
+ Nextcloud Talk username and `NEXTCLOUD_TALK_PASSWORD` to the app password
+ you generated in the previous step.
+
+1. In `/etc/zulip/settings.py`, set `NEXTCLOUD_SERVER` to the URL of your
+ Nextcloud server.
+
+1. Restart the Zulip server with
+ `/home/zulip/deployments/current/scripts/restart-server`.
+
+{settings_tab|organization-settings}
+
+1. Under **Compose settings**, select Nextcloud Talk from the
+ **Call provider** dropdown.
+
+1. Click **Save changes**.
+
+{end_tabs}
+
+## Related documentation
+
+- [How to start a call](/help/start-a-call)
+- [Jitsi Meet integration](/integrations/jitsi)
+- [Zoom integration](/integrations/zoom)
+- [BigBlueButton integration](/integrations/big-blue-button)
+- [Constructor Groups integration](/integrations/constructor-groups)
diff --git a/templates/zerver/integrations/zoom.md b/templates/zerver/integrations/zoom.md
index 8f6b17cb750..a355177de2b 100644
--- a/templates/zerver/integrations/zoom.md
+++ b/templates/zerver/integrations/zoom.md
@@ -40,3 +40,4 @@ in order to use this integration.
- [Jitsi Meet integration](/integrations/jitsi)
- [BigBlueButton integration](/integrations/big-blue-button)
- [Constructor Groups integration](/integrations/constructor-groups)
+- [Nextcloud Talk integration](/integrations/nextcloud-talk)
diff --git a/tools/lib/capitalization.py b/tools/lib/capitalization.py
index 34088b0b88b..32a752c5399 100644
--- a/tools/lib/capitalization.py
+++ b/tools/lib/capitalization.py
@@ -63,6 +63,7 @@ IGNORED_PHRASES = [
r"Download Zulip for macOS \(Intel\)",
r"BigBlueButton",
r"Constructor Groups",
+ r"Nextcloud Talk",
# Code things
r"\.zuliprc",
# BeautifulSoup will remove <z-user> which is horribly confusing,
diff --git a/version.py b/version.py
index 0b1f39ca5ec..9c87e299384 100644
--- a/version.py
+++ b/version.py
@@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
# https://zulip.readthedocs.io/en/latest/documentation/api.html#step-by-step-guide
# Also available at docs/documentation/api.md.
-API_FEATURE_LEVEL = 464
+API_FEATURE_LEVEL = 465
# Bump the minor PROVISION_VERSION to indicate that folks should provision
# only when going from an old version of the code to a newer version. Bump
diff --git a/web/src/compose_call_ui.ts b/web/src/compose_call_ui.ts
index f7b78f377fd..a68719adbe5 100644
--- a/web/src/compose_call_ui.ts
+++ b/web/src/compose_call_ui.ts
@@ -174,6 +174,29 @@ export function generate_and_insert_audio_or_video_call_link(
break;
}
+ case available_providers.nextcloud_talk?.id: {
+ const room_name = `${get_recipient_label()?.label_text ?? ""} conversation`;
+ const request = {room_name};
+
+ channel.post({
+ url: "/json/calls/nextcloud_talk/create",
+ data: request,
+ success(response) {
+ const data = call_response_schema.parse(response);
+ insert_video_call_url(data.url, $target_textarea);
+ },
+ error(_, status) {
+ if (status !== "abort") {
+ ui_report.generic_embed_error(
+ $t_html({defaultMessage: "Failed to create video call."}),
+ 2000,
+ );
+ }
+ },
+ });
+
+ break;
+ }
case available_providers.jitsi_meet?.id: {
const video_call_id = util.random_int(100000000000000, 999999999999999);
const video_call_url = compose_call.get_jitsi_server_url(video_call_id.toString());
diff --git a/web/src/state_data.ts b/web/src/state_data.ts
index 5689db9a22d..99e3fb10380 100644
--- a/web/src/state_data.ts
+++ b/web/src/state_data.ts
@@ -456,6 +456,7 @@ export const realm_schema = z.object({
zoom_server_to_server: z.optional(z.object({name: z.string(), id: z.number()})),
big_blue_button: z.optional(z.object({name: z.string(), id: z.number()})),
constructor_groups: z.optional(z.object({name: z.string(), id: z.number()})),
+ nextcloud_talk: z.optional(z.object({name: z.string(), id: z.number()})),
}),
realm_avatar_changes_disabled: z.boolean(),
realm_bot_domain: z.string(),
diff --git a/web/tests/compose_video.test.cjs b/web/tests/compose_video.test.cjs
index db06bc3c6a5..ce11c0e86bf 100644
--- a/web/tests/compose_video.test.cjs
+++ b/web/tests/compose_video.test.cjs
@@ -68,6 +68,10 @@ const realm_available_video_chat_providers = {
id: 6,
name: "Constructor Groups",
},
+ nextcloud_talk: {
+ id: 7,
+ name: "Nextcloud Talk",
+ },
};
function test(label, f) {
@@ -316,6 +320,54 @@ test("videos", ({override}) => {
assert.ok(called);
assert.match(syntax_to_insert, video_link_regex);
})();
+
+ (function test_nextcloud_talk_audio_and_video_links_compose_clicked() {
+ let syntax_to_insert;
+ let called = false;
+
+ const $textarea = $.create("nextcloud-target-stub");
+ $textarea.set_parents_result(".message_edit_form", []);
+
+ const ev = {
+ preventDefault() {},
+ stopPropagation() {},
+ };
+
+ override(compose_ui, "insert_syntax_and_focus", (syntax) => {
+ syntax_to_insert = syntax;
+ called = true;
+ });
+
+ $("textarea#compose-textarea").val("");
+
+ override(
+ realm,
+ "realm_video_chat_provider",
+ realm_available_video_chat_providers.nextcloud_talk.id,
+ );
+
+ override(compose_closed_ui, "get_recipient_label", () => ({label_text: "general"}));
+
+ channel.post = (options) => {
+ assert.equal(options.url, "/json/calls/nextcloud_talk/create");
+ assert.equal(options.data.room_name, "general conversation");
+ options.success({
+ result: "success",
+ msg: "",
+ url: "https://nextcloud.example.com/index.php/call/abc123token",
+ });
+ return {abort() {}};
+ };
+
+ $("textarea#compose-textarea").val("");
+
+ const video_handler = $("body").get_on_handler("click", ".video_link");
+ video_handler.call($textarea, ev);
+ const video_link_regex =
+ /\[translated: Join video call\.]\(https:\/\/nextcloud\.example\.com\/index\.php\/call\/abc123token\)/;
+ assert.ok(called);
+ assert.match(syntax_to_insert, video_link_regex);
+ })();
});
test("test_video_chat_button_toggle disabled", ({override}) => {
diff --git a/web/tests/settings_org.test.cjs b/web/tests/settings_org.test.cjs
index e2e538a7d38..7b3265b0837 100644
--- a/web/tests/settings_org.test.cjs
+++ b/web/tests/settings_org.test.cjs
@@ -443,6 +443,10 @@ test("set_up", ({override, override_rewire}) => {
id: 6,
name: "Constructor Groups",
},
+ nextcloud_talk: {
+ id: 7,
+ name: "Nextcloud Talk",
+ },
});
override(realm, "realm_message_retention_days", null);
diff --git a/zerver/lib/integrations.py b/zerver/lib/integrations.py
index a8ef383cb28..9302f444338 100644
--- a/zerver/lib/integrations.py
+++ b/zerver/lib/integrations.py
@@ -970,6 +970,9 @@ VIDEO_CALL_INTEGRATIONS: list[Integration] = [
"constructor-groups", ["video-calling", "communication"], display_name="Constructor Groups"
),
Integration("jitsi", ["video-calling", "communication"], display_name="Jitsi Meet"),
+ Integration(
+ "nextcloud-talk", ["video-calling", "communication"], display_name="Nextcloud Talk"
+ ),
Integration("zoom", ["video-calling", "communication"]),
]
@@ -1155,7 +1158,7 @@ INTEGRATIONS_WITHOUT_SCREENSHOTS = (
# Outgoing integrations
| {"email", "onyx"}
# Video call integrations
- | {"big-blue-button", "constructor-groups", "jitsi", "zoom"}
+ | {"big-blue-button", "constructor-groups", "jitsi", "nextcloud-talk", "zoom"}
| {
# these integrations do not send messages
"giphy",
diff --git a/zerver/models/realms.py b/zerver/models/realms.py
index 10ceb5857ec..a3fea0b9340 100644
--- a/zerver/models/realms.py
+++ b/zerver/models/realms.py
@@ -662,6 +662,10 @@ class Realm(models.Model):
"name": "Constructor Groups",
"id": 6,
},
+ "nextcloud_talk": {
+ "name": "Nextcloud Talk",
+ "id": 7,
+ },
}
video_chat_provider = models.PositiveSmallIntegerField(
@@ -1087,6 +1091,12 @@ class Realm(models.Model):
or settings.CONSTRUCTOR_GROUPS_URL is None
):
continue
+ if provider == "nextcloud_talk" and (
+ settings.NEXTCLOUD_SERVER is None
+ or settings.NEXTCLOUD_TALK_USERNAME is None
+ or settings.NEXTCLOUD_TALK_PASSWORD is None
+ ):
+ continue
enabled_video_chat_providers[provider] = self.VIDEO_CHAT_PROVIDERS[provider]
return enabled_video_chat_providers
diff --git a/zerver/openapi/test_curl_examples.py b/zerver/openapi/test_curl_examples.py
index ea82d2c4d43..819183e85fd 100644
--- a/zerver/openapi/test_curl_examples.py
+++ b/zerver/openapi/test_curl_examples.py
@@ -35,6 +35,8 @@ UNTESTED_GENERATED_CURL_EXAMPLES = {
"delete-reminder",
# Would need Constructor Groups credentials configured to test this endpoint.
"create-constructor-groups-video-call",
+ # Would need Nextcloud Talk server configured to test this endpoint.
+ "create-nextcloud-talk-video-call",
}
diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yaml
index cdf77aa4fde..e6ee4e573fb 100644
--- a/zerver/openapi/zulip.yaml
+++ b/zerver/openapi/zulip.yaml
@@ -5511,11 +5511,15 @@ paths:
- 4 = BigBlueButton
- 5 = Zoom (Server to Server OAuth integration)
- 6 = Constructor Groups
+ - 7 = Nextcloud Talk
Note that only one of the [Zoom integrations][zoom-video-calls] can
be configured on a Zulip server.
- **Changes**: In Zulip 12.0 (feature level 460), added the
+ **Changes**: In Zulip 12.0 (feature level 465), added the
+ Constructor Groups option.
+
+ In Zulip 12.0 (feature level 460), added the
Constructor Groups option.
In Zulip 10.0 (feature level 353), added the Zoom Server
@@ -19218,11 +19222,15 @@ paths:
- 4 = BigBlueButton
- 5 = Zoom (Server to Server OAuth integration)
- 6 = Constructor Groups
+ - 7 = Nextcloud Talk
Note that only one of the [Zoom integrations][zoom-video-calls] can
be configured on a Zulip server.
- **Changes**: In Zulip 12.0 (feature level 460), added the
+ **Changes**: In Zulip 12.0 (feature level 465), added the
+ Nextcloud Talk option.
+
+ In Zulip 12.0 (feature level 460), added the
Constructor Groups option.
In Zulip 10.0 (feature level 353), added the Zoom Server
@@ -25361,6 +25369,56 @@ paths:
"url": "/calls/bigbluebutton/join?meeting_id=%22zulip-something%22&password=%22something%22&checksum=%22somechecksum%22",
}
+ /calls/nextcloud_talk/create:
+ post:
+ tags: ["channels"]
+ operationId: create-nextcloud-talk-video-call
+ summary: Create Nextcloud Talk video call
+ description: |
+ Create a video call URL for a Nextcloud Talk video call. Requires
+ [Nextcloud Talk](/integrations/nextcloud-talk) to be configured on the
+ Zulip server.
+
+ **Changes**: New in Zulip 12.0 (feature level 465).
+ requestBody:
+ required: true
+ content:
+ application/x-www-form-urlencoded:
+ schema:
+ type: object
+ required:
+ - room_name
+ properties:
+ room_name:
+ type: string
+ description: |
+ Room name for the Nextcloud Talk conversation.
+ example: "#Test > team check-in"
+ responses:
+ "200":
+ description: Success.
+ content:
+ application/json:
+ schema:
+ allOf:
+ - $ref: "#/components/schemas/JsonSuccessBase"
+ - additionalProperties: false
+ properties:
+ result: {}
+ msg: {}
+ ignored_parameters_unsupported: {}
+ url:
+ description: |
+ The URL for the Nextcloud Talk conversation.
+ type: string
+ example: "https://nextcloud.example.com/index.php/call/abc123xyz"
+ example:
+ {
+ "msg": "",
+ "result": "success",
+ "url": "https://nextcloud.example.com/index.php/call/abc123xyz",
+ }
+
/calls/constructorgroups/create:
post:
tags: ["channels"]
diff --git a/zerver/tests/test_create_video_call.py b/zerver/tests/test_create_video_call.py
index 79c33e6e158..ad435c04f3d 100644
--- a/zerver/tests/test_create_video_call.py
+++ b/zerver/tests/test_create_video_call.py
@@ -1,6 +1,7 @@
from unittest import mock
import orjson
+import requests
import responses
from django.core.signing import Signer
from django.http import HttpResponseRedirect
@@ -674,3 +675,142 @@ class ConstructorGroupsVideoCallTest(ZulipTestCase):
service._make_authenticated_request("GET", "/room/default")
self.assertEqual(str(cm.exception.msg), "Failed to create Constructor Groups call")
self.assertIn("Constructor Groups API request failed", error_log.output[0])
+
+
+class NextcloudVideoCallTest(ZulipTestCase):
+ @override
+ def setUp(self) -> None:
+ super().setUp()
+ self.user = self.example_user("hamlet")
+ self.login_user(self.user)
+ self.nextcloud_api_url = "https://nextcloud.example.com/ocs/v2.php/apps/spreed/api/v4/room"
+
+ @responses.activate
+ def test_create_nextcloud_talk_video_call_success(self) -> None:
+ responses.add(
+ responses.POST,
+ self.nextcloud_api_url,
+ json={
+ "ocs": {
+ "meta": {"status": "ok", "statuscode": 200, "message": "OK"},
+ "data": {
+ "token": "abc123token",
+ "name": "Test Meeting",
+ "displayName": "Test Meeting",
+ "type": 3,
+ },
+ }
+ },
+ status=200,
+ )
+
+ response = self.client_post(
+ "/json/calls/nextcloud_talk/create", {"room_name": "#Test > team check-in"}
+ )
+ self.assertEqual(responses.calls[0].request.url, self.nextcloud_api_url)
+
+ self.assertEqual(
+ responses.calls[0].request.headers["OCS-APIRequest"],
+ "true",
+ )
+ self.assertEqual(
+ responses.calls[0].request.headers["Accept"],
+ "application/json",
+ )
+ self.assertIn("Authorization", responses.calls[0].request.headers)
+ self.assertTrue(responses.calls[0].request.headers["Authorization"].startswith("Basic "))
+
+ assert responses.calls[0].request.body is not None
+ self.assertEqual(
+ orjson.loads(responses.calls[0].request.body),
+ {
+ "roomType": 3,
+ "roomName": "#Test > team check-in",
+ },
+ )
+
+ json = self.assert_json_success(response)
+ self.assertEqual(json["url"], "https://nextcloud.example.com/index.php/call/abc123token")
+
+ def test_create_nextcloud_talk_not_configured(self) -> None:
+ for setting_name in [
+ "NEXTCLOUD_SERVER",
+ "NEXTCLOUD_TALK_USERNAME",
+ "NEXTCLOUD_TALK_PASSWORD",
+ ]:
+ with self.settings(**{setting_name: None}):
+ response = self.client_post(
+ "/json/calls/nextcloud_talk/create",
+ {"room_name": "#Test > team check-in"},
+ )
+ self.assert_json_error(response, "Nextcloud Talk is not configured")
+
+ @responses.activate
+ def test_create_nextcloud_talk_connection_error(self) -> None:
+ responses.add(
+ responses.POST,
+ self.nextcloud_api_url,
+ body=requests.RequestException("Connection failed"),
+ )
+
+ response = self.client_post(
+ "/json/calls/nextcloud_talk/create", {"room_name": "#Test > team check-in"}
+ )
+
+ self.assert_json_error(response, "Error connecting to the Nextcloud Talk server")
+
+ @responses.activate
+ def test_create_nextcloud_talk_invalid_response(self) -> None:
+ # Missing 'token' field
+ responses.add(
+ responses.POST,
+ self.nextcloud_api_url,
+ json={
+ "ocs": {
+ "meta": {"status": "ok"},
+ "data": {},
+ }
+ },
+ status=200,
+ )
+
+ response = self.client_post(
+ "/json/calls/nextcloud_talk/create",
+ {"room_name": "#Test > team check-in"},
+ )
+ self.assert_json_error(response, "Failed to create Nextcloud Talk call")
+
+ @responses.activate
+ def test_create_nextcloud_talk_truncates_long_room_name(self) -> None:
+ responses.add(
+ responses.POST,
+ self.nextcloud_api_url,
+ json={
+ "ocs": {
+ "meta": {"status": "ok", "statuscode": 200, "message": "OK"},
+ "data": {
+ "token": "abc123token",
+ "name": "Truncated Conversation",
+ "displayName": "Truncated Meeting",
+ "type": 3,
+ },
+ }
+ },
+ status=200,
+ )
+
+ long_room_name = "A" * 300
+
+ response = self.client_post(
+ "/json/calls/nextcloud_talk/create", {"room_name": long_room_name}
+ )
+
+ from zerver.views.video_calls import MAX_NEXTCLOUD_TALK_ROOM_NAME_LENGTH
+
+ assert responses.calls[0].request.body is not None
+ request_body = orjson.loads(responses.calls[0].request.body)
+ self.assert_length(request_body["roomName"], MAX_NEXTCLOUD_TALK_ROOM_NAME_LENGTH)
+ self.assertTrue(request_body["roomName"].endswith("..."))
+
+ json = self.assert_json_success(response)
+ self.assertEqual(json["url"], "https://nextcloud.example.com/index.php/call/abc123token")
diff --git a/zerver/tests/test_realm.py b/zerver/tests/test_realm.py
index 803b97ee3b3..4d76dfffc6b 100644
--- a/zerver/tests/test_realm.py
+++ b/zerver/tests/test_realm.py
@@ -1402,6 +1402,33 @@ class RealmTest(ZulipTestCase):
constructor_groups_provider_id,
)
+ nextcloud_talk_provider_id = Realm.VIDEO_CHAT_PROVIDERS["nextcloud_talk"]["id"]
+ req = {"video_chat_provider": f"{nextcloud_talk_provider_id}"}
+ with self.settings(NEXTCLOUD_SERVER=None):
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_error(
+ result, f"Invalid video_chat_provider {nextcloud_talk_provider_id}"
+ )
+
+ with self.settings(NEXTCLOUD_TALK_USERNAME=None):
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_error(
+ result, f"Invalid video_chat_provider {nextcloud_talk_provider_id}"
+ )
+
+ with self.settings(NEXTCLOUD_TALK_PASSWORD=None):
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_error(
+ result, f"Invalid video_chat_provider {nextcloud_talk_provider_id}"
+ )
+
+ result = self.client_patch("/json/realm", req)
+ self.assert_json_success(result)
+ self.assertEqual(
+ get_realm("zulip").video_chat_provider,
+ nextcloud_talk_provider_id,
+ )
+
def test_data_deletion_schedule_when_deactivating_realm(self) -> None:
self.login("desdemona")
diff --git a/zerver/views/video_calls.py b/zerver/views/video_calls.py
index dd45ce86192..a61a92bb6a0 100644
--- a/zerver/views/video_calls.py
+++ b/zerver/views/video_calls.py
@@ -33,6 +33,7 @@ from zerver.lib.cache import (
zoom_server_access_token_cache_key,
)
from zerver.lib.exceptions import ErrorCode, JsonableError
+from zerver.lib.message import truncate_content
from zerver.lib.outgoing_http import OutgoingSession
from zerver.lib.partial import partial
from zerver.lib.pysa import mark_sanitized
@@ -552,3 +553,55 @@ def make_constructor_groups_video_call(
raise CreateVideoCallFailedError("Constructor Groups")
return json_success(request, {"url": room_url})
+
+
+# Nextcloud Talk API limits room names to 255 characters.
+MAX_NEXTCLOUD_TALK_ROOM_NAME_LENGTH = 255
+
+
+@typed_endpoint
+def create_nextcloud_talk_url(
+ request: HttpRequest, user: UserProfile, *, room_name: str
+) -> HttpResponse:
+ if (
+ settings.NEXTCLOUD_SERVER is None
+ or settings.NEXTCLOUD_TALK_USERNAME is None
+ or settings.NEXTCLOUD_TALK_PASSWORD is None
+ ):
+ raise JsonableError(_("Nextcloud Talk is not configured"))
+
+ room_name = truncate_content(room_name, MAX_NEXTCLOUD_TALK_ROOM_NAME_LENGTH, "...")
+ # https://nextcloud-talk.readthedocs.io/en/stable/conversation/#creating-a-new-conversation
+ api_url = urljoin(settings.NEXTCLOUD_SERVER, "/ocs/v2.php/apps/spreed/api/v4/room")
+
+ payload = {
+ # Create a PUBLIC conversation (roomType=3) which allows guest access
+ # https://nextcloud-talk.readthedocs.io/en/latest/constants/#conversation-types
+ "roomType": 3,
+ "roomName": room_name,
+ }
+ username = str(settings.NEXTCLOUD_TALK_USERNAME)
+ password = str(settings.NEXTCLOUD_TALK_PASSWORD)
+ credentials = f"{username}:{password}".encode()
+ encoded_credentials = b64encode(credentials).decode("ascii")
+
+ headers = {
+ "OCS-APIRequest": "true",
+ "Accept": "application/json",
+ "Authorization": f"Basic {encoded_credentials}",
+ }
+
+ try:
+ response = VideoCallSession().post(api_url, json=payload, headers=headers, timeout=10)
+ response.raise_for_status()
+ except requests.RequestException:
+ raise JsonableError(_("Error connecting to the Nextcloud Talk server"))
+
+ try:
+ data = response.json()
+ token = data["ocs"]["data"]["token"]
+ except (KeyError, ValueError):
+ raise CreateVideoCallFailedError("Nextcloud Talk")
+
+ call_url = urljoin(settings.NEXTCLOUD_SERVER, f"/index.php/call/{token}")
+ return json_success(request, data={"url": call_url})
diff --git a/zproject/computed_settings.py b/zproject/computed_settings.py
index db534301f8c..650a8843b7d 100644
--- a/zproject/computed_settings.py
+++ b/zproject/computed_settings.py
@@ -535,6 +535,9 @@ BIG_BLUE_BUTTON_SECRET = get_secret("big_blue_button_secret")
CONSTRUCTOR_GROUPS_ACCESS_KEY = get_secret("constructor_groups_access_key")
CONSTRUCTOR_GROUPS_SECRET_KEY = get_secret("constructor_groups_secret_key")
+NEXTCLOUD_TALK_USERNAME = get_secret("nextcloud_talk_username")
+NEXTCLOUD_TALK_PASSWORD = get_secret("nextcloud_talk_password")
+
# These are the bots that Zulip sends automated messages as.
INTERNAL_BOTS = [
{
diff --git a/zproject/default_settings.py b/zproject/default_settings.py
index dc9b638d22d..75e6bcd9093 100644
--- a/zproject/default_settings.py
+++ b/zproject/default_settings.py
@@ -198,6 +198,10 @@ BIG_BLUE_BUTTON_URL = get_secret("big_blue_button_url", development_only=True)
# Allow setting Constructor Groups URL in development.
CONSTRUCTOR_GROUPS_URL = get_secret("constructor_groups_url", development_only=True)
+# Allow setting Nextcloud Talk settings in zulip-secrets.conf in
+# development; this is useful since there are no public Nextcloud Talk servers.
+NEXTCLOUD_SERVER = get_secret("nextcloud_server", development_only=True)
+
# Max state storage per user
# TODO: Add this to zproject/prod_settings_template.py once stateful bots are fully functional.
USER_STATE_SIZE_LIMIT = 10000000
diff --git a/zproject/prod_settings_template.py b/zproject/prod_settings_template.py
index 26af19c67ad..33c4626da3b 100644
--- a/zproject/prod_settings_template.py
+++ b/zproject/prod_settings_template.py
@@ -749,6 +749,10 @@ SOCIAL_AUTH_SAML_SUPPORT_CONTACT = {
## zulip-secrets.conf.
# CONSTRUCTOR_GROUPS_URL = "https://example.constructor.app/api/groups/xapi"
+## Controls the Nextcloud Talk video call integration. You must also
+## set nextcloud_talk_username and nextcloud_talk_password in
+## zulip-secrets.conf.
+# NEXTCLOUD_SERVER = "https://nextcloud.example.com"
################
## AI Features
diff --git a/zproject/test_extra_settings.py b/zproject/test_extra_settings.py
index d3af39542c9..7f51fde40b6 100644
--- a/zproject/test_extra_settings.py
+++ b/zproject/test_extra_settings.py
@@ -206,6 +206,10 @@ CONSTRUCTOR_GROUPS_URL = "https://example.constructor.app/api/groups/xapi"
CONSTRUCTOR_GROUPS_ACCESS_KEY = "test-access-key"
CONSTRUCTOR_GROUPS_SECRET_KEY = "test-secret-key"
+NEXTCLOUD_SERVER = "https://nextcloud.example.com"
+NEXTCLOUD_TALK_USERNAME = "username"
+NEXTCLOUD_TALK_PASSWORD = "password"
+
# By default two factor authentication is disabled in tests.
# Explicitly set this to True within tests that must have this on.
TWO_FACTOR_AUTHENTICATION_ENABLED = False
diff --git a/zproject/urls.py b/zproject/urls.py
index cf7a7473d41..1211e57b8f2 100644
--- a/zproject/urls.py
+++ b/zproject/urls.py
@@ -269,6 +269,7 @@ from zerver.views.users import (
)
from zerver.views.video_calls import (
complete_zoom_user,
+ create_nextcloud_talk_url,
deauthorize_zoom_user,
get_bigbluebutton_url,
join_bigbluebutton,
@@ -603,6 +604,8 @@ v1_api_and_json_patterns = [
rest_path("calls/bigbluebutton/create", GET=get_bigbluebutton_url),
# Used to generate a Constructor Groups video call URL
rest_path("calls/constructorgroups/create", POST=make_constructor_groups_video_call),
+ # Used to generate a Nextcloud Talk video call URL
+ rest_path("calls/nextcloud_talk/create", POST=create_nextcloud_talk_url),
# export/realm -> zerver.views.realm_export
rest_path("export/realm", POST=export_realm, GET=get_realm_exports),
rest_path("export/realm/<int:export_id>", DELETE=delete_realm_export),