Skip to content

Commit

Permalink
Merge pull request #9 from mynaparrot/auto_recording
Browse files Browse the repository at this point in the history
feat: auto recording + playback recording
  • Loading branch information
jibon57 authored Nov 20, 2022
2 parents 37ca940 + 6c99207 commit 262f21c
Show file tree
Hide file tree
Showing 43 changed files with 946 additions and 1,004 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
!LICENSE
!/assets/
!/plugnmeet/
.DS_Store
8 changes: 6 additions & 2 deletions plugnmeet/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ Contributors: mynaparrot
Donate link: https://www.mynaparrot.com/
Tags: mynaparrot, web conference, plugnmeet
Requires at least: 5.9
Tested up to: 6.0.3
Stable tag: 1.1.5
Tested up to: 6.1
Stable tag: 1.2.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Expand Down Expand Up @@ -56,6 +56,10 @@ Please follow this article: https://www.plugnmeet.org/docs/installation

== Changelog ==

= 1.2.0 =
* auto recording + playback recording
* new permission setting

= 1.1.0 =
* Bump Plug-N-Meet PHP SDK to v1.1.0

Expand Down
2 changes: 1 addition & 1 deletion plugnmeet/admin/class-plugnmeet-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public function save_room_data() {
$published = isset($_POST['published']) ? sanitize_text_field($_POST['published']) : 1;
$roles = isset($_POST['roles']) ? $_POST['roles'] : array();

$room_metadata_items = ['room_features', 'chat_features', 'shared_note_pad_features', 'whiteboard_features', 'external_media_player_features', 'waiting_room_features', 'breakout_room_features', 'display_external_link_features', 'default_lock_settings', 'custom_design'];
$room_metadata_items = ['room_features', 'recording_features', 'chat_features', 'shared_note_pad_features', 'whiteboard_features', 'external_media_player_features', 'waiting_room_features', 'breakout_room_features', 'display_external_link_features', 'default_lock_settings', 'custom_design'];

$room_metadata = [];
foreach ($room_metadata_items as $item) {
Expand Down
2 changes: 1 addition & 1 deletion plugnmeet/admin/class-plugnmeet-room-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function getFormData() {
$fields_values['attendee_pass'] = PlugnmeetHelper::secureRandomKey(10);
}

$room_metadata_items = ['room_features', 'chat_features', 'shared_note_pad_features', 'whiteboard_features', 'external_media_player_features', 'waiting_room_features', 'breakout_room_features', 'display_external_link_features', 'default_lock_settings', 'custom_design'];
$room_metadata_items = ['room_features', 'recording_features', 'chat_features', 'shared_note_pad_features', 'whiteboard_features', 'external_media_player_features', 'waiting_room_features', 'breakout_room_features', 'display_external_link_features', 'default_lock_settings', 'custom_design'];

if (isset($data->room_metadata)) {
$room_metadata = json_decode($data->room_metadata, true);
Expand Down
18 changes: 18 additions & 0 deletions plugnmeet/admin/partials/form-parts/permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,23 @@
'title' => $role['name'],
'require_password' => "on",
'join_as' => 'attendee',
'can_view_recording' => "off",
'can_play' => "off",
'can_download' => "off",
'can_delete' => "off"
);

if (isset($role['capabilities']['edit_users']) && $role['capabilities']['edit_users']) {
$r['require_password'] = "off";
$r['can_play'] = "on";
$r['can_view_recording'] = "on";
$r['can_download'] = "on";
$r['can_delete'] = "on";
$r['join_as'] = 'moderator';
} elseif (isset($role['capabilities']['edit_posts']) && $role['capabilities']['edit_posts']) {
$r['require_password'] = "off";
$r['can_view_recording'] = "on";
$r['can_play'] = "on";
$r['can_download'] = "on";
$r['join_as'] = 'moderator';
}
Expand All @@ -43,6 +49,8 @@
'title' => "Guest/Public",
'require_password' => "on",
'join_as' => 'attendee',
'can_view_recording' => 'off',
'can_play' => 'off',
'can_download' => "off",
'can_delete' => "off"
);
Expand Down Expand Up @@ -100,6 +108,8 @@
<th><?php echo __("Join as <br/>Moderator", "plugnmeet"); ?></th>
<th><?php echo __("Join as <br/>Attendee", "plugnmeet"); ?></th>
<th><?php echo __("Require <br/> Password", "plugnmeet"); ?></th>
<th><?php echo __("Allow View <br/>Recordings", "plugnmeet"); ?></th>
<th><?php echo __("Allow Play <br/>Recordings", "plugnmeet"); ?></th>
<th><?php echo __("Allow Download <br/>Recordings", "plugnmeet"); ?></th>
<th><?php echo __("Allow Delete <br/>Recordings", "plugnmeet"); ?></th>
</tr>
Expand All @@ -120,6 +130,14 @@
<input type="checkbox" name="roles[<?php echo $key; ?>][require_password]"
<?php echo $role['require_password'] === "on" ? "checked='checked'" : ""; ?>>
</td>
<td align="center">
<input type="checkbox" name="roles[<?php echo $key; ?>][can_view_recording]"
<?php echo $role['can_view_recording'] === "on" ? "checked='checked'" : ""; ?>>
</td>
<td align="center">
<input type="checkbox" name="roles[<?php echo $key; ?>][can_play]"
<?php echo $role['can_play'] === "on" ? "checked='checked'" : ""; ?>>
</td>
<td align="center">
<input type="checkbox" name="roles[<?php echo $key; ?>][can_download]"
<?php echo $role['can_download'] === "on" ? "checked='checked'" : ""; ?>>
Expand Down
6 changes: 6 additions & 0 deletions plugnmeet/admin/partials/plugnmeet-admin-edit-room.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,12 @@
</div>

<div class="tab-pane fade" id="other-features" role="tabpanel" aria-labelledby="other-features">
<table class="form-table" role="presentation">
<tbody>
<?php echo PlugnmeetHelper::getRecordingFeatures($fields_values['recording_features']); ?>
</tbody>
</table>
<hr/>
<table class="form-table" role="presentation">
<tbody>
<?php echo PlugnmeetHelper::getChatFeatures($fields_values['chat_features']); ?>
Expand Down
5 changes: 3 additions & 2 deletions plugnmeet/helpers/ajaxHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function get_recordings() {
wp_send_json($output);
}

$check = $this->canAccess($roomId, 'can_download');
$check = $this->canAccess($roomId, 'can_view_recording');
if (!$check->status) {
$output->msg = $check->msg;
wp_send_json($output);
Expand Down Expand Up @@ -73,13 +73,14 @@ public function download_recording() {

$recordingId = isset($_POST['recordingId']) ? sanitize_text_field($_POST['recordingId']) : null;
$roomId = isset($_POST['roomId']) ? sanitize_text_field($_POST['roomId']) : null;
$role = isset($_POST['role']) ? sanitize_text_field($_POST['role']) : 'can_download';

if (!$recordingId || !$roomId) {
$output->msg = __("both roomId & record id required", 'plugnmeet');
wp_send_json($output);
}

$check = $this->canAccess($roomId, 'can_download');
$check = $this->canAccess($roomId, $role);
if (!$check->status) {
$output->msg = $check->msg;
wp_send_json($output);
Expand Down
77 changes: 64 additions & 13 deletions plugnmeet/helpers/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,19 +147,6 @@ public static function getRoomFeatures($room_features) {
"selected" => 1,
"type" => "select"
),
"allow_recording" => array(
"label" => __("Allow recording", "plugnmeet"),
"options" => array(
array(
"label" => __("Yes", "plugnmeet"),
"value" => 1
), array(
"label" => __("No", "plugnmeet"),
"value" => 0
)),
"selected" => 1,
"type" => "select"
),
"allow_rtmp" => array(
"label" => __("Allow rtmp", "plugnmeet"),
"options" => array(
Expand Down Expand Up @@ -240,6 +227,70 @@ public static function getRoomFeatures($room_features) {
return self::formatHtml($roomFeatures, "room_features", $data);
}

public static function getRecordingFeatures($recording_features) {
$recordingFeatures = array(
"is_allow" => array(
"label" => __("Allow recording", "plugnmeet"),
"options" => array(
array(
"label" => __("Yes", "plugnmeet"),
"value" => 1
), array(
"label" => __("No", "plugnmeet"),
"value" => 0
)),
"selected" => 1,
"type" => "select"
),
"is_allow_cloud" => array(
"label" => __("Allow cloud recording", "plugnmeet"),
"options" => array(
array(
"label" => __("Yes", "plugnmeet"),
"value" => 1
), array(
"label" => __("No", "plugnmeet"),
"value" => 0
)),
"selected" => 1,
"type" => "select"
),
"enable_auto_cloud_recording" => array(
"label" => __("Enable auto cloud recording", "plugnmeet"),
"options" => array(
array(
"label" => __("Yes", "plugnmeet"),
"value" => 1
), array(
"label" => __("No", "plugnmeet"),
"value" => 0
)),
"selected" => 0,
"type" => "select"
),
"is_allow_local" => array(
"label" => __("Allow local recording", "plugnmeet"),
"options" => array(
array(
"label" => __("Yes", "plugnmeet"),
"value" => 1
), array(
"label" => __("No", "plugnmeet"),
"value" => 0
)),
"selected" => 1,
"type" => "select"
),
);

$data = [];
if (!empty($recording_features)) {
$data = $recording_features;
}

return self::formatHtml($recordingFeatures, "recording_features", $data);
}

public static function getChatFeatures($chat_features) {
$chatFeatures = array(
"allow_chat" => array(
Expand Down
2 changes: 1 addition & 1 deletion plugnmeet/helpers/libs/plugnmeet-sdk-php/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"description": "plugNmeet PHP SDK",
"type": "library",
"license": "MIT",
"version": "1.1.5",
"version": "1.2.0",
"autoload": {
"psr-4": {
"Mynaparrot\\Plugnmeet\\": "src/"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,11 @@ public function setAllowedNumberRooms(int $allowedNumberRooms): void
/**
* @return array
*/
public function buildBody()
public function buildBody(): array
{
$body = array(
return array(
"is_allow" => $this->isAllow(),
"allowed_number_rooms" => $this->allowedNumberRooms
"allowed_number_rooms" => $this->getAllowedNumberRooms()
);

return $body;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,39 +56,39 @@ public function __construct()
/**
* @return bool
*/
public function isAllowChat()
public function isAllowChat(): bool
{
return $this->allowChat;
}

/**
* @param bool $allowChat
*/
public function setAllowChat($allowChat)
public function setAllowChat(bool $allowChat)
{
$this->allowChat = filter_var($allowChat, FILTER_VALIDATE_BOOLEAN);
}

/**
* @return bool
*/
public function isAllowFileUpload()
public function isAllowFileUpload(): bool
{
return $this->allowFileUpload;
}

/**
* @param bool $allowFileUpload
*/
public function setAllowFileUpload($allowFileUpload)
public function setAllowFileUpload(bool $allowFileUpload)
{
$this->allowFileUpload = filter_var($allowFileUpload, FILTER_VALIDATE_BOOLEAN);
}

/**
* @return string[]
*/
public function getAllowedFileTypes()
public function getAllowedFileTypes(): array
{
return $this->allowedFileTypes;
}
Expand All @@ -104,35 +104,35 @@ public function setAllowedFileTypes(array $allowedFileTypes)
/**
* @return int
*/
public function getMaxFileSize()
public function getMaxFileSize(): int
{
return $this->maxFileSize;
}

/**
* @param int $maxFileSize
*/
public function setMaxFileSize($maxFileSize)
public function setMaxFileSize(int $maxFileSize)
{
$this->maxFileSize = $maxFileSize;
}

/**
* @return array
*/
public function buildBody()
public function buildBody(): array
{
$body = array(
"allow_chat" => $this->allowChat,
"allow_file_upload" => $this->allowFileUpload
"allow_chat" => $this->isAllowChat(),
"allow_file_upload" => $this->isAllowFileUpload()
);

if (!empty($this->allowedFileTypes)) {
$body['allowed_file_types'] = $this->allowedFileTypes;
$body['allowed_file_types'] = $this->getAllowedFileTypes();
}

if ($this->maxFileSize > 0) {
$body['max_file_size'] = $this->maxFileSize;
$body['max_file_size'] = $this->getMaxFileSize();
}

return $body;
Expand Down
Loading

0 comments on commit 262f21c

Please sign in to comment.