|
@ -56,7 +56,7 @@ |
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
//--------------------------------------------------------------------------------/ |
|
|
//--------------------------------------------------------------------------------/ |
|
|
let channelMode = ""; |
|
|
let channelMode = ""; |
|
|
const channelOptions = ["public", "private"]; |
|
|
const channelOptions = ["public", "private", "protected"]; |
|
|
|
|
|
|
|
|
const joinChannel = async (id: number) => { |
|
|
const joinChannel = async (id: number) => { |
|
|
socket.emit("joinChannel", { |
|
|
socket.emit("joinChannel", { |
|
@ -100,9 +100,10 @@ |
|
|
|
|
|
|
|
|
const createChannel = async () => { |
|
|
const createChannel = async () => { |
|
|
let name; |
|
|
let name; |
|
|
|
|
|
let password = ""; |
|
|
name = prompt("Enter a name for the new channel:"); |
|
|
name = prompt("Enter a name for the new channel:"); |
|
|
if (name) { |
|
|
if (name) { |
|
|
let password = ""; |
|
|
if (channelMode === 'protected') |
|
|
password = prompt("Enter a password for the new channel:"); |
|
|
password = prompt("Enter a password for the new channel:"); |
|
|
name = "🚪 " + name; |
|
|
name = "🚪 " + name; |
|
|
const response = await fetch(API_URL + "/channels", { |
|
|
const response = await fetch(API_URL + "/channels", { |
|
@ -212,12 +213,10 @@ |
|
|
on:click={() => removeChannel(channel.id)} |
|
|
on:click={() => removeChannel(channel.id)} |
|
|
on:keydown={() => removeChannel(channel.id)}>🗑️</button |
|
|
on:keydown={() => removeChannel(channel.id)}>🗑️</button |
|
|
> |
|
|
> |
|
|
{#if channel.isPrivate == true} |
|
|
{#if channel.isPrivate == false} |
|
|
<button on:click={() => inviteChannel(channel.id)}>🤝</button> |
|
|
<button on:click={() => inviteChannel(channel.id)}>🤝</button> |
|
|
{/if} |
|
|
{/if} |
|
|
{#if channel.password !== ''} |
|
|
|
|
|
<button on:click={() => changePassword(channel.id)}>🔑</button> |
|
|
<button on:click={() => changePassword(channel.id)}>🔑</button> |
|
|
{/if} |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
</div> |
|
|
</li> |
|
|
</li> |
|
|