Git Product home page Git Product logo

vicariousdrama / cornychat Goto Github PK

View Code? Open in Web Editor NEW
21.0 2.0 6.0 20.44 MB

🌽 Corny Chat is an open source audio space built on Jam that integrates Nostr and Lightning

Home Page: https://cornychat.com

License: GNU Affero General Public License v3.0

Shell 0.19% Dockerfile 0.16% JavaScript 94.85% HTML 0.41% CSS 1.02% SCSS 0.91% TypeScript 1.98% EJS 0.49%
audio bitcoin chat foss lightning nostr voice

cornychat's Introduction

Corny Chat

This software provides an open source audio space for users of Nostr.

Users can quickly login with existing Nostr accounts and have name and avatar image set from profile data used throughout Nostr.

Roadmap

  • βœ… Login Enhancements
    • βœ… Anon login
    • βœ… Nostr Login with NIP-07 extension
    • βœ… Nostr Login with user provided NSEC
  • βœ… Recognition of User Profile (kind 0)
    • βœ… Fetch and display Name (kind 0)
    • βœ… Fetch and display Avatar Image from picture (kind 0)
    • βœ… Fetch and display Lightning Address (kind 0)
    • βœ… Nostr Address (kind 0)
    • βœ… Description/About (kind 0)
  • βœ… Room Customizations
    • βœ… Set Room Background Picture
    • βœ… Set Room Colors from Preconfigured Palette/Theme
    • βœ… Set Room Colors from Custom Selection
    • βœ… Set Room Emoji Reactions vs Default
    • βœ… Allow multiple avatars per row to fit on desktop
    • βœ… Add Collapse/Expand to hide/show the room description
  • βœ… User Avatar
    • βœ… Allow Users to set their in room status (e.g. AFK, BRB, Present)
    • βœ… Raise Hand as Audience member and Speaker
    • βœ… Show microphone on/muted for speakers
    • βœ… Show indication when speaker is speaking
    • βœ… Show indication of verified Nostr login
  • βœ… View User Profile
    • βœ… Display name, about, avatar, nostr address on popup
    • βœ… Verify nostr address
    • βœ… Follow User Action to adjust contact list (kind 3)
    • βœ… Unfollow User Action to adjust contact list (kind 3)
  • ⬜ Edit User Profile
    • ⬜ Edit Personal Profile to set name, picture, about, lud16, nip05
    • ⬜ Upload Banner image to common media uploaders
    • ⬜ Upload Avatar image to common media uploaders
  • β˜‘οΈ Reaction Customizations
    • βœ… Update Default Emoji Reactions
    • ⬜ Emoji sets (kind 30030)
    • ⬜ Target user for sending reaction
    • ⬜ Animate reaction from sender to target
  • β˜‘οΈ Zapping other Users
    • βœ… Prepare Zap based Invoice
    • βœ… Allow Alby Browser Extension to Pay Invoice
    • ⬜ Confirm Zap paid (kind 9735)
    • ⬜ Animate Zap from payer to receiver
    • ⬜ Zap Default to target without confirmation (e.g. using Alby budget)
  • βœ… Nostr Scheduled Events
    • βœ… Allow rooms to schedule a future event
    • βœ… Publish Nostr Calendar Time Event (kind 31923 per NIP-52)
    • βœ… Publish Nostr Delete Event (kind 5 per NIP-9)
    • βœ… Periodically update cache of scheduled events
  • β˜‘οΈ Nostr Live Activity + Chat
    • βœ… Create and Publish Nostr Live Activity for Rooms (kind 30311 per NIP-53)
    • βœ… Live Chat Message tied to the Live Activity (kind 1311)
    • ⬜ Ability for user to react to chat message
    • ⬜ Ability for user to zap a chat message
  • β˜‘οΈ Landing Page
    • βœ… Show list of all Nostr Scheduled Audio Spaces across instances
    • βœ… Show list of all Nostr Live Audio Spaces across instances
    • ⬜ Server Message of the Day when user accesses first time during day
  • βœ… About Page
    • βœ… Link to this git repository for source code
    • βœ… List of code contributors, supporters, producers.. contact and links
    • βœ… Contact information for server operator

About Nostr:

NOSTR is an acronym meaning "Notes and Other Stuff Transmitted through Relays". It is an alternative and open protocol for exchanging simple structured information publicly through relays your client(s) are connected to. With Nostr, you cannot be deplatformed, and you are not fed an algorithm by default. You can move between clients that evolve over time. For more information, check out Nostr.how

