Skip to content
Snippets Groups Projects
Verified Commit bd17d06f authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Pridano prehravani nahravek

parent 39e21ff7
No related branches found
No related tags found
No related merge requests found
Pipeline #20317 passed
0.17.2
0.18.0
......@@ -50,6 +50,7 @@ sub get($c) {
my $users = { 0 => [], 1 => [] };
my @invites = ();
my @records = ();
USER:
foreach my $user ( $meet->users ) {
......@@ -68,12 +69,29 @@ sub get($c) {
}
}
RECORD:
foreach my $record ( $meet->records({ deleted => undef }, { order_by => { -desc => 'recorded' }}) ) {
my $url = join '/', (
$c->config->{jibri_records},
$record->uuid,
$record->file,
);
push @records, {
id => $record->id,
recorded => $record->recorded,
description => $record->description,
url => $url,
}
}
$c->render(openapi => $c->spec_filter({
$meet->get_columns,
groups => $meet->cached_groups, #TODO: direct
moderators => $users->{1},
participants => $users->{0},
invites => \@invites,
records => \@records,
}, 'Meet'));
}
......@@ -106,6 +124,7 @@ sub list($c) {
moderators => $meet->cached_moderators,
participants => [],
invites => [],
records => [],
}, 'Meet')
}
......
......@@ -48,4 +48,32 @@ sub create($c) {
$c->render( status => 204, text => '' );
}
sub delete($c) {
$c->openapi->valid_input or return;
my $record = $c->_get($c->stash->{id}, 1) // return;
$record->update({ deleted => \'now()' });
$c->render( status => 204, text => '' );
}
sub _get($c, $id, $access) {
my $record = $c->schema->resultset('Record')->find({ id => $id });
return $c->error(404, 'NOT_FOUND') if ! $record;
my $roles = $record->meet->user_roles($c->stash->{user}, $c->stash->{groups});
return $c->error(403, 'ACCESS_DENIED') if ! $roles->{any};
if ( $access == 1 && ! ($roles->{moderator} || $roles->{owner}) ) {
return $c->error(403, 'ACCESS_DENIED');
}
if ( $access == 2 && ! $roles->{owner} ) {
return $c->error(403, 'ACCESS_DENIED');
}
return $record;
}
1;
......@@ -42,6 +42,7 @@ our %Lexicon = (
'Invites' => 'Pozvánky',
'Create invite' => 'Vytvořit pozvánku',
'Firstname, Lastname' => '',
'Records' => 'Nahrávky',
);
1;
......
......@@ -21,7 +21,7 @@ __PACKAGE__->add_columns(
meet_id
deleted
recorded
decription
description
file
),
);
......@@ -32,6 +32,13 @@ __PACKAGE__->add_unique_constraint(
'uuid' => [qw(uuid)]
);
__PACKAGE__->belongs_to(
meet => 'SeMeet::Schema::Result::Meet',
{
'foreign.id' => 'self.meet_id',
},
);
1;
......@@ -56,6 +56,10 @@ components:
type: array
items:
$ref: '#/components/schemas/InviteInList'
records:
type: array
items:
$ref: '#/components/schemas/Record'
GroupInList:
type: object
properties:
......@@ -118,6 +122,21 @@ components:
displayname:
type: string
description: Jmeno, Prijmeni
Record:
type: object
properties:
recorded:
type: integer
readOnly: true
recorded:
type: string
readOnly: true
url:
type: string
readOnly: true
description:
type: string
nullable: true
paths:
/meets:
......@@ -538,3 +557,23 @@ paths:
responses:
204:
description: Record created
/records/{id}:
delete:
x-mojo-to: records#delete
security:
- Bearer: []
tags:
- records
summary: "Smazat nahravku"
operationId: deleteRecord
parameters:
- name: id
in: path
required: true
example: 100345
description: "Identifikator nahravky"
schema:
type: integer
responses:
204:
description: Record deleted
This diff is collapsed.
This diff is collapsed.
......@@ -20,6 +20,7 @@
<title><%= config->{name} %></title>
<link rel="manifest" href="/manifest.json"/>
<link rel="stylesheet" href="<%= config->{styleguide} %>css/styles.css"/>
<link rel="stylesheet" href="/video-js.css"/>
<link rel="stylesheet" href="/custom.css"/>
% if ( $c->stash->{meet} ) {
<script src='https://jitsi.pirati.cz/external_api.js'></script>
......
<div id='meet' class="mb-1"></div>
<div id='meet' class="mb-1" v-if="showMeet"></div>
<script>
const MEET_DOMAIN = 'meet.pirati.cz';
const MEET_OPTIONS = {
......
......@@ -4,6 +4,7 @@
% if ( $roles->{owner} ) {
<span class="icon">
<i class="ico--cross ml-3 cursor-pointer" @click="removeUser(moderator.id)"></i>
<i class="ico--jitsi ml-3 cursor-pointer" @click="playRecord(moderator.id)"></i>
</span>
% }
</span>
......
<div class="flex">
<div v-for="record in meet.records" class="flex-initial m-1" :id="'record'+record.id">
<div class="text-white bg-grey-500 p-2">
<div class="flex justify-between">
<div>{{ record.recorded }}</div>
<div>
% if ( $roles->{owner} || $roles->{moderator} ) {
<span class="icon" title="Smazat nahrávku">
<i class="ico--bin ml-3 cursor-pointer" @click="removeRecord(record.id)"></i>
</span>
% }
</div>
</div>
</div>
<video :id="record.id" class="video-js" controls preload="auto" width="320" height="240" data-setup="{}" >
<source :src="record.url" type="video/mp4" />
</video>
</div>
</div>
......@@ -45,5 +45,8 @@
</main>
</section>
</div>
% if ( $c->stash->{meet} ) {
<script src="/video.min.js"></script>
% }
</body>
</html>
......@@ -4,11 +4,12 @@
%= include 'includes/meet'
<div class="grid grid-cols-5 border border-b-0 divide-x text-center">
<div class="grid grid-cols-6 border border-b-0 divide-x text-center">
<div @click="active_tab='groups'" class="p-4 bg-grey-125" :class="tabClass('groups')"><%=l 'Authorized groups' %></div>
<div @click="active_tab='participants'" class="p-4 bg-grey-125" :class="tabClass('participants')"><%=l 'Authorized persons' %></div>
<div @click="active_tab='moderators'" class="p-4 bg-grey-125" :class="tabClass('moderators')"><%=l 'Moderators' %></div>
<div @click="active_tab='invites'" class="p-4 bg-grey-125" :class="tabClass('invites')"><%=l 'Invites' %></div>
<div @click="active_tab='records'" class="p-4 bg-grey-125" :class="tabClass('records')"><%=l 'Records' %></div>
<div @click="active_tab='form'" class="p-4 bg-grey-125" :class="tabClass('form')"><%=l $roles->{owner} ? 'Configuration':'About meet' %></div>
</div>
......@@ -24,6 +25,9 @@
</div>
<div v-if="active_tab == 'invites'">
%= include 'includes/meet_invites'
</div>
<div v-if="active_tab == 'records'">
%= include 'includes/meet_records'
</div>
<div v-if="active_tab == 'form'">
% if ( $roles->{owner} ) {
......@@ -57,6 +61,7 @@
const GROUPS_URL = '/api/groups';
const USERS_URL = '/api/users';
const INVITES_URL = '/api/invites';
const RECORDS_URL = '/api/records';
const MEET_URL = '/api/meets/<%= stash->{id} %>';
const ADD_GROUPS_URL = '/api/meets/<%= stash->{id} %>/groups';
const ADD_USERS_URL = '/api/meets/<%= stash->{id} %>/users';
......@@ -70,6 +75,7 @@
el: '#App',
data: {
showMeet: 1,
meet: {},
newInvite: {},
......@@ -198,6 +204,11 @@
})
},
playRecord: function(url) {
this.showMeet = 0;
console.log(url);
},
removeUser: function(id, kind) {
fetch(MEET_URL + '/users/' + id, {
method: "DELETE",
......@@ -280,6 +291,18 @@
}
})
},
removeRecord: function(id) {
fetch(RECORDS_URL + '/' + id, {
method: "DELETE",
headers: API_HEADERS,
})
.then( response => {
if (response.ok) {
this.getMeet()
}
})
},
% }
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment