remove unused build args, use env variables (#14)

This commit is contained in:
pluja
2023-09-29 19:23:15 +02:00
parent edbc38b535
commit 21ac9ae51a
12 changed files with 63 additions and 74 deletions

View File

@@ -1,12 +1,11 @@
import { transcriptions } from '$lib/stores';
import { browser, dev } from '$app/environment';
import { PUBLIC_INTERNAL_API_HOST } from '$env/static/public';
import { CLIENT_API_HOST } from '$lib/utils';
/** @type {import('./$types').PageLoad} */
export async function load({ fetch }) {
// Use different endpoints for server-side and client-side
const endpoint = browser ? `${CLIENT_API_HOST}/api/transcriptions` : `${PUBLIC_INTERNAL_API_HOST}/api/transcriptions`;
const endpoint = browser ? `${CLIENT_API_HOST}/api/transcriptions` : `${process.env.INTERNAL_API_HOST}/api/transcriptions`;
console.log(endpoint);
const response = await fetch(endpoint);

View File

@@ -1,6 +1,5 @@
/** @type {import('./$types').PageLoad} */
import { currentTranscription } from '$lib/stores';
import { PUBLIC_INTERNAL_API_HOST } from '$env/static/public';
import { CLIENT_API_HOST } from '$lib/utils';
import { browser } from '$app/environment';
@@ -9,7 +8,7 @@ export async function load({params}) {
let id = params.id;
// Use different endpoints for server-side and client-side
const endpoint = browser ? `${CLIENT_API_HOST}/api/transcriptions` : `${PUBLIC_INTERNAL_API_HOST}/api/transcriptions`;
const endpoint = browser ? `${CLIENT_API_HOST}/api/transcriptions` : `${process.env.INTERNAL_API_HOST}/api/transcriptions`;
const response = await fetch(`${endpoint}/${id}`);
const ts = await response.json();
// Set currentTranscription to the fetched transcription

View File

@@ -11,28 +11,29 @@
let canPlay = false;
$: if(canPlay && video && Math.abs(video.currentTime - $currentVideoPlayerTime) > tolerance) {
console.log(video.currentTime, $currentVideoPlayerTime)
// When testing in Chrome, it works, just see https://stackoverflow.com/a/67584611
video.currentTime = $currentVideoPlayerTime;
}
</script>
<Toaster />
{#if $currentTranscription}
<div class="grid grid-cols-3 h-screen overflow-hidden">
<div class="col-span-1 bg-transparent overflow-hidden">
<div class="h-full w-full relative">
<div class="grid h-screen grid-cols-3 overflow-hidden">
<div class="col-span-1 overflow-hidden bg-transparent">
<div class="relative w-full h-full">
<video id="video"
controls
bind:this={video}
on:timeupdate={(e) => $currentVideoPlayerTime.set(e.target.currentTime)}
on:timeupdate={(e) => $currentVideoPlayerTime = e.target.currentTime}
on:canplay={() => canPlay = true}
on:loadedmetadata={() => canPlay = true}
class="absolute top-0 left-0 h-full w-full">
class="absolute top-0 left-0 w-full h-full">
<source src="{CLIENT_API_HOST}/api/video/{$currentTranscription.fileName}" type="video/mp4" />
<track kind="captions" />
</video>
</div>
</div>
<div class="col-span-2 bg-content overflow-auto">
<div class="col-span-2 overflow-auto bg-content">
<Editor />
</div>
</div>