diff --git a/src/lib/components/Chat/ChatInput.svelte b/src/lib/components/Chat/ChatInput.svelte
new file mode 100644
index 00000000..c5b30ed5
--- /dev/null
+++ b/src/lib/components/Chat/ChatInput.svelte
@@ -0,0 +1,48 @@
+
+
+
diff --git a/src/lib/components/Chat/ChatMessage.svelte b/src/lib/components/Chat/ChatMessage.svelte
new file mode 100644
index 00000000..51246dba
--- /dev/null
+++ b/src/lib/components/Chat/ChatMessage.svelte
@@ -0,0 +1,64 @@
+
+
+
+
+
diff --git a/src/lib/components/Chat/ChatProfileCard.svelte b/src/lib/components/Chat/ChatProfileCard.svelte
new file mode 100644
index 00000000..7964115d
--- /dev/null
+++ b/src/lib/components/Chat/ChatProfileCard.svelte
@@ -0,0 +1,48 @@
+
diff --git a/src/lib/components/MainDrawer/Community.svelte b/src/lib/components/MainDrawer/Community.svelte
deleted file mode 100644
index 9f4b1209..00000000
--- a/src/lib/components/MainDrawer/Community.svelte
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/src/lib/components/MainDrawer/LoginPrompt.svelte b/src/lib/components/MainDrawer/LoginPrompt.svelte
index a6475993..48dfdb0e 100644
--- a/src/lib/components/MainDrawer/LoginPrompt.svelte
+++ b/src/lib/components/MainDrawer/LoginPrompt.svelte
@@ -3,7 +3,8 @@
import IconSocialGoogle from '$lib/assets/icons/social/IconSocialGoogle.svelte'
import IconSocialGitHubInverse from '$lib/assets/icons/social/IconSocialGitHubInverse.svelte'
import { env } from '$env/dynamic/public'
- import { login_modal } from '$lib/stores/helperStore'
+ import { is_login_modal_open } from '$lib/stores/helperStore'
+ import IconMageLogo from '$lib/assets/icons/IconMageLogo.svg'
async function getHref(provider: string) {
const response = await fetch(`${env.PUBLIC_API_URL}/auth/${provider}`, {
@@ -19,16 +20,19 @@
{
- $login_modal = false
+ $is_login_modal_open = false
}}>
{
e.stopPropagation()
}}>
-
+
+
+
+
{#if env.PUBLIC_CROSS_ORIGIN === 'false'}
diff --git a/src/lib/components/MainDrawer/MainDrawer.svelte b/src/lib/components/MainDrawer/MainDrawer.svelte
new file mode 100644
index 00000000..0bd65a1b
--- /dev/null
+++ b/src/lib/components/MainDrawer/MainDrawer.svelte
@@ -0,0 +1,229 @@
+
+
+
+
+
diff --git a/src/lib/components/MainDrawer/SmallDrawer.svelte b/src/lib/components/MainDrawer/SmallDrawer.svelte
new file mode 100644
index 00000000..ddbf525a
--- /dev/null
+++ b/src/lib/components/MainDrawer/SmallDrawer.svelte
@@ -0,0 +1,179 @@
+
+
+
+
+
diff --git a/src/lib/components/Profile/FollowList.svelte b/src/lib/components/Profile/SubscribeList.svelte
similarity index 100%
rename from src/lib/components/Profile/FollowList.svelte
rename to src/lib/components/Profile/SubscribeList.svelte
diff --git a/src/lib/stores/adminStore.ts b/src/lib/stores/adminStore.ts
index ea54d195..bf62dd32 100644
--- a/src/lib/stores/adminStore.ts
+++ b/src/lib/stores/adminStore.ts
@@ -29,8 +29,7 @@ async function getUserRole(hooks_call = false, headers = {}) {
async function getRoles(hooks_call = false, headers = {}) {
if (hooks_call) {
return await fetch(`${env.PUBLIC_API_URL}/roles`, {
- method: 'GET',
- headers
+ method: 'GET'
}).then((response) => response.json())
} else {
return await fetch(`${env.PUBLIC_API_URL}/roles`, {
diff --git a/src/lib/stores/authStore.ts b/src/lib/stores/authStore.ts
index 908ed046..33842244 100644
--- a/src/lib/stores/authStore.ts
+++ b/src/lib/stores/authStore.ts
@@ -1,27 +1,6 @@
import { env } from '$env/dynamic/public'
import { writable, type Writable } from 'svelte/store'
-export const currentUser: Writable = writable(null)
+export const current_user: Writable = writable(null)
-export const userRole: Writable = writable(null)
-
-async function getUserDetails(jwt: string, userId: string) {
- if (!jwt || !userId) {
- return null
- } else {
- return await fetch(`${env.PUBLIC_API_URL}/auth/me`, {
- method: 'GET',
- headers: {
- authorization: jwt,
- userId
- }
- }).then(async (response) => {
- const res = await response.json()
- return res.user
- }).catch(() => {
- return null
- })
- }
-}
-
-export { getUserDetails }
+export const user_role: Writable = writable(null)
diff --git a/src/lib/stores/channelStore.ts b/src/lib/stores/channelStore.ts
index 15cf5161..5f6ed295 100644
--- a/src/lib/stores/channelStore.ts
+++ b/src/lib/stores/channelStore.ts
@@ -1,16 +1,15 @@
import { get, writable, type Writable } from 'svelte/store'
import { env } from '$env/dynamic/public'
-import { currentUser } from '$lib/stores/authStore'
-
-let skip = 0
-let limit = 100
export const searchQuery: Writable = writable('')
export const currentChannel: Writable = writable(null)
-export const myChannels: Writable<[]> = writable([])
-export const channels: Writable<[]> = writable([])
-export const searchedchannels: Writable<[]> = writable([])
export const techList: Writable<[]> = writable([])
+export const tags: Writable = writable([])
+export const categoryAssets: Writable<{
+ web2: object
+ web3: object
+ game: object
+}> = writable({ web2: {}, web3: {}, game: {} })
async function createChannel({
title,
@@ -221,18 +220,10 @@ async function deleteMembers({ channelId }: { channelId: string }) {
})
}
-function resetSkipLimit() {
- skip = 0
- limit = 100
-}
-
-async function getMyChannels() {
- return await fetch(`${env.PUBLIC_API_URL}/channels/me/hosted`, {
+async function getMyChannels({ skip = 0, limit = 50 }: { skip: number; limit: number }) {
+ return await fetch(`${env.PUBLIC_API_URL}/channels/me/hosted?skip=${skip}&limit=${limit}`, {
method: 'GET'
- }).then(async (response) => {
- const res = await response.json()
- myChannels.set(res)
- })
+ }).then((response) => response.json())
}
async function getChannelsByUserId({
@@ -254,43 +245,31 @@ async function getChannelsByUserId({
).then((response) => response.json())
}
-async function getChannels({ isRefresh = false }: { isRefresh?: boolean } = {}) {
- if (isRefresh) {
- resetSkipLimit()
- }
+async function getFavChannels({ skip = 0, limit = 50 }: { skip: number; limit: number }) {
+ return await fetch(`${env.PUBLIC_API_URL}/channels/me/fav?skip=${skip}&limit=${limit}`, {
+ method: 'GET'
+ }).then((response) => response.json())
+}
+
+async function getMostActiveChannels({ skip = 0, limit = 50 }: { skip: number; limit: number }) {
+ return await fetch(`${env.PUBLIC_API_URL}/channels/most-active?skip=${skip}&limit=${limit}`, {
+ method: 'GET'
+ }).then((response) => response.json())
+}
- const result = await fetch(
+async function getWeeklyChannels({ skip = 0, limit = 50 }: { skip: number; limit: number }) {
+ return await fetch(`${env.PUBLIC_API_URL}/channels/weekly?skip=${skip}&limit=${limit}`, {
+ method: 'GET'
+ }).then((response) => response.json())
+}
+
+async function getChannels({ skip = 0, limit = 50 }: { skip: number; limit: number }) {
+ return await fetch(
`${env.PUBLIC_API_URL}/channels?searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`,
{
method: 'GET'
}
- )
-
- if (result.ok) {
- return await result.json()
- } else {
- throw new Error('Error fetching channels')
- }
-
- // then(async (response) => {
- // console.log('response', response)
-
- // const res = await response.json()
- // if (res.length) {
- // skip += limit
- // console.log('res', res)
- //TODO: push res to channels
- // channels.update(current => [...current, res])
- // } else {
- //TODO: show alert
- // if ((this.searchQuery || this.filterTechList.length) && !this.skip)
- // this.snackBar.open('No results with the search criteria', null, {
- // duration: 2000
- // })
- // }
- // console.log(channels)
- // return channels
- // })
+ ).then((response) => response.json())
}
async function leaveChannel({
@@ -362,86 +341,6 @@ async function toggleNotifications({ channel, userId }: { channel: any; userId:
// })
// }
-// async getTechList() {
-// if (this.techList.length < 1) {
-// const web2Assets: any = await lastValueFrom(this.http
-// .get(`${environment.hostUrl}/assets/images/web2/_categoryWeb2.json`))
-// const web3Assets: any = await lastValueFrom(this.http
-// .get(`${environment.hostUrl}/assets/images/web3/_categoryWeb3.json`))
-// const gameAssets: any = await lastValueFrom(this.http
-// .get(`${environment.hostUrl}/assets/images/games/_categoryGames.json`))
-// web3Assets.forEach((file) => {
-// let fileName = file.item_image.substring(file.item_image.lastIndexOf('/') + 1)
-// fileName = fileName.substring(0, fileName.indexOf('.'))
-// const nameAndTickerList = fileName.split('-')
-// const ticker = nameAndTickerList.pop().toUpperCase()
-// const fullName = nameAndTickerList
-// .map((name) => name.charAt(0).toUpperCase() + name.slice(1))
-// .join(' ')
-// file.item_text = `${fullName} (${ticker})`
-// })
-// web2Assets.push(...web3Assets)
-// gameAssets.forEach((file) => {
-// let fileName = file.item_image.substring(file.item_image.lastIndexOf('/') + 1)
-// fileName = fileName.substring(0, fileName.indexOf('.'))
-// const nameSplitList = fileName.split('-')
-// const fullName = nameSplitList
-// .map((name) => name.charAt(0).toUpperCase() + name.slice(1))
-// .join(' ')
-// file.item_text = fullName
-// })
-// web2Assets.push(...gameAssets)
-// this.techList = web2Assets
-// this.techList.sort((a, b) => a.item_text.localeCompare(b.item_text))
-// }
-// }
-
-async function getTechList() {
- if (get(techList).length < 1) {
- let web2Assets: any = await fetch(`/category/web2/_categoryWeb2.json`, {
- method: 'GET'
- })
- let web3Assets: any = await fetch(`/category/web3/_categoryWeb3.json`, {
- method: 'GET'
- })
- let gameAssets: any = await fetch(`/category/games/_categoryGames.json`, {
- method: 'GET'
- })
- if (web2Assets.ok) {
- web2Assets = await web2Assets.json()
- }
- if (web3Assets.ok) {
- web3Assets = await web3Assets.json()
- }
- if (gameAssets.ok) {
- gameAssets = await gameAssets.json()
- }
-
- web3Assets.forEach((file: any) => {
- let fileName = file.item_image.substring(file.item_image.lastIndexOf('/') + 1)
- fileName = fileName.substring(0, fileName.indexOf('.'))
- const nameAndTickerList = fileName.split('-')
- const ticker = nameAndTickerList.pop().toUpperCase()
- const fullName = nameAndTickerList
- .map((name: any) => name.charAt(0).toUpperCase() + name.slice(1))
- .join(' ')
- file.item_text = `${fullName} (${ticker})`
- })
- web2Assets.push(...web3Assets)
- gameAssets.forEach((file: any) => {
- let fileName = file.item_image.substring(file.item_image.lastIndexOf('/') + 1)
- fileName = fileName.substring(0, fileName.indexOf('.'))
- const nameSplitList = fileName.split('-')
- const fullName = nameSplitList
- .map((name: any) => name.charAt(0).toUpperCase() + name.slice(1))
- .join(' ')
- file.item_text = fullName
- })
- web2Assets.push(...gameAssets)
- techList.set(web2Assets)
- }
-}
-
async function getTechListJson() {
if (get(techList).length < 1) {
let gameAssets: any = await fetch(`svg-json/image_urls.json`, {
@@ -454,6 +353,16 @@ async function getTechListJson() {
return gameAssets
}
}
+
+async function getTags() {
+ return await fetch(`${env.PUBLIC_API_URL}/tags`, {
+ method: 'GET'
+ }).then(async (response) => {
+ const res = await response.json()
+ tags.set(res)
+ })
+}
+
export {
createChannel,
deleteChannel,
@@ -472,9 +381,13 @@ export {
deleteMembers,
getMyChannels,
getChannelsByUserId,
+ getFavChannels,
+ getMostActiveChannels,
+ getWeeklyChannels,
getChannels,
leaveChannel,
enterChannel,
toggleNotifications,
- getTechListJson
+ getTechListJson,
+ getTags
}
diff --git a/src/lib/stores/chatStore.ts b/src/lib/stores/chatStore.ts
index fbd40322..c73829e1 100644
--- a/src/lib/stores/chatStore.ts
+++ b/src/lib/stores/chatStore.ts
@@ -1,7 +1,15 @@
import { writable, type Writable } from 'svelte/store'
-import { emitDeleteMessageToChannel, emitDeleteAllMessagesToChannel, emitHistoryToChannel, emitMessageToChannel, emitChatMessage, emitChatTypingByUser, emitChannelChatTypingByUser } from '$lib/stores/socketStore'
+import {
+ emitDeleteMessageToChannel,
+ emitDeleteAllMessagesToChannel,
+ emitHistoryToChannel,
+ emitMessageToChannel,
+ emitChatMessage,
+ emitChatTypingByUser,
+ emitChannelChatTypingByUser
+} from '$lib/stores/socketStore'
import { env } from '$env/dynamic/public'
-import { currentUser } from './authStore'
+import { current_user } from './authStore'
import { currentChannel } from './channelStore'
let lastMessageSendDate: Date = new Date()
@@ -15,99 +23,100 @@ export const activeTabs: Writable<[]> = writable([])
export const isShowingSearchResults: Writable = writable(false)
function resetSkipLimit() {
- skip = 0
- limit = 100
+ skip = 0
+ limit = 100
}
-function deleteMessage({ message, channelId }: { message: any, channelId: string }) {
- emitDeleteMessageToChannel({ channelId, message: JSON.stringify(message) })
+function deleteMessage({ message, channelId }: { message: any; channelId: string }) {
+ emitDeleteMessageToChannel({ channelId, message: JSON.stringify(message) })
}
function deleteAllMessages({ channelId }: { channelId: string }) {
- emitDeleteAllMessagesToChannel({ channelId })
+ emitDeleteAllMessagesToChannel({ channelId })
}
-async function postFile({ channelId, fileToUpload }: { channelId: string, fileToUpload: File }) {
- const formData: FormData = new FormData()
- formData.append('file', fileToUpload, fileToUpload.name)
- formData.append('channelId', channelId)
- formData.append('name', fileToUpload.name)
- formData.append('type', fileToUpload.type)
- return await fetch(`${env.PUBLIC_API_URL}/attachments/file`, { method: 'POST', body: JSON.stringify(formData) })
+async function postFile({ channelId, fileToUpload }: { channelId: string; fileToUpload: File }) {
+ const formData: FormData = new FormData()
+ formData.append('file', fileToUpload, fileToUpload.name)
+ formData.append('channelId', channelId)
+ formData.append('name', fileToUpload.name)
+ formData.append('type', fileToUpload.type)
+ return await fetch(`${env.PUBLIC_API_URL}/attachments/file`, {
+ method: 'POST',
+ body: JSON.stringify(formData)
+ })
}
async function deleteFile({ key }: { key: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/attachments/file?key=${key}`, {
- method: 'DELETE'
- })
+ return await fetch(`${env.PUBLIC_API_URL}/attachments/file?key=${key}`, {
+ method: 'DELETE'
+ })
}
async function getTrendingGifs() {
- return await fetch(`${env.PUBLIC_API_URL}/giphy/trending`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/giphy/trending`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
async function searchGifs({ query }: { query: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/giphy/search?${query}`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/giphy/search?${query}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
-async function getMessages({ chat, chatType }: { chat: any, chatType: string }) {
- const data = { limit: limit, skip: 0 }
- if (chatType == 'channelChat') {
- skip = skip + limit
- data.skip = skip
- emitHistoryToChannel({ channelId: chat.channel, skip: data.skip })
- } else if (chatType == 'oneToOneChat') {
- data.skip = chat.skip
- }
+async function getMessages({ chat, chatType }: { chat: any; chatType: string }) {
+ const data = { limit: limit, skip: 0 }
+ if (chatType == 'channelChat') {
+ skip = skip + limit
+ data.skip = skip
+ emitHistoryToChannel({ channelId: chat.channel, skip: data.skip })
+ } else if (chatType == 'oneToOneChat') {
+ data.skip = chat.skip
+ }
}
-async function sendChannelMessage({ channel, attributes }: { channel: any, attributes: any }) {
- const dateNow = new Date()
- const diff = Math.round(
- Math.abs((dateNow.getTime() - lastMessageSendDate.getTime()) / 1000)
- )
- if (diff <= 0.7) {
- //TODO: show alert
- // snackBar.open('Please be courteous to other users', null, {
- // duration: 1000
- // })
- } else {
- //TODO: get currentUser
- const user: any = null
- attributes.userId = user._id
- attributes.avatar = user.avatar
- const completeMessage = {
- attributes: attributes,
- body: attributes.text,
- state: { timestamp: new Date().toISOString() },
- user: user,
- author: user.displayName
- }
- emitMessageToChannel({ channelId: channel._id, message: completeMessage })
- lastMessageSendDate = new Date()
- // sendEmailAndWebNotifications({ channel: channel._id, user, attributes })
- }
+async function sendChannelMessage({ channel, attributes }: { channel: any; attributes: any }) {
+ const dateNow = new Date()
+ const diff = Math.round(Math.abs((dateNow.getTime() - lastMessageSendDate.getTime()) / 1000))
+ if (diff <= 0.7) {
+ //TODO: show alert
+ // snackBar.open('Please be courteous to other users', null, {
+ // duration: 1000
+ // })
+ } else {
+ //TODO: get currentUser
+ const user: any = null
+ attributes.userId = user._id
+ attributes.avatar = user.avatar
+ const completeMessage = {
+ attributes: attributes,
+ body: attributes.text,
+ state: { timestamp: new Date().toISOString() },
+ user: user,
+ author: user.displayName
+ }
+ emitMessageToChannel({ channelId: channel._id, message: completeMessage })
+ lastMessageSendDate = new Date()
+ // sendEmailAndWebNotifications({ channel: channel._id, user, attributes })
+ }
}
-async function sendChatMessage({ chat, attributes }: { chat: any, attributes: any }) {
- //TODO: get currentUser
- const user: any = null
- attributes.userId = user._id
- attributes.avatar = user.avatar
- const completeMessage = {
- attributes: attributes,
- body: attributes.text,
- state: { timestamp: new Date().toISOString() },
- user: user,
- author: user.displayName
- }
- emitChatMessage({ source1: chat.source1, source2: chat.source2, message: completeMessage })
- lastMessageSendDate = new Date()
- // sendEmailAndWebNotifications({ channel: chat._id, user, attributes })
+async function sendChatMessage({ chat, attributes }: { chat: any; attributes: any }) {
+ //TODO: get currentUser
+ const user: any = null
+ attributes.userId = user._id
+ attributes.avatar = user.avatar
+ const completeMessage = {
+ attributes: attributes,
+ body: attributes.text,
+ state: { timestamp: new Date().toISOString() },
+ user: user,
+ author: user.displayName
+ }
+ emitChatMessage({ source1: chat.source1, source2: chat.source2, message: completeMessage })
+ lastMessageSendDate = new Date()
+ // sendEmailAndWebNotifications({ channel: chat._id, user, attributes })
}
// async function sendEmailAndWebNotifications({ channel, user, attributes }: { channel: any, user: any, attributes: any }) {
@@ -146,277 +155,291 @@ async function sendChatMessage({ chat, attributes }: { chat: any, attributes: an
// }
// }
-function emitChannelChatTyping({ typingUser, channelId = '' }: { typingUser: any, channelId: string }) {
- if (!channelId) {
- emitChatTypingByUser(typingUser)
- } else {
- emitChannelChatTypingByUser({ channelId, typingUser })
- }
+function emitChannelChatTyping({
+ typingUser,
+ channelId = ''
+}: {
+ typingUser: any
+ channelId: string
+}) {
+ if (!channelId) {
+ emitChatTypingByUser(typingUser)
+ } else {
+ emitChannelChatTypingByUser({ channelId, typingUser })
+ }
}
-async function createChat({ source1, source2 }: { source1: string, source2: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/chats`, {
- method: 'PUT',
- body: JSON.stringify({ source1, source2 }),
- }).then(async response => {
- const res = await response.json()
- //TODO: fix array push to writable
- // chats.subscribe((value: any) => {
- // const doesChatExist = value.some((cht: any) => res._id === cht._id)
- // if (!doesChatExist) value.push(res)
- // return res
- // })
- })
+async function createChat({ source1, source2 }: { source1: string; source2: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/chats`, {
+ method: 'PUT',
+ body: JSON.stringify({ source1, source2 })
+ }).then(async (response) => {
+ const res = await response.json()
+ //TODO: fix array push to writable
+ // chats.subscribe((value: any) => {
+ // const doesChatExist = value.some((cht: any) => res._id === cht._id)
+ // if (!doesChatExist) value.push(res)
+ // return res
+ // })
+ })
}
-async function getChat({ source1, source2 }: { source1: string, source2: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/chats/me?source1=${source1}&source2=${source2}`, {
- method: 'GET'
- }).then(response => response.json())
+async function getChat({ source1, source2 }: { source1: string; source2: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/chats/me?source1=${source1}&source2=${source2}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
async function getChats(isRefresh = false) {
- if (isRefresh) {
- chats.set([])
- resetSkipLimit()
- }
- return await fetch(`${env.PUBLIC_API_URL}/chats?searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`, {
- method: 'GET'
- }).then(async response => {
- const res = await response.json()
- //TODO: fix array push to writable
- // if (chats.length) {
- // skip += limit
- // chats.push(...chats)
- // } else {
- //TODO: show alert
- // if (searchQuery && !skip)
- // snackBar.open('No results with the search criteria', null, {
- // duration: 2000
- // })
- // }
- // return chats
- })
+ if (isRefresh) {
+ chats.set([])
+ resetSkipLimit()
+ }
+ return await fetch(
+ `${env.PUBLIC_API_URL}/chats?searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`,
+ {
+ method: 'GET'
+ }
+ ).then(async (response) => {
+ const res = await response.json()
+ //TODO: fix array push to writable
+ // if (chats.length) {
+ // skip += limit
+ // chats.push(...chats)
+ // } else {
+ //TODO: show alert
+ // if (searchQuery && !skip)
+ // snackBar.open('No results with the search criteria', null, {
+ // duration: 2000
+ // })
+ // }
+ // return chats
+ })
}
async function deleteChat({ chat }: { chat: any }) {
- // const dialogData: DialogData = {
- // title: 'Delete Chat',
- // message: 'Are you sure you want to delete this chat?',
- // okText: 'Yes',
- // cancelText: 'Cancel'
- // }
-
- // const dialogRef = dialogService.openDialog(dialogData, {
- // disableClose: true
- // })
-
- // dialogRef.afterClosed().subscribe(async (result: any) => {
- // if (result) {
- await fetch(`${env.PUBLIC_API_URL}/chats?chatId=${chat._id}`, {
- method: 'DELETE'
- }).then(async response => {
- await response.json()
- //TODO: fix array filter to writable
- // chats.set(chats.filter((cht) => cht.chat._id !== chat._id))
- })
- // }
- // })
+ // const dialogData: DialogData = {
+ // title: 'Delete Chat',
+ // message: 'Are you sure you want to delete this chat?',
+ // okText: 'Yes',
+ // cancelText: 'Cancel'
+ // }
+
+ // const dialogRef = dialogService.openDialog(dialogData, {
+ // disableClose: true
+ // })
+
+ // dialogRef.afterClosed().subscribe(async (result: any) => {
+ // if (result) {
+ await fetch(`${env.PUBLIC_API_URL}/chats?chatId=${chat._id}`, {
+ method: 'DELETE'
+ }).then(async (response) => {
+ await response.json()
+ //TODO: fix array filter to writable
+ // chats.set(chats.filter((cht) => cht.chat._id !== chat._id))
+ })
+ // }
+ // })
}
-async function updateChatProperties({ chatId, updatedProperties }: { chatId: string, updatedProperties: any }) {
- return await fetch(`${env.PUBLIC_API_URL}/chats?chatId=${chatId}`, {
- method: 'PATCH', body: JSON.stringify(updatedProperties)
- }).then(response => response.json())
+async function updateChatProperties({
+ chatId,
+ updatedProperties
+}: {
+ chatId: string
+ updatedProperties: any
+}) {
+ return await fetch(`${env.PUBLIC_API_URL}/chats?chatId=${chatId}`, {
+ method: 'PATCH',
+ body: JSON.stringify(updatedProperties)
+ }).then((response) => response.json())
}
async function incrementUnreadMessageCount({ chatId }: { chatId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/chats?unread/chatId=${chatId}`, {
- method: 'PATCH'
- })
+ return await fetch(`${env.PUBLIC_API_URL}/chats?unread/chatId=${chatId}`, {
+ method: 'PATCH'
+ })
}
async function clearUnreadMessageCount({ chatId }: { chatId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/chats?unread/chatId=${chatId}`, {
- method: 'DELETE'
- })
+ return await fetch(`${env.PUBLIC_API_URL}/chats?unread/chatId=${chatId}`, {
+ method: 'DELETE'
+ })
}
async function searchChats() {
- chats.set([])
- return getChats(true)
+ chats.set([])
+ return getChats(true)
}
-async function openChat({ chat, friendGroup = null }: { chat: any, friendGroup: any }) {
- if (friendGroup) {
- return activateGroupTab(friendGroup)
- }
- //TODO: get writable channel id
- // if (!chat.chat) {
- // const existingChat = await getChat({
- // source1: authStore.currentUser._id,
- // source2: chat._id
- // })
- // if (!existingChat) {
- // chat = await createChat({
- // source1: authStore.currentUser._id,
- // source2: chat._id
- // })
- // } else {
- // chat = existingChat
- // }
- // }
- // activateChatTab(chat)
- // socketStore.emitChatMessage({
- // source1: authStore.currentUser._id,
- // source2: chat._id,
- // message: "incoming message"
- // })
-
+async function openChat({ chat, friendGroup = null }: { chat: any; friendGroup: any }) {
+ if (friendGroup) {
+ return activateGroupTab(friendGroup)
+ }
+ //TODO: get writable channel id
+ // if (!chat.chat) {
+ // const existingChat = await getChat({
+ // source1: authStore.currentUser._id,
+ // source2: chat._id
+ // })
+ // if (!existingChat) {
+ // chat = await createChat({
+ // source1: authStore.currentUser._id,
+ // source2: chat._id
+ // })
+ // } else {
+ // chat = existingChat
+ // }
+ // }
+ // activateChatTab(chat)
+ // socketStore.emitChatMessage({
+ // source1: authStore.currentUser._id,
+ // source2: chat._id,
+ // message: "incoming message"
+ // })
}
async function activateChatTab({ chat }: { chat: any }) {
- // const user = authStore.currentUser
- if (checkAlreadyExist(chat)) return
- //TODO: get writable activeTabs
- // activeTabs.push(chat)
- await clearUnreadMessageCount({ chatId: chat.chat._id })
- chat.chat.unreadMessageCount = 0
+ // const user = authStore.currentUser
+ if (checkAlreadyExist(chat)) return
+ //TODO: get writable activeTabs
+ // activeTabs.push(chat)
+ await clearUnreadMessageCount({ chatId: chat.chat._id })
+ chat.chat.unreadMessageCount = 0
}
async function activateGroupTab({ group }: { group: any }) {
- // const user = authStore.currentUser
- if (checkAlreadyExist(group)) return
- //TODO: get writable activeTabs
- // socketStore.emitChannelSubscribeByUser(group.channelId, user._id)
- // activeTabs.push(group)
+ // const user = authStore.currentUser
+ if (checkAlreadyExist(group)) return
+ //TODO: get writable activeTabs
+ // socketStore.emitChannelSubscribeByUser(group.channelId, user._id)
+ // activeTabs.push(group)
}
function checkAlreadyExist({ item }: { item: any }) {
- //TODO: get writable currentUser
- // const chat = activeTabs.find((chat) => {
- // if (chat._id === item._id || ((chat.source1 === item.source1 && chat.source2 === item.source2) ||
- // (chat.source2 === item.source1 && chat.source1 === item.source2))) {
- // return true
- // }
- // })
- // return (activeTabs.indexOf(item) !== -1) || (chat !== undefined)
- return null
+ //TODO: get writable currentUser
+ // const chat = activeTabs.find((chat) => {
+ // if (chat._id === item._id || ((chat.source1 === item.source1 && chat.source2 === item.source2) ||
+ // (chat.source2 === item.source1 && chat.source1 === item.source2))) {
+ // return true
+ // }
+ // })
+ // return (activeTabs.indexOf(item) !== -1) || (chat !== undefined)
+ return null
}
async function incomingMessageActivateChatTab(data: any) {
- // const user = authStore.currentUser
- // const otherUser = userStore.getUserById(data.source1)
- const chat = null
- //TODO: get writable currentUser
- // const existingChat = await getChat({
- // source1: authStore.currentUser._id,
- // source2: data.source1
- // })
- // if (!existingChat) {
- // chat = await createChat({
- // source1: authStore.currentUser._id,
- // source2: data.source1,
- // user: otherUser
- // })
- // } else {
- // chat = existingChat
- // }
- // if (!user.isDoNotDisturbEnabled) {
- // chat.isUserRequestingToOpenChat = true
- // initIncomingMessage = data
- // activateChatTab(chat)
- // }
+ // const user = authStore.currentUser
+ // const otherUser = userStore.getUserById(data.source1)
+ const chat = null
+ //TODO: get writable currentUser
+ // const existingChat = await getChat({
+ // source1: authStore.currentUser._id,
+ // source2: data.source1
+ // })
+ // if (!existingChat) {
+ // chat = await createChat({
+ // source1: authStore.currentUser._id,
+ // source2: data.source1,
+ // user: otherUser
+ // })
+ // } else {
+ // chat = existingChat
+ // }
+ // if (!user.isDoNotDisturbEnabled) {
+ // chat.isUserRequestingToOpenChat = true
+ // initIncomingMessage = data
+ // activateChatTab(chat)
+ // }
}
-async function blockUser({ senderId, isBlocked }: { senderId: string, isBlocked: boolean }) {
- //TODO: get writable channel id
- // await channelStore.blockUserFromChannel({
- // channelId: channelStore.currentChannel._id,
- // userId: senderId
- // })
- // await channelStore.removeChannelNotificationSubscriber({
- // channelId: channelStore.currentChannel._id,
- // userId: senderId
- // })
- // socketStore.emitRemovedUser(channelStore.currentChannel._id, senderId)
- // channelStore.currentChannel.blockedUsers?.push(senderId)
- // isBlocked = channelStore.isUserBlockedFromChannel(senderId)
+async function blockUser({ senderId, isBlocked }: { senderId: string; isBlocked: boolean }) {
+ //TODO: get writable channel id
+ // await channelStore.blockUserFromChannel({
+ // channelId: channelStore.currentChannel._id,
+ // userId: senderId
+ // })
+ // await channelStore.removeChannelNotificationSubscriber({
+ // channelId: channelStore.currentChannel._id,
+ // userId: senderId
+ // })
+ // socketStore.emitRemovedUser(channelStore.currentChannel._id, senderId)
+ // channelStore.currentChannel.blockedUsers?.push(senderId)
+ // isBlocked = channelStore.isUserBlockedFromChannel(senderId)
}
-async function unblockUser({ senderId, isBlocked }: { senderId: string, isBlocked: boolean }) {
- //TODO: get writable channel id
- // await channelStore.unblockUserFromChannel({
- // channelId: channelStore.currentChannel._id,
- // userId: senderId
- // })
- // channelStore.currentChannel.blockedUsers =
- // channelStore.currentChannel.blockedUsers?.filter(
- // (user) => !!(user != senderId)
- // )
- // isBlocked = channelStore.isUserBlockedFromChannel(senderId)
+async function unblockUser({ senderId, isBlocked }: { senderId: string; isBlocked: boolean }) {
+ //TODO: get writable channel id
+ // await channelStore.unblockUserFromChannel({
+ // channelId: channelStore.currentChannel._id,
+ // userId: senderId
+ // })
+ // channelStore.currentChannel.blockedUsers =
+ // channelStore.currentChannel.blockedUsers?.filter(
+ // (user) => !!(user != senderId)
+ // )
+ // isBlocked = channelStore.isUserBlockedFromChannel(senderId)
}
-async function showDeleteMessageDialog({ oneVone, message }: { oneVone: boolean, message: any }) {
- // const dialogData: DialogData = {
- // title: 'Delete Message',
- // message: 'Are you sure you want to delete this message?',
- // okText: 'Yes',
- // cancelText: 'Cancel'
- // }
-
- // const dialogRef = dialogService.openDialog(dialogData, {
- // disableClose: true
- // })
-
- // dialogRef.afterClosed().subscribe((result) => {
- // if (result) {
- //TODO: show alert
- commitDeleteMessage({ oneVone, message })
- // }
- // })
+async function showDeleteMessageDialog({ oneVone, message }: { oneVone: boolean; message: any }) {
+ // const dialogData: DialogData = {
+ // title: 'Delete Message',
+ // message: 'Are you sure you want to delete this message?',
+ // okText: 'Yes',
+ // cancelText: 'Cancel'
+ // }
+
+ // const dialogRef = dialogService.openDialog(dialogData, {
+ // disableClose: true
+ // })
+
+ // dialogRef.afterClosed().subscribe((result) => {
+ // if (result) {
+ //TODO: show alert
+ commitDeleteMessage({ oneVone, message })
+ // }
+ // })
}
-async function commitDeleteMessage({ oneVone, message }: { oneVone: boolean, message: any }) {
- // let chan = null
- // if (oneVone || !channelStore.currentChannel) {
- // chan = { _id: message.channelId } // if friend chat
- // } else {
- // chan = channelStore.currentChannel // if channel chat
- // }
- // if (chan) {
- // //TODO: get writable channel id
- // deleteMessage({ message, channelId: chan._id })
- // }
+async function commitDeleteMessage({ oneVone, message }: { oneVone: boolean; message: any }) {
+ // let chan = null
+ // if (oneVone || !channelStore.currentChannel) {
+ // chan = { _id: message.channelId } // if friend chat
+ // } else {
+ // chan = channelStore.currentChannel // if channel chat
+ // }
+ // if (chan) {
+ // //TODO: get writable channel id
+ // deleteMessage({ message, channelId: chan._id })
+ // }
}
-
export {
- deleteMessage,
- deleteAllMessages,
- postFile,
- deleteFile,
- getTrendingGifs,
- searchGifs,
- getMessages,
- sendChannelMessage,
- sendChatMessage,
- emitChannelChatTypingByUser,
- createChat,
- getChat,
- getChats,
- deleteChat,
- updateChatProperties,
- incrementUnreadMessageCount,
- clearUnreadMessageCount,
- searchChats,
- openChat,
- activateChatTab,
- activateGroupTab,
- checkAlreadyExist,
- incomingMessageActivateChatTab,
- blockUser,
- unblockUser,
- showDeleteMessageDialog,
- commitDeleteMessage
-}
\ No newline at end of file
+ deleteMessage,
+ deleteAllMessages,
+ postFile,
+ deleteFile,
+ getTrendingGifs,
+ searchGifs,
+ getMessages,
+ sendChannelMessage,
+ sendChatMessage,
+ emitChannelChatTypingByUser,
+ createChat,
+ getChat,
+ getChats,
+ deleteChat,
+ updateChatProperties,
+ incrementUnreadMessageCount,
+ clearUnreadMessageCount,
+ searchChats,
+ openChat,
+ activateChatTab,
+ activateGroupTab,
+ checkAlreadyExist,
+ incomingMessageActivateChatTab,
+ blockUser,
+ unblockUser,
+ showDeleteMessageDialog,
+ commitDeleteMessage
+}
diff --git a/src/lib/stores/creatorSpaceStore.ts b/src/lib/stores/creatorSpaceStore.ts
deleted file mode 100644
index 88d19406..00000000
--- a/src/lib/stores/creatorSpaceStore.ts
+++ /dev/null
@@ -1 +0,0 @@
-import { writable } from 'svelte/store'
\ No newline at end of file
diff --git a/src/lib/stores/followStore.ts b/src/lib/stores/followStore.ts
deleted file mode 100644
index ca81653a..00000000
--- a/src/lib/stores/followStore.ts
+++ /dev/null
@@ -1,59 +0,0 @@
-import { env } from '$env/dynamic/public'
-
-async function createFollow({ source1, source2 }: { source1: string, source2: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/follow`, {
- method: 'PUT',
- body: JSON.stringify({ source1, source2 })
- }).then(response => response.json())
-}
-
-async function getFollows({ source, sourceType, searchQuery, skip, limit }: { source: string, sourceType: string, searchQuery: string, skip: string, limit: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/follow?source=${source}&sourceType=${sourceType}&searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`, {
- method: 'GET'
- }).then(response => response.json())
-}
-
-async function getFollowCount({ source, sourceType }: { source: string, sourceType: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/follow/count?source=${source}&sourceType=${sourceType}`, {
- method: 'GET'
- }).then(response => response.json())
-}
-
-async function deleteFollow({ source1, source2 }: { source1: string, source2: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/follow?source1=${source1}&source2=${source2}`, {
- method: 'DELETE'
- }).then(response => response.json())
-}
-
-async function getFollowRelationship({ source }: { source: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/follow/relationship?source=${source}`, {
- method: 'GET'
- }).then(response => response.json())
-}
-
-async function toggleFollow({ follow, senderId, userId }: { follow: any, senderId: string, userId: string }) {
- if (follow) {
- if (!follow.isFollowing) {
- await createFollow({
- source1: senderId,
- source2: userId
- })
- follow.isFollowing = true
- } else {
- await deleteFollow({
- source1: senderId,
- source2: userId
- })
- follow.isFollowing = false
- }
- }
-}
-
-export {
- createFollow,
- getFollows,
- getFollowCount,
- deleteFollow,
- getFollowRelationship,
- toggleFollow
-}
\ No newline at end of file
diff --git a/src/lib/stores/funFactStore.ts b/src/lib/stores/funFactStore.ts
index 59b3718e..5ac678b3 100644
--- a/src/lib/stores/funFactStore.ts
+++ b/src/lib/stores/funFactStore.ts
@@ -1,47 +1,52 @@
import { env } from '$env/dynamic/public'
async function createFunFact({ funFactText }: { funFactText: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/fun-facts`, {
- method: 'PUT',
- body: JSON.stringify({ funFactText })
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/fun-facts`, {
+ method: 'PUT',
+ body: JSON.stringify({ funFactText })
+ }).then((response) => response.json())
}
async function deleteFunFact({ funFactId }: { funFactId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/fun-facts?funFactId=${funFactId}`, {
- method: 'DELETE'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/fun-facts?funFactId=${funFactId}`, {
+ method: 'DELETE'
+ }).then((response) => response.json())
}
async function getRandomFunFact() {
- return await fetch(`${env.PUBLIC_API_URL}/fun-facts/random`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/fun-facts/random`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
-async function getFunFacts({ searchQuery, skip, limit }: { searchQuery: string, skip: string, limit: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/fun-facts?searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`, {
- method: 'GET'
- }).then(async response => {
- const funFactsWithCount = await response.json()
-
- if (!funFactsWithCount || !funFactsWithCount['total']) {
- if (searchQuery) {
- // this.snackBar.open('No results with the search criteria', null, {
- // duration: 2000
- // })
- }
- }
- return {
- funFacts: funFactsWithCount['funFacts'],
- total: funFactsWithCount['total']
- }
- })
+async function getFunFacts({
+ searchQuery,
+ skip,
+ limit
+}: {
+ searchQuery: string
+ skip: string
+ limit: string
+}) {
+ return await fetch(
+ `${env.PUBLIC_API_URL}/fun-facts?searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`,
+ {
+ method: 'GET'
+ }
+ ).then(async (response) => {
+ const funFactsWithCount = await response.json()
+ if (!funFactsWithCount || !funFactsWithCount['total']) {
+ if (searchQuery) {
+ // this.snackBar.open('No results with the search criteria', null, {
+ // duration: 2000
+ // })
+ }
+ }
+ return {
+ funFacts: funFactsWithCount['funFacts'],
+ total: funFactsWithCount['total']
+ }
+ })
}
-export {
- createFunFact,
- deleteFunFact,
- getRandomFunFact,
- getFunFacts
-}
\ No newline at end of file
+export { createFunFact, deleteFunFact, getRandomFunFact, getFunFacts }
diff --git a/src/lib/stores/helperStore.ts b/src/lib/stores/helperStore.ts
index bfc83c49..2d1d4115 100644
--- a/src/lib/stores/helperStore.ts
+++ b/src/lib/stores/helperStore.ts
@@ -1,3 +1,3 @@
import { writable, type Writable } from 'svelte/store'
-export const login_modal: Writable = writable(null)
+export const is_login_modal_open: Writable = writable(null)
diff --git a/src/lib/stores/remoteConfigStore.ts b/src/lib/stores/remoteConfigStore.ts
index a5679230..048c07c4 100644
--- a/src/lib/stores/remoteConfigStore.ts
+++ b/src/lib/stores/remoteConfigStore.ts
@@ -1,5 +1,5 @@
import { env } from '$env/dynamic/public'
-import { writable, type Writable } from "svelte/store"
+import { writable, type Writable } from 'svelte/store'
export const isMaintenanceModeEnabled: Writable = writable(false)
export const isFeatureVideoResponsesEnabled: Writable = writable(false)
@@ -7,37 +7,34 @@ export const isFeatureGroupChatEnabled: Writable = writable(false)
export const isFeatureMintPageEnabled: Writable = writable(false)
export const isFeaturePremiumPageEnabled: Writable = writable(false)
-async function createRemoteConfig({ flagKey, flagValue }: { flagKey: string, flagValue: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/remote-config`, {
- method: 'PUT',
- body: JSON.stringify({ flagKey, flagValue })
- }).then(response => response.json())
+async function createRemoteConfig({ flagKey, flagValue }: { flagKey: string; flagValue: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/remote-config`, {
+ method: 'PUT',
+ body: JSON.stringify({ flagKey, flagValue })
+ }).then((response) => response.json())
}
async function getRemoteConfigs() {
- return await fetch(`${env.PUBLIC_API_URL}/remote-config`, {
- method: 'GET'
- }).then(async response => {
- const remoteConfigs = await response.json()
- remoteConfigs.map((config: { flagKey: string; flagValue: boolean }) => {
- if (config.flagKey === 'maintenance-mode') isMaintenanceModeEnabled.set(config.flagValue)
- if (config.flagKey === 'feature-video-responses') isFeatureVideoResponsesEnabled.set(config.flagValue)
- if (config.flagKey === 'feature-group-chat') isFeatureGroupChatEnabled.set(config.flagValue)
- if (config.flagKey === 'feature-mint-page') isFeatureMintPageEnabled.set(config.flagValue)
- if (config.flagKey === 'feature-premium-page') isFeaturePremiumPageEnabled.set(config.flagValue)
- })
- })
+ return await fetch(`${env.PUBLIC_API_URL}/remote-configs`, {
+ method: 'GET'
+ }).then(async (response) => {
+ const remoteConfigs = await response.json()
+ remoteConfigs.map((config: { flagKey: string; flagValue: boolean }) => {
+ if (config.flagKey === 'maintenance-mode') isMaintenanceModeEnabled.set(config.flagValue)
+ if (config.flagKey === 'feature-video-responses')
+ isFeatureVideoResponsesEnabled.set(config.flagValue)
+ if (config.flagKey === 'feature-group-chat') isFeatureGroupChatEnabled.set(config.flagValue)
+ if (config.flagKey === 'feature-mint-page') isFeatureMintPageEnabled.set(config.flagValue)
+ if (config.flagKey === 'feature-premium-page')
+ isFeaturePremiumPageEnabled.set(config.flagValue)
+ })
+ })
}
async function getRemoteConfigByKey({ flagKey }: { flagKey: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/remote-config?flagKey=${flagKey}`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/remote-config?flagKey=${flagKey}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
-
-export {
- createRemoteConfig,
- getRemoteConfigs,
- getRemoteConfigByKey
-}
\ No newline at end of file
+export { createRemoteConfig, getRemoteConfigs, getRemoteConfigByKey }
diff --git a/src/lib/stores/sfxStore.ts b/src/lib/stores/sfxStore.ts
index 07c91d59..96961515 100644
--- a/src/lib/stores/sfxStore.ts
+++ b/src/lib/stores/sfxStore.ts
@@ -1,95 +1,100 @@
import { writable, type Writable } from 'svelte/store'
export enum SoundEffect {
- All = 'All',
- AskedToSpeak = 'AskedToSpeak',
- ChannelUpdates = 'ChannelUpdates',
- FriendRequestReceived = 'FriendRequestReceived',
- FriendRequestSend = 'FriendRequestSend',
- MutedMic = 'MutedMic',
- UnmutedMic = 'UnmutedMic',
- SentMessage = 'SentMessage',
- ReceivedMessage = 'ReceivedMessage',
- StartedSharingScreen = 'StartedSharingScreen',
- StoppedSharingScreen = 'StoppedSharingScreen',
- UserJoinedChannel = 'UserJoinedChannel',
- UserLeftChannel = 'UserLeftChannel'
+ All = 'All',
+ AskedToSpeak = 'AskedToSpeak',
+ ChannelUpdates = 'ChannelUpdates',
+ FriendRequestReceived = 'FriendRequestReceived',
+ FriendRequestSend = 'FriendRequestSend',
+ MutedMic = 'MutedMic',
+ UnmutedMic = 'UnmutedMic',
+ SentMessage = 'SentMessage',
+ ReceivedMessage = 'ReceivedMessage',
+ StartedSharingScreen = 'StartedSharingScreen',
+ StoppedSharingScreen = 'StoppedSharingScreen',
+ UserJoinedChannel = 'UserJoinedChannel',
+ UserLeftChannel = 'UserLeftChannel'
}
-export const sfxList: Writable<({ key: SoundEffect; path: null; isMuted: boolean; } | { key: SoundEffect; path: string; isMuted: boolean; })[]> = writable()
+export const sfxList: Writable<
+ (
+ | { key: SoundEffect; path: null; isMuted: boolean }
+ | { key: SoundEffect; path: string; isMuted: boolean }
+ )[]
+> = writable()
async function getAllSavedMutedSfx() {
- return (sfxList.set([
- {
- key: SoundEffect.All,
- path: null,
- isMuted: await getIsMuted(SoundEffect.All)
- },
- {
- key: SoundEffect.AskedToSpeak,
- path: '../../assets/sfx/askedToSpeak.wav',
- isMuted: await getIsMuted(SoundEffect.AskedToSpeak)
- },
- {
- key: SoundEffect.ChannelUpdates,
- path: '../../assets/sfx/channelUpdates.wav',
- isMuted: await getIsMuted(SoundEffect.ChannelUpdates)
- },
- {
- key: SoundEffect.FriendRequestReceived,
- path: '../../assets/sfx/FriendRequestReceived.wav',
- isMuted: await getIsMuted(SoundEffect.FriendRequestReceived)
- },
- {
- key: SoundEffect.FriendRequestSend,
- path: '../../assets/sfx/friendRequestSend.wav',
- isMuted: await getIsMuted(SoundEffect.FriendRequestSend)
- },
- {
- key: SoundEffect.MutedMic,
- path: '../../assets/sfx/mutedMic.wav',
- isMuted: await getIsMuted(SoundEffect.MutedMic)
- },
- {
- key: SoundEffect.UnmutedMic,
- path: '../../assets/sfx/unmutedMic.wav',
- isMuted: await getIsMuted(SoundEffect.MutedMic)
- },
- {
- key: SoundEffect.SentMessage,
- path: '../../assets/sfx/sentMessage.wav',
- isMuted: await getIsMuted(SoundEffect.SentMessage)
- },
- {
- key: SoundEffect.ReceivedMessage,
- path: '../../assets/sfx/receivedMessage.wav',
- isMuted: await getIsMuted(SoundEffect.SentMessage)
- },
- {
- key: SoundEffect.StartedSharingScreen,
- path: '../../assets/sfx/startedSharingScreen.wav',
- isMuted: await getIsMuted(SoundEffect.StartedSharingScreen)
- },
- {
- key: SoundEffect.StoppedSharingScreen,
- path: '../../assets/sfx/stoppedSharingScreen.wav',
- isMuted: await getIsMuted(SoundEffect.StartedSharingScreen)
- },
- {
- key: SoundEffect.UserJoinedChannel,
- path: '../../assets/sfx/userJoinedChannel.wav',
- isMuted: await getIsMuted(SoundEffect.UserJoinedChannel)
- },
- {
- key: SoundEffect.UserLeftChannel,
- path: '../../assets/sfx/userLeftChannel',
- isMuted: await getIsMuted(SoundEffect.UserJoinedChannel)
- }
- ]))
+ return sfxList.set([
+ {
+ key: SoundEffect.All,
+ path: null,
+ isMuted: await getIsMuted(SoundEffect.All)
+ },
+ {
+ key: SoundEffect.AskedToSpeak,
+ path: '../../assets/sfx/askedToSpeak.wav',
+ isMuted: await getIsMuted(SoundEffect.AskedToSpeak)
+ },
+ {
+ key: SoundEffect.ChannelUpdates,
+ path: '../../assets/sfx/channelUpdates.wav',
+ isMuted: await getIsMuted(SoundEffect.ChannelUpdates)
+ },
+ {
+ key: SoundEffect.FriendRequestReceived,
+ path: '../../assets/sfx/FriendRequestReceived.wav',
+ isMuted: await getIsMuted(SoundEffect.FriendRequestReceived)
+ },
+ {
+ key: SoundEffect.FriendRequestSend,
+ path: '../../assets/sfx/friendRequestSend.wav',
+ isMuted: await getIsMuted(SoundEffect.FriendRequestSend)
+ },
+ {
+ key: SoundEffect.MutedMic,
+ path: '../../assets/sfx/mutedMic.wav',
+ isMuted: await getIsMuted(SoundEffect.MutedMic)
+ },
+ {
+ key: SoundEffect.UnmutedMic,
+ path: '../../assets/sfx/unmutedMic.wav',
+ isMuted: await getIsMuted(SoundEffect.MutedMic)
+ },
+ {
+ key: SoundEffect.SentMessage,
+ path: '../../assets/sfx/sentMessage.wav',
+ isMuted: await getIsMuted(SoundEffect.SentMessage)
+ },
+ {
+ key: SoundEffect.ReceivedMessage,
+ path: '../../assets/sfx/receivedMessage.wav',
+ isMuted: await getIsMuted(SoundEffect.SentMessage)
+ },
+ {
+ key: SoundEffect.StartedSharingScreen,
+ path: '../../assets/sfx/startedSharingScreen.wav',
+ isMuted: await getIsMuted(SoundEffect.StartedSharingScreen)
+ },
+ {
+ key: SoundEffect.StoppedSharingScreen,
+ path: '../../assets/sfx/stoppedSharingScreen.wav',
+ isMuted: await getIsMuted(SoundEffect.StartedSharingScreen)
+ },
+ {
+ key: SoundEffect.UserJoinedChannel,
+ path: '../../assets/sfx/userJoinedChannel.wav',
+ isMuted: await getIsMuted(SoundEffect.UserJoinedChannel)
+ },
+ {
+ key: SoundEffect.UserLeftChannel,
+ path: '../../assets/sfx/userLeftChannel',
+ isMuted: await getIsMuted(SoundEffect.UserJoinedChannel)
+ }
+ ])
}
async function getIsMuted(key: SoundEffect) {
- return JSON.parse(window.localStorage.getItem(key) || 'false')
+ return JSON.parse(window.localStorage.getItem(key) || 'false')
}
// public playAudio(key: SoundEffect) {
@@ -113,7 +118,4 @@ async function getIsMuted(key: SoundEffect) {
// sfxList.find((sfx: { key: SoundEffect; }) => sfx.key == key).isMuted = isMuted
// }
-export {
- getAllSavedMutedSfx,
- getIsMuted
-}
\ No newline at end of file
+export { getAllSavedMutedSfx, getIsMuted }
diff --git a/src/lib/stores/socketStore.ts b/src/lib/stores/socketStore.ts
index 6259bac8..4ca68406 100644
--- a/src/lib/stores/socketStore.ts
+++ b/src/lib/stores/socketStore.ts
@@ -1,8 +1,8 @@
import { env } from '$env/dynamic/public'
-import { writable, type Writable } from "svelte/store"
+import { writable, type Writable } from 'svelte/store'
-let platformSocket: WebSocket | undefined
-let channelSocket: WebSocket | undefined
+let platformSocket: WebSocket
+let channelSocket: WebSocket
export const platformConnection: Writable = writable()
export const channelConnection: Writable = writable()
@@ -10,121 +10,138 @@ export const platformMessage: Writable = writable()
export const channelMessage: Writable = writable()
async function getPlatformSocket() {
- return await fetch(`${env.PUBLIC_API_URL}/wsinit/wsid`, {
- method: 'GET',
- }).then(async response => {
- const data = await response.text()
- await setupWebsocketConnection({ websocketId: data, isChannelConnection: false })
- })
+ return await fetch(`${env.PUBLIC_API_URL}/wsinit/wsid`, {
+ method: 'GET'
+ }).then(async (response) => {
+ const data = await response.text()
+ await setupWebsocketConnection({ websocketId: data, isChannelConnection: false })
+ })
}
async function getChannelSocket({ channelId }: { channelId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/wsinit/channelid?channelId=${channelId}`, {
- method: 'GET',
- }).then(async response => {
- const data = await response.text()
- await setupWebsocketConnection({ websocketId: data, isChannelConnection: true })
- })
-}
-
-async function setupWebsocketConnection({ websocketId, isChannelConnection }: { websocketId: string, isChannelConnection: boolean }) {
- if (!isChannelConnection) {
- platformSocket = new WebSocket(`${env.PUBLIC_WEBSOCKET_URL}/wsinit/wsid/${websocketId}/connect`)
- platformSocket?.addEventListener('open', (data) => {
- console.log("socket connection open")
- console.log(data)
- platformConnection.set('open')
- })
- platformSocket?.addEventListener('message', (data) => {
- console.log("listening to messages")
- console.log(data)
- platformMessage.set(data)
- })
- platformSocket?.addEventListener('error', (data) => {
- console.log("socket connection error")
- console.log(data)
- })
- platformSocket?.addEventListener('close', (data) => {
- console.log("socket connection close")
- console.log(data)
- platformConnection.set('close')
- })
- } else {
- channelSocket = new WebSocket(`${env.PUBLIC_WEBSOCKET_URL}/wsinit/channelid/${websocketId}/connect`)
- channelSocket?.addEventListener('open', (data) => {
- console.log("channel socket connection open")
- console.log(data)
- channelConnection.set('open')
- })
- channelSocket?.addEventListener('message', (data) => {
- console.log("listening to messages")
- console.log(data)
- channelMessage.set(data)
- })
- channelSocket?.addEventListener('error', (data) => {
- console.log("socket connection error")
- console.log(data)
- })
- channelSocket?.addEventListener('close', (data) => {
- console.log("socket connection close")
- console.log(data)
- channelConnection.set('close')
- })
- }
-}
-
-function emitUserConnection({ userId, isOnline }: { userId: string, isOnline: boolean }) {
- platformSocket?.send(JSON.stringify({ eventName: isOnline ? 'user-connect' : 'user-disconnect', userId: userId }))
-}
-
-function emitRemovedUser({ channelId, userId }: { channelId: string, userId: string }) {
- channelSocket?.send(JSON.stringify({ eventName: `user-removed`, channelId, userId }))
+ return await fetch(`${env.PUBLIC_API_URL}/wsinit/channelid?channelId=${channelId}`, {
+ method: 'GET'
+ }).then(async (response) => {
+ const data = await response.text()
+ await setupWebsocketConnection({ websocketId: data, isChannelConnection: true })
+ })
+}
+
+async function setupWebsocketConnection({
+ websocketId,
+ isChannelConnection
+}: {
+ websocketId: string
+ isChannelConnection: boolean
+}) {
+ if (!isChannelConnection) {
+ platformSocket = new WebSocket(`${env.PUBLIC_WEBSOCKET_URL}/wsinit/wsid/${websocketId}/connect`)
+ platformSocket?.addEventListener('open', (data) => {
+ console.log('socket connection open')
+ console.log(data)
+ platformConnection.set('open')
+ })
+ platformSocket?.addEventListener('message', (data) => {
+ console.log('listening to messages')
+ console.log(data)
+ platformMessage.set(data)
+ })
+ platformSocket?.addEventListener('error', (data) => {
+ console.log('socket connection error')
+ console.log(data)
+ })
+ platformSocket?.addEventListener('close', (data) => {
+ console.log('socket connection close')
+ console.log(data)
+ platformConnection.set('close')
+ })
+ } else {
+ channelSocket = new WebSocket(
+ `${env.PUBLIC_WEBSOCKET_URL}/wsinit/channelid/${websocketId}/connect`
+ )
+ channelSocket?.addEventListener('open', (data) => {
+ console.log('channel socket connection open')
+ console.log(data)
+ channelConnection.set('open')
+ })
+ channelSocket?.addEventListener('message', (data) => {
+ console.log('listening to messages')
+ console.log(data)
+ channelMessage.set(data)
+ })
+ channelSocket?.addEventListener('error', (data) => {
+ console.log('socket connection error')
+ console.log(data)
+ })
+ channelSocket?.addEventListener('close', (data) => {
+ console.log('socket connection close')
+ console.log(data)
+ channelConnection.set('close')
+ })
+ }
+}
+
+function emitUserConnection({ userId, isOnline }: { userId: string; isOnline: boolean }) {
+ platformSocket?.send(
+ JSON.stringify({ eventName: isOnline ? 'user-connect' : 'user-disconnect', userId: userId })
+ )
+}
+
+function emitRemovedUser({ channelId, userId }: { channelId: string; userId: string }) {
+ channelSocket?.send(JSON.stringify({ eventName: `user-removed`, channelId, userId }))
}
function emitChannelUpdate({ channelId }: { channelId: string }) {
- channelSocket?.send(JSON.stringify({ eventName: `channel-update`, channelId }))
-}
-
-function emitChannelAccessRequest({ channelId, userId }: { channelId: string, userId: string }) {
- platformSocket?.send(JSON.stringify({ eventName: `channel-access-request`, channel: channelId, user: userId }))
-}
-
-function emitChannelAccessResponse({ channelId, userId, isGrantedAccess }: { channelId: string, userId: string, isGrantedAccess: boolean }) {
- platformSocket?.send(JSON.stringify({ eventName: `channel-access-response`, channel: channelId, user: userId, isGrantedAccess }))
-}
-
-/************ Recording ****************/
-
-function emitVideoRecordingStarted({ channelId }: { channelId: string }) {
- platformSocket?.send(JSON.stringify({ eventName: `video-recording-started`, channelId }))
-}
-
-function emitVideoRecordingEnded({ channelId, sessionCounter }: { channelId: string, sessionCounter: number }) {
- platformSocket?.send(
- JSON.stringify({ eventName: 'video-recording-ended', channelId, sessionCounter })
- )
-}
-
-function emitCompositionDeleted({ channelId, compositionSid }: { channelId: string, compositionSid: string }) {
- platformSocket?.send(
- JSON.stringify({ eventName: 'composition-deleted', channelId, compositionSid })
- )
+ channelSocket?.send(JSON.stringify({ eventName: `channel-update`, channelId }))
+}
+
+function emitChannelAccessRequest({ channelId, userId }: { channelId: string; userId: string }) {
+ platformSocket?.send(
+ JSON.stringify({ eventName: `channel-access-request`, channel: channelId, user: userId })
+ )
+}
+
+function emitChannelAccessResponse({
+ channelId,
+ userId,
+ isGrantedAccess
+}: {
+ channelId: string
+ userId: string
+ isGrantedAccess: boolean
+}) {
+ platformSocket?.send(
+ JSON.stringify({
+ eventName: `channel-access-response`,
+ channel: channelId,
+ user: userId,
+ isGrantedAccess
+ })
+ )
}
/************ Chat ****************/
-function emitChatMessage({ source1, source2, message }: { source1: string, source2: string, message: any }) {
- platformSocket?.send(JSON.stringify({ eventName: `message-sent`, source1, source2, message }))
+function emitChatMessage({
+ source1,
+ source2,
+ message
+}: {
+ source1: string
+ source2: string
+ message: any
+}) {
+ platformSocket?.send(JSON.stringify({ eventName: `message-sent`, source1, source2, message }))
}
function emitChatTypingByUser({ userId }: { userId: string }) {
- platformSocket?.send(
- JSON.stringify({
- eventName: `chat-typing`,
- user: userId,
- isTyping: true
- })
- )
+ platformSocket?.send(
+ JSON.stringify({
+ eventName: `chat-typing`,
+ user: userId,
+ isTyping: true
+ })
+ )
}
/************ Channel chat ****************/
@@ -142,253 +159,314 @@ function emitChatTypingByUser({ userId }: { userId: string }) {
// })
// }
-function emitChannelSubscribeByUser({ channelId, userId }: { channelId: string, userId: string }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: `channel-subscribe`,
- channel: channelId,
- userId: userId
- })
- )
+function emitChannelSubscribeByUser({ channelId, userId }: { channelId: string; userId: string }) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: `channel-subscribe`,
+ channel: channelId,
+ userId: userId
+ })
+ )
}
-function emitMessageToChannel({ channelId, message }: { channelId: string, message: any }) {
- channelSocket?.send(
- JSON.stringify({ eventName: `channel-message`, channel: channelId, message })
- )
+function emitMessageToChannel({ channelId, message }: { channelId: string; message: any }) {
+ channelSocket?.send(JSON.stringify({ eventName: `channel-message`, channel: channelId, message }))
}
-function emitDeleteMessageToChannel({ channelId, message }: { channelId: string, message: string }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: `delete-channel-message`,
- channel: channelId,
- message
- })
- )
+function emitDeleteMessageToChannel({
+ channelId,
+ message
+}: {
+ channelId: string
+ message: string
+}) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: `delete-channel-message`,
+ channel: channelId,
+ message
+ })
+ )
}
function emitDeleteAllMessagesToChannel({ channelId }: { channelId: string }) {
- channelSocket?.send(
- JSON.stringify({ eventName: `delete-all-channel-messages`, channel: channelId })
- )
-}
-
-function emitHistoryToChannel({ channelId, skip }: { channelId: string, skip: number }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: `channel-message-history`,
- channel: channelId,
- skip
- })
- )
-}
-
-function emitChannelChatTypingByUser({ channelId, typingUser }: { channelId: string, typingUser: string }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: `channel-chat-typing`,
- channel: channelId,
- typingUser
- })
- )
+ channelSocket?.send(
+ JSON.stringify({ eventName: `delete-all-channel-messages`, channel: channelId })
+ )
+}
+
+function emitHistoryToChannel({ channelId, skip }: { channelId: string; skip: number }) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: `channel-message-history`,
+ channel: channelId,
+ skip
+ })
+ )
+}
+
+function emitChannelChatTypingByUser({
+ channelId,
+ typingUser
+}: {
+ channelId: string
+ typingUser: string
+}) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: `channel-chat-typing`,
+ channel: channelId,
+ typingUser
+ })
+ )
}
/************ Channel streaming ****************/
-function emitRoomMemberUpdate({ channelId, userData, isNewUser }: { channelId: string, userData: any, isNewUser: boolean }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: 'channel-streaming-room-member-update',
- channel: channelId,
- userData,
- isNewUser
- })
- )
-}
-
-function emitUserActions({ channelId, userData, message }: { channelId: string, userData: any, message: string }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: `channel-streaming-user-actions`,
- channel: channelId,
- userData,
- message
- })
- )
+function emitRoomMemberUpdate({
+ channelId,
+ userData,
+ isNewUser
+}: {
+ channelId: string
+ userData: any
+ isNewUser: boolean
+}) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: 'channel-streaming-room-member-update',
+ channel: channelId,
+ userData,
+ isNewUser
+ })
+ )
+}
+
+function emitUserActions({
+ channelId,
+ userData,
+ message
+}: {
+ channelId: string
+ userData: any
+ message: string
+}) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: `channel-streaming-user-actions`,
+ channel: channelId,
+ userData,
+ message
+ })
+ )
+}
+
+function emitReactToMessage({
+ channelId,
+ message,
+ user,
+ reaction
+}: {
+ channelId: string
+ message: any
+ user: any
+ reaction: string
+}) {
+ channelSocket?.send(
+ JSON.stringify({
+ eventName: `react-to-message`,
+ channel: channelId,
+ message,
+ user,
+ reaction
+ })
+ )
}
-function emitReactToMessage({ channelId, message, user, reaction }: { channelId: string, message: any, user: any, reaction: string }) {
- channelSocket?.send(
- JSON.stringify({
- eventName: `react-to-message`,
- channel: channelId,
- message,
- user,
- reaction
- })
- )
-}
-
-
-
-
-
+/************ Recording ****************/
+// function emitVideoRecordingStarted({ channelId }: { channelId: string }) {
+// platformSocket?.send(JSON.stringify({ eventName: `video-recording-started`, channelId }))
+// }
+// function emitVideoRecordingEnded({
+// channelId,
+// sessionCounter
+// }: {
+// channelId: string
+// sessionCounter: number
+// }) {
+// platformSocket?.send(
+// JSON.stringify({ eventName: 'video-recording-ended', channelId, sessionCounter })
+// )
+// }
+// function emitCompositionDeleted({
+// channelId,
+// compositionSid
+// }: {
+// channelId: string
+// compositionSid: string
+// }) {
+// platformSocket?.send(
+// JSON.stringify({ eventName: 'composition-deleted', channelId, compositionSid })
+// )
+// }
//TODO: place these everywhere we are using socket listeners
function listenToUserConnection({ userId }: { userId: string }) {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `user-connection-${userId}`) {
- //parsedData.user
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `user-connection-${userId}`) {
+ //parsedData.user
+ }
+ })
}
function listenToRemovedUser({ channelId }: { channelId: string }) {
- channelMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `user-removed-${channelId}`) {
- //parsedData.userId
- }
- })
+ channelMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `user-removed-${channelId}`) {
+ //parsedData.userId
+ }
+ })
}
function listenToChannelUpdate({ channelId }: { channelId: string }) {
- channelMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `channel-update-${channelId}`) {
- // channelService.currentChannel.description = parsedData.channel.description
- // channelService.currentChannel.thumbnail = parsedData.channel.thumbnail
- // channelService.currentChannel.isPrivate = parsedData.channel.isPrivate
- // channelService.currentChannel.attachments = parsedData.channel.attachments
- }
- })
+ channelMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `channel-update-${channelId}`) {
+ // channelService.currentChannel.description = parsedData.channel.description
+ // channelService.currentChannel.thumbnail = parsedData.channel.thumbnail
+ // channelService.currentChannel.isPrivate = parsedData.channel.isPrivate
+ // channelService.currentChannel.attachments = parsedData.channel.attachments
+ }
+ })
}
function listenToChannelAccessRequest({ channelId }: { channelId: string }) {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `channel-access-request` && parsedData.channelId === channelId) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `channel-access-request` && parsedData.channelId === channelId) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToChannelAccessResponse({ channelId }: { channelId: string }) {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `channel-access-response` && parsedData.channelId === channelId) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `channel-access-response` && parsedData.channelId === channelId) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToVideoRecordingStarted({ channelId }: { channelId: string }) {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `video-recording-started` && parsedData.channelId === channelId) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `video-recording-started` && parsedData.channelId === channelId) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToCompositionStatusUpdate({ channelId }: { channelId: string }) {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `composition-status-update` && parsedData.channelId === channelId) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (
+ parsedData.eventName === `composition-status-update` &&
+ parsedData.channelId === channelId
+ ) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToCompositionDeleted({ channelId }: { channelId: string }) {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `composition-deleted` && parsedData.channelId === channelId) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `composition-deleted` && parsedData.channelId === channelId) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToChatMessages() {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `message-received`) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `message-received`) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToChatTyping() {
- platformMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `chat-typing`) {
- console.log("parsedData", parsedData)
- }
- })
+ platformMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `chat-typing`) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToChannelMessage({ channelId }: { channelId: string }) {
- channelMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `channel-message-${channelId}`) {
- console.log("parsedData", parsedData)
- }
- })
+ channelMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `channel-message-${channelId}`) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToChannelTyping() {
- channelMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `typing`) {
- console.log("parsedData", parsedData)
- }
- })
+ channelMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `typing`) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToRoomMemberUpdate({ channelId }: { channelId: string }) {
- channelMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `channel-streaming-room-member-update-${channelId}`) {
- console.log("parsedData", parsedData)
- }
- })
+ channelMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `channel-streaming-room-member-update-${channelId}`) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
function listenToUserActions({ channelId }: { channelId: string }) {
- channelMessage.subscribe(value => {
- const parsedData = JSON.parse(value.data)
- if (parsedData.eventName === `channel-streaming-user-actions-${channelId}`) {
- console.log("parsedData", parsedData)
- }
- })
+ channelMessage.subscribe((value) => {
+ const parsedData = JSON.parse(value.data)
+ if (parsedData.eventName === `channel-streaming-user-actions-${channelId}`) {
+ console.log('parsedData', parsedData)
+ }
+ })
}
export {
- getPlatformSocket,
- getChannelSocket,
- emitUserConnection,
- emitRemovedUser,
- emitChannelUpdate,
- emitChannelAccessRequest,
- emitChannelAccessResponse,
- emitVideoRecordingStarted,
- emitVideoRecordingEnded,
- emitCompositionDeleted,
- emitChatMessage,
- emitChatTypingByUser,
- emitChannelSubscribeByUser,
- emitMessageToChannel,
- emitDeleteMessageToChannel,
- emitDeleteAllMessagesToChannel,
- emitHistoryToChannel,
- emitChannelChatTypingByUser,
- emitRoomMemberUpdate,
- emitUserActions,
- emitReactToMessage
-}
\ No newline at end of file
+ getPlatformSocket,
+ getChannelSocket,
+ emitUserConnection,
+ emitRemovedUser,
+ emitChannelUpdate,
+ emitChannelAccessRequest,
+ emitChannelAccessResponse,
+ emitChatMessage,
+ emitChatTypingByUser,
+ emitChannelSubscribeByUser,
+ emitMessageToChannel,
+ emitDeleteMessageToChannel,
+ emitDeleteAllMessagesToChannel,
+ emitHistoryToChannel,
+ emitChannelChatTypingByUser,
+ emitRoomMemberUpdate,
+ emitUserActions,
+ emitReactToMessage
+ // emitVideoRecordingStarted,
+ // emitVideoRecordingEnded,
+ // emitCompositionDeleted
+}
diff --git a/src/lib/stores/streamStore.ts b/src/lib/stores/streamStore.ts
index 2ca15102..5e6e65b5 100644
--- a/src/lib/stores/streamStore.ts
+++ b/src/lib/stores/streamStore.ts
@@ -7,734 +7,790 @@ let videoStreamId = ''
let hasActiveTracks = false
const userData: {
- id: string
- avatar: any
- username: any
- displayName: string
- userType: string
- obsState: string
- screenState: string
- webcamState: string
- audioState: string
- isHandRaised: boolean
- obsStream: any
- screenStream: any
- webcamStream: any
- audioStream: any
+ id: string
+ avatar: any
+ username: any
+ displayName: string
+ userType: string
+ obsState: string
+ screenState: string
+ webcamState: string
+ audioState: string
+ isHandRaised: boolean
+ obsStream: any
+ screenStream: any
+ webcamStream: any
+ audioStream: any
} = {
- id: '',
- avatar: null,
- username: null,
- displayName: '',
- userType: 'listener',
- obsState: 'restricted',
- screenState: 'restricted',
- webcamState: 'restricted',
- audioState: 'restricted',
- isHandRaised: false,
- obsStream: null,
- screenStream: null,
- webcamStream: null,
- audioStream: null
+ id: '',
+ avatar: null,
+ username: null,
+ displayName: '',
+ userType: 'listener',
+ obsState: 'restricted',
+ screenState: 'restricted',
+ webcamState: 'restricted',
+ audioState: 'restricted',
+ isHandRaised: false,
+ obsStream: null,
+ screenStream: null,
+ webcamStream: null,
+ audioStream: null
}
let streamOptions: {
- isRecording: boolean
- isLiveStreaming: boolean
- isEveryoneSilenced: boolean
- duration: number
- hasWaitedOneSecondObs: boolean
- hasWaitedOneSecondScreen: boolean
- hasWaitedOneSecondWebcam: boolean
- hasWaitedOneSecondAudio: boolean
- hasWaitedOneSecondRecord: boolean
- hasWaitedOneSecondRaiseHand: boolean
- hasWaitedOneSecondSilence: boolean
- isTimedOut: boolean
- isMaxLimitReached: boolean
+ isRecording: boolean
+ isLiveStreaming: boolean
+ isEveryoneSilenced: boolean
+ duration: number
+ hasWaitedOneSecondObs: boolean
+ hasWaitedOneSecondScreen: boolean
+ hasWaitedOneSecondWebcam: boolean
+ hasWaitedOneSecondAudio: boolean
+ hasWaitedOneSecondRecord: boolean
+ hasWaitedOneSecondRaiseHand: boolean
+ hasWaitedOneSecondSilence: boolean
+ isTimedOut: boolean
+ isMaxLimitReached: boolean
} = {
- isRecording: false,
- isLiveStreaming: false,
- isEveryoneSilenced: true,
- duration: 0,
- hasWaitedOneSecondObs: true,
- hasWaitedOneSecondScreen: true,
- hasWaitedOneSecondWebcam: true,
- hasWaitedOneSecondAudio: true,
- hasWaitedOneSecondRecord: true,
- hasWaitedOneSecondRaiseHand: true,
- hasWaitedOneSecondSilence: true,
- isTimedOut: false,
- isMaxLimitReached: false
+ isRecording: false,
+ isLiveStreaming: false,
+ isEveryoneSilenced: true,
+ duration: 0,
+ hasWaitedOneSecondObs: true,
+ hasWaitedOneSecondScreen: true,
+ hasWaitedOneSecondWebcam: true,
+ hasWaitedOneSecondAudio: true,
+ hasWaitedOneSecondRecord: true,
+ hasWaitedOneSecondRaiseHand: true,
+ hasWaitedOneSecondSilence: true,
+ isTimedOut: false,
+ isMaxLimitReached: false
}
export const roomMembers: Writable<[]> = writable([])
export const channelMembersCount: Writable = writable(0)
-async function getMembers({ channelId, isParticipant, skip, limit }: { channelId: string, isParticipant: boolean, skip: number, limit: number }) {
- return await fetch(`${env.PUBLIC_API_URL}/channel-members?channelId=${channelId}&isParticipant=${isParticipant}&skip=${skip}&limit=${limit}`, {
- method: 'GET',
- }).then(response => response.json())
+async function getMembers({
+ channelId,
+ isParticipant,
+ skip,
+ limit
+}: {
+ channelId: string
+ isParticipant: boolean
+ skip: number
+ limit: number
+}) {
+ return await fetch(
+ `${env.PUBLIC_API_URL}/channel-members?channelId=${channelId}&isParticipant=${isParticipant}&skip=${skip}&limit=${limit}`,
+ {
+ method: 'GET'
+ }
+ ).then((response) => response.json())
}
async function getChannelMembersCount({ channelId }: { channelId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/channel-members/count?channelId=${channelId}`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/channel-members/count?channelId=${channelId}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
async function initRoomMembers() {
- //TODO: get currenChannel writeable
- // roomMembers = await getMembers({
- // channelId: channelStore.currentChannel._id,
- // isParticipant: true,
- // skip: 0,
- // limit: 10
- // })
- // channelMembersCount = await getChannelMembersCount({
- // channelId: channelStore.currentChannel._id
- // })
- // Object.assign(userData, getMember(authService.currentUser))
- // const doesUserExist = roomMembers.some((member) => member.id == userData.id)
- // if (channelStore.currentChannel.user === userData.id && !doesUserExist) {
- // roomMembers.push(userData)
- // }
- // socketStore.emitRoomMemberUpdate({
- // channelId: channelStore.currentChannel._id,
- // userData: userData,
- // isNewUser: true
- // })
- // listenToRoomMemberUpdate()
- // listenToUserActions()
-
- // streamOptions.isEveryoneSilenced =
- // channelStore.currentChannel.isEveryoneSilenced
- // if (channelStore.currentChannel.user === authService.currentUser._id) {
- // await createLiveStream(
- // channelStore.currentChannel._id,
- // `${channelStore.currentChannel.title}-${channelStore.currentChannel.user}`
- // )
- // await channelStore.updateisLive({
- // channelId: channelStore.currentChannel._id,
- // isLive: true
- // })
- // }
+ //TODO: get currenChannel writeable
+ // roomMembers = await getMembers({
+ // channelId: channelStore.currentChannel._id,
+ // isParticipant: true,
+ // skip: 0,
+ // limit: 10
+ // })
+ // channelMembersCount = await getChannelMembersCount({
+ // channelId: channelStore.currentChannel._id
+ // })
+ // Object.assign(userData, getMember(authService.currentUser))
+ // const doesUserExist = roomMembers.some((member) => member.id == userData.id)
+ // if (channelStore.currentChannel.user === userData.id && !doesUserExist) {
+ // roomMembers.push(userData)
+ // }
+ // socketStore.emitRoomMemberUpdate({
+ // channelId: channelStore.currentChannel._id,
+ // userData: userData,
+ // isNewUser: true
+ // })
+ // listenToRoomMemberUpdate()
+ // listenToUserActions()
+ // streamOptions.isEveryoneSilenced =
+ // channelStore.currentChannel.isEveryoneSilenced
+ // if (channelStore.currentChannel.user === authService.currentUser._id) {
+ // await createLiveStream(
+ // channelStore.currentChannel._id,
+ // `${channelStore.currentChannel.title}-${channelStore.currentChannel.user}`
+ // )
+ // await channelStore.updateisLive({
+ // channelId: channelStore.currentChannel._id,
+ // isLive: true
+ // })
+ // }
}
function listenToRoomMemberUpdate() {
- //TODO: fix subscribing to writeables
- // roomMembersSubscription = socketStore
- // .listenToRoomMemberUpdate({
- // channelId: channelStore.currentChannel._id
- // })
- // .subscribe(async (data) => {
- // if (channelStore.currentChannel) {
- // if (data.isNewUser) {
- // const doesUserExist = roomMembers.some(
- // (member) => member.id == data.userData.id
- // )
- // if (!doesUserExist && data.userData.userType != 'listener') {
- // roomMembers.push(data.userData)
- // if (userData.id == data.userData.id) {
- // userData = data.userData
- // }
- // }
- // } else if (!data.isNewUser) {
- // const index = roomMembers.findIndex(
- // (item) => item.id == data.userData.id
- // )
- // if (index > -1) roomMembers.splice(index, 1)
- // if (userData.id == data.userData.id) {
- // userData = data.userData
- // }
- // }
- // if (data.userData.obsStream) attachTrack(data.userData.obsStream, data.userData.id, 'obs')
- // if (data.userData.screenStream) attachTrack(data.userData.screenStream, data.userData.id, 'screen')
- // if (data.userData.webcamStream) attachTrack(data.userData.webcamStream, data.userData.id, 'webcam')
- // if (data.userData.audioStream) attachTrack(data.userData.audioStream, data.userData.id, 'audio')
- // channelMembersCount = await getChannelMembersCount({
- // channelId: channelStore.currentChannel._id
- // })
- // console.log("channelMembersCount", channelMembersCount)
- // channelStore.currentChannel.memberCount = channelMembersCount
- // }
- // })
+ //TODO: fix subscribing to writeables
+ // roomMembersSubscription = socketStore
+ // .listenToRoomMemberUpdate({
+ // channelId: channelStore.currentChannel._id
+ // })
+ // .subscribe(async (data) => {
+ // if (channelStore.currentChannel) {
+ // if (data.isNewUser) {
+ // const doesUserExist = roomMembers.some(
+ // (member) => member.id == data.userData.id
+ // )
+ // if (!doesUserExist && data.userData.userType != 'listener') {
+ // roomMembers.push(data.userData)
+ // if (userData.id == data.userData.id) {
+ // userData = data.userData
+ // }
+ // }
+ // } else if (!data.isNewUser) {
+ // const index = roomMembers.findIndex(
+ // (item) => item.id == data.userData.id
+ // )
+ // if (index > -1) roomMembers.splice(index, 1)
+ // if (userData.id == data.userData.id) {
+ // userData = data.userData
+ // }
+ // }
+ // if (data.userData.obsStream) attachTrack(data.userData.obsStream, data.userData.id, 'obs')
+ // if (data.userData.screenStream) attachTrack(data.userData.screenStream, data.userData.id, 'screen')
+ // if (data.userData.webcamStream) attachTrack(data.userData.webcamStream, data.userData.id, 'webcam')
+ // if (data.userData.audioStream) attachTrack(data.userData.audioStream, data.userData.id, 'audio')
+ // channelMembersCount = await getChannelMembersCount({
+ // channelId: channelStore.currentChannel._id
+ // })
+ // console.log("channelMembersCount", channelMembersCount)
+ // channelStore.currentChannel.memberCount = channelMembersCount
+ // }
+ // })
}
function listenToUserActions() {
- //TODO: fix subscribing to writeables
- // userActionsSubscription = socketStore
- // .listenToUserActions({
- // channelId: channelStore.currentChannel._id
- // })
- // .subscribe(async (data) => {
- // const messageData = JSON.parse(data.message)
- // let member = roomMembers.find((member) => member.id == messageData.userId)
- // if (!member) member = data.userData
- // switch (messageData.type) {
- // case 'toggleTrack':
- // if (messageData.trackType === 'obs') { member.obsState === 'live' ? attachTrack(member.obsStream, data.userData.id, 'obs') : detachTrack(member.id, 'obs') }
- // if (messageData.trackType === 'screen' && userData.id !== member.id) {
- // member.screenState === 'live' ? attachTrack(member.screenStream, member.id, 'screen') : detachTrack(member.id, 'screen')
- // }
- // if (messageData.trackType === 'webcam' && userData.id !== member.id) { member.webcamState === 'live' ? attachTrack(member.webcamStream, member.id, 'webcam') : detachTrack(member.id, 'webcam') }
- // if (messageData.trackType === 'audio' && userData.id !== member.id) { member.audioState === 'live' ? attachTrack(member.audioStream, member.id, 'audio') : detachTrack(member.id, 'audio') }
- // break;
- // case 'toggleRaiseHand':
- // if (channelStore.currentChannel.user == userData.id &&
- // userData.id != messageData.userId &&
- // messageData.isHandRaised
- // ) {
- // const snackBarRef = snackBar.open(
- // `${member.displayName} would like to participate`,
- // 'Allow',
- // { duration: 5000, verticalPosition: 'top' }
- // )
- // snackBarRef.onAction().subscribe(() => {
- // try {
- // toggleUserType(member, true)
- // } catch (err) {
- // console.log(err)
- // }
- // })
- // // inAppSnackBarService.openSnackBar(`${member} would like to participate`, 'error', 3000, 'bottom', 'center')
- // }
- // break
- // case 'toggleSilenceOnEveryone':
- // streamOptions.isEveryoneSilenced = messageData.isEveryoneSilenced
- // if (userData.id !== channelStore.currentChannel.user) {
- // await stopObsStream()
- // await stopScreenStream()
- // await stopWebcamStream()
- // await stopAudioStream()
- // }
- // break
- // case 'toggleRestriction':
- // switch (messageData.featureType) {
- // case 'obs':
- // if (member.id === messageData.userId) {
- // member.obsState = messageData.featureState
- // }
- // if (userData.id === messageData.userId) {
- // userData.obsState = messageData.featureState
- // await stopObsStream(userData.obsState)
- // }
- // break
- // case 'screen':
- // if (member.id === messageData.userId) {
- // member.screenState = messageData.featureState
- // }
- // if (userData.id === messageData.userId) {
- // userData.screenState = messageData.featureState
- // await stopScreenStream(userData.screenState)
- // }
- // break
- // case 'webcam':
- // if (member.id === messageData.userId) {
- // member.webcamState = messageData.featureState
- // }
- // if (userData.id === messageData.userId) {
- // userData.webcamState = messageData.featureState
- // await stopWebcamStream(userData.webcamState)
- // }
- // break
- // case 'audio':
- // if (member.id === messageData.userId) {
- // member.audioState = messageData.featureState
- // }
- // if (userData.id === messageData.userId) {
- // userData.audioState = messageData.featureState
- // await stopAudioStream(userData.audioState)
- // }
- // break
- // }
- // break
- // }
- // updateUserInRoom(member)
- // })
+ //TODO: fix subscribing to writeables
+ // userActionsSubscription = socketStore
+ // .listenToUserActions({
+ // channelId: channelStore.currentChannel._id
+ // })
+ // .subscribe(async (data) => {
+ // const messageData = JSON.parse(data.message)
+ // let member = roomMembers.find((member) => member.id == messageData.userId)
+ // if (!member) member = data.userData
+ // switch (messageData.type) {
+ // case 'toggleTrack':
+ // if (messageData.trackType === 'obs') { member.obsState === 'live' ? attachTrack(member.obsStream, data.userData.id, 'obs') : detachTrack(member.id, 'obs') }
+ // if (messageData.trackType === 'screen' && userData.id !== member.id) {
+ // member.screenState === 'live' ? attachTrack(member.screenStream, member.id, 'screen') : detachTrack(member.id, 'screen')
+ // }
+ // if (messageData.trackType === 'webcam' && userData.id !== member.id) { member.webcamState === 'live' ? attachTrack(member.webcamStream, member.id, 'webcam') : detachTrack(member.id, 'webcam') }
+ // if (messageData.trackType === 'audio' && userData.id !== member.id) { member.audioState === 'live' ? attachTrack(member.audioStream, member.id, 'audio') : detachTrack(member.id, 'audio') }
+ // break;
+ // case 'toggleRaiseHand':
+ // if (channelStore.currentChannel.user == userData.id &&
+ // userData.id != messageData.userId &&
+ // messageData.isHandRaised
+ // ) {
+ // const snackBarRef = snackBar.open(
+ // `${member.displayName} would like to participate`,
+ // 'Allow',
+ // { duration: 5000, verticalPosition: 'top' }
+ // )
+ // snackBarRef.onAction().subscribe(() => {
+ // try {
+ // toggleUserType(member, true)
+ // } catch (err) {
+ // console.log(err)
+ // }
+ // })
+ // // inAppSnackBarService.openSnackBar(`${member} would like to participate`, 'error', 3000, 'bottom', 'center')
+ // }
+ // break
+ // case 'toggleSilenceOnEveryone':
+ // streamOptions.isEveryoneSilenced = messageData.isEveryoneSilenced
+ // if (userData.id !== channelStore.currentChannel.user) {
+ // await stopObsStream()
+ // await stopScreenStream()
+ // await stopWebcamStream()
+ // await stopAudioStream()
+ // }
+ // break
+ // case 'toggleRestriction':
+ // switch (messageData.featureType) {
+ // case 'obs':
+ // if (member.id === messageData.userId) {
+ // member.obsState = messageData.featureState
+ // }
+ // if (userData.id === messageData.userId) {
+ // userData.obsState = messageData.featureState
+ // await stopObsStream(userData.obsState)
+ // }
+ // break
+ // case 'screen':
+ // if (member.id === messageData.userId) {
+ // member.screenState = messageData.featureState
+ // }
+ // if (userData.id === messageData.userId) {
+ // userData.screenState = messageData.featureState
+ // await stopScreenStream(userData.screenState)
+ // }
+ // break
+ // case 'webcam':
+ // if (member.id === messageData.userId) {
+ // member.webcamState = messageData.featureState
+ // }
+ // if (userData.id === messageData.userId) {
+ // userData.webcamState = messageData.featureState
+ // await stopWebcamStream(userData.webcamState)
+ // }
+ // break
+ // case 'audio':
+ // if (member.id === messageData.userId) {
+ // member.audioState = messageData.featureState
+ // }
+ // if (userData.id === messageData.userId) {
+ // userData.audioState = messageData.featureState
+ // await stopAudioStream(userData.audioState)
+ // }
+ // break
+ // }
+ // break
+ // }
+ // updateUserInRoom(member)
+ // })
}
function disconnected() {
- console.log('disconnected')
- //TODO: determine if this is needed
- // if (!sharedService.wasHomePressed) {
- // window.location.href = '/'
- // }
- streamOptions = {
- isRecording: false,
- isLiveStreaming: false,
- isEveryoneSilenced: false,
- duration: 0,
- hasWaitedOneSecondObs: true,
- hasWaitedOneSecondScreen: true,
- hasWaitedOneSecondWebcam: true,
- hasWaitedOneSecondAudio: true,
- hasWaitedOneSecondRecord: true,
- hasWaitedOneSecondRaiseHand: true,
- hasWaitedOneSecondSilence: true,
- isTimedOut: false,
- isMaxLimitReached: false
- }
- videoStreamId = ''
- roomMembers.set([])
- hasActiveTracks = false
- //TODO: determine if this is needed
- // sharedService.wasHomePressed = false
-
- //TODO: fix sockets
- // socketStore.emitRoomMemberUpdate({
- // channelId: channelStore.currentChannel._id,
- // userData: userData,
- // isNewUser: false
- // })
- // if (authService.currentUser && channelStore.currentChannel.user == authService.currentUser._id) {
- // updateLiveStream()
- // channelStore.updateisLive({
- // channelId: channelStore.currentChannel._id,
- // isLive: false
- // })
- // }
-}
-
-function getMember({ _id, avatar, username, displayName, obsStream, screenStream, webcamStream, audioStream }
- : { _id: string, avatar: string, username: string, displayName: string, obsStream: string, screenStream: string, webcamStream: string, audioStream: string }) {
- return {
- id: _id,
- avatar,
- username,
- displayName,
- userType: '',//TODO: fix subscribing to writeables _id == channelStore.currentChannel.user ? 'host' : 'listener',
- obsState: 'hibernate',
- screenState: 'hibernate',
- webcamState: 'hibernate',
- audioState: 'hibernate',
- isHandRaised: false,
- obsStream,
- screenStream,
- webcamStream,
- audioStream
- }
+ console.log('disconnected')
+ //TODO: determine if this is needed
+ // if (!sharedService.wasHomePressed) {
+ // window.location.href = '/'
+ // }
+ streamOptions = {
+ isRecording: false,
+ isLiveStreaming: false,
+ isEveryoneSilenced: false,
+ duration: 0,
+ hasWaitedOneSecondObs: true,
+ hasWaitedOneSecondScreen: true,
+ hasWaitedOneSecondWebcam: true,
+ hasWaitedOneSecondAudio: true,
+ hasWaitedOneSecondRecord: true,
+ hasWaitedOneSecondRaiseHand: true,
+ hasWaitedOneSecondSilence: true,
+ isTimedOut: false,
+ isMaxLimitReached: false
+ }
+ videoStreamId = ''
+ roomMembers.set([])
+ hasActiveTracks = false
+ //TODO: determine if this is needed
+ // sharedService.wasHomePressed = false
+
+ //TODO: fix sockets
+ // socketStore.emitRoomMemberUpdate({
+ // channelId: channelStore.currentChannel._id,
+ // userData: userData,
+ // isNewUser: false
+ // })
+ // if (authService.currentUser && channelStore.currentChannel.user == authService.currentUser._id) {
+ // updateLiveStream()
+ // channelStore.updateisLive({
+ // channelId: channelStore.currentChannel._id,
+ // isLive: false
+ // })
+ // }
+}
+
+function getMember({
+ _id,
+ avatar,
+ username,
+ displayName,
+ obsStream,
+ screenStream,
+ webcamStream,
+ audioStream
+}: {
+ _id: string
+ avatar: string
+ username: string
+ displayName: string
+ obsStream: string
+ screenStream: string
+ webcamStream: string
+ audioStream: string
+}) {
+ return {
+ id: _id,
+ avatar,
+ username,
+ displayName,
+ userType: '', //TODO: fix subscribing to writeables _id == channelStore.currentChannel.user ? 'host' : 'listener',
+ obsState: 'hibernate',
+ screenState: 'hibernate',
+ webcamState: 'hibernate',
+ audioState: 'hibernate',
+ isHandRaised: false,
+ obsStream,
+ screenStream,
+ webcamStream,
+ audioStream
+ }
}
function updateUserInRoom(userData: any) {
- //TODO: fix subscribing to writeables
- // const roomUser = roomMembers.find((member) => member.id == userData.id)
- // if (roomUser) {
- // Object.assign(roomUser, userData)
- // } else {
- // if (userData.userType != 'listener') roomMembers.push(userData)
- // }
+ //TODO: fix subscribing to writeables
+ // const roomUser = roomMembers.find((member) => member.id == userData.id)
+ // if (roomUser) {
+ // Object.assign(roomUser, userData)
+ // } else {
+ // if (userData.userType != 'listener') roomMembers.push(userData)
+ // }
}
async function startObsStream() {
- if (streamOptions.hasWaitedOneSecondObs) {
- waitOneSecondObs()
- const trackName = `obs-${userData.id}`
- const liveInput = await getLiveInput({ meta: { name: trackName }, recording: { mode: "automatic" } })
- userData.obsStream = liveInput
- userData.obsState = 'live'
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'obs' })
- streamOptions.isLiveStreaming = true
- // sfxService.playAudio(SoundEffect.StartedSharingScreen)
- waitOneSecondObs()
- checkForActiveTracks()
- //TODO: show alert
- // dialogService.openDialog({
- // title: 'Streaming Information',
- // message: `URL: + ${liveInput.webRTC.url}`,
- // okText: 'OK'
- // }, {
- // disableClose: true
- // })
- }
+ if (streamOptions.hasWaitedOneSecondObs) {
+ waitOneSecondObs()
+ const trackName = `obs-${userData.id}`
+ const liveInput = await getLiveInput({
+ meta: { name: trackName },
+ recording: { mode: 'automatic' }
+ })
+ userData.obsStream = liveInput
+ userData.obsState = 'live'
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'obs' })
+ streamOptions.isLiveStreaming = true
+ // sfxService.playAudio(SoundEffect.StartedSharingScreen)
+ waitOneSecondObs()
+ checkForActiveTracks()
+ //TODO: show alert
+ // dialogService.openDialog({
+ // title: 'Streaming Information',
+ // message: `URL: + ${liveInput.webRTC.url}`,
+ // okText: 'OK'
+ // }, {
+ // disableClose: true
+ // })
+ }
}
async function stopObsStream(state = 'hibernate') {
- await deleteLiveInput({ inputId: userData.obsStream?.uid })
- streamOptions.isLiveStreaming = false
- userData.obsStream = null
- userData.obsState = state
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'obs' })
- detachTrack({ memberId: userData.id, trackType: 'obs' })
- checkForActiveTracks()
+ await deleteLiveInput({ inputId: userData.obsStream?.uid })
+ streamOptions.isLiveStreaming = false
+ userData.obsStream = null
+ userData.obsState = state
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'obs' })
+ detachTrack({ memberId: userData.id, trackType: 'obs' })
+ checkForActiveTracks()
}
async function startScreenStream() {
- if (streamOptions.hasWaitedOneSecondScreen) {
- waitOneSecondScreen()
- const trackName = `screen-${userData.id}`
- const liveInput = await getLiveInput({ meta: { name: trackName }, recording: { mode: "automatic" } })
- userData.screenStream = liveInput
- const videoElement = createVideoElement({ memberId: userData.id, trackType: 'screen' })
- //TODO: add WHIPClient
- // const input = new WHIPClient(liveInput.webRTC.url, videoElement, 'screen')
- userData.screenState = 'live'
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'screen' })
- // userData.screenStream.on('stopped', () => {
- // stopScreenStream()
- // })
- streamOptions.isLiveStreaming = true
- // sfxService.playAudio(SoundEffect.StartedSharingScreen)
- waitOneSecondScreen()
- checkForActiveTracks()
- }
-}
-
-function createVideoElement({ memberId, trackType }: { memberId: string, trackType: string }): HTMLVideoElement {
- const container = trackType !== 'audio' ? document.getElementById('screen_container') : document.getElementById('audio_container')
- //TODO: get htmlviewelement in sveltekit
- const videoElement: HTMLVideoElement = new HTMLVideoElement()//renderer.createElement('video')
- videoElement.setAttribute('id', `${trackType}-${memberId}`)
- videoElement.setAttribute('autoplay', 'autoplay')
-
- const { matches: isMobile } = window.matchMedia('(max-width: 767px)')
- if (videoElement) {
- if (isMobile) {
- videoElement.style.width = '80%'
- videoElement.style.cssText =
- 'scroll-snap-align: center; width: 80%!important; margin: 0 0.5rem;'
- } else {
- videoElement.style.width = '100%'
- }
- videoElement.addEventListener('dblclick', (event) => {
- if (document.fullscreenElement) {
- document.exitFullscreen()
- } else {
- videoElement.requestFullscreen()
- }
- })
- videoElement.addEventListener('click', (event) => {
- event.preventDefault()
- event.stopPropagation()
- videoElement.scrollIntoView()
- })
- }
-
- container?.append(videoElement)
-
- if (isMobile) {
- const allVideoElements = Array.prototype.slice.call(
- container?.getElementsByTagName('video')
- )
- allVideoElements.forEach((element, i) => {
- if (i === 0) element.style.marginLeft = '10%'
- else element.style.marginLeft = '0.5rem'
- if (allVideoElements.length === i + 1) element.style.marginRight = '10%'
- else element.style.marginRight = '0.5rem'
- })
- }
-
- return videoElement
-}
-
-function attachTrack({ liveInput, memberId, trackType }: { liveInput: any, memberId: string, trackType: string }) {
- const videoElement = createVideoElement({ memberId, trackType })
- //TODO: add WHEPClient
- // const output = new WHEPClient(liveInput.webRTCPlayback.url, videoElement)
-}
-
-function detachTrack({ memberId, trackType }: { memberId: string, trackType: string }) {
- const videoElement = document.getElementById(`${trackType}-${memberId}`)
- videoElement?.remove()
+ if (streamOptions.hasWaitedOneSecondScreen) {
+ waitOneSecondScreen()
+ const trackName = `screen-${userData.id}`
+ const liveInput = await getLiveInput({
+ meta: { name: trackName },
+ recording: { mode: 'automatic' }
+ })
+ userData.screenStream = liveInput
+ const videoElement = createVideoElement({ memberId: userData.id, trackType: 'screen' })
+ //TODO: add WHIPClient
+ // const input = new WHIPClient(liveInput.webRTC.url, videoElement, 'screen')
+ userData.screenState = 'live'
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'screen' })
+ // userData.screenStream.on('stopped', () => {
+ // stopScreenStream()
+ // })
+ streamOptions.isLiveStreaming = true
+ // sfxService.playAudio(SoundEffect.StartedSharingScreen)
+ waitOneSecondScreen()
+ checkForActiveTracks()
+ }
+}
+
+function createVideoElement({
+ memberId,
+ trackType
+}: {
+ memberId: string
+ trackType: string
+}): HTMLVideoElement {
+ const container =
+ trackType !== 'audio'
+ ? document.getElementById('screen_container')
+ : document.getElementById('audio_container')
+ //TODO: get htmlviewelement in sveltekit
+ const videoElement: HTMLVideoElement = new HTMLVideoElement() //renderer.createElement('video')
+ videoElement.setAttribute('id', `${trackType}-${memberId}`)
+ videoElement.setAttribute('autoplay', 'autoplay')
+
+ const { matches: isMobile } = window.matchMedia('(max-width: 767px)')
+ if (videoElement) {
+ if (isMobile) {
+ videoElement.style.width = '80%'
+ videoElement.style.cssText =
+ 'scroll-snap-align: center; width: 80%!important; margin: 0 0.5rem;'
+ } else {
+ videoElement.style.width = '100%'
+ }
+ videoElement.addEventListener('dblclick', (event) => {
+ if (document.fullscreenElement) {
+ document.exitFullscreen()
+ } else {
+ videoElement.requestFullscreen()
+ }
+ })
+ videoElement.addEventListener('click', (event) => {
+ event.preventDefault()
+ event.stopPropagation()
+ videoElement.scrollIntoView()
+ })
+ }
+
+ container?.append(videoElement)
+
+ if (isMobile) {
+ const allVideoElements = Array.prototype.slice.call(container?.getElementsByTagName('video'))
+ allVideoElements.forEach((element, i) => {
+ if (i === 0) element.style.marginLeft = '10%'
+ else element.style.marginLeft = '0.5rem'
+ if (allVideoElements.length === i + 1) element.style.marginRight = '10%'
+ else element.style.marginRight = '0.5rem'
+ })
+ }
+
+ return videoElement
+}
+
+function attachTrack({
+ liveInput,
+ memberId,
+ trackType
+}: {
+ liveInput: any
+ memberId: string
+ trackType: string
+}) {
+ const videoElement = createVideoElement({ memberId, trackType })
+ //TODO: add WHEPClient
+ // const output = new WHEPClient(liveInput.webRTCPlayback.url, videoElement)
+}
+
+function detachTrack({ memberId, trackType }: { memberId: string; trackType: string }) {
+ const videoElement = document.getElementById(`${trackType}-${memberId}`)
+ videoElement?.remove()
}
async function stopScreenStream(state = 'hibernate') {
- await deleteLiveInput({ inputId: userData.screenStream?.uid })
- streamOptions.isLiveStreaming = false
- userData.screenStream = null
- userData.screenState = state
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'screen' })
- detachTrack({ memberId: userData.id, trackType: 'screen' })
- checkForActiveTracks()
+ await deleteLiveInput({ inputId: userData.screenStream?.uid })
+ streamOptions.isLiveStreaming = false
+ userData.screenStream = null
+ userData.screenState = state
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'screen' })
+ detachTrack({ memberId: userData.id, trackType: 'screen' })
+ checkForActiveTracks()
}
async function startWebcamStream() {
- if (streamOptions.hasWaitedOneSecondWebcam) {
- waitOneSecondWebcam()
- const trackName = `webcam-${userData.id}`
- const liveInput = await getLiveInput({ meta: { name: trackName }, recording: { mode: "automatic" } })
- userData.webcamStream = liveInput
- const videoElement = createVideoElement({ memberId: userData.id, trackType: 'webcam' })
- //TODO: add WHIPClient
- // const input = new WHIPClient(liveInput.webRTC.url, videoElement, 'webcam')
- userData.screenState = 'live'
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'webcam' })
- // userData.webcamStream.on('stopped', () => {
- // stopWebcamStream()
- // })
- waitOneSecondWebcam()
- checkForActiveTracks()
- }
+ if (streamOptions.hasWaitedOneSecondWebcam) {
+ waitOneSecondWebcam()
+ const trackName = `webcam-${userData.id}`
+ const liveInput = await getLiveInput({
+ meta: { name: trackName },
+ recording: { mode: 'automatic' }
+ })
+ userData.webcamStream = liveInput
+ const videoElement = createVideoElement({ memberId: userData.id, trackType: 'webcam' })
+ //TODO: add WHIPClient
+ // const input = new WHIPClient(liveInput.webRTC.url, videoElement, 'webcam')
+ userData.screenState = 'live'
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'webcam' })
+ // userData.webcamStream.on('stopped', () => {
+ // stopWebcamStream()
+ // })
+ waitOneSecondWebcam()
+ checkForActiveTracks()
+ }
}
async function stopWebcamStream(state = 'hibernate') {
- await deleteLiveInput({ inputId: userData.webcamStream?.uid })
- userData.webcamStream = null
- userData.webcamState = state
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'webcam' })
- detachTrack({ memberId: userData.id, trackType: 'webcam' })
- checkForActiveTracks()
+ await deleteLiveInput({ inputId: userData.webcamStream?.uid })
+ userData.webcamStream = null
+ userData.webcamState = state
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'webcam' })
+ detachTrack({ memberId: userData.id, trackType: 'webcam' })
+ checkForActiveTracks()
}
async function startAudioStream() {
- if (streamOptions.hasWaitedOneSecondAudio) {
- waitOneSecondAudio()
- const trackName = `audio-${userData.id}`
- const liveInput = await getLiveInput({ meta: { name: trackName }, recording: { mode: "automatic" } })
- userData.audioStream = liveInput
- const videoElement = createVideoElement({ memberId: userData.id, trackType: 'audio' })
- //TODO: add WHIPClient
- // const input = new WHIPClient(liveInput.webRTC.url, videoElement, 'audio')
- userData.audioState = 'live'
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'audio' })
- // userData.audioStream.onended = () => {
- // stopAudioStream()
- // }
- waitOneSecondAudio()
- checkForActiveTracks()
- }
+ if (streamOptions.hasWaitedOneSecondAudio) {
+ waitOneSecondAudio()
+ const trackName = `audio-${userData.id}`
+ const liveInput = await getLiveInput({
+ meta: { name: trackName },
+ recording: { mode: 'automatic' }
+ })
+ userData.audioStream = liveInput
+ const videoElement = createVideoElement({ memberId: userData.id, trackType: 'audio' })
+ //TODO: add WHIPClient
+ // const input = new WHIPClient(liveInput.webRTC.url, videoElement, 'audio')
+ userData.audioState = 'live'
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'audio' })
+ // userData.audioStream.onended = () => {
+ // stopAudioStream()
+ // }
+ waitOneSecondAudio()
+ checkForActiveTracks()
+ }
}
async function stopAudioStream(state = 'hibernate') {
- await deleteLiveInput({ inputId: userData.audioStream?.uid })
- userData.audioStream = null
- userData.audioState = state
- updateUserInRoom(userData)
- sendDataToRoom({ type: 'toggleTrack', trackType: 'audio' })
- detachTrack({ memberId: userData.id, trackType: 'audio' })
- checkForActiveTracks()
+ await deleteLiveInput({ inputId: userData.audioStream?.uid })
+ userData.audioStream = null
+ userData.audioState = state
+ updateUserInRoom(userData)
+ sendDataToRoom({ type: 'toggleTrack', trackType: 'audio' })
+ detachTrack({ memberId: userData.id, trackType: 'audio' })
+ checkForActiveTracks()
}
//TODO: uncomment when adding video recording or when time limit for live streams
function checkForActiveTracks() {
- // hasActiveTracks = roomMembers.some(member => member.screenStream != null || member.webcamStream != null || member.audioStream != null)
- // if (!hasActiveTracks) endRecording()
+ // hasActiveTracks = roomMembers.some(member => member.screenStream != null || member.webcamStream != null || member.audioStream != null)
+ // if (!hasActiveTracks) endRecording()
}
async function leaveRoom() {
- // if (channelStore.currentChannel) {
- disconnected()
- stopObsStream()
- stopScreenStream()
- stopWebcamStream()
- stopAudioStream()
- //TODO: fix subscribring to room members writeable
- // if (roomMembersSubscription) {
- // roomMembersSubscription.unsubscribe()
- // }
- // if (userActionsSubscription) {
- // userActionsSubscription.unsubscribe()
- // }
- // }
+ // if (channelStore.currentChannel) {
+ disconnected()
+ stopObsStream()
+ stopScreenStream()
+ stopWebcamStream()
+ stopAudioStream()
+ //TODO: fix subscribring to room members writeable
+ // if (roomMembersSubscription) {
+ // roomMembersSubscription.unsubscribe()
+ // }
+ // if (userActionsSubscription) {
+ // userActionsSubscription.unsubscribe()
+ // }
+ // }
}
function toggleRaiseHand() {
- if (streamOptions.hasWaitedOneSecondRaiseHand) {
- waitOneSecondRaiseHand()
- // sfxService.playAudio(SoundEffect.AskedToSpeak)
- sendDataToRoom({
- type: 'toggleRaiseHand',
- userId: userData.id,
- isHandRaised: true
- })
- }
+ if (streamOptions.hasWaitedOneSecondRaiseHand) {
+ waitOneSecondRaiseHand()
+ // sfxService.playAudio(SoundEffect.AskedToSpeak)
+ sendDataToRoom({
+ type: 'toggleRaiseHand',
+ userId: userData.id,
+ isHandRaised: true
+ })
+ }
}
function toggleSilenceOnEveryone() {
- if (streamOptions.hasWaitedOneSecondSilence) {
- waitOneSecondSilence()
- streamOptions.isEveryoneSilenced = !streamOptions.isEveryoneSilenced
- sendDataToRoom({
- type: 'toggleSilenceOnEveryone',
- isEveryoneSilenced: streamOptions.isEveryoneSilenced
- })
- //TODO: fix channel writeable
- // channelStore.updateChannelProperties({
- // channelId: channelStore.currentChannel._id,
- // updatedProperties: {
- // isEveryoneSilenced: streamOptions.isEveryoneSilenced
- // }
- // })
- }
-}
-
-function toggleUserType({ user, isHandRaised = false }: { user: any, isHandRaised: boolean }) {
- //TODO: fix channel writeable
- // if (user.userType === 'listener' || isHandRaised) {
- // user.userType = 'participant'
- // user.isHandRaised = false
- // socketStore.emitRoomMemberUpdate({
- // channelId: channelStore.currentChannel._id,
- // userData: user,
- // isNewUser: true
- // })
- // } else if (user.userType === 'participant') {
- // user.userType = 'listener'
- // socketStore.emitRoomMemberUpdate({
- // channelId: channelStore.currentChannel._id,
- // userData: user,
- // isNewUser: false
- // })
- // }
-}
-
-function toggleRestriction({ user, featureType }: { user: any, featureType: string }) {
- let featureState = 'hibernate'
- switch (featureType) {
- case 'screen':
- if (user.screenState === 'restricted') {
- featureState = 'hibernate'
- } else {
- featureState = 'restricted'
- }
- user.screenState = featureState
- break
- case 'webcam':
- if (user.webcamState === 'restricted') {
- featureState = 'hibernate'
- } else {
- featureState = 'restricted'
- }
- user.webcamState = featureState
- break
- case 'audio':
- if (user.audioState === 'restricted') {
- featureState = 'hibernate'
- } else {
- featureState = 'restricted'
- }
- user.audioState = featureState
- break
- }
- sendDataToRoom({
- type: 'toggleRestriction',
- userId: user.id,
- featureType: featureType,
- featureState: featureState
- })
+ if (streamOptions.hasWaitedOneSecondSilence) {
+ waitOneSecondSilence()
+ streamOptions.isEveryoneSilenced = !streamOptions.isEveryoneSilenced
+ sendDataToRoom({
+ type: 'toggleSilenceOnEveryone',
+ isEveryoneSilenced: streamOptions.isEveryoneSilenced
+ })
+ //TODO: fix channel writeable
+ // channelStore.updateChannelProperties({
+ // channelId: channelStore.currentChannel._id,
+ // updatedProperties: {
+ // isEveryoneSilenced: streamOptions.isEveryoneSilenced
+ // }
+ // })
+ }
+}
+
+function toggleUserType({ user, isHandRaised = false }: { user: any; isHandRaised: boolean }) {
+ //TODO: fix channel writeable
+ // if (user.userType === 'listener' || isHandRaised) {
+ // user.userType = 'participant'
+ // user.isHandRaised = false
+ // socketStore.emitRoomMemberUpdate({
+ // channelId: channelStore.currentChannel._id,
+ // userData: user,
+ // isNewUser: true
+ // })
+ // } else if (user.userType === 'participant') {
+ // user.userType = 'listener'
+ // socketStore.emitRoomMemberUpdate({
+ // channelId: channelStore.currentChannel._id,
+ // userData: user,
+ // isNewUser: false
+ // })
+ // }
+}
+
+function toggleRestriction({ user, featureType }: { user: any; featureType: string }) {
+ let featureState = 'hibernate'
+ switch (featureType) {
+ case 'screen':
+ if (user.screenState === 'restricted') {
+ featureState = 'hibernate'
+ } else {
+ featureState = 'restricted'
+ }
+ user.screenState = featureState
+ break
+ case 'webcam':
+ if (user.webcamState === 'restricted') {
+ featureState = 'hibernate'
+ } else {
+ featureState = 'restricted'
+ }
+ user.webcamState = featureState
+ break
+ case 'audio':
+ if (user.audioState === 'restricted') {
+ featureState = 'hibernate'
+ } else {
+ featureState = 'restricted'
+ }
+ user.audioState = featureState
+ break
+ }
+ sendDataToRoom({
+ type: 'toggleRestriction',
+ userId: user.id,
+ featureType: featureType,
+ featureState: featureState
+ })
}
function sendDataToRoom(message: any) {
- // if (channelStore.currentChannel) {
- emitUserActions({
- channelId: '',//TODO: get channelId from writeable channelStore.currentChannel._id,
- userData: userData,
- message: JSON.stringify(message)
- })
- // }
+ // if (channelStore.currentChannel) {
+ emitUserActions({
+ channelId: '', //TODO: get channelId from writeable channelStore.currentChannel._id,
+ userData: userData,
+ message: JSON.stringify(message)
+ })
+ // }
}
async function waitOneSecondObs() {
- streamOptions.hasWaitedOneSecondObs = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondObs = true
- }, 1500)
+ streamOptions.hasWaitedOneSecondObs = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondObs = true
+ }, 1500)
}
async function waitOneSecondScreen() {
- streamOptions.hasWaitedOneSecondScreen = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondScreen = true
- }, 1500)
+ streamOptions.hasWaitedOneSecondScreen = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondScreen = true
+ }, 1500)
}
async function waitOneSecondWebcam() {
- streamOptions.hasWaitedOneSecondWebcam = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondWebcam = true
- }, 1500)
+ streamOptions.hasWaitedOneSecondWebcam = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondWebcam = true
+ }, 1500)
}
async function waitOneSecondAudio() {
- streamOptions.hasWaitedOneSecondAudio = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondAudio = true
- }, 1500)
+ streamOptions.hasWaitedOneSecondAudio = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondAudio = true
+ }, 1500)
}
async function waitOneSecondRecord() {
- streamOptions.hasWaitedOneSecondRecord = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondRecord = true
- }, 1500)
+ streamOptions.hasWaitedOneSecondRecord = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondRecord = true
+ }, 1500)
}
async function waitOneSecondRaiseHand() {
- streamOptions.hasWaitedOneSecondRaiseHand = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondRaiseHand = true
- }, 3000)
+ streamOptions.hasWaitedOneSecondRaiseHand = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondRaiseHand = true
+ }, 3000)
}
async function waitOneSecondSilence() {
- streamOptions.hasWaitedOneSecondSilence = false
- setTimeout(async () => {
- streamOptions.hasWaitedOneSecondSilence = true
- }, 3000)
+ streamOptions.hasWaitedOneSecondSilence = false
+ setTimeout(async () => {
+ streamOptions.hasWaitedOneSecondSilence = true
+ }, 3000)
}
-async function createLiveStream({ channelId, title }: { channelId: string, title: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/streams`, {
- method: 'POST',
- body: JSON.stringify({ channel: channelId, title })
- }).then(async response => {
- const res = await response.json()
- videoStreamId = res._id
- })
+async function createLiveStream({ channelId, title }: { channelId: string; title: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/streams`, {
+ method: 'POST',
+ body: JSON.stringify({ channel: channelId, title })
+ }).then(async (response) => {
+ const res = await response.json()
+ videoStreamId = res._id
+ })
}
async function updateLiveStream() {
- if (videoStreamId) {
- return await fetch(`${env.PUBLIC_API_URL}/streams/${videoStreamId}/end`, {})
- }
+ if (videoStreamId) {
+ return await fetch(`${env.PUBLIC_API_URL}/streams/${videoStreamId}/end`, {})
+ }
}
async function getLiveInput(trackData: any) {
- return await fetch(`${env.PUBLIC_API_URL}/cloudflare/live-input`, {
- method: 'POST',
- body: JSON.stringify(trackData)
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/cloudflare/live-input`, {
+ method: 'POST',
+ body: JSON.stringify(trackData)
+ }).then((response) => response.json())
}
async function deleteLiveInput({ inputId }: { inputId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/cloudflare/live-input?inputId=${inputId}`, {
- method: 'DELETE'
- })
+ return await fetch(`${env.PUBLIC_API_URL}/cloudflare/live-input?inputId=${inputId}`, {
+ method: 'DELETE'
+ })
}
export {
- initRoomMembers,
- disconnected,
- updateUserInRoom,
- startObsStream,
- stopObsStream,
- startScreenStream,
- stopScreenStream,
- startWebcamStream,
- stopWebcamStream,
- startAudioStream,
- stopAudioStream,
- leaveRoom,
- toggleRaiseHand,
- toggleSilenceOnEveryone,
- toggleUserType,
- toggleRestriction,
- waitOneSecondObs,
- waitOneSecondScreen,
- waitOneSecondWebcam,
- waitOneSecondAudio,
- waitOneSecondRecord,
- waitOneSecondRaiseHand,
- waitOneSecondSilence,
- createLiveStream,
- updateLiveStream,
- getLiveInput,
- deleteLiveInput
-}
\ No newline at end of file
+ initRoomMembers,
+ disconnected,
+ updateUserInRoom,
+ startObsStream,
+ stopObsStream,
+ startScreenStream,
+ stopScreenStream,
+ startWebcamStream,
+ stopWebcamStream,
+ startAudioStream,
+ stopAudioStream,
+ leaveRoom,
+ toggleRaiseHand,
+ toggleSilenceOnEveryone,
+ toggleUserType,
+ toggleRestriction,
+ waitOneSecondObs,
+ waitOneSecondScreen,
+ waitOneSecondWebcam,
+ waitOneSecondAudio,
+ waitOneSecondRecord,
+ waitOneSecondRaiseHand,
+ waitOneSecondSilence,
+ createLiveStream,
+ updateLiveStream,
+ getLiveInput,
+ deleteLiveInput
+}
diff --git a/src/lib/stores/subscribeStore.ts b/src/lib/stores/subscribeStore.ts
new file mode 100644
index 00000000..11928fdc
--- /dev/null
+++ b/src/lib/stores/subscribeStore.ts
@@ -0,0 +1,85 @@
+import { env } from '$env/dynamic/public'
+
+async function createFollow({ source1, source2 }: { source1: string; source2: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/subscribe`, {
+ method: 'PUT',
+ body: JSON.stringify({ source1, source2 })
+ }).then((response) => response.json())
+}
+
+async function getFollows({
+ source,
+ sourceType,
+ searchQuery,
+ skip,
+ limit
+}: {
+ source: string
+ sourceType: string
+ searchQuery: string
+ skip: string
+ limit: string
+}) {
+ return await fetch(
+ `${env.PUBLIC_API_URL}/subscribe?source=${source}&sourceType=${sourceType}&searchQuery=${searchQuery}&skip=${skip}&limit=${limit}`,
+ {
+ method: 'GET'
+ }
+ ).then((response) => response.json())
+}
+
+async function getFollowCount({ source, sourceType }: { source: string; sourceType: string }) {
+ return await fetch(
+ `${env.PUBLIC_API_URL}/subscribe/count?source=${source}&sourceType=${sourceType}`,
+ {
+ method: 'GET'
+ }
+ ).then((response) => response.json())
+}
+
+async function deleteFollow({ source1, source2 }: { source1: string; source2: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/subscribe?source1=${source1}&source2=${source2}`, {
+ method: 'DELETE'
+ }).then((response) => response.json())
+}
+
+async function getFollowRelationship({ source }: { source: string }) {
+ return await fetch(`${env.PUBLIC_API_URL}/subscribe/relationship?source=${source}`, {
+ method: 'GET'
+ }).then((response) => response.json())
+}
+
+async function toggleFollow({
+ subscribe,
+ senderId,
+ userId
+}: {
+ subscribe: any
+ senderId: string
+ userId: string
+}) {
+ if (subscribe) {
+ if (!subscribe.isFollowing) {
+ await createFollow({
+ source1: senderId,
+ source2: userId
+ })
+ subscribe.isFollowing = true
+ } else {
+ await deleteFollow({
+ source1: senderId,
+ source2: userId
+ })
+ subscribe.isFollowing = false
+ }
+ }
+}
+
+export {
+ createFollow,
+ getFollows,
+ getFollowCount,
+ deleteFollow,
+ getFollowRelationship,
+ toggleFollow
+}
diff --git a/src/lib/stores/transactionStore.ts b/src/lib/stores/transactionStore.ts
index daefef3c..731bb4f9 100644
--- a/src/lib/stores/transactionStore.ts
+++ b/src/lib/stores/transactionStore.ts
@@ -1,33 +1,47 @@
import { env } from '$env/dynamic/public'
-async function createTransaction({ url, type, amount, receiverId, receiverName, senderId, senderName, channelId }
- : { url: string, type: string, amount: string, receiverId: string, receiverName: string, senderId: string, senderName: string, channelId: string }) {
- url = `https://explorer.solana.com/tx/${url}?cluster=devnet`
- const data = {
- channelId: channelId,
- url: url,
- date: new Date().toLocaleDateString(),
- receiverId: receiverId,
- receiverName: receiverName,
- senderId: senderId,
- senderName: senderName,
- amount: amount,
- type: type
- }
- return await fetch(`${env.PUBLIC_API_URL}/transactions`, {
- method: 'POST',
- body: JSON.stringify(data)
- }).then(response => response.json())
+async function createTransaction({
+ url,
+ type,
+ amount,
+ receiverId,
+ receiverName,
+ senderId,
+ senderName,
+ channelId
+}: {
+ url: string
+ type: string
+ amount: string
+ receiverId: string
+ receiverName: string
+ senderId: string
+ senderName: string
+ channelId: string
+}) {
+ url = `https://explorer.solana.com/tx/${url}?cluster=devnet`
+ const data = {
+ channelId: channelId,
+ url: url,
+ date: new Date().toLocaleDateString(),
+ receiverId: receiverId,
+ receiverName: receiverName,
+ senderId: senderId,
+ senderName: senderName,
+ amount: amount,
+ type: type
+ }
+ return await fetch(`${env.PUBLIC_API_URL}/transactions`, {
+ method: 'POST',
+ body: JSON.stringify(data)
+ }).then((response) => response.json())
}
//TODO: send userId through header
async function getTransactions() {
- return await fetch(`${env.PUBLIC_API_URL}/transactions`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/transactions`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
-export {
- createTransaction,
- getTransactions
-}
\ No newline at end of file
+export { createTransaction, getTransactions }
diff --git a/src/lib/stores/userStore.ts b/src/lib/stores/userStore.ts
index c3cee3eb..52dba2ef 100644
--- a/src/lib/stores/userStore.ts
+++ b/src/lib/stores/userStore.ts
@@ -1,77 +1,84 @@
import { env } from '$env/dynamic/public'
async function getUserById({ userId }: { userId: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/users/search/id?userId=${userId}`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/users/search/id?userId=${userId}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
async function getUsersByIds({ userIds }: { userIds: Array }) {
- return await fetch(`${env.PUBLIC_API_URL}/users/search/ids`, {
- method: 'POST',
- body: JSON.stringify({ userIds })
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/users/search/ids`, {
+ method: 'POST',
+ body: JSON.stringify({ userIds })
+ }).then((response) => response.json())
}
async function getUsersByName({ name }: { name: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/users/search/name?name=${name}`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/users/search/name?name=${name}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
async function getUserByUsername({ username }: { username: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/users/search/username?username=${username}`, {
- method: 'GET'
- }).then(response => response.json())
+ return await fetch(`${env.PUBLIC_API_URL}/users/search/username?username=${username}`, {
+ method: 'GET'
+ }).then((response) => response.json())
+}
+
+async function getHighestRankedUsers({ skip = 0, limit = 50 }: { skip: number; limit: number }) {
+ return await fetch(`${env.PUBLIC_API_URL}/users/highest-ranked?skip=${skip}&limit=${limit}`, {
+ method: 'GET'
+ }).then((response) => response.json())
}
async function updateUser(body: any) {
- return await fetch(`${env.PUBLIC_API_URL}/users/current`, {
- method: 'PATCH',
- body: JSON.stringify(body)
- }).then(async response => {
- //TODO: update user in auth service
- const userUpdate = await response.json()
- // this.authService.setUser(userUpdate)
- return userUpdate
- })
+ return await fetch(`${env.PUBLIC_API_URL}/users/current`, {
+ method: 'PATCH',
+ body: JSON.stringify(body)
+ }).then(async (response) => {
+ //TODO: update user in auth service
+ const userUpdate = await response.json()
+ // this.authService.setUser(userUpdate)
+ return userUpdate
+ })
}
-async function updateAvatar({ fileToUpload, fileName }: { fileToUpload: any, fileName: string }) {
- const formData: FormData = new FormData()
- formData.append('file', fileToUpload, fileName)
- formData.append('bucketName', 'avatars')
- return await fetch(`${env.PUBLIC_API_URL}/users/current/avatar`, {
- method: 'PUT',
- body: formData
- }).then(async response => {
- //TODO: update user in auth service
- const userUpdate = await response.json()
- // this.authService.setUser(userUpdate)
- return userUpdate
- })
+async function updateAvatar({ fileToUpload, fileName }: { fileToUpload: any; fileName: string }) {
+ const formData: FormData = new FormData()
+ formData.append('file', fileToUpload, fileName)
+ formData.append('bucketName', 'avatars')
+ return await fetch(`${env.PUBLIC_API_URL}/users/current/avatar`, {
+ method: 'PUT',
+ body: formData
+ }).then(async (response) => {
+ //TODO: update user in auth service
+ const userUpdate = await response.json()
+ // this.authService.setUser(userUpdate)
+ return userUpdate
+ })
}
async function updateUsername({ username }: { username: string }) {
- return await fetch(`${env.PUBLIC_API_URL}/users/current/username`, {
- method: 'PATCH',
- body: JSON.stringify({ username })
- }).then(async response => {
- //TODO: update user in auth service
- const userUpdate = await response.json()
- // if (!userUpdate.exists) {
- // this.authService.setUser(userUpdate)
- // }
- return userUpdate
- })
+ return await fetch(`${env.PUBLIC_API_URL}/users/current/username`, {
+ method: 'PATCH',
+ body: JSON.stringify({ username })
+ }).then(async (response) => {
+ //TODO: update user in auth service
+ const userUpdate = await response.json()
+ // if (!userUpdate.exists) {
+ // this.authService.setUser(userUpdate)
+ // }
+ return userUpdate
+ })
}
export {
- getUserById,
- getUsersByIds,
- getUsersByName,
- getUserByUsername,
- updateUser,
- updateAvatar,
- updateUsername
-}
\ No newline at end of file
+ getUserById,
+ getUsersByIds,
+ getUsersByName,
+ getUserByUsername,
+ getHighestRankedUsers,
+ updateUser,
+ updateAvatar,
+ updateUsername
+}
diff --git a/src/lib/stores/videoStore.ts b/src/lib/stores/videoStore.ts
deleted file mode 100644
index 88d19406..00000000
--- a/src/lib/stores/videoStore.ts
+++ /dev/null
@@ -1 +0,0 @@
-import { writable } from 'svelte/store'
\ No newline at end of file
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
new file mode 100644
index 00000000..fc219ce4
--- /dev/null
+++ b/src/lib/utils.ts
@@ -0,0 +1,17 @@
+export const levelAndBarValueFromExp = (
+ currentExp: number
+): { level: number; barValue: number } => {
+ const level = Math.floor(0.5 * Math.sqrt(currentExp)) + 1
+ const currentLevelExp = Math.pow(level - 1, 2) * 100
+ const nextLevelExp = Math.pow(level, 2) * 100
+ const expDifference = nextLevelExp - currentLevelExp
+ const expProgress = (currentExp - currentLevelExp) / expDifference
+ const barValue = Math.round(expProgress * 100)
+
+ return { level, barValue }
+}
+
+export const colorFromLevel = (level: number): string => {
+ const hue = (360 * (level * 0.6180339887498949)) % 360
+ return `hsl(${hue}, 100%, 50%)`
+}
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
index ee327252..ea426acd 100644
--- a/src/routes/+error.svelte
+++ b/src/routes/+error.svelte
@@ -2,4 +2,4 @@
import { page } from '$app/stores'
-{$page.error?.message}
\ No newline at end of file
+{$page.error?.message}
diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts
index 74991e1b..533dee94 100644
--- a/src/routes/+layout.server.ts
+++ b/src/routes/+layout.server.ts
@@ -1,7 +1,9 @@
import type { LayoutServerLoad } from './$types'
export const load: LayoutServerLoad = async ({ locals }) => {
+ // console.log('locals', locals)
return {
- user: locals.user
+ user: locals.user,
+ isBanned: locals.isBanned
}
}
diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte
index 934a3985..92649c5d 100644
--- a/src/routes/+layout.svelte
+++ b/src/routes/+layout.svelte
@@ -1,42 +1,23 @@
-
@@ -86,184 +87,26 @@
+
+ {#if data && data.isBanned}
+
+
+
+
Your account is banned
+
+
+
+ {/if}
+
-
+ {#if !$page.url.pathname.includes('/channel')}
+
+ {:else}
+
+ {/if}
diff --git a/src/routes/browse/+page.server.ts b/src/routes/browse/+page.server.ts
index 086fd1d4..ff822570 100644
--- a/src/routes/browse/+page.server.ts
+++ b/src/routes/browse/+page.server.ts
@@ -1,13 +1,28 @@
-import { error } from '@sveltejs/kit'
import type { PageServerLoad } from './$types'
-import { getMyChannels, getChannels } from '$lib/stores/channelStore'
+import { get } from '$lib/api'
-export const load = (async ({ params }) => {
- // const post = await getChannels()
+export const load = (async ({ locals }) => {
+ const mostActiveChannels = await get(`channels/most-active?skip=${0}&limit=${5}`)
+ const weeklyChannels = await get(`channels/weekly?skip=${0}&limit=${10}`)
+ const highestRankedUsers = await get(`users/highest-ranked?skip=${0}&limit=${10}`)
+ const risingStarUsers = await get(`users/rising-stars?skip=${0}&limit=${10}`)
+ let myChannels = []
+ let favChannels = []
+ if (locals.user) {
+ myChannels = await get(`channels/me/hosted?skip=${0}&limit=${10}`)
+ favChannels = await get(`channels/me/fav?skip=${0}&limit=${10}`)
+ }
+ const tableChannels = await get(`channels?searchQuery=&skip=${0}&limit=${50}`)
- // if (post) {
- // return post
- // }
-
- // throw error(404, 'Not found')
-}) satisfies PageServerLoad
\ No newline at end of file
+ return {
+ post: {
+ mostActiveChannels,
+ weeklyChannels,
+ highestRankedUsers,
+ risingStarUsers,
+ myChannels,
+ favChannels,
+ tableChannels
+ }
+ }
+}) satisfies PageServerLoad
diff --git a/src/routes/browse/+page.svelte b/src/routes/browse/+page.svelte
index 42965b48..796c13a2 100644
--- a/src/routes/browse/+page.svelte
+++ b/src/routes/browse/+page.svelte
@@ -1,26 +1,45 @@
-
-
+
+
+
+
+
+
+
+
+
+{#if current_user}
+
-
-
-
-
+
+{/if}
-
+
diff --git a/src/routes/channel/[channelId]/+page.server.ts b/src/routes/channel/[channelId]/+page.server.ts
index 22dd40eb..24dac332 100644
--- a/src/routes/channel/[channelId]/+page.server.ts
+++ b/src/routes/channel/[channelId]/+page.server.ts
@@ -1,12 +1,13 @@
import { error } from '@sveltejs/kit'
import type { PageServerLoad } from './$types'
-
+import { getChannel } from '$lib/stores/channelStore'
+
export const load = (async ({ params }) => {
- // const post = null
-
- // if (post) {
- // return post
- // }
-
- // throw error(404, 'Not found')
-}) satisfies PageServerLoad
\ No newline at end of file
+ const post = await getChannel({ channelId: params.channelId })
+ if (post) {
+ return {
+ post
+ }
+ }
+ throw error(404, 'Not found')
+}) satisfies PageServerLoad
diff --git a/src/routes/channel/[channelId]/+page.svelte b/src/routes/channel/[channelId]/+page.svelte
index 42f7dad7..2fd78059 100644
--- a/src/routes/channel/[channelId]/+page.svelte
+++ b/src/routes/channel/[channelId]/+page.svelte
@@ -1 +1,56 @@
-
Welcome to channel page
+
+
+
+
+
+
+
+
+ {#if showDrawer}
+
+ {/if}
+
diff --git a/src/routes/creator-space/+page.server.ts b/src/routes/creator-space/+page.server.ts
deleted file mode 100644
index 22dd40eb..00000000
--- a/src/routes/creator-space/+page.server.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { error } from '@sveltejs/kit'
-import type { PageServerLoad } from './$types'
-
-export const load = (async ({ params }) => {
- // const post = null
-
- // if (post) {
- // return post
- // }
-
- // throw error(404, 'Not found')
-}) satisfies PageServerLoad
\ No newline at end of file
diff --git a/src/routes/creator-space/+page.svelte b/src/routes/creator-space/+page.svelte
deleted file mode 100644
index 9942ad79..00000000
--- a/src/routes/creator-space/+page.svelte
+++ /dev/null
@@ -1 +0,0 @@
-
Welcome to creator-space page
diff --git a/src/routes/legal/+page.server.ts b/src/routes/legal/+page.server.ts
index dc6d9bd3..4b3740d1 100644
--- a/src/routes/legal/+page.server.ts
+++ b/src/routes/legal/+page.server.ts
@@ -1,20 +1,32 @@
import { error } from '@sveltejs/kit'
import type { PageServerLoad } from './$types'
-import { getLegalDocs } from '../../lib/stores/adminStore'
+import { getLegalDocs } from '$lib/stores/adminStore'
export const load = (async () => {
- // const post = await getLegalDocs()
- const post = [
- { name: "Privacy Policy", url: "https://code-crow-legal-docs.s3.amazonaws.com/legal/privacy.pdf" },
- { name: "Cookie Policy", url: "https://code-crow-legal-docs.s3.amazonaws.com/legal/cookie.pdf" },
- { name: "Copyright Policy", url: "https://code-crow-legal-docs.s3.amazonaws.com/legal/copyright.pdf" },
- { name: "GDPR Policy", url: "https://code-crow-legal-docs.s3.amazonaws.com/legal/gdpr.pdf" },
- { name: "Terms of Service", url: "https://code-crow-legal-docs.s3.amazonaws.com/legal/terms.pdf" }
- ]
- if (post) {
- return {
- post
- }
- }
- throw error(404, 'Not found')
-}) satisfies PageServerLoad
\ No newline at end of file
+ // const post = await getLegalDocs()
+ const post = [
+ {
+ name: 'Privacy Policy',
+ url: 'https://code-crow-legal-docs.s3.amazonaws.com/legal/privacy.pdf'
+ },
+ {
+ name: 'Cookie Policy',
+ url: 'https://code-crow-legal-docs.s3.amazonaws.com/legal/cookie.pdf'
+ },
+ {
+ name: 'Copyright Policy',
+ url: 'https://code-crow-legal-docs.s3.amazonaws.com/legal/copyright.pdf'
+ },
+ { name: 'GDPR Policy', url: 'https://code-crow-legal-docs.s3.amazonaws.com/legal/gdpr.pdf' },
+ {
+ name: 'Terms of Service',
+ url: 'https://code-crow-legal-docs.s3.amazonaws.com/legal/terms.pdf'
+ }
+ ]
+ if (post) {
+ return {
+ post
+ }
+ }
+ throw error(404, 'Not found')
+}) satisfies PageServerLoad
diff --git a/src/routes/logout/+page.server.ts b/src/routes/logout/+page.server.ts
index e878eb04..7b7fef6e 100644
--- a/src/routes/logout/+page.server.ts
+++ b/src/routes/logout/+page.server.ts
@@ -1,14 +1,13 @@
import { redirect } from '@sveltejs/kit'
-import { userRole, currentUser } from '$lib/stores/authStore'
-
+import { current_user, user_role } from '$lib/stores/authStore'
import type { PageServerLoad } from './$types'
-export const load: PageServerLoad = async ({ cookies }) => {
- userRole.set(null)
- currentUser.set(null)
+export const load = (async ({ cookies }) => {
+ current_user.set(null)
+ user_role.set(null)
// eat the cookie
- const cookieItem = ['token', 'userId']
+ const cookieItem = ['token', 'userId', 'user']
cookieItem.forEach((item) => {
cookies.set(item, '', {
path: '/',
@@ -18,4 +17,4 @@ export const load: PageServerLoad = async ({ cookies }) => {
// redirect the user
throw redirect(302, '/browse')
-}
+}) satisfies PageServerLoad
diff --git a/src/routes/profile/[customUsername]/+page.svelte b/src/routes/profile/[customUsername]/+page.svelte
index 7e8ff31e..d5fa1077 100644
--- a/src/routes/profile/[customUsername]/+page.svelte
+++ b/src/routes/profile/[customUsername]/+page.svelte
@@ -1,10 +1,10 @@
@@ -134,7 +134,7 @@
-
+
@@ -151,13 +151,13 @@
-
+
22Following
+ class="text-sm">Subscribers
-
+
10Followers
+ class="text-sm">Interests
2045
-
+
diff --git a/src/routes/settings/+page.svelte b/src/routes/settings/+page.svelte
index b4f6d0d5..b1386a8d 100644
--- a/src/routes/settings/+page.svelte
+++ b/src/routes/settings/+page.svelte
@@ -42,7 +42,7 @@
checked />
-
1v1 chat
+
diff --git a/src/routes/videos/+page.server.ts b/src/routes/videos/+page.server.ts
deleted file mode 100644
index 22dd40eb..00000000
--- a/src/routes/videos/+page.server.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import { error } from '@sveltejs/kit'
-import type { PageServerLoad } from './$types'
-
-export const load = (async ({ params }) => {
- // const post = null
-
- // if (post) {
- // return post
- // }
-
- // throw error(404, 'Not found')
-}) satisfies PageServerLoad
\ No newline at end of file
diff --git a/src/routes/videos/+page.svelte b/src/routes/videos/+page.svelte
deleted file mode 100644
index 54d706de..00000000
--- a/src/routes/videos/+page.svelte
+++ /dev/null
@@ -1 +0,0 @@
-
Welcome to videos page
diff --git a/static/svg-json/game.json b/static/svg-json/game.json
new file mode 100644
index 00000000..048583ba
--- /dev/null
+++ b/static/svg-json/game.json
@@ -0,0 +1,30 @@
+{
+ "Among Us": "/category-optimized/games/among-us.svg",
+ "Animal Crossing": "/category-optimized/games/animal-crossing.svg",
+ "Apex Legends": "/category-optimized/games/apex-legends.svg",
+ "Brawlhalla": "/category-optimized/games/brawlhalla.svg",
+ "Call Of Duty Black Ops 4": "/category-optimized/games/call-of-duty-black-ops-4.svg",
+ "Call Of Duty Mobile": "/category-optimized/games/call-of-duty-mobile.svg",
+ "Call Of Duty Warzone": "/category-optimized/games/call-of-duty-warzone.svg",
+ "Counter Strike": "/category-optimized/games/counter-strike.svg",
+ "Dead By Daylight": "/category-optimized/games/dead-by-daylight.svg",
+ "Destiny 2": "/category-optimized/games/destiny-2.svg",
+ "Dota 2": "/category-optimized/games/dota-2.svg",
+ "Dungeons And Dragons": "/category-optimized/games/dungeons-and-dragons.svg",
+ "Escape From Tarkov": "/category-optimized/games/escape-from-tarkov.svg",
+ "Final Fantasy Xiv": "/category-optimized/games/final-fantasy-xiv.svg",
+ "Fortnite": "/category-optimized/games/fortnite.svg",
+ "Genshin Impact": "/category-optimized/games/genshin-impact.svg",
+ "Gta 5": "/category-optimized/games/gta-5.svg",
+ "Halo": "/category-optimized/games/halo.svg",
+ "League Of Legends": "/category-optimized/games/league-of-legends.svg",
+ "Minecraft Logo": "/category-optimized/games/minecraft-logo.svg",
+ "Overwatch": "/category-optimized/games/overwatch.svg",
+ "PUBG": "/category-optimized/games/PUBG.svg",
+ "Roblox": "/category-optimized/games/roblox.svg",
+ "Rocket League": "/category-optimized/games/rocket-league.svg",
+ "Sea Of Thieves": "/category-optimized/games/sea-of-thieves.svg",
+ "Super Smash Bros": "/category-optimized/games/super-smash-bros.svg",
+ "Valorant": "/category-optimized/games/valorant.svg",
+ "World Of Warcraft": "/category-optimized/games/world-of-warcraft.svg"
+}
diff --git a/static/svg-json/web2.json b/static/svg-json/web2.json
new file mode 100644
index 00000000..ac79de73
--- /dev/null
+++ b/static/svg-json/web2.json
@@ -0,0 +1,101 @@
+{
+ "Amazon Web Services": "/category-optimized/web2/amazon-web-services.svg",
+ "Android": "/category-optimized/web2/android-os.svg",
+ "Angular": "/category-optimized/web2/angularjs.svg",
+ "Ansible": "/category-optimized/web2/ansible.svg",
+ "Apollo": "/category-optimized/web2/apollo.svg",
+ "Arduino": "/category-optimized/web2/arduino.svg",
+ "Atom Editor": "/category-optimized/web2/atom-editor.svg",
+ "Azure": "/category-optimized/web2/azure.svg",
+ "Bitbucket": "/category-optimized/web2/bitbucket.svg",
+ "C": "/category-optimized/web2/c-programming.svg",
+ "C#": "/category-optimized/web2/c-sharp-logo.svg",
+ "C++": "/category-optimized/web2/c++.svg",
+ "Chaos Computer Club": "/category-optimized/web2/chaos-computer-club.svg",
+ "CircleCI": "/category-optimized/web2/circleci.svg",
+ "Cloudflare": "/category-optimized/web2/cloudflare.svg",
+ "Code Crow": "/category-optimized/logo_3.svg",
+ "Codepen": "/category-optimized/web2/codepen.svg",
+ "Coderwall": "/category-optimized/web2/coderwall.svg",
+ "Coffee Script": "/category-optimized/web2/coffee-script.svg",
+ "Connect Develop": "/category-optimized/web2/connect-develop.svg",
+ "Contao": "/category-optimized/web2/contao.svg",
+ "CSS3": "/category-optimized/web2/css3.svg",
+ "Cydia": "/category-optimized/web2/cydia.svg",
+ "Delphi IDE": "/category-optimized/web2/delphi-ide.svg",
+ "Dev Post": "/category-optimized/web2/dev-post.svg",
+ "Django": "/category-optimized/web2/django.svg",
+ "Docker": "/category-optimized/web2/docker.svg",
+ "Drupal": "/category-optimized/web2/drupal.svg",
+ "Encrypt": "/category-optimized/web2/encrypt.svg",
+ "Espeasy": "/category-optimized/web2/espeasy.svg",
+ "Flask": "/category-optimized/web2/flask.svg",
+ "Flutter": "/category-optimized/web2/flutter.svg",
+ "Fonticons": "/category-optimized/web2/fonticons.svg",
+ "Forumbee": "/category-optimized/web2/forumbee.svg",
+ "Git": "/category-optimized/web2/git.svg",
+ "Github": "/category-optimized/web2/github.svg",
+ "Gitlab": "/category-optimized/web2/gitlab.svg",
+ "Golang": "/category-optimized/web2/golang.svg",
+ "Google Cloud": "/category-optimized/web2/google-cloud.svg",
+ "Google Compute Engine": "/category-optimized/web2/google-compute-engine.svg",
+ "Google Firebase Console": "/category-optimized/web2/google-firebase-console.svg",
+ "Hadoop Distributed File System": "/category-optimized/web2/hadoop-distributed-file-system.svg",
+ "Haskell": "/category-optimized/web2/haskell.svg",
+ "Heroku": "/category-optimized/web2/heroku.svg",
+ "HTML5": "/category-optimized/web2/html-5.svg",
+ "IntelliJ Idea": "/category-optimized/web2/intellij-idea.svg",
+ "Java": "/category-optimized/web2/java.svg",
+ "Javascript": "/category-optimized/web2/javascript.svg",
+ "Jenkins": "/category-optimized/web2/jenkins.svg",
+ "JSFiddle": "/category-optimized/web2/jsfiddle.svg",
+ "Kali Linux": "/category-optimized/web2/kali-linux.svg",
+ "Kibana": "/category-optimized/web2/kibana.svg",
+ "Kotlin": "/category-optimized/web2/kotlin.svg",
+ "Kubernetes": "/category-optimized/web2/kubernetes.svg",
+ "Let's Encrypt": "/category-optimized/web2/let's-encrypt.svg",
+ "Lisp": "/category-optimized/web2/lisp.svg",
+ "Material UI": "/category-optimized/web2/material-ui.svg",
+ "MongoDB": "/category-optimized/web2/mongodb.svg",
+ "MySQL": "/category-optimized/web2/mysql-logo.svg",
+ "Nginx": "/category-optimized/web2/nginx.svg",
+ "Node.js": "/category-optimized/web2/nodejs.svg",
+ "NotePad++": "/category-optimized/web2/notepad++.svg",
+ "NPM": "/category-optimized/web2/npm.svg",
+ "Nutanix": "/category-optimized/web2/nutanix.svg",
+ "Octocat": "/category-optimized/web2/octocat.svg",
+ "Open Source": "/category-optimized/web2/open-source.svg",
+ "OpenID": "/category-optimized/web2/openid.svg",
+ "OpenVPN": "/category-optimized/web2/openvpn.svg",
+ "Perl": "/category-optimized/web2/perl.svg",
+ "PostgreSQL": "/category-optimized/web2/postgresql.svg",
+ "Pycharm": "/category-optimized/web2/pycharm.svg",
+ "Python": "/category-optimized/web2/python.svg",
+ "Raspberry Pi": "/category-optimized/web2/raspberry-pi.svg",
+ "React Native": "/category-optimized/web2/react-native.svg",
+ "Redux": "/category-optimized/web2/redux.svg",
+ "Ruby Gem": "/category-optimized/web2/ruby-gem.svg",
+ "Ruby": "/category-optimized/web2/ruby-programming-language.svg",
+ "Salesforce": "/category-optimized/web2/salesforce.svg",
+ "Sass": "/category-optimized/web2/sass.svg",
+ "Selenium": "/category-optimized/web2/selenium.svg",
+ "Slack": "/category-optimized/web2/slack-new.svg",
+ "Splunk": "/category-optimized/web2/splunk.svg",
+ "Spring": "/category-optimized/web2/spring-logo.svg",
+ "Stack Overflow": "/category-optimized/web2/stack-overflow.svg",
+ "Swift": "/category-optimized/web2/swift.svg",
+ "Symfony": "/category-optimized/web2/symfony.svg",
+ "TensorFlow": "/category-optimized/web2/tensorflow.svg",
+ "Tomcat": "/category-optimized/web2/tomcat.svg",
+ "Travis CI": "/category-optimized/web2/travis-ci.svg",
+ "Typescript": "/category-optimized/web2/typescript.svg",
+ "Visual Studio 2019": "/category-optimized/web2/visual-studio-2019.svg",
+ "Visual Studio Code": "/category-optimized/web2/visual-studio-code-2019.svg",
+ "Vue.js": "/category-optimized/web2/vue-js.svg",
+ "Web Components": "/category-optimized/web2/web-components.svg",
+ "Webflow": "/category-optimized/web2/webflow.svg",
+ "Webhook": "/category-optimized/web2/webhook.svg",
+ "Xamrin": "/category-optimized/web2/xamarin.svg",
+ "Xmpp": "/category-optimized/web2/xmpp.svg",
+ "Ruby on Rails": "/category-optimized/web2/ruby-on-rails.svg"
+}
diff --git a/static/svg-json/web3.json b/static/svg-json/web3.json
new file mode 100644
index 00000000..01d63a2e
--- /dev/null
+++ b/static/svg-json/web3.json
@@ -0,0 +1,552 @@
+{
+ "0x (ZRX)": "/category-optimized/web3/0x-zrx.svg",
+ "1inch (1INCH)": "/category-optimized/web3/1inch-1inch.svg",
+ "2key Network (2KEY)": "/category-optimized/web3/2key-network-2key.svg",
+ "88mph (MPH)": "/category-optimized/web3/88mph-mph.svg",
+ "Aave (AAVE)": "/category-optimized/web3/aave-aave.svg",
+ "Abbc Coin (ABBC)": "/category-optimized/web3/abbc-coin-abbc.svg",
+ "Achain (ACT)": "/category-optimized/web3/achain-act.svg",
+ "Add Xyz (ADD)": "/category-optimized/web3/add-xyz-add.svg",
+ "Adx Net (ADX)": "/category-optimized/web3/adx-net-adx.svg",
+ "Aelf (ELF)": "/category-optimized/web3/aelf-elf.svg",
+ "Aeon (AEON)": "/category-optimized/web3/aeon-aeon.svg",
+ "Aeron (ARNX)": "/category-optimized/web3/aeron-arnx.svg",
+ "Aeternity (AE)": "/category-optimized/web3/aeternity-ae.svg",
+ "Agoras Tokens (AGRS)": "/category-optimized/web3/agoras-tokens-agrs.svg",
+ "Agrello Delta (DLT)": "/category-optimized/web3/agrello-delta-dlt.svg",
+ "Aidos Kuneen (ADK)": "/category-optimized/web3/aidos-kuneen-adk.svg",
+ "Aion (AION)": "/category-optimized/web3/aion-aion.svg",
+ "Airswap (AST)": "/category-optimized/web3/airswap-ast.svg",
+ "Akash Network (AKT)": "/category-optimized/web3/akash-network-akt.svg",
+ "Akropolis (AKRO)": "/category-optimized/web3/akropolis-akro.svg",
+ "Alchemy Pay (ACH)": "/category-optimized/web3/alchemy-pay-ach.svg",
+ "Algorand (ALGO)": "/category-optimized/web3/algorand-algo.svg",
+ "All Sports (SOC)": "/category-optimized/web3/all-sports-soc.svg",
+ "Allsafe (ASAFE)": "/category-optimized/web3/allsafe-asafe.svg",
+ "Alpha Finance Lab (ALPHA)": "/category-optimized/web3/alpha-finance-lab-alpha.svg",
+ "Amber (AMB)": "/category-optimized/web3/amber-amb.svg",
+ "Amp (AMP)": "/category-optimized/web3/amp-amp.svg",
+ "Ampleforth (AMPL)": "/category-optimized/web3/ampleforth-ampl.svg",
+ "Ankr (ANKR)": "/category-optimized/web3/ankr-ankr.svg",
+ "Anyswap (ANY)": "/category-optimized/web3/anyswap-any.svg",
+ "Apenft (NFT)": "/category-optimized/web3/apenft-nft.svg",
+ "Apollo Currency (APL)": "/category-optimized/web3/apollo-currency-apl.svg",
+ "Appcoins (APPC)": "/category-optimized/web3/appcoins-appc.svg",
+ "Aragon (ANT)": "/category-optimized/web3/aragon-ant.svg",
+ "Arcblock (ABT)": "/category-optimized/web3/arcblock-abt.svg",
+ "Ardor (ARDR)": "/category-optimized/web3/ardor-ardr.svg",
+ "Ark (ARK)": "/category-optimized/web3/ark-ark.svg",
+ "Arpa Chain (ARPA)": "/category-optimized/web3/arpa-chain-arpa.svg",
+ "Arweave (AR)": "/category-optimized/web3/arweave-ar.svg",
+ "Asch (XAS)": "/category-optimized/web3/asch-xas.svg",
+ "Augur (REP)": "/category-optimized/web3/augur-rep.svg",
+ "Aurora (AOA)": "/category-optimized/web3/aurora-aoa.svg",
+ "Autonio (NIOX)": "/category-optimized/web3/autonio-niox.svg",
+ "Avalanche (AVAX)": "/category-optimized/web3/avalanche-avax.svg",
+ "Axie Infinity (AXS)": "/category-optimized/web3/axie-infinity-axs.svg",
+ "Baby Doge Coin (BABYDOGE)": "/category-optimized/web3/baby-doge-coin-babydoge.svg",
+ "Bakerytoken (BAKE)": "/category-optimized/web3/bakerytoken-bake.svg",
+ "Balancer (BAL)": "/category-optimized/web3/balancer-bal.svg",
+ "Banano (BAN)": "/category-optimized/web3/banano-ban.svg",
+ "Bancor (BNT)": "/category-optimized/web3/bancor-bnt.svg",
+ "Band Protocol (BAND)": "/category-optimized/web3/band-protocol-band.svg",
+ "Bankera (BNK)": "/category-optimized/web3/bankera-bnk.svg",
+ "Barnbridge (BOND)": "/category-optimized/web3/barnbridge-bond.svg",
+ "Basic Attention Token (BAT)": "/category-optimized/web3/basic-attention-token-bat.svg",
+ "Beam (BEAM)": "/category-optimized/web3/beam-beam.svg",
+ "Bean Cash (BITB)": "/category-optimized/web3/bean-cash-bitb.svg",
+ "Beanstalk (BEAN)": "/category-optimized/web3/beanstalk-bean.svg",
+ "Beefy Finance (BIFI)": "/category-optimized/web3/beefy-finance-bifi.svg",
+ "Belacoin (BELA)": "/category-optimized/web3/belacoin-bela.svg",
+ "Bibox Token (BIX)": "/category-optimized/web3/bibox-token-bix.svg",
+ "Biconomy (BICO)": "/category-optimized/web3/biconomy-bico.svg",
+ "Binance Usd (BUSD)": "/category-optimized/web3/binance-usd-busd.svg",
+ "Biswap (BSW)": "/category-optimized/web3/biswap-bsw.svg",
+ "Bitcloud (BTDX)": "/category-optimized/web3/bitcloud-btdx.svg",
+ "Bitcoin (BTC)": "/category-optimized/web3/bitcoin-btc.svg",
+ "Bitcoin Cash (BCH)": "/category-optimized/web3/bitcoin-cash-bch.svg",
+ "Bitcoin Diamond (BCD)": "/category-optimized/web3/bitcoin-diamond-bcd.svg",
+ "Bitcoin Gold (BTG)": "/category-optimized/web3/bitcoin-gold-btg.svg",
+ "Bitcoin Plus (XBC)": "/category-optimized/web3/bitcoin-plus-xbc.svg",
+ "Bitcoin Private (BTCP)": "/category-optimized/web3/bitcoin-private-btcp.svg",
+ "Bitcoin Sv (BSV)": "/category-optimized/web3/bitcoin-sv-bsv.svg",
+ "Bitcoinz (BTCZ)": "/category-optimized/web3/bitcoinz-btcz.svg",
+ "Bitcore (BTX)": "/category-optimized/web3/bitcore-btx.svg",
+ "Bitforex Token (BF)": "/category-optimized/web3/bitforex-token-bf.svg",
+ "Bitsend (BSD)": "/category-optimized/web3/bitsend-bsd.svg",
+ "Bitshares (BTS)": "/category-optimized/web3/bitshares-bts.svg",
+ "Bittorrent (BTTOLD)": "/category-optimized/web3/bittorrent-bttold.svg",
+ "Blackcoin (BLK)": "/category-optimized/web3/blackcoin-blk.svg",
+ "Blockmason (BCPT)": "/category-optimized/web3/blockmason-bcpt.svg",
+ "Blocknet (BLOCK)": "/category-optimized/web3/blocknet-block.svg",
+ "Blockstamp (BST)": "/category-optimized/web3/blockstamp-bst.svg",
+ "Blocktix (TIX)": "/category-optimized/web3/blocktix-tix.svg",
+ "Bluzelle (BLZ)": "/category-optimized/web3/bluzelle-blz.svg",
+ "Bnb (BNB)": "/category-optimized/web3/bnb-bnb.svg",
+ "Bottos (BTO)": "/category-optimized/web3/bottos-bto.svg",
+ "Bounty0x (BNTY)": "/category-optimized/web3/bounty0x-bnty.svg",
+ "Braintrust (BTRST)": "/category-optimized/web3/braintrust-btrst.svg",
+ "Bread (BRD)": "/category-optimized/web3/bread-brd.svg",
+ "Bytecoin Bcn (BCN)": "/category-optimized/web3/bytecoin-bcn-bcn.svg",
+ "Bytom (BTM)": "/category-optimized/web3/bytom-btm.svg",
+ "Bzx Protocol (BZRX)": "/category-optimized/web3/bzx-protocol-bzrx.svg",
+ "Cardano (ADA)": "/category-optimized/web3/cardano-ada.svg",
+ "Cartesi (CTSI)": "/category-optimized/web3/cartesi-ctsi.svg",
+ "Casper (CSPR)": "/category-optimized/web3/casper-cspr.svg",
+ "Celo (CELO)": "/category-optimized/web3/celo-celo.svg",
+ "Celsius (CEL)": "/category-optimized/web3/celsius-cel.svg",
+ "Centrality (CENNZ)": "/category-optimized/web3/centrality-cennz.svg",
+ "Certik (CTK)": "/category-optimized/web3/certik-ctk.svg",
+ "Chainlink (LINK)": "/category-optimized/web3/chainlink-link.svg",
+ "Chainx (PCX)": "/category-optimized/web3/chainx-pcx.svg",
+ "Chatcoin (CHAT)": "/category-optimized/web3/chatcoin-chat.svg",
+ "Chia Network (XCH)": "/category-optimized/web3/chia-network-xch.svg",
+ "Chimpion (BNANA)": "/category-optimized/web3/chimpion-bnana.svg",
+ "Cindicator (CND)": "/category-optimized/web3/cindicator-cnd.svg",
+ "Civic (CVC)": "/category-optimized/web3/civic-cvc.svg",
+ "Clams (CLAM)": "/category-optimized/web3/clams-clam.svg",
+ "Cloakcoin (CLOAK)": "/category-optimized/web3/cloakcoin-cloak.svg",
+ "Cloudcoin (CCE)": "/category-optimized/web3/cloudcoin-cce.svg",
+ "Cobinhood (COB)": "/category-optimized/web3/cobinhood-cob.svg",
+ "Coin98 (C98)": "/category-optimized/web3/coin98-c98.svg",
+ "Coinloan (CLT)": "/category-optimized/web3/coinloan-clt.svg",
+ "Coinmetro Token (XCM)": "/category-optimized/web3/coinmetro-token-xcm.svg",
+ "Colossusxt (COLX)": "/category-optimized/web3/colossusxt-colx.svg",
+ "Commercium (CMM)": "/category-optimized/web3/commercium-cmm.svg",
+ "Compound (COMP)": "/category-optimized/web3/compound-comp.svg",
+ "Compound Dai (CDAI)": "/category-optimized/web3/compound-dai-cdai.svg",
+ "Compound Usd Coin (CUSDC)": "/category-optimized/web3/compound-usd-coin-cusdc.svg",
+ "Compound Usdt (CUSDT)": "/category-optimized/web3/compound-usdt-cusdt.svg",
+ "Convex Finance (CVX)": "/category-optimized/web3/convex-finance-cvx.svg",
+ "Cortex (CTXC)": "/category-optimized/web3/cortex-ctxc.svg",
+ "Cosmos (ATOM)": "/category-optimized/web3/cosmos-atom.svg",
+ "Coti (COTI)": "/category-optimized/web3/coti-coti.svg",
+ "Counterparty (XCP)": "/category-optimized/web3/counterparty-xcp.svg",
+ "Cream Finance (CREAM)": "/category-optimized/web3/cream-finance-cream.svg",
+ "Credits (CS)": "/category-optimized/web3/credits-cs.svg",
+ "Crown (CRW)": "/category-optimized/web3/crown-crw.svg",
+ "Crpt (CRPT)": "/category-optimized/web3/crpt-crpt.svg",
+ "Crypto Com Coin (CRO)": "/category-optimized/web3/crypto-com-coin-cro.svg",
+ "Curve Dao Token (CRV)": "/category-optimized/web3/curve-dao-token-crv.svg",
+ "Cybermiles (CMT)": "/category-optimized/web3/cybermiles-cmt.svg",
+ "Cybervein (CVT)": "/category-optimized/web3/cybervein-cvt.svg",
+ "Dash (DASH)": "/category-optimized/web3/dash-dash.svg",
+ "Data (DTA)": "/category-optimized/web3/data-dta.svg",
+ "Decentraland (MANA)": "/category-optimized/web3/decentraland-mana.svg",
+ "Decred (DCR)": "/category-optimized/web3/decred-dcr.svg",
+ "Deepbrain Chain (DBC)": "/category-optimized/web3/deepbrain-chain-dbc.svg",
+ "Defichain (DFI)": "/category-optimized/web3/defichain-dfi.svg",
+ "Dent (DENT)": "/category-optimized/web3/dent-dent.svg",
+ "Dentacoin (DCN)": "/category-optimized/web3/dentacoin-dcn.svg",
+ "Derivadao (DDX)": "/category-optimized/web3/derivadao-ddx.svg",
+ "Deso (DESO)": "/category-optimized/web3/deso-deso.svg",
+ "Dether (DTH)": "/category-optimized/web3/dether-dth.svg",
+ "Diamond (DMD)": "/category-optimized/web3/diamond-dmd.svg",
+ "Digibyte (DGB)": "/category-optimized/web3/digibyte-dgb.svg",
+ "Digital Reserve Currency (DRC)": "/category-optimized/web3/digital-reserve-currency-drc.svg",
+ "Digitalbits (XDB)": "/category-optimized/web3/digitalbits-xdb.svg",
+ "Digitalnote (XDN)": "/category-optimized/web3/digitalnote-xdn.svg",
+ "Digixdao (DGD)": "/category-optimized/web3/digixdao-dgd.svg",
+ "District0x (DNT)": "/category-optimized/web3/district0x-dnt.svg",
+ "Divi (DIVI)": "/category-optimized/web3/divi-divi.svg",
+ "Dmarket (DMT)": "/category-optimized/web3/dmarket-dmt.svg",
+ "Dock (DOCK)": "/category-optimized/web3/dock-dock.svg",
+ "Dogebonk (DOBO)": "/category-optimized/web3/dogebonk-dobo.svg",
+ "Dogecoin (DOGE)": "/category-optimized/web3/dogecoin-doge.svg",
+ "Domraider (DRT)": "/category-optimized/web3/domraider-drt.svg",
+ "Dragonchain (DRGN)": "/category-optimized/web3/dragonchain-drgn.svg",
+ "Eboostcoin (EBST)": "/category-optimized/web3/eboostcoin-ebst.svg",
+ "Ecash (XEC)": "/category-optimized/web3/ecash-xec.svg",
+ "Edgeless (EDG)": "/category-optimized/web3/edgeless-edg.svg",
+ "Educare (EKT)": "/category-optimized/web3/educare-ekt.svg",
+ "Egretia (EGT)": "/category-optimized/web3/egretia-egt.svg",
+ "Einsteinium (EMC2)": "/category-optimized/web3/einsteinium-emc2.svg",
+ "Elastos (ELA)": "/category-optimized/web3/elastos-ela.svg",
+ "Electra (ECA)": "/category-optimized/web3/electra-eca.svg",
+ "Electroneum (ETN)": "/category-optimized/web3/electroneum-etn.svg",
+ "Elongate (ELONGATE)": "/category-optimized/web3/elongate-elongate.svg",
+ "Elrond Egld (EGLD)": "/category-optimized/web3/elrond-egld-egld.svg",
+ "Emercoin (EMC)": "/category-optimized/web3/emercoin-emc.svg",
+ "Energy Web Token (EWT)": "/category-optimized/web3/energy-web-token-ewt.svg",
+ "Enigma (ENG)": "/category-optimized/web3/enigma-eng.svg",
+ "Enjin Coin (ENJ)": "/category-optimized/web3/enjin-coin-enj.svg",
+ "Enzyme (MLN)": "/category-optimized/web3/enzyme-mln.svg",
+ "Eos (EOS)": "/category-optimized/web3/eos-eos.svg",
+ "Ergo (ERG)": "/category-optimized/web3/ergo-erg.svg",
+ "Esbc (ESBC)": "/category-optimized/web3/esbc-esbc.svg",
+ "Ether Zero (ETZ)": "/category-optimized/web3/ether-zero-etz.svg",
+ "Ethereum Classic (ETC)": "/category-optimized/web3/ethereum-classic-etc.svg",
+ "Ethereum (ETH)": "/category-optimized/web3/ethereum-eth.svg",
+ "Ethereum Name Service (ENS)": "/category-optimized/web3/ethereum-name-service-ens.svg",
+ "Etherparty (FUEL)": "/category-optimized/web3/etherparty-fuel.svg",
+ "Everex (EVX)": "/category-optimized/web3/everex-evx.svg",
+ "Everipedia (IQ)": "/category-optimized/web3/everipedia-iq.svg",
+ "Everscale (EVER)": "/category-optimized/web3/everscale-ever.svg",
+ "Exchange Union (XUC)": "/category-optimized/web3/exchange-union-xuc.svg",
+ "Expanse (EXP)": "/category-optimized/web3/expanse-exp.svg",
+ "Faceter (FACE)": "/category-optimized/web3/faceter-face.svg",
+ "Factom (FCT)": "/category-optimized/web3/factom-fct.svg",
+ "Fantom (FTM)": "/category-optimized/web3/fantom-ftm.svg",
+ "Feathercoin (FTC)": "/category-optimized/web3/feathercoin-ftc.svg",
+ "Fei Usd (FEI)": "/category-optimized/web3/fei-usd-fei.svg",
+ "Fetch (FET)": "/category-optimized/web3/fetch-fet.svg",
+ "Filecoin (FIL)": "/category-optimized/web3/filecoin-fil.svg",
+ "Floki Inu (FLOKI)": "/category-optimized/web3/floki-inu-floki.svg",
+ "Flow (FLOW)": "/category-optimized/web3/flow-flow.svg",
+ "Foam (FOAM)": "/category-optimized/web3/foam-foam.svg",
+ "Fox Token (FOX)": "/category-optimized/web3/fox-token-fox.svg",
+ "Frax (FRAX)": "/category-optimized/web3/frax-frax.svg",
+ "Frax Share (FXS)": "/category-optimized/web3/frax-share-fxs.svg",
+ "Ftx Token (FTT)": "/category-optimized/web3/ftx-token-ftt.svg",
+ "Fujicoin (FJC)": "/category-optimized/web3/fujicoin-fjc.svg",
+ "Function X (FX)": "/category-optimized/web3/function-x-fx.svg",
+ "Fusion (FSN)": "/category-optimized/web3/fusion-fsn.svg",
+ "Gala (GALA)": "/category-optimized/web3/gala-gala.svg",
+ "Gamecredits (GAME)": "/category-optimized/web3/gamecredits-game.svg",
+ "Gas (GAS)": "/category-optimized/web3/gas-gas.svg",
+ "Gemini Dollar (GUSD)": "/category-optimized/web3/gemini-dollar-gusd.svg",
+ "Genesis Vision (GVT)": "/category-optimized/web3/genesis-vision-gvt.svg",
+ "Gifto (GTO)": "/category-optimized/web3/gifto-gto.svg",
+ "Gincoin Global Interest Rate (GIN)": "/category-optimized/web3/gincoin-global-interest-rate-gin.svg",
+ "Gitcoin (GTC)": "/category-optimized/web3/gitcoin-gtc.svg",
+ "Global Social Chain (GSC)": "/category-optimized/web3/global-social-chain-gsc.svg",
+ "Gnosis Gno (GNO)": "/category-optimized/web3/gnosis-gno-gno.svg",
+ "Gobyte (GBX)": "/category-optimized/web3/gobyte-gbx.svg",
+ "Golem Network Tokens (GLM)": "/category-optimized/web3/golem-network-tokens-glm.svg",
+ "Golos Blockchain (GLS)": "/category-optimized/web3/golos-blockchain-gls.svg",
+ "Gridcoin (GRC)": "/category-optimized/web3/gridcoin-grc.svg",
+ "Grin (GRIN)": "/category-optimized/web3/grin-grin.svg",
+ "Groestlcoin (GRS)": "/category-optimized/web3/groestlcoin-grs.svg",
+ "Gulden (NLG)": "/category-optimized/web3/gulden-nlg.svg",
+ "Gxchain (GXC)": "/category-optimized/web3/gxchain-gxc.svg",
+ "Hackenai (HAI)": "/category-optimized/web3/hackenai-hai.svg",
+ "Hakka Finance (HAKKA)": "/category-optimized/web3/hakka-finance-hakka.svg",
+ "Handshake (HNS)": "/category-optimized/web3/handshake-hns.svg",
+ "Harmony (ONE)": "/category-optimized/web3/harmony-one.svg",
+ "Haven Protocol (XHV)": "/category-optimized/web3/haven-protocol-xhv.svg",
+ "Hedera (HBAR)": "/category-optimized/web3/hedera-hbar.svg",
+ "Hedgetrade (HEDG)": "/category-optimized/web3/hedgetrade-hedg.svg",
+ "Helium (HNT)": "/category-optimized/web3/helium-hnt.svg",
+ "Hex (HEX)": "/category-optimized/web3/hex-hex.svg",
+ "High Performance Blockchain (HPB)": "/category-optimized/web3/high-performance-blockchain-hpb.svg",
+ "Hive Blockchain (HIVE)": "/category-optimized/web3/hive-blockchain-hive.svg",
+ "Holo (HOT)": "/category-optimized/web3/holo-hot.svg",
+ "Hord (HORD)": "/category-optimized/web3/hord-hord.svg",
+ "Html Coin (HTML)": "/category-optimized/web3/html-coin-html.svg",
+ "Huobi Token (HT)": "/category-optimized/web3/huobi-token-ht.svg",
+ "Husd (HUSD)": "/category-optimized/web3/husd-husd.svg",
+ "Hush (HUSH)": "/category-optimized/web3/hush-hush.svg",
+ "Hydro (HYDRO)": "/category-optimized/web3/hydro-hydro.svg",
+ "Hypercash (HC)": "/category-optimized/web3/hypercash-hc.svg",
+ "Icon (ICX)": "/category-optimized/web3/icon-icx.svg",
+ "Idex (IDEX)": "/category-optimized/web3/idex-idex.svg",
+ "Ignis (IGNIS)": "/category-optimized/web3/ignis-ignis.svg",
+ "Immutable X (IMX)": "/category-optimized/web3/immutable-x-imx.svg",
+ "Injective Protocol (INJ)": "/category-optimized/web3/injective-protocol-inj.svg",
+ "Ink (INK)": "/category-optimized/web3/ink-ink.svg",
+ "Insight Chain (INB)": "/category-optimized/web3/insight-chain-inb.svg",
+ "Internet Computer (ICP)": "/category-optimized/web3/internet-computer-icp.svg",
+ "Ion (ION)": "/category-optimized/web3/ion-ion.svg",
+ "Iostoken (IOST)": "/category-optimized/web3/iostoken-iost.svg",
+ "Iot Chain (ITC)": "/category-optimized/web3/iot-chain-itc.svg",
+ "Iota (MIOTA)": "/category-optimized/web3/iota-miota.svg",
+ "Iotex (IOTX)": "/category-optimized/web3/iotex-iotx.svg",
+ "Iqeon (IQN)": "/category-optimized/web3/iqeon-iqn.svg",
+ "Irisnet (IRIS)": "/category-optimized/web3/irisnet-iris.svg",
+ "Just (JST)": "/category-optimized/web3/just-jst.svg",
+ "Kadena (KDA)": "/category-optimized/web3/kadena-kda.svg",
+ "Kambria (KAT)": "/category-optimized/web3/kambria-kat.svg",
+ "Kanadecoin (KNDC)": "/category-optimized/web3/kanadecoin-kndc.svg",
+ "Karatgold Coin (KBC)": "/category-optimized/web3/karatgold-coin-kbc.svg",
+ "Karbo (KRB)": "/category-optimized/web3/karbo-krb.svg",
+ "Karma Eos (KARMA)": "/category-optimized/web3/karma-eos-karma.svg",
+ "Kava (KAVA)": "/category-optimized/web3/kava-kava.svg",
+ "Keep Network (KEEP)": "/category-optimized/web3/keep-network-keep.svg",
+ "Keeperdao (ROOK)": "/category-optimized/web3/keeperdao-rook.svg",
+ "Kin (KIN)": "/category-optimized/web3/kin-kin.svg",
+ "Kingmoney (KIM)": "/category-optimized/web3/kingmoney-kim.svg",
+ "Klaytn (KLAY)": "/category-optimized/web3/klaytn-klay.svg",
+ "Kleros (PNK)": "/category-optimized/web3/kleros-pnk.svg",
+ "Komodo (KMD)": "/category-optimized/web3/komodo-kmd.svg",
+ "Kucoin Token (KCS)": "/category-optimized/web3/kucoin-token-kcs.svg",
+ "Kusama (KSM)": "/category-optimized/web3/kusama-ksm.svg",
+ "Lamden (TAU)": "/category-optimized/web3/lamden-tau.svg",
+ "Largo Coin (LRG)": "/category-optimized/web3/largo-coin-lrg.svg",
+ "Latoken (LA)": "/category-optimized/web3/latoken-la.svg",
+ "Library Credits (LBC)": "/category-optimized/web3/library-credits-lbc.svg",
+ "Likecoin (LIKE)": "/category-optimized/web3/likecoin-like.svg",
+ "Lisk (LSK)": "/category-optimized/web3/lisk-lsk.svg",
+ "Litecoin Cash (LCC)": "/category-optimized/web3/litecoin-cash-lcc.svg",
+ "Litecoin (LTC)": "/category-optimized/web3/litecoin-ltc.svg",
+ "Livepeer (LPT)": "/category-optimized/web3/livepeer-lpt.svg",
+ "Loom Network (LOOM)": "/category-optimized/web3/loom-network-loom.svg",
+ "Loopring (LRC)": "/category-optimized/web3/loopring-lrc.svg",
+ "Lto Network (LTO)": "/category-optimized/web3/lto-network-lto.svg",
+ "Lunyr (LUN)": "/category-optimized/web3/lunyr-lun.svg",
+ "Lykke (LKK)": "/category-optimized/web3/lykke-lkk.svg",
+ "Lympo (LYM)": "/category-optimized/web3/lympo-lym.svg",
+ "Maidsafecoin (MAID)": "/category-optimized/web3/maidsafecoin-maid.svg",
+ "Maker (MKR)": "/category-optimized/web3/maker-mkr.svg",
+ "Mantra Dao (OM)": "/category-optimized/web3/mantra-dao-om.svg",
+ "Masari (MSR)": "/category-optimized/web3/masari-msr.svg",
+ "Mask Network (MASK)": "/category-optimized/web3/mask-network-mask.svg",
+ "Measurable Data Token (MDT)": "/category-optimized/web3/measurable-data-token-mdt.svg",
+ "Medibloc (MED)": "/category-optimized/web3/medibloc-med.svg",
+ "Medishares (MDS)": "/category-optimized/web3/medishares-mds.svg",
+ "Meetone (MEETONE)": "/category-optimized/web3/meetone-meetone.svg",
+ "Metadium (META)": "/category-optimized/web3/metadium-meta.svg",
+ "Metahero (HERO)": "/category-optimized/web3/metahero-hero.svg",
+ "Metal (MTL)": "/category-optimized/web3/metal-mtl.svg",
+ "Metaverse (ETP)": "/category-optimized/web3/metaverse-etp.svg",
+ "Mimblewimblecoin (MWC)": "/category-optimized/web3/mimblewimblecoin-mwc.svg",
+ "Mina (MINA)": "/category-optimized/web3/mina-mina.svg",
+ "Mirror Protocol (MIR)": "/category-optimized/web3/mirror-protocol-mir.svg",
+ "Mithril (MITH)": "/category-optimized/web3/mithril-mith.svg",
+ "Mixin (XIN)": "/category-optimized/web3/mixin-xin.svg",
+ "Moac (MOAC)": "/category-optimized/web3/moac-moac.svg",
+ "Moeda Loyalty Points (MDA)": "/category-optimized/web3/moeda-loyalty-points-mda.svg",
+ "Molecular Future (MOF)": "/category-optimized/web3/molecular-future-mof.svg",
+ "Monacoin (MONA)": "/category-optimized/web3/monacoin-mona.svg",
+ "Monero (XMR)": "/category-optimized/web3/monero-xmr.svg",
+ "Monetha (MTH)": "/category-optimized/web3/monetha-mth.svg",
+ "Monnos (MNS)": "/category-optimized/web3/monnos-mns.svg",
+ "Monolith (TKN)": "/category-optimized/web3/monolith-tkn.svg",
+ "Multi Collateral Dai (DAI)": "/category-optimized/web3/multi-collateral-dai-dai.svg",
+ "Mvl (MVL)": "/category-optimized/web3/mvl-mvl.svg",
+ "Mxc (MXC)": "/category-optimized/web3/mxc-mxc.svg",
+ "Myriad (XMY)": "/category-optimized/web3/myriad-xmy.svg",
+ "Mysterium (MYST)": "/category-optimized/web3/mysterium-myst.svg",
+ "Naga (NGC)": "/category-optimized/web3/naga-ngc.svg",
+ "Namecoin (NMC)": "/category-optimized/web3/namecoin-nmc.svg",
+ "Nano (XNO)": "/category-optimized/web3/nano-xno.svg",
+ "Nav Coin (NAV)": "/category-optimized/web3/nav-coin-nav.svg",
+ "Near Protocol (NEAR)": "/category-optimized/web3/near-protocol-near.svg",
+ "Neblio (NEBL)": "/category-optimized/web3/neblio-nebl.svg",
+ "Nebulas Token (NAS)": "/category-optimized/web3/nebulas-token-nas.svg",
+ "Nem (XEM)": "/category-optimized/web3/nem-xem.svg",
+ "Neo (NEO)": "/category-optimized/web3/neo-neo.svg",
+ "Nervos Network (CKB)": "/category-optimized/web3/nervos-network-ckb.svg",
+ "Nest Protocol (NEST)": "/category-optimized/web3/nest-protocol-nest.svg",
+ "Neumark (NEU)": "/category-optimized/web3/neumark-neu.svg",
+ "Newton (NEW)": "/category-optimized/web3/newton-new.svg",
+ "Nexo (NEXO)": "/category-optimized/web3/nexo-nexo.svg",
+ "Nexus (NXS)": "/category-optimized/web3/nexus-nxs.svg",
+ "Nimiq (NIM)": "/category-optimized/web3/nimiq-nim.svg",
+ "Nkn (NKN)": "/category-optimized/web3/nkn-nkn.svg",
+ "Nolimitcoin (NLC2)": "/category-optimized/web3/nolimitcoin-nlc2.svg",
+ "Nucleus Vision (NCASH)": "/category-optimized/web3/nucleus-vision-ncash.svg",
+ "Nucypher (NU)": "/category-optimized/web3/nucypher-nu.svg",
+ "Nuls (NULS)": "/category-optimized/web3/nuls-nuls.svg",
+ "Numeraire (NMR)": "/category-optimized/web3/numeraire-nmr.svg",
+ "Nxt (NXT)": "/category-optimized/web3/nxt-nxt.svg",
+ "Oasis Network (ROSE)": "/category-optimized/web3/oasis-network-rose.svg",
+ "Oax (OAX)": "/category-optimized/web3/oax-oax.svg",
+ "Obyte (GBYTE)": "/category-optimized/web3/obyte-gbyte.svg",
+ "Ocean Protocol (OCEAN)": "/category-optimized/web3/ocean-protocol-ocean.svg",
+ "Odem (ODE)": "/category-optimized/web3/odem-ode.svg",
+ "Okb (OKB)": "/category-optimized/web3/okb-okb.svg",
+ "Okcash (OK)": "/category-optimized/web3/okcash-ok.svg",
+ "Omg (OMG)": "/category-optimized/web3/omg-omg.svg",
+ "Omni (OMNI)": "/category-optimized/web3/omni-omni.svg",
+ "Ongsocial (ONG)": "/category-optimized/web3/ongsocial-ong.svg",
+ "Ontology (ONT)": "/category-optimized/web3/ontology-ont.svg",
+ "Orbs (ORBS)": "/category-optimized/web3/orbs-orbs.svg",
+ "Orchid (OXT)": "/category-optimized/web3/orchid-oxt.svg",
+ "Origin Protocol (OGN)": "/category-optimized/web3/origin-protocol-ogn.svg",
+ "Origintrail (TRAC)": "/category-optimized/web3/origintrail-trac.svg",
+ "Ost (OST)": "/category-optimized/web3/ost-ost.svg",
+ "Pancakeswap (CAKE)": "/category-optimized/web3/pancakeswap-cake.svg",
+ "Parsiq (PRQ)": "/category-optimized/web3/parsiq-prq.svg",
+ "Particl (PART)": "/category-optimized/web3/particl-part.svg",
+ "Pascal (PASC)": "/category-optimized/web3/pascal-pasc.svg",
+ "Patientory (PTOY)": "/category-optimized/web3/patientory-ptoy.svg",
+ "Pax Gold (PAXG)": "/category-optimized/web3/pax-gold-paxg.svg",
+ "Paxos Standard (USDP)": "/category-optimized/web3/paxos-standard-usdp.svg",
+ "Paypex (PAYX)": "/category-optimized/web3/paypex-payx.svg",
+ "Paypie (PPP)": "/category-optimized/web3/paypie-ppp.svg",
+ "Pearl (PEARL)": "/category-optimized/web3/pearl-pearl.svg",
+ "Peercoin (PPC)": "/category-optimized/web3/peercoin-ppc.svg",
+ "Perlin (PERL)": "/category-optimized/web3/perlin-perl.svg",
+ "Phantasma (SOUL)": "/category-optimized/web3/phantasma-soul.svg",
+ "Pillar (PLR)": "/category-optimized/web3/pillar-plr.svg",
+ "Pinkcoin (PINK)": "/category-optimized/web3/pinkcoin-pink.svg",
+ "Pirate Chain (ARRR)": "/category-optimized/web3/pirate-chain-arrr.svg",
+ "Pivx (PIVX)": "/category-optimized/web3/pivx-pivx.svg",
+ "Pluton (PLU)": "/category-optimized/web3/pluton-plu.svg",
+ "Pnetwork (PNT)": "/category-optimized/web3/pnetwork-pnt.svg",
+ "Poet (POE)": "/category-optimized/web3/poet-poe.svg",
+ "Polis (POLIS)": "/category-optimized/web3/polis-polis.svg",
+ "Polkadot New (DOT)": "/category-optimized/web3/polkadot-new-dot.svg",
+ "Polybius (PLBT)": "/category-optimized/web3/polybius-plbt.svg",
+ "Polygon (MATIC)": "/category-optimized/web3/polygon-matic.svg",
+ "Polymath Network (POLY)": "/category-optimized/web3/polymath-network-poly.svg",
+ "Polyswarm (NCT)": "/category-optimized/web3/polyswarm-nct.svg",
+ "Poocoin (POOCOIN)": "/category-optimized/web3/poocoin-poocoin.svg",
+ "Populous (PPT)": "/category-optimized/web3/populous-ppt.svg",
+ "Potcoin (POT)": "/category-optimized/web3/potcoin-pot.svg",
+ "Power Ledger (POWR)": "/category-optimized/web3/power-ledger-powr.svg",
+ "Presearch (PRE)": "/category-optimized/web3/presearch-pre.svg",
+ "Primecoin (XPM)": "/category-optimized/web3/primecoin-xpm.svg",
+ "Prometeus (PROM)": "/category-optimized/web3/prometeus-prom.svg",
+ "Propy (PRO)": "/category-optimized/web3/propy-pro.svg",
+ "Proton (XPR)": "/category-optimized/web3/proton-xpr.svg",
+ "Ptokens Btc (PBTC)": "/category-optimized/web3/ptokens-btc-pbtc.svg",
+ "Pumapay (PMA)": "/category-optimized/web3/pumapay-pma.svg",
+ "Pundi X (NPXS)": "/category-optimized/web3/pundi-x-npxs.svg",
+ "Qash (QASH)": "/category-optimized/web3/qash-qash.svg",
+ "Qlink (QLC)": "/category-optimized/web3/qlink-qlc.svg",
+ "Qtum (QTUM)": "/category-optimized/web3/qtum-qtum.svg",
+ "Quant (QNT)": "/category-optimized/web3/quant-qnt.svg",
+ "Quantstamp (QSP)": "/category-optimized/web3/quantstamp-qsp.svg",
+ "Quantum Resistant Ledger (QRL)": "/category-optimized/web3/quantum-resistant-ledger-qrl.svg",
+ "Quarkchain (QKC)": "/category-optimized/web3/quarkchain-qkc.svg",
+ "Raiden Network Token (RDN)": "/category-optimized/web3/raiden-network-token-rdn.svg",
+ "Ramp (RAMP)": "/category-optimized/web3/ramp-ramp.svg",
+ "Ravencoin (RVN)": "/category-optimized/web3/ravencoin-rvn.svg",
+ "Rchain (REV)": "/category-optimized/web3/rchain-rev.svg",
+ "Redd (RDD)": "/category-optimized/web3/redd-rdd.svg",
+ "Ren (REN)": "/category-optimized/web3/ren-ren.svg",
+ "Request (REQ)": "/category-optimized/web3/request-req.svg",
+ "Reserve Rights (RSR)": "/category-optimized/web3/reserve-rights-rsr.svg",
+ "Reserve (RSV)": "/category-optimized/web3/reserve-rsv.svg",
+ "Revain (REV)": "/category-optimized/web3/revain-rev.svg",
+ "Ripio Credit Network (RCN)": "/category-optimized/web3/ripio-credit-network-rcn.svg",
+ "Rise (RISE)": "/category-optimized/web3/rise-rise.svg",
+ "Rlc (RLC)": "/category-optimized/web3/rlc-rlc.svg",
+ "Rsk Infrastructure Framework (RIF)": "/category-optimized/web3/rsk-infrastructure-framework-rif.svg",
+ "Ruff (RUFF)": "/category-optimized/web3/ruff-ruff.svg",
+ "Ryo Currency (RYO)": "/category-optimized/web3/ryo-currency-ryo.svg",
+ "Safemoon (SAFEMOON)": "/category-optimized/web3/safemoon-safemoon.svg",
+ "Safepal (SFP)": "/category-optimized/web3/safepal-sfp.svg",
+ "Saffron Finance (SFI)": "/category-optimized/web3/saffron-finance-sfi.svg",
+ "Salt (SALT)": "/category-optimized/web3/salt-salt.svg",
+ "Salus (SLS)": "/category-optimized/web3/salus-sls.svg",
+ "Santiment (SAN)": "/category-optimized/web3/santiment-san.svg",
+ "Secret (SCRT)": "/category-optimized/web3/secret-scrt.svg",
+ "Seele (SEELE)": "/category-optimized/web3/seele-seele.svg",
+ "Senso (SENSO)": "/category-optimized/web3/senso-senso.svg",
+ "Serum (SRM)": "/category-optimized/web3/serum-srm.svg",
+ "Shiba Inu (SHIB)": "/category-optimized/web3/shiba-inu-shib.svg",
+ "Shibadoge (SHIBDOGE)": "/category-optimized/web3/shibadoge-shibdoge.svg",
+ "Shipchain (SHIP)": "/category-optimized/web3/shipchain-ship.svg",
+ "Siacoin (SC)": "/category-optimized/web3/siacoin-sc.svg",
+ "Sibcoin (SIB)": "/category-optimized/web3/sibcoin-sib.svg",
+ "Singularitynet (AGIX)": "/category-optimized/web3/singularitynet-agix.svg",
+ "Sirin Labs Token (SRN)": "/category-optimized/web3/sirin-labs-token-srn.svg",
+ "Skycoin (SKY)": "/category-optimized/web3/skycoin-sky.svg",
+ "Smartcash (SMART)": "/category-optimized/web3/smartcash-smart.svg",
+ "Smooth Love Potion (SLP)": "/category-optimized/web3/smooth-love-potion-slp.svg",
+ "Snowswap (SNOW)": "/category-optimized/web3/snowswap-snow.svg",
+ "Solana (SOL)": "/category-optimized/web3/solana-sol.svg",
+ "Sonm Bep20 (SNM)": "/category-optimized/web3/sonm-bep20-snm.svg",
+ "Sophiatx (SPHTX)": "/category-optimized/web3/sophiatx-sphtx.svg",
+ "Sora (XOR)": "/category-optimized/web3/sora-xor.svg",
+ "Spankchain (SPANK)": "/category-optimized/web3/spankchain-spank.svg",
+ "Stacks (STX)": "/category-optimized/web3/stacks-stx.svg",
+ "Starname (IOV)": "/category-optimized/web3/starname-iov.svg",
+ "Startcoin (START)": "/category-optimized/web3/startcoin-start.svg",
+ "Status (SNT)": "/category-optimized/web3/status-snt.svg",
+ "Steem Dollars (SBD)": "/category-optimized/web3/steem-dollars-sbd.svg",
+ "Steem (STEEM)": "/category-optimized/web3/steem-steem.svg",
+ "Stellar (XLM)": "/category-optimized/web3/stellar-xlm.svg",
+ "Storj (STORJ)": "/category-optimized/web3/storj-storj.svg",
+ "Straks (STAK)": "/category-optimized/web3/straks-stak.svg",
+ "Stratis (STRAX)": "/category-optimized/web3/stratis-strax.svg",
+ "Streamr (DATA)": "/category-optimized/web3/streamr-data.svg",
+ "Strong (STRONG)": "/category-optimized/web3/strong-strong.svg",
+ "Student Coin (STC)": "/category-optimized/web3/student-coin-stc.svg",
+ "Substratum (SUB)": "/category-optimized/web3/substratum-sub.svg",
+ "Sumokoin (SUMO)": "/category-optimized/web3/sumokoin-sumo.svg",
+ "Sushiswap (SUSHI)": "/category-optimized/web3/sushiswap-sushi.svg",
+ "Suterusu (SUTER)": "/category-optimized/web3/suterusu-suter.svg",
+ "Swarm City (SWT)": "/category-optimized/web3/swarm-city-swt.svg",
+ "Swipe (SXP)": "/category-optimized/web3/swipe-sxp.svg",
+ "Switcheo (SWTH)": "/category-optimized/web3/switcheo-swth.svg",
+ "Symbol (XYM)": "/category-optimized/web3/symbol-xym.svg",
+ "Synthetix Network Token (SNX)": "/category-optimized/web3/synthetix-network-token-snx.svg",
+ "Syntropy (NOIA)": "/category-optimized/web3/syntropy-noia.svg",
+ "Syscoin (SYS)": "/category-optimized/web3/syscoin-sys.svg",
+ "Telcoin (TEL)": "/category-optimized/web3/telcoin-tel.svg",
+ "Tellor (TRB)": "/category-optimized/web3/tellor-trb.svg",
+ "Tenx (PAY)": "/category-optimized/web3/tenx-pay.svg",
+ "Tera (TERA)": "/category-optimized/web3/tera-tera.svg",
+ "Ternio (TERN)": "/category-optimized/web3/ternio-tern.svg",
+ "Terra Luna (LUNA)": "/category-optimized/web3/terra-luna-luna.svg",
+ "Tether Gold (XAUT)": "/category-optimized/web3/tether-gold-xaut.svg",
+ "Tether (USDT)": "/category-optimized/web3/tether-usdt.svg",
+ "Tezos (XTZ)": "/category-optimized/web3/tezos-xtz.svg",
+ "The Graph (GRT)": "/category-optimized/web3/the-graph-grt.svg",
+ "The Sandbox (SAND)": "/category-optimized/web3/the-sandbox-sand.svg",
+ "The Transfer Token (TTT)": "/category-optimized/web3/the-transfer-token-ttt.svg",
+ "Theta Fuel (TFUEL)": "/category-optimized/web3/theta-fuel-tfuel.svg",
+ "Theta Network (THETA)": "/category-optimized/web3/theta-network-theta.svg",
+ "Thorchain (RUNE)": "/category-optimized/web3/thorchain-rune.svg",
+ "Thorecoin (THR)": "/category-optimized/web3/thorecoin-thr.svg",
+ "Thunder Token (TT)": "/category-optimized/web3/thunder-token-tt.svg",
+ "Tigercash (TCH)": "/category-optimized/web3/tigercash-tch.svg",
+ "Time New Bank (TNB)": "/category-optimized/web3/time-new-bank-tnb.svg",
+ "Tokenbox (TBX)": "/category-optimized/web3/tokenbox-tbx.svg",
+ "Tokenomy (TEN)": "/category-optimized/web3/tokenomy-ten.svg",
+ "Tokenpay (TPAY)": "/category-optimized/web3/tokenpay-tpay.svg",
+ "Tokes (TKS)": "/category-optimized/web3/tokes-tks.svg",
+ "Tomochain (TOMO)": "/category-optimized/web3/tomochain-tomo.svg",
+ "Toncoin (TONCOIN)": "/category-optimized/web3/toncoin-toncoin.svg",
+ "Torex (TOR)": "/category-optimized/web3/torex-tor.svg",
+ "Torn (TORN)": "/category-optimized/web3/torn-torn.svg",
+ "Trezarcoin (TZC)": "/category-optimized/web3/trezarcoin-tzc.svg",
+ "Tribe (TRIBE)": "/category-optimized/web3/tribe-tribe.svg",
+ "Trinity Network Credit (TNC)": "/category-optimized/web3/trinity-network-credit-tnc.svg",
+ "Tron (TRX)": "/category-optimized/web3/tron-trx.svg",
+ "Trueusd (TUSD)": "/category-optimized/web3/trueusd-tusd.svg",
+ "Turtlecoin (TRTL)": "/category-optimized/web3/turtlecoin-trtl.svg",
+ "Ubiq (UBQ)": "/category-optimized/web3/ubiq-ubq.svg",
+ "Ultra (UOS)": "/category-optimized/web3/ultra-uos.svg",
+ "Uma (UMA)": "/category-optimized/web3/uma-uma.svg",
+ "Uniswap (UNI)": "/category-optimized/web3/uniswap-uni.svg",
+ "Unus Sed Leo (LEO)": "/category-optimized/web3/unus-sed-leo-leo.svg",
+ "Uquid Coin (UQC)": "/category-optimized/web3/uquid-coin-uqc.svg",
+ "Usd Coin (USDC)": "/category-optimized/web3/usd-coin-usdc.svg",
+ "Utrust (UTK)": "/category-optimized/web3/utrust-utk.svg",
+ "V Systems (VSYS)": "/category-optimized/web3/v-systems-vsys.svg",
+ "Vechain (VET)": "/category-optimized/web3/vechain-vet.svg",
+ "Vectorspace Ai (VXV)": "/category-optimized/web3/vectorspace-ai-vxv.svg",
+ "Veil (VEIL)": "/category-optimized/web3/veil-veil.svg",
+ "Velas (VLX)": "/category-optimized/web3/velas-vlx.svg",
+ "Verge (XVG)": "/category-optimized/web3/verge-xvg.svg",
+ "Vericoin (VRC)": "/category-optimized/web3/vericoin-vrc.svg",
+ "Veritaseum (VERI)": "/category-optimized/web3/veritaseum-veri.svg",
+ "Vertcoin (VTC)": "/category-optimized/web3/vertcoin-vtc.svg",
+ "Vesper (VSP)": "/category-optimized/web3/vesper-vsp.svg",
+ "Vethor Token (VTHO)": "/category-optimized/web3/vethor-token-vtho.svg",
+ "Viacoin (VIA)": "/category-optimized/web3/viacoin-via.svg",
+ "Vibe (VIBE)": "/category-optimized/web3/vibe-vibe.svg",
+ "Vite (VITE)": "/category-optimized/web3/vite-vite.svg",
+ "Wagerr (WGR)": "/category-optimized/web3/wagerr-wgr.svg",
+ "Waltonchain (WTC)": "/category-optimized/web3/waltonchain-wtc.svg",
+ "Wanchain (WAN)": "/category-optimized/web3/wanchain-wan.svg",
+ "Waves (WAVES)": "/category-optimized/web3/waves-waves.svg",
+ "Wax (WAXP)": "/category-optimized/web3/wax-waxp.svg",
+ "Waykichain (WICC)": "/category-optimized/web3/waykichain-wicc.svg",
+ "Wepower (WPR)": "/category-optimized/web3/wepower-wpr.svg",
+ "Whitecoin (XWC)": "/category-optimized/web3/whitecoin-xwc.svg",
+ "Wing (WING)": "/category-optimized/web3/wing-wing.svg",
+ "Wings (WINGS)": "/category-optimized/web3/wings-wings.svg",
+ "Wownero (WOW)": "/category-optimized/web3/wownero-wow.svg",
+ "Wrapped Bitcoin (WBTC)": "/category-optimized/web3/wrapped-bitcoin-wbtc.svg",
+ "Xdai (STAKE)": "/category-optimized/web3/xdai-stake.svg",
+ "Xensor (XSR)": "/category-optimized/web3/xensor-xsr.svg",
+ "Xmax (XMX)": "/category-optimized/web3/xmax-xmx.svg",
+ "Xpa (XPA)": "/category-optimized/web3/xpa-xpa.svg",
+ "Xrp (XRP)": "/category-optimized/web3/xrp-xrp.svg",
+ "Xtrabytes (XBY)": "/category-optimized/web3/xtrabytes-xby.svg",
+ "Xyo (XYO)": "/category-optimized/web3/xyo-xyo.svg",
+ "Yearn Finance (YFI)": "/category-optimized/web3/yearn-finance-yfi.svg",
+ "Yooshi (YOOSHI)": "/category-optimized/web3/yooshi-yooshi.svg",
+ "Yoyow (YOYOW)": "/category-optimized/web3/yoyow-yoyow.svg",
+ "Zb Token (ZB)": "/category-optimized/web3/zb-token-zb.svg",
+ "Zcash (ZEC)": "/category-optimized/web3/zcash-zec.svg",
+ "Zclassic (ZCL)": "/category-optimized/web3/zclassic-zcl.svg",
+ "Zel (FLUX)": "/category-optimized/web3/zel-flux.svg",
+ "Zelwin (ZLW)": "/category-optimized/web3/zelwin-zlw.svg",
+ "Zilliqa (ZIL)": "/category-optimized/web3/zilliqa-zil.svg"
+}
diff --git a/tests/videos.spec.ts b/tests/videos.spec.ts
deleted file mode 100644
index f1355893..00000000
--- a/tests/videos.spec.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-import { expect, test } from '@playwright/test'
-
-test('videos page had expected to load', async ({ page }) => {
- await page.goto('/videos')
- await expect(page).toHaveURL(/.*videos/)
-})
\ No newline at end of file