About Jam:

This software is built as a fork from Diego's Jam which was forked from Jam from stable branch on gitlab from 2023-07-27. πŸ“ Jam is an open source alternative to Clubhouse, Twitter Spaces and similar audio spaces. With Jam you can create audio rooms that can be used for panel discussions, jam sessions, free flowing conversations, debates, theatre plays, musicals and more. The only limit is your imagination. For more information, check out Jam, the Jam community on 🎧 Discord, Jam on X, and Jam on 😽 Product Hunt. The original README for Jam is available here

Host Your Own Server

Hosting your own Instance is easy...

Follow the Install guidance for setting up your server

Periodically Update your install with changes

cornychat's People

Contributors

mitschabaude avatar tosh avatar doublemalt avatar vicariousdrama avatar diamsa avatar alexleutgoeb avatar hellp avatar jolg42 avatar dudekowsky avatar behroozbc avatar jmcudd avatar

Stargazers

Emmanuel Salomon avatar Yavin 5 avatar Adam Johnson avatar Rsync⚑️  avatar A.Z. avatar  avatar Pattern avatar haruki7049 avatar BoltC avatar OceanSlim avatar aurelienmaurel avatar chef4brains avatar Lewin Kelly avatar  avatar Yudibilly avatar 22388o⚑️  avatar tigs avatar Jacob Spevak avatar  avatar sparky avatar Ethan Tuttle avatar

Watchers

 avatar  avatar

cornychat's Issues

Deleting Moderators/Speakers (and probably owners) causes error in client

When deleting a moderator or speaker, the remove calls for each entry being deleted conflict with the main room update call on the back end with the new logic to prevent overwrites. The user is presented with an error indicating the settings couldnt be updated.

  • See: ui/jam-core/room.js removeModerator function call to put
  • See: ui/jam-core/room/Speakers.js removeSpeaker function call to put

Both of these are calling the put function in ui/jam-core/backend.js which performs an authenticated api request to 'PUT' the data to the endpoint. The backend then bails as these subsequent calls aren't issuing the new updateTime value from the prior call.

This is initiated in ui/views/editRoom/EditRoom.jsx around line 100 for the owners, moderators and speakers. It may not be necessary to make these removeModerator and removeSpeaker calls unless they are issuing swarm updates. If so, it may be better to do the removeModerator and removeSpeaker call after the normal update?

Feature: Room List track include prior hour

At the top of the hour, the home page typically shows no or fewer rooms then may actually exist because the room list api call only queries those rooms that were known to be recently active in the current hour. Thus, when switching to a new hour there may not be activity known yet and thus the list can be empty.

Change the logic to get all active rooms in the current and former hour, and then check active connections to see how many apply to each room.

Feature: Add support for kicking users

A new list of kicked users can be added to the room state.

When a moderator, room owner, or admin kicks a user:

  1. display a dialog to input the following

    • comment for kick reason
    • unban timeout (default 5 minutes)
  2. If moderator presses cancel, no action is performed

  3. If moderator presses ok, then record

    • the ID of the user being kicked
    • the current date and time (as a timestamp)
    • the expiration of the ban (as a timestamp)
    • the id of the user that peformed the kick action
    • the comment
  4. Notify all participants of the room that the user was kicked for X reason

  5. Peers should drop connections to the kicked user

  6. The user should be exited by client side effect.

  7. Peers should not establish connections with users considered kicked

The Room Settings should have a way to review any kicked users, and prematurely unban them

On room updates, auto remove any expired ban records (consider moving to an archive record in the backend for review)

Feature: Don't eject users when closing the room

Currently, non moderators are ejected from the room when it is marked as closed by a moderator. This should be changed to keep users in the room if they were in the room before hand, but disallow new people to enter.

Slides - show slide number

When there is a lot of slides, it can be helpful to have an indicator of what slide number its on. It may be fine to just prefix the caption text indicating current slide of total slides. E.g.

27/64 - caption of slide

Slides - support saving as list

This feature is only available if window.nostr is present as the user will need to sign the event

Add option to save existing slides as a new Album (this will be a nostr Bookmark Set (kind 30003)) from the room settings.

Prompt for the following to include

  • name
  • about
  • choose image from the set to use as the picture representing the slide album, defaulting to first image

Standard tags are defined at https://github.com/nostr-protocol/nips#standardized-tags, but for sanity, we'll add additional as needed

Include all the images as r tags in the following format

["r", "the url", "the caption"]

