diff --git a/package.json b/package.json index ce93e02d..ab8bf470 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mage-website", - "version": "0.0.9", + "version": "0.0.10", "license": "GPL-3.0", "private": true, "type": "module", @@ -34,8 +34,8 @@ "eslint-plugin-svelte3": "^4.0.0", "postcss": "^8.4.21", "postcss-cli": "^10.1.0", - "prettier": "^3.0.0", - "prettier-plugin-svelte": "^2.9.0", + "prettier": "^2.8.4 <2.9.0", + "prettier-plugin-svelte": "^2.10.1", "svelte": "^3.55.1", "svelte-check": "^3.0.4", "svelte-preprocess": "^5.0.1", @@ -53,7 +53,7 @@ "@tailwindcss/aspect-ratio": "^0.4.2", "@tailwindcss/typography": "^0.5.9", "animate.css": "^4.1.1", - "daisyui": "^3.1.0", + "daisyui": "^3.2.1", "emoji-picker-element": "^1.18.1", "nprogress": "^0.2.0", "playwright-e2e-coverage-report": "^1.0.28", diff --git a/src/hooks.server.ts b/src/hooks.server.ts index 6bd8489f..4edef471 100644 --- a/src/hooks.server.ts +++ b/src/hooks.server.ts @@ -56,7 +56,7 @@ export const handle: Handle = async ({ event, resolve }) => { } if (Authenticate({ pathname, user_role: role || 'user' })) { - if (maintenanceMode && !['/contact', '/legal', '/careers'].includes(pathname)) { + if (maintenanceMode) { if (pathname === '/maintenance') { return await resolve(event) } else { diff --git a/src/lib/assets/icons/drawer/IconDrawerStreak.svelte b/src/lib/assets/icons/drawer/IconDrawerStreak.svelte index 2ebe835e..a8111066 100644 --- a/src/lib/assets/icons/drawer/IconDrawerStreak.svelte +++ b/src/lib/assets/icons/drawer/IconDrawerStreak.svelte @@ -8,5 +8,9 @@ + d="M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z" /> + diff --git a/src/lib/assets/icons/profile/IconProfileStreak.svelte b/src/lib/assets/icons/profile/IconProfileStreak.svelte index 8f07a4d5..ec93c13d 100644 --- a/src/lib/assets/icons/profile/IconProfileStreak.svelte +++ b/src/lib/assets/icons/profile/IconProfileStreak.svelte @@ -8,5 +8,9 @@ + d="M15.362 5.214A8.252 8.252 0 0112 21 8.25 8.25 0 016.038 7.048 8.287 8.287 0 009 9.6a8.983 8.983 0 013.361-6.867 8.21 8.21 0 003 2.48z" /> + diff --git a/src/lib/components/Browse/Sections/ItemCarousel.svelte b/src/lib/components/Browse/Sections/ItemCarousel.svelte index 4a4d22d6..e2c38bbe 100644 --- a/src/lib/components/Browse/Sections/ItemCarousel.svelte +++ b/src/lib/components/Browse/Sections/ItemCarousel.svelte @@ -48,7 +48,7 @@

{channel.title || ''}

-
+
diff --git a/src/lib/components/Browse/Sections/ItemChannel.svelte b/src/lib/components/Browse/Sections/ItemChannel.svelte index 48a544c5..4d8d2def 100644 --- a/src/lib/components/Browse/Sections/ItemChannel.svelte +++ b/src/lib/components/Browse/Sections/ItemChannel.svelte @@ -50,7 +50,7 @@

{channel.title}

-
+
diff --git a/src/lib/components/Browse/Sections/ItemTable.svelte b/src/lib/components/Browse/Sections/ItemTable.svelte index e13e2753..ffd8ce63 100644 --- a/src/lib/components/Browse/Sections/ItemTable.svelte +++ b/src/lib/components/Browse/Sections/ItemTable.svelte @@ -13,7 +13,7 @@
-
+
diff --git a/src/lib/components/Browse/Sections/ItemUser.svelte b/src/lib/components/Browse/Sections/ItemUser.svelte index c04ae45e..bf64ef1d 100644 --- a/src/lib/components/Browse/Sections/ItemUser.svelte +++ b/src/lib/components/Browse/Sections/ItemUser.svelte @@ -9,7 +9,7 @@
-
+
diff --git a/src/lib/components/Browse/Sections/SectionCarousel.svelte b/src/lib/components/Browse/Sections/SectionCarousel.svelte index 212eb452..047fb50d 100644 --- a/src/lib/components/Browse/Sections/SectionCarousel.svelte +++ b/src/lib/components/Browse/Sections/SectionCarousel.svelte @@ -3,7 +3,9 @@ import IconDrawerChevron from '$lib/assets/icons/drawer/IconDrawerChevron.svelte' import LoadingItemCarousel from '$lib/components/Browse/Sections/LoadingItemCarousel.svelte' import { onMount } from 'svelte' - import Swiper, { Navigation } from 'swiper' + import Swiper from 'swiper' + import { Navigation } from 'swiper/modules' + import ItemCarousel from '$lib/components/Browse/Sections/ItemCarousel.svelte' import 'swiper/css' @@ -60,7 +62,8 @@ {:then value} {#if value?.length > 0}
-
+
-
+
diff --git a/src/lib/components/Channel/Chat/ChatInput.svelte b/src/lib/components/Channel/Chat/ChatInput.svelte index 127f654f..9545e01e 100644 --- a/src/lib/components/Channel/Chat/ChatInput.svelte +++ b/src/lib/components/Channel/Chat/ChatInput.svelte @@ -8,8 +8,9 @@ import EmojiPicker from '$lib/components/Channel/Chat/EmojiPicker.svelte' import GifPicker from '$lib/components/Channel/Chat/GifPicker.svelte' - export let channel: any - export let users: any + export let channel: any, + viewers: any[] = [] + let selectedCommand = 0 let selectedUser = 0 let inputBox: any = null @@ -19,14 +20,18 @@ $channel_connection === `open-${channel._id}` && $page.data.user?.userId $: isHost = channel.user === $page.data.user?.userId + $: viewersWithOutHost = viewers.filter((viewer) => viewer.userId !== channel.user) + function insert(str: string, index: number, value: string) { return str.substr(0, index) + value + str.substr(index) } const sendMessage = () => { - if (messageIsCommand) { - if (selectedCommand && selectedUser >= 0) { - const user = users[selectedUser] + if (messageIsCommand && !chatMessage.startsWith('/ai ')) { + if (selectedCommand) { + const usernameFromMsg = chatMessage.substring(chatMessage.indexOf('@') + 1) + const user = viewersWithOutHost.find((viewer: any) => viewer.username === usernameFromMsg) + if (!user) return executeCommand(selectedCommand, user.userId) } } else if (!chatMessage.startsWith('/') || chatMessage.startsWith('/ai')) { @@ -55,15 +60,15 @@ } const slectCommandfromKey = (key: string) => { - if (key === 'ArrowDown' && selectedCommand < 3) { + if (key === 'ArrowDown' && selectedCommand < 4) { selectedCommand++ - } else if (key === 'ArrowUp' && selectedCommand >= 1) { + } else if (key === 'ArrowUp' && selectedCommand >= 2) { selectedCommand-- } } const slectUserfromKey = (key: string) => { - if (key === 'ArrowDown' && selectedUser < users.length) { + if (key === 'ArrowDown' && selectedUser < viewers.length) { selectedUser++ } else if (key === 'ArrowUp' && selectedUser >= 0) { selectedUser-- @@ -109,6 +114,7 @@ // toggle commands handlers const toggleBan = (userId: string) => { + if (channel.user === userId) return let isEnabled = false if (!channel.bans.includes(userId)) { channel.bans.push(userId) @@ -126,6 +132,7 @@ } const toggleMod = (userId: string) => { + if (channel.user === userId) return if (!channel.bans.includes(userId)) { let isEnabled = false if (!channel.mods?.includes(userId)) { @@ -143,6 +150,7 @@ } const toggleGuest = (userId: string) => { + if (channel.user === userId) return if (!channel.bans.includes(userId)) { let isEnabled = false if (!channel.guests.includes(userId) && channel.guests.length < 9) { @@ -187,16 +195,14 @@ ] $: messageIsCommand = - chatMessage && - chatMessage.startsWith('/') && - /[a-z] @[a-z]/.test(chatMessage.substr(1)) && - chatMessage.startsWith('/ai ') + chatMessage && chatMessage.startsWith('/') && /[a-z] @[a-z]/.test(chatMessage.substr(1)) $: showUsers = chatMessage && chatMessage.endsWith('@') $: showCommandOptions = chatMessage && chatMessage.startsWith('/') && !chatMessage.startsWith('/ai ') && + !chatMessage.includes('@') && (channel.user === $page.data.user?.userId || channel.mods?.includes($page.data.user?.userId)) && !showUsers @@ -253,12 +259,12 @@
{/if} - {#if users.length > 0 && showUsers} + {#if viewersWithOutHost.length > 0 && showUsers}
diff --git a/src/lib/components/Channel/Chat/DropdownViewChannel.svelte b/src/lib/components/Channel/Chat/DropdownViewChannel.svelte index 71ab6c2e..05b8719f 100644 --- a/src/lib/components/Channel/Chat/DropdownViewChannel.svelte +++ b/src/lib/components/Channel/Chat/DropdownViewChannel.svelte @@ -119,7 +119,7 @@
-
+
diff --git a/src/lib/components/Channel/Chat/FloatingMenu.svelte b/src/lib/components/Channel/Chat/FloatingMenu.svelte index 0aa20bc6..a07a2d98 100644 --- a/src/lib/components/Channel/Chat/FloatingMenu.svelte +++ b/src/lib/components/Channel/Chat/FloatingMenu.svelte @@ -1,5 +1,5 @@ -