diff --git a/src/lib/components/Channel/Chat/DrawerRestream.svelte b/src/lib/components/Channel/Chat/DrawerRestream.svelte
new file mode 100644
index 00000000..6b41e8f0
--- /dev/null
+++ b/src/lib/components/Channel/Chat/DrawerRestream.svelte
@@ -0,0 +1,225 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/lib/components/Channel/Stream/StreamControls.svelte b/src/lib/components/Channel/Stream/StreamControls.svelte
index a420bcca..d4279e27 100644
--- a/src/lib/components/Channel/Stream/StreamControls.svelte
+++ b/src/lib/components/Channel/Stream/StreamControls.svelte
@@ -1,5 +1,4 @@
@@ -399,22 +399,7 @@
{#if $is_feature_restream_enabled}
-
+
{/if}
@@ -425,4 +410,5 @@
bind:checked={isScrollable}
on:click={() => {
isScrollable = !isScrollable
- }} />
+ }}
+/>
diff --git a/src/lib/components/Profile/DrawerEditProfile.svelte b/src/lib/components/Profile/DrawerEditProfile.svelte
index 906d9f18..6481b6aa 100644
--- a/src/lib/components/Profile/DrawerEditProfile.svelte
+++ b/src/lib/components/Profile/DrawerEditProfile.svelte
@@ -4,7 +4,8 @@
import DrawerAddCategory from '$lib/components/Browse/DrawerAddCategory.svelte'
import IconLink from '$lib/assets/icons/IconLink.svelte'
import { category_list } from '$lib/stores/channelStore'
- import { createEffect, objectMonitor } from '$lib/utils'
+ import { createEffect, objectMonitor, isValidURL } from '$lib/utils'
+
export let showDrawer: boolean
export let profile: any
@@ -31,11 +32,6 @@
let isLastFieldValid = false
- const isValidURL = (url: string) => {
- const urlPattern = /^https?:\/\/\S+$/i
- return urlPattern.test(url)
- }
-
$: {
const lastField = inputFields[inputFields.length - 1]
isLastFieldValid = isValidURL(lastField)
diff --git a/src/lib/stores/channelStore.ts b/src/lib/stores/channelStore.ts
index 6e55189e..74b9fa31 100644
--- a/src/lib/stores/channelStore.ts
+++ b/src/lib/stores/channelStore.ts
@@ -10,3 +10,7 @@ export const category_assets: Writable<{
export const is_chat_drawer_open: Writable = writable(false)
export const is_chat_drawer_destroy: Writable = writable(false)
export const was_chat_drawer_closed: Writable = writable(false)
+
+export const is_restream_drawer_open: Writable = writable(false)
+export const is_restream_drawer_destroy: Writable = writable(false)
+export const was_restream_drawer_closed: Writable = writable(false)
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index 8ad8015e..47eeb511 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -344,4 +344,19 @@ export const objectMonitor = (object:any) => {
return (currentState:any) => {
return JSON.stringify(object) !== JSON.stringify(currentState)
}
+}
+
+export const isValidURL = (url: string) => {
+ // const urlPattern = /^https?:\/\/\S+$/i
+ // return urlPattern.test(url)
+ const pattern = new RegExp(
+ '^(https?:\\/\\/)?' + // protocol
+ '((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' + // domain name
+ '((\\d{1,3}\\.){3}\\d{1,3}))' + // OR ip (v4) address
+ '(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' + // port and path
+ '(\\?[;&a-z\\d%_.~+=-]*)?' + // query string
+ '(\\#[-a-z\\d_]*)?$', // fragment locator
+ 'i'
+ );
+ return pattern.test(url);
}
\ No newline at end of file
diff --git a/src/lib/websocket.ts b/src/lib/websocket.ts
index 8cd10683..cd5feb30 100644
--- a/src/lib/websocket.ts
+++ b/src/lib/websocket.ts
@@ -39,11 +39,13 @@ const emitChannelUpdate = ({
const emitChannelSubscribeByUser = ({
channelSocket,
channelId,
+ hostId,
userId,
username
}: {
channelSocket: WebSocket
channelId: string
+ hostId: string
userId: string
username: string
}) => {
@@ -51,6 +53,7 @@ const emitChannelSubscribeByUser = ({
JSON.stringify({
eventName: `channel-subscribe`,
channel: channelId,
+ hostId,
user: { userId, username }
})
)
diff --git a/src/routes/channel/[channelId]/+page.svelte b/src/routes/channel/[channelId]/+page.svelte
index 027c1d50..34b715d1 100644
--- a/src/routes/channel/[channelId]/+page.svelte
+++ b/src/routes/channel/[channelId]/+page.svelte
@@ -107,6 +107,7 @@
emitChannelSubscribeByUser({
channelSocket: chan.socket,
channelId: $page.params.channelId,
+ hostId: chan.user,
userId: $page.data.user?.userId,
username: $page.data.user?.user?.username
})