Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add option to not use avatars in BBB rooms #276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Key | Description
`app.shortener` | Value of your shortener service. Should start with `https://` and contain `{token}`.
`avatar.path` | Absolute path to an optional avatar cache directory.
`avatar.url` | URL which serves `avatar.path` to be used as avatar cache.
`avatar.enabled` | Set to `false` if you want to disable the use of Nextcloud avatars in BBB rooms.

### Avatar cache (v2.2+)
The generation of avatars puts a high load on your Nextcloud instance, since the
Expand Down Expand Up @@ -113,8 +114,8 @@ For additional security, we recommend to disable directory listing, symlinks and
any language interpreter such as php for the cache directory.

Cached avatars are usually deleted as soon as the meeting ends. In cases the BBB
server shuts down unexpected, we provide the `bbb:clear-avatar-cache` occ
command (example use: `./occ bbb:clear-avatar-cache`).
server shuts down unexpected or you set `avatar.enabled` to `false` (via gui or manually) while a meeting was running,
we provide the `bbb:clear-avatar-cache` occ command (example use: `./occ bbb:clear-avatar-cache`).


## :bowtie: User guide
Expand Down
8 changes: 5 additions & 3 deletions lib/BigBlueButton/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ public function createJoinUrl(Room $room, float $creationTime, string $displayna
}

if ($uid) {
$avatarUrl = $this->avatarRepository->getAvatarUrl($room, $uid);

$joinMeetingParams->setUserID($uid);
$joinMeetingParams->setAvatarURL($avatarUrl);

if ($this->config->getAppValue('bbb', 'avatar.enabled', 'true') === 'true') {
$avatarUrl = $this->avatarRepository->getAvatarUrl($room, $uid);
$joinMeetingParams->setAvatarURL($avatarUrl);
}
}

return $this->getServer()->getJoinMeetingURL($joinMeetingParams);
Expand Down
12 changes: 10 additions & 2 deletions lib/Controller/HookController.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use OCA\BigBlueButton\Event\MeetingEndedEvent;
use OCA\BigBlueButton\Event\RecordingReadyEvent;
use OCA\BigBlueButton\Service\RoomService;
use OCP\IConfig;
use OCP\AppFramework\Controller;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IRequest;
Expand All @@ -27,18 +28,23 @@ class HookController extends Controller {
/** @var IEventDispatcher */
private $eventDispatcher;

/** @var IConfig */
private $config;

public function __construct(
string $appName,
IRequest $request,
RoomService $service,
AvatarRepository $avatarRepository,
IEventDispatcher $eventDispatcher
IEventDispatcher $eventDispatcher,
IConfig $config
) {
parent::__construct($appName, $request);

$this->service = $service;
$this->avatarRepository = $avatarRepository;
$this->eventDispatcher = $eventDispatcher;
$this->config = $config;
}

public function setToken(string $token): void {
Expand All @@ -65,7 +71,9 @@ public function meetingEnded($recordingmarks = false): void {

$this->service->updateRunning($room->getId(), false);

$this->avatarRepository->clearRoom($room->uid);
if ($this->config->getAppValue('bbb', 'avatar.enabled', 'true') === 'true') {
$this->avatarRepository->clearRoom($room->uid);
}

$this->eventDispatcher->dispatch(MeetingEndedEvent::class, new MeetingEndedEvent($room, $recordingmarks));
}
Expand Down
1 change: 1 addition & 0 deletions lib/Settings/Admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public function getForm() {
'join.theme' => $this->config->getAppValue('bbb', 'join.theme') === 'true' ? 'checked' : '',
'app.shortener' => $this->config->getAppValue('bbb', 'app.shortener'),
'join.mediaCheck' => $this->config->getAppValue('bbb', 'join.mediaCheck', 'true') === 'true' ? 'checked' : '',
'avatar.enabled' => $this->config->getAppValue('bbb', 'avatar.enabled', 'true') === 'true' ? 'checked' : '',
];

return new TemplateResponse('bbb', 'admin', $parameters);
Expand Down
5 changes: 5 additions & 0 deletions templates/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
<label for="bbb-join-theme"><?php p($l->t('Use Nextcloud theme in BigBlueButton.')); ?></label>
</p>

<p>
<input type="checkbox" name="avatar.enabled" id="bbb-avatar-enabled" class="checkbox bbb-setting" value="1" <?php p($_['avatar.enabled']); ?> />
<label for="bbb-avatar-enabled"><?php p($l->t('Use Nextcloud avatars in BBB rooms.')); ?></label>
</p>

<h3><?php p($l->t('Default Room Settings')); ?></h3>
<p><?php p($l->t('Below you can change some default values, which are used to create a new room.')); ?></p>

Expand Down