Files
de-mls/frontend/src/routes/+page.svelte
Ekaterina Broslavskaya 8ebeb4d898 FIx waku double message issue (#32)
* Refactor Waku client test to improve node setup and logging

* Refactor Waku integration to use new node setup and improve message handling

* Refactor Waku node setup and message handling with improved configuration

* Refactor main application structure and improve Waku node initialization

- Restructured main application to separate server and Waku node initialization
- Added more detailed logging for Waku node setup and connection process
- Updated Cargo.toml to use underscore naming convention and update Alloy dependency
- Modified Dockerfile to simplify build process
- Improved error handling and task management in main application flow

* Refactor project structure and improve dependency management

- Updated package name in Cargo.toml to use hyphen instead of underscore for consistency.
- Simplified dependency paths for Waku bindings in Cargo.toml files across the project.
- Modified Dockerfile to streamline the build process by removing unnecessary release flags.
- Enhanced README with updated environment variable instructions for better clarity.
- Improved frontend button structure for better user interaction.
- Cleaned up unused code in Waku actor and related tests, enhancing maintainability.

* Update Waku node initialization with auto-subscription notes

- Added comments to clarify that the Waku node is auto-subscribing to the pubsub topic and that explicit subscription is unnecessary due to this behavior.
- Documented the limitation regarding subscription checks in Waku, referencing the related issue for better context.

* Remove unused Go setup from CI workflow and clean up Cargo.toml by commenting out the library section. This streamlines the configuration and focuses on Rust dependencies.

* Add peer address configuration and benchmark setup

- Introduced a new benchmark configuration in Cargo.toml for `group_flow_benchmark`.
- Updated docker-compose.yml to include `PEER_ADDRESSES` environment variable.
- Enhanced README with instructions for setting `PEER_ADDRESSES` for node connections.
- Modified main.rs to parse and utilize peer addresses for Waku node connections, improving network configuration flexibility.

* Update Cargo.toml and Dockerfile for library configuration and build process

- Added a library section in Cargo.toml to specify bench settings.
- Modified Dockerfile to create necessary source files and streamline the build process by removing redundant commands.
- Updated main.rs to improve error handling for peer address configuration.

* Comment out library and benchmark sections in Cargo.toml, update Dockerfile to streamline build process, and disable CI benchmark jobs in workflow configuration.
2025-03-21 16:25:48 +07:00

100 lines
3.7 KiB
Svelte

<script lang="ts">
import {user, channel, eth_private_key, group, createNewRoom} from "$lib/stores/user"
import {goto, invalidate} from '$app/navigation';
import { env } from '$env/dynamic/public'
import toast from 'svelte-french-toast';
let status, rooms;
export let data;
$:({status, rooms} = data);
let eth_pk = "";
let room = "";
let create_new_room = false;
const join_room = () => {
eth_private_key.set(eth_pk);
group.set(room);
createNewRoom.set(create_new_room);
goto("/chat");
}
const select_room = (selected_room: string) => {
room = selected_room;
};
const filled_in = () => {
return !(eth_pk.length > 0 && room.length > 0);
};
const reload = () => {
toast.success("Reloaded rooms")
let url = `${env.PUBLIC_API_URL}`;
if (url.endsWith("/")) {
url = url.slice(0, -1);
}
invalidate(`${url}/rooms`);
}
</script>
<div class="flex flex-col justify-center">
<div class="title">
<h1 class="text-3xl font-bold text-center">Chatr: a Websocket chatroom</h1>
</div>
<div class="join self-center">
</div>
<div class="rooms self-center my-5">
<div class="flex justify-between py-2">
<h2 class="text-xl font-bold ">
List of active chatroom's
</h2>
<button class="btn btn-square btn-sm btn-accent" on:click={reload}>↻</button>
</div>
{#if status && rooms.length < 1}
<div class="card bg-base-300 w-96 shadow-xl text-center">
<div class="card-body">
<h3 class="card-title ">{status}</h3>
</div>
</div>
{/if}
{#if rooms}
{#each rooms as room}
<button class="card bg-base-300 w-96 shadow-xl my-3 w-full" on:click={() => select_room(room)}>
<div class="card-body">
<div class="flex justify-between">
<h2 class="card-title">{room}</h2>
<button class="btn btn-primary btn-md">Select Room</button>
</div>
</div>
</button>
{/each}
{/if}
</div>
<div class="create self-center my-5 w-[40rem]">
<div>
<label class="label" for="eth-private-key">
<span class="label-text">Eth Private Key</span>
</label>
<input id="eth-private-key" placeholder="Eth Private Key" bind:value={eth_pk}
class="input input-bordered input-primary w-full bg-base-200 mb-4 mr-3">
</div>
<div>
<label class="label" for="room-name">
<span class="label-text">Room name</span>
</label>
<input id="room-name" placeholder="Room Name" bind:value={room}
class="input input-bordered input-primary w-full bg-base-200 mb-4 mr-3">
</div>
<div class="form-control">
<label class="label cursor-pointer">
<span class="label-text">Create Room</span>
<input type="checkbox" class="checkbox checkbox-primary" bind:checked={create_new_room} />
</label>
</div>
<button class="btn btn-primary" disabled="{filled_in(eth_pk, room, create_new_room)}" on:click={join_room}>Join Room.</button>
</div>
<div class="github self-center">
<p>
Check out <a class="link link-accent" href="https://github.com/0xLaurens/chatr" target="_blank"
rel="noreferrer">Chatr</a>, to view the source code!
</p>
</div>
</div>