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

Fix: vods showing in wrong channels #1296

Merged
merged 2 commits into from
Jun 23, 2024
Merged
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage-website",
"version": "0.3.01",
"version": "0.3.02",
"license": "GPL-3.0",
"private": true,
"type": "module",
Expand Down
40 changes: 21 additions & 19 deletions src/lib/components/Channel/Stream/DialogVod.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import { is_vod_modal_open } from '$lib/stores/channelStore'
import { timeSince } from '$lib/utils'

export let vod: any
export let vod: any, isHost: boolean

$: vodIsVisible = vod?.isVisible

Expand Down Expand Up @@ -34,24 +34,26 @@
}}>
<form method="dialog">
<div class="flex absolute right-2 top-2">
<div class="dropdown-menu dropdown dropdown-end" tabindex="1">
<button class="btn btn-sm btn-circle btn-ghost">
<IconMore />
</button>
<ul
tabindex="1"
class="dropdown-content menu p-2 shadow bg-base-200 rounded-box w-52 z-10">
<li>
<a on:click={toggleVodVisibility}
><input
type="checkbox"
class="toggle toggle-primary toggle-xs"
bind:checked={vodIsVisible} />
Visible to viewers</a>
</li>
<!-- <li><a>Download</a></li> -->
</ul>
</div>
{#if isHost}
<div class="dropdown-menu dropdown dropdown-end" tabindex="1">
<button class="btn btn-sm btn-circle btn-ghost">
<IconMore />
</button>
<ul
tabindex="1"
class="dropdown-content menu p-2 shadow bg-base-200 rounded-box w-52 z-10">
<li>
<a on:click={toggleVodVisibility}
><input
type="checkbox"
class="toggle toggle-primary toggle-xs"
bind:checked={vodIsVisible} />
Visible to viewers</a>
</li>
<!-- <li><a>Download</a></li> -->
</ul>
</div>
{/if}
<button
class="btn btn-sm btn-circle btn-ghost"
on:click={() => {
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/Channel/Stream/StreamControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import IconRefresh from '$lib/assets/icons/IconRefresh.svelte'
import IconCopy from '$lib/assets/icons/IconCopy.svelte'
import { copyToClipboard, updateVideoItems } from '$lib/utils'
import { env } from '$env/dynamic/public'

export let isHostOrGuest: boolean = false,
channel: any,
Expand Down Expand Up @@ -82,7 +83,7 @@
trackType,
liveInput: {
meta: {
name: $page.params.channelId
name: `${env.PUBLIC_ENV}-${$page.params.channelId}`
},
recording: { mode: 'off' }
}
Expand Down Expand Up @@ -124,7 +125,7 @@
trackType: 'rtmps',
liveInput: {
meta: {
name: $page.params.channelId
name: `${env.PUBLIC_ENV}-${$page.params.channelId}`
},
recording: { mode: 'automatic' }
}
Expand Down
5 changes: 3 additions & 2 deletions src/lib/components/Channel/Stream/VodList.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
let vods: any = [],
selectedVod: any

// Update the vod list with the selected vod
$: {
if (selectedVod) {
vods = vods.map((vod: any) => (vod.id === selectedVod.id ? selectedVod : vod))
Expand All @@ -20,7 +21,7 @@
onMount(async () => {
vods = await get(`vods?channelId=${channelId}`)
if (hostUserId !== $page.data.user?.userId) {
vods = vods.filter((vod: any) => !vod.isVisible)
vods = vods.filter((vod: any) => vod.isVisible)
}
})
</script>
Expand Down Expand Up @@ -53,5 +54,5 @@
</div>
{/each}
</div>
<DialogVod bind:vod={selectedVod} />
<DialogVod bind:vod={selectedVod} isHost={hostUserId === $page.data.user?.userId} />
{/if}
Loading