Repository navigation
Expand file tree
/
Copy pathci-setup-rooms.sh
More file actions
executable file
Β·109 lines (86 loc) Β· 4.22 KB
/
Copy pathci-setup-rooms.sh
File metadata and controls
executable file
Β·109 lines (86 loc) Β· 4.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
# SPDX-License-Identifier: GPL-3.0-or-later
# This script is intended to setup specific rooms that we want to test
SERVER_URL="http://localhost:8080"
# Check if a Talk capability is available
# Usage: has_capability "capability-name"
has_capability() {
local capability="$1"
curl -s -u admin:admin "$SERVER_URL/ocs/v2.php/cloud/capabilities" \
-H "OCS-APIRequest: true" \
-H 'accept: application/json, text/plain, */*' \
| jq -e ".ocs.data.capabilities.spreed.features | any(. == \"$capability\")" > /dev/null 2>&1
}
# Setup a room with lobby enabled and add admin as a normal participant
response=$(curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room" \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"roomType":2,"roomName":"LobbyTest"}')
echo $response
token=$(echo $response | jq -r .ocs.data.token)
echo $token
curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room/$token/webinar/lobby" \
-X 'PUT' \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"state":1}'
curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room/$token/participants" \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"newParticipant":"admin","source":"users"}'
# Setup a listable room so other users can join them
response=$(curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room" \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"roomType":2,"roomName":"OpenConversationTest"}')
echo $response
token=$(echo $response | jq -r .ocs.data.token)
echo $token
curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room/$token/listable" \
-X 'PUT' \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"scope":1}'
# Setup a room with react-only permission (can react but cannot chat)
# Only available when server supports react-permission capability (Talk 24+)
if has_capability "react-permission"; then
echo "Setting up ReactOnlyTest room (react-permission capability detected)"
# Permission values: CustomPermissions=1 (auto-added), JoinCall=4, React=256
# Total: 260 (4 + 256, custom flag auto-added when non-zero)
response=$(curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room" \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"roomType":2,"roomName":"ReactOnlyTest"}')
echo $response
token=$(echo $response | jq -r .ocs.data.token)
echo "ReactOnlyTest token: $token"
# Set default permissions to react-only (no chat permission)
# 260 = JoinCall(4) + React(256)
curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room/$token/permissions/default" \
-X 'PUT' \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"permissions":260}'
# Add admin as a participant (will get the default react-only permissions)
curl -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v4/room/$token/participants" \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json, text/plain, */*' \
--data-raw '{"newParticipant":"admin","source":"users"}'
# Send a message from alice (moderator) so there's something to react to
curl -X POST -u alice:alice "$SERVER_URL/ocs/v2.php/apps/spreed/api/v1/chat/$token" \
-H "OCS-APIRequest: true" \
-H 'content-type: application/json' \
-H 'accept: application/json' \
--data-raw '{"message":"React to this message!"}'
else
echo "Skipping ReactOnlyTest room setup (react-permission capability not available)"
fi