Go to file
snxraven 9d759e5af3 Merge pull request 'fix: make avatars not draggable and selectable' (#11) from Cyber/LinkUp-P2P-Chat:main into main
Reviewed-on: #11

Good Job!
2024-06-15 17:50:47 +00:00
assets Add internal command handler with ping and clear commands to start 2024-06-14 00:57:05 -04:00
chatBot update 2024-06-15 03:28:36 -04:00
images update readme, add screenshot 2024-06-15 03:57:42 -04:00
test first commit 2024-06-03 19:23:14 -04:00
.gitignore remove unused function 2024-06-13 01:38:10 -04:00
README.md update readme, add screenshot 2024-06-15 03:57:42 -04:00
app.js fix: make avatars not draggable and selectable 2024-06-15 15:42:35 +02:00
commands.js Adding hyperdrive files management via ~list-files 2024-06-14 01:56:46 -04:00
index.html Better style for the side bar + removing alert on copy 2024-06-13 05:24:44 -04:00
package.json Setting force window default size, min size and adding real window buttons 2024-06-09 01:27:42 -04:00
style.css fix: make avatars not draggable and selectable 2024-06-15 15:42:35 +02:00

README.md

LinkUp is currently in active development and not fully launched.

To launch the App in Dev Mode:

git clone https://git.ssh.surf/snxraven/LinkUp-P2P-Chat.git

cd LinkUp-P2P-Chat

npm i; npm i pear -g;

Lastly - run the app: pear dev -s /tmp/tmp_pear


LinkUp Documentation

Overview

LinkUp is a peer-to-peer chat application that allows users to create and join chat rooms, share files, and communicate with each other in real-time. The application uses the Hyperswarm, Hyperdrive, and Corestore libraries for decentralized networking and storage. This documentation provides a comprehensive guide to understanding, setting up, and using LinkUp.

Screenshot

Table of Contents

Configuration

LinkUp uses a configuration file (config.json) to store user information, chat room details, and registered users. This file is automatically created and managed by the application.

Configuration File Structure

{
  "userName": "",
  "userAvatar": "",
  "rooms": [],
  "registeredUsers": {}
}
  • userName: The username of the registered user.
  • userAvatar: The URL of the user's avatar image.
  • rooms: An array of chat rooms the user has joined or created.
  • registeredUsers: An object containing registered usernames and their avatar URLs.

Usage

Registering a User

  1. Launch the application.
  2. If the configuration file does not exist, you will be prompted to register.
  3. Enter a username and optionally select an avatar image.
  4. Submit the registration form to complete the process.

Creating a Chat Room

  1. Click on the "Create/Join Room" button in the sidebar.
  2. Click on "Create Room".
  3. A new room will be created with a random topic.

Joining a Chat Room

  1. Click on the "Create/Join Room" button in the sidebar.
  2. Enter the topic of the room you wish to join in the "Topic" field.
  3. Click on "Join Room".

Sending Messages

  1. Select a chat room from the sidebar.
  2. Enter your message in the message input box at the bottom of the chat window.
  3. Press Enter or click on the "Send" button to send the message.

Attaching Files

  1. Click on the "Attach File" button in the message form.
  2. Select a file from your device.
  3. The file will be uploaded and a download link will be shared in the chat.

Recording and Sending Audio Messages

  1. Click and hold the "Talk" button to start recording an audio message.
  2. Release the button to stop recording and send the audio message.

Commands

LinkUp supports several commands that can be entered in the chat input box:

  • ~clear: Clears the chat messages.
  • ~ping: Responds with "pong".
  • ~help: Lists available commands.
  • ~join [topic]: Joins a chat room with the specified topic.
  • ~leave: Leaves the current chat room.
  • ~create [alias]: Creates a new chat room with the specified alias.
  • ~list-files: Lists all files available in the current chat room.

Development

Project Structure

  • app.js: Main application logic.
  • commands.js: Command handling logic.
  • index.html: HTML structure of the application.
  • style.css: CSS for styling the application.
  • config.json: Configuration file for storing user and room data.

Event Handling

LinkUp uses an EventEmitter to handle various events such as receiving messages, joining rooms, and updating the peer count. Event listeners are set up during the initialization process.

Key Functions

  • initialize(): Initializes the application, sets up event listeners, and loads configuration.
  • registerUser(): Handles user registration.
  • createChatRoom(): Creates a new chat room.
  • joinChatRoom(): Joins an existing chat room.
  • sendMessage(): Sends a text message.
  • handleFileInput(): Handles file attachments.
  • setupEventListeners(): Sets up event listeners for UI interactions.

FAQs

Q: How do I change my username or avatar? A: Currently, changing username or avatar after registration is not supported. You would need to delete the config.json file and restart the application to re-register.

Q: How can I see the list of files shared in a room? A: Use the ~list-files command to see all files shared in the current chat room.

Q: How do I leave a chat room? A: Click on the "Leave Room" button in the chat window.

For more information, please refer to the Pears Documentation.

Feel free to contribute to this project by submitting issues or pull requests on Git.