Generate a d tag. Assemble the full bookmark set for the album with the user's pubkey who is performing the action

User sign and publish to relays.

Feature: Auto-Navigate to Homepage when at Enter Room screen for too long

When a user is on the Enter Room screen they establish connection to participants in the room and are counted as a user of the room. As the server is only aware of a connection, but not the user's state, this causes rooms with only people at the door to appear as though they have people in them on the lobby page, and via the announcement bot.

Recommend adding script to force navigating anyone at the Enter Room screen to the home page if they are there in excess of 1 minute.

Slides - update currentslide based on deleted slides

If current slide is beyond the point of a slide being deleted, then the currentSlide will be showing a later slide then intended.

E.g. Imagine 10 slides, and the currentSlide being shown is slide 7. When slide 4 and 5 are deleted, the currentSlide number is still 7, but will advance to show what used to be slide 9, which skips what was slide 8.

To resolve, update currentSlide to be decremented if the slide being deleted is less than the current slide when updating room settings.

Refactor tags used to better meet existing nostr standards

See nostr-protocol/nips#1137 which was spawned from #24

  • Change the t tag for audiospace to an l tag
  • Add an L tag to define the namespace?
  • Change the t tag for cornychat to an l tag, and ensure using the environment JAM_HOST value instead of hardcoded (actual should be cornychat.com, not cornychat as depicted in image sample in #24)
  • Convert deleted tag with value deleted that is populated in deleteNostrSchedule to use NIP-40 expiration timestamp instead
  • Add check for expiration tag to getScheduledEvents

Documentation: Add section for Nostr kinds used

As nostr event kinds are being defined or used in specific ways, it would be helpful to others to have readable documentation providing excamples of creation and usage of the following

  • Expected fields read from profile (kind 0)
  • Sign in with extension (unpublished kind 1)
  • Verification from relays (kind 1)
  • Reading and Writing Followers (kind 3) --- note about session storage
  • Setup of Zap Request (kind 9734)
  • Live Activities (kind 30311)
  • Corny Chat Slide Set (kind 30388)
  • Corny Chat Link Set (kind 31388)
  • Time-Based Calendar Event (kind 31923)
  • Deleting Time-Based Calendar Event (kind 5) --- note the deletion pattern to update before delete

Regardless of naming in the NIPs, focus on key material such as the expected tags, dependencies, and risks of overwrites

HTML Encoding issues in room settings

Need to apply the decode calls to various fields that can contain HTML encoded entities.

Previously addressed the room topic, description, and some others but need to also apply to

  • room link caption
  • room slide caption
  • schedule title
  • schedule description

Consider adding nostr nests planned events as scheduled

Nostr Nests uses live activities for both going live, and scheduling. This is in place of using a scheduled calendar time event which corny chat has opted for.

A live activity event is kind 30311 with a tag status set to planned or live or ended.

For planned events, the scheduled start time is in the tag starts. Until the event is started, the actual streaming url is not given, but it's derivable. The d tag is the unique identifier for the planned event, and once it is live, it is included in a url with the streaming tag as follows: https://nostrnests.com/api/v1/live/4186938a-4538-491b-95a5-ff15d7149f1e/live.m3u8. The 4186938a-4538-491b-95a5-ff15d7149f1e portion of the url matches the value of the d tag.

Note that nostr nests includes a single streaming tag when planned, but then has two streaming tags once it goes live. The value of the streaming tag that should be ignored is wss+livekit://nostrnests.com:443

Unfortunately, there's nothing specific to filter on of the live activity to differentiate it as a audiospace event separate from other live activities that would appear on streaming viewers. Nostr Nests itself may be filtering on the service tag which they set to https://nostrnests.com but the goal for discovery is to allow for pulling in any audio space implementation that conforms to a common tagging approach.

For corny chat, we may be able to start with pulling all live activities, and just parsing through looking for the status as planned or live to discern scheduled or not, and filter by time. The url is deterministic based on the d tag when its nostrnests, but this may not be consistent for other implementations that come in the future.

As a first pass, it may be more practical to do a filtered pull specific to nostr nests, but revoke if not reciprocated within a reasonable period of time

Time Meridiems

Hi,
This is the first time I've raised an issue on GH so please excuse me if I'm doing it all wrong.

On the home page (conrnychat.com) there is a list of scheduled events & these events have a date and time.
The times are not displaying the correct AM/PM and are showing up like this - Monday, April 8 at 2:00M GMT+1

NIP-46 Auth

Would love to see NIP-46 integration for easy mobile sign in

Room names less than 4 characters dont give user adequate info

Minimum room name length is 4 characters. If using less (e.g., soy), then an error is presented to the user, but doesnt guide them to the need to make it longer.

image

Reported by Tekkadan

See ui/views/PossibleRoom.jsx around line 51 for roomId.length check

Firefox on MacOS may not be working?

Got a report from a user that using Firefox on MacOS is not working. The mic is muted and there is no audio.
May be related to recent MacOS update? Works with Chrome at the moment.

Add a way for users to report bugs

This can start with

  • link on the home page
  • link/action from the navigation menu

Have the link go to this repository.
In the future, possible to DM me over nostr so im immediately made aware.

Follow/Unfollow action needs to update button state

When viewing a profile, if click on Follow a user, the button should update to enable Unfollowing and vice versa.

Verify whether this is being done, as well as confirmation for negative (Unfollow) actions

Slides - support loading from list

This feature is only available if the user has a pubkey/npub as they will need to be able to select an existing list

Add option to load slides from list

Present user with a list of their bookmark sets (kind 30003) and show them the name, about, and image for each to facilitate their selection.

Once a choice is made and continuing, iterate all tags, and for each r tag, populate a slide with the url from the tag[1] and caption from tag[2]

View Profile without Nostr Extension

When viewing profile without nostr extension, the buttons for zap, follow and unfollow are not shown.

Add in a placeholder indicating that these features are available if using a nostr extension. This helps incentivize users to setup for nostr and can later be worked into onboarding

User Labels/Petnames

Add support to Corny Chat to load all pet names authored by the user (filter: {authors: [userpubkey], kind: [1985,30382]}) and cache in the session storage.

Reference the session storage of these labels when rendering the names of the following places

  • avatars in the room (speaker array, audience array)
  • room settings: speakers
  • room settings: moderators
  • room settings: owners
  • profile of a user

Allow a user of Corny Chat to assign a label by viewing the profile of a user and inputting a petname.


NIP-32: Labeling
https://github.com/nostr-protocol/nips/blob/master/32.md

If using NIP-32, its kind 1985. The namespace L used is com.cornychat. The label l can be petname with the content field reflecting the petname given

Note that NIP-32 ends with this

A good heuristic for whether a use case fits this NIP is whether labels would ever be unique. For example, many events might be labeled with a particular place, topic, or pubkey, but labels with specific values like "John Doe" or "3.18743" are not labels, they are values, and should be handled in some other way.

Another weakness is that these are long lived, non-temporal labels.


Alternative NIP-81: Relationship Status
https://github.com/vitorpamplona/nips/blob/relationship-status/81.md

This approach uses a replaceable kind 30382, where the d tag is the targeted pubkey being associated, and n tags for theoretical lists. A petname can be used for assigning the label that the user should see in place of the target's self identified name per kind0. The following example optionally encrypts the petname and a summary tag, both of which can be plaintext tags

{
  "kind": 30382,
  "tags": [
    ["d", "e88a691e98d9987c964521dff60025f60700378a4879180dcbbb4a5027850411"],
    ["n", "Follows"],
    ["n", "Bitcoiners"],
    ["n", "6064460175057025"]
  ],
  "content": nip44Encrypt(JSON.stringify([
    ["petname", "NVK (Coldcard)"],
    ["summary", "Owes me a beer"]
  ])),
  // ...other fields
}

As a replaceable, special care must be taken when creating and editing the petname of a user to check for existing definitions, and ONLY update the relevant field (e.g. the petname) while keeping the lists (n tags) and others intact.

Add room favorites

Per NIP51, use kind 30003 Bookmark Sets to be able to have a named list "favorite-audiospaces", and use the "r" tag for url to room in cornychat, nostrnests, etc. Signed by user pubkey

Slides - Add a slideshow timer option to room settings

MarkπŸ’βš‘οΈπŸ«‚πŸ’œ
2h
I'd like a slideshow feature timer - auto plays list with a set time delay in between each one 😎 Good update it's gonna be useful

See https://njump.me/nevent1qvzqqqqqqypzptvh8qps4wzvqnl6a3j2htwke35zev6sr5vn5hl3e99eqacfz42cqyghwumn8ghj7vf5xqhxvdm69e5k7tcpz9mhxue69uhkummnw3ezuamfdejj7qpqkz0tkq3lmqfazs4lkelytn6u72eyuejyew6u3d4xt8g39fp6m48sgt6w0j


Consider adding a room setting to allow setting a slideshow timer.

This could be a value where 0 = dont autochange, any positive number being seconds between changes. Defaulting to 0 for rooms so that this is treated as an opt-in feature.

Currently, the current slide is tracked as room state and gets saved to the backend and pushed to peers. Recommend refactoring this to be a new state pushed around through SFU to peers, but not saved to room state saved in backend as every change requires setting the updateTime which would prevent mods (including the one enabling it) from making room state updates if the frequency is too often (e.g., 1 second would be disastrous)

Scheduling appears to be broken

When scheduling an event from within a room, it does not always work.
I'm trying to update the schedule for the https://cornychat.com/nostroholics room, but when I do so with others in the room, I get two errors. 1) the error about it being out of date, and 2) the room flashes its users as though the speaker array was updated, even though it wasn't successfully saved in the backend.

Slides - allow upload file

Allow upload file directly in the interface so users don't have to go to another site to upload and fetch the URL.

Also allow upload directly from the menu navigation without having to go into room settings. Just add slide to last in the list.

Feature: Associate Nostr ID across Device IDs

Each device or profile of a device that accesses Corny Chat has its own locally generated public and private key pair independent of nostr. The public key portion is the ID, also referred to the JamID or identity of a user within the system. These ids are referenced in room owners, moderators, speakers arrays for permissions.

A user identity can verify with their nostr account.

If a user accesses corny chat from multiple profiles, and each are verified with nostr, it would be convenient for them to automatically get the permissions assigned to them on their other device profiles. This would ensure that room owners, admins, moderators etc would automatically get their ownership when switching devices, provided they've logged in with nostr.

Document tags used in Scheduled Calendar Time Event (kind 31923)

Document in the following places the tags in use and expected for compatibility.

  • A markdown file in the repo
  • A page for the website
  • NIP-52 in nostr-protocols/nips

image

Furthermore, make special note of the following

  • The t tag audiospace is required for inclusion in the cached list of scheduled events
  • The p tag can be repeated to include multiple pubkeys. The use of host as the role is expected by Flockstr. For cornychat, this is assigned as the value for whatever moderator/owner set this schedule time. Role names may change in the future.

Slides - Allow synch/unsynch

  • Allow users to navigate through slides without updating the room's currentslide
  • Allow moderators to toggle a synch and unsynched state on the slides (lock and unlock icon?) to allow them to cycle through slides locally before assigning the current slide desired.

Side Chat

Chats within a chat.

  • Labels for each side chat
  • Volume control for each chat.
  • stream audio in side chats
  • record side chats

Live Activities Support

Setup Live Event nostr event for each active room (and maybe scheduled ones?)

Status for room should be live when room has at least one participant if not marked as private or closed. If room is private or closed, then flip to live when both are set accordingly to a publicly announced open room. Otherwise, if the event has been started, if can be ended. If a scheduled event exist for the room, status should be planned until the live start time

See: NIP53 https://github.com/nostr-protocol/nips/blob/master/53.md, kind 30311

Sample live event from Nostr Nests which appears to query for all live activities, and then filter on the service being https://nostrnests.com for whether it should display on main page

https://njump.me/naddr1qqjx2erxvf3nywpk95unzwfc956rxdn995unzwfc94snxwfsvv6xycesx93nvqg4waehxw309aex2mrp0yhxgctdw4eju6t09upzqmpddzaqzmpfzstl6x820srtwdlvzslh64kh3lw5ffdjfzzx2f0vqvzqqqrkvung8kel

Zap.Stream events need naddr1 adjustment

Corny Chat homepage is showing some zap.stream events
image

The 3 Design events all end up with failures for unexpected application error!
https://zap.stream/naddr1qvzqqqrkvupzpn6956apxcad0mfp8grcuugdysg44eepex68h50t73zcathmfs49qqjxzd3kvesnzdph956xyvp5956rgefn95unzcf5956kyv35vyenwde58yukxldj5wx

image

Going to zap.stream directly, to the event, and then loading in njump.me
https://njump.me/naddr1qqjr2enyv56x2v3495unxcen956xxe3395unjv3395crxe3nxsmnjdmyxumn2qg3waehxw309ahx7um5wgh8w6twv5hsygx0gknt5ymr44ldyyaq0rn3p5jpzkh8y8ymg773a06ytr4wldxz55psgqqqwensayhtyl

This event contains a tag for relays, so may be able to use that to assemble when building out the naddr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.