Skip to content

Commit

Permalink
Store Fonts
Browse files Browse the repository at this point in the history
  • Loading branch information
ingalls committed Sep 12, 2024
1 parent c864cc4 commit 6e93eac
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 17 deletions.
11 changes: 8 additions & 3 deletions api/routes/video-lease.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,13 @@ export default async function router(schema: Schema, config: Config) {
group: 'VideoLease',
description: 'Create a new video Lease',
body: Type.Object({
name: Type.String(),
duration: Type.Integer(),
name: Type.String({
description: 'Human readable name'
}),
duration: Type.Integer({
minimum: 0,
description: 'Duration in Seconds'
}),
path: Type.Optional(Type.String()),
stream_user: Type.Optional(Type.String()),
stream_pass: Type.Optional(Type.String()),
Expand All @@ -187,7 +192,7 @@ export default async function router(schema: Schema, config: Config) {
try {
const user = await Auth.as_user(config, req);

if (user.access !== AuthUserAccess.ADMIN &&req.body.duration > 60 * 60 * 16) {
if (user.access !== AuthUserAccess.ADMIN && req.body.duration > 60 * 60 * 16) {
throw new Err(400, null, 'Only Administrators can request a lease > 16 hours')
}

Expand Down
Binary file added api/web/public/fonts/Open Sans Bold/0-255.pbf
Binary file not shown.
54 changes: 41 additions & 13 deletions api/web/src/components/CloudTAK/util/Video.vue
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
<template>
<div>
<video
id='cot-player'
class='video-js vjs-default-skin'
width='400'
height='300'
controls
>
<source
type='application/x-mpegURL'
:src='video'
<TablerLoading v-if='loading'/>
<template v-else>
<video
id='cot-player'
class='video-js vjs-default-skin'
width='400'
height='300'
controls
>
</video>
<source
type='application/x-mpegURL'
:src='video'
>
</video>
</template>
</div>
</template>

<script>
<script lang='ts'>
import { std } from '/src/std.ts';
import videojs from 'video.js';
import 'video.js/dist/video-js.css';
import {
TablerLoading
} from '@tak-ps/vue-tabler';
export default {
name: 'CoTVideo',
Expand All @@ -29,16 +36,37 @@ export default {
},
data: function() {
return {
player: false
loading: true,
player: false,
lease: false,
}
},
unmounted: function() {
this.player.dispose();
},
mounted: async function() {
await this.requestLease();
this.loading = false;
this.$nextTick(() => {
this.player = videojs('cot-player');
});
},
methods: {
requestLease: async function() {
this.lease = await std('/api/video/lease', {
method: 'POST',
body: {
name: 'Temporary Lease',
duration: 1 * 60 * 60,
proxy: this.video
}
})
}
},
components: {
TablerLoading
}
}
</script>
2 changes: 1 addition & 1 deletion api/web/src/stores/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export const useMapStore = defineStore('cloudtak', {
center: [-105.91873757464982, 39.2473040734323],
style: {
version: 8,
glyphs: 'https://fonts.openmaptiles.org/{fontstack}/{range}.pbf',
glyphs: '/fonts/{fontstack}/{range}.pbf',
sprite: [{
id: 'default',
url: String(stdurl(`/api/icon/sprite?token=${localStorage.token}&iconset=default`))
Expand Down

0 comments on commit 6e93eac

Please sign in to comment.