diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 43ee98ff..c3161c39 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -4,14 +4,20 @@ import { getUserDetails, userRole, currentUser } from '$lib/stores/authStore' import { getUserRole, getRoles } from '$lib/stores/adminStore' import { getRemoteConfigs, isMaintenanceModeEnabled } from '$lib/stores/remoteConfigStore' import { Authenticate } from '$lib/authentication/authentication' -import type { Handle, HandleFetch } from '@sveltejs/kit' +import type { Handle } from '@sveltejs/kit' import { env } from '$env/dynamic/public' -import { isChannelPage } from '$lib/stores/helperStore' +import { + isChannelPage, + userId as userIdWritable, + token as tokenWritable +} from '$lib/stores/helperStore' export const handle: Handle = async ({ event, resolve }) => { const pathname = event.url.pathname const userId = event.url.searchParams.get('userId') || event.cookies.get('userId') || '' + userIdWritable.set(userId) let token = event.url.searchParams.get('token') || event.cookies.get('token') || '' + tokenWritable.set(token) let user = get(currentUser), role = get(userRole), isBanned = false @@ -127,22 +133,3 @@ export function handleError({ error }: { error: any }) { message: 'Whoops something wrong!' } } - -//TODO: fix global handleFetch -// export const handleFetch: HandleFetch = async ({ request, fetch }) => { -// let headers: any = {} -// if (request.url.startsWith(env.PUBLIC_API_URL)) { -// if (env.PUBLIC_CROSS_ORIGIN === 'false') { -// headers = { -// authorization: request.locals.user.token, -// userId: request.locals.user.userId -// } -// } else { -// headers = { -// 'x-api-key': env.PUBLIC_API_KEY, -// userId: request.locals.user.userId -// } -// } -// } -// return fetch(request, headers) -// } diff --git a/src/lib/assets/icons/IconInfo.svelte b/src/lib/assets/icons/IconInfo.svelte new file mode 100644 index 00000000..7547a9b6 --- /dev/null +++ b/src/lib/assets/icons/IconInfo.svelte @@ -0,0 +1,10 @@ + diff --git a/src/lib/components/Browse/AddCategory.svelte b/src/lib/components/Browse/AddCategory.svelte index e69de29b..f20a28ea 100644 --- a/src/lib/components/Browse/AddCategory.svelte +++ b/src/lib/components/Browse/AddCategory.svelte @@ -0,0 +1,177 @@ + + +
+

Select category

+
+
+
+
+ {#if categoryIcons.length} + {#each categoryIcons as icon} + removeCategory(icon)} /> + {/each} + {/if} +
+ + searchCategory()} + name="" + class="grow md:ml-4 md:mr-12 focus:outline-0 max-w-[8rem] bg-base-100 md:max-w-xs" + placeholder={categoryIcons.length ? '' : 'Categories'} + autocomplete="off" /> +
+ ({maxCategoryLabel}) +
+ +
+ {#each tabs as tab} + + setActiveTab(tab)} + >{tab} + {/each} +
+ +
+ {#if renderingAssets.length} + {#each renderingAssets as [name, image_url]} + + + {/each} + {:else if searchQuery != ''} +
+ + +

No results for the search query

+
+ {:else} +
+ +
+ {/if} +
+
+ +
+ + +
+
+ + diff --git a/src/lib/components/Browse/CreateChannel.svelte b/src/lib/components/Browse/CreateChannel.svelte index bd1b9442..3175cfb0 100644 --- a/src/lib/components/Browse/CreateChannel.svelte +++ b/src/lib/components/Browse/CreateChannel.svelte @@ -3,6 +3,8 @@ import { tags, getTags, createChannel } from '$lib/stores/channelStore' import { onMount } from 'svelte' import Tags from 'svelte-tags-input' + import AddCategory from './AddCategory.svelte' + import { goto } from '$app/navigation' export let showDrawer: boolean @@ -19,6 +21,8 @@ fileuploader: HTMLInputElement, thumbnailRef: any, showThumbnail = false, + showAddCategory = false, + categoryIcons: any = [], maxTag = 3, maxCategory = 4 @@ -55,7 +59,7 @@ } const addChannel = async () => { let res = await createChannel(newChannel) - console.log(res) + goto(`/channel/${res._id}`) } @@ -64,91 +68,102 @@
(showDrawer = false)} class="drawer-overlay" /> -
-

- Create a new channel -

-
-

- When you create a channel, you may allow viewer's to observe your desktop as you host your - channel -

-

- Please hide all sensitive data before going live. + {#if showAddCategory} + + {:else} +

+

+ Create a new channel

+
+

+ When you create a channel, you may allow viewer's to observe your desktop as you host + your channel +

+

+ Please hide all sensitive data before going live. +

-
-
-
- {#if showThumbnail} - Preview - {:else} - - {/if} +
+
+
+ {#if showThumbnail} + Preview + {:else} + + {/if} +
-
- + - -