Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Channel #464

Open
bob2402 opened this issue May 8, 2024 · 0 comments
Open

Channel #464

bob2402 opened this issue May 8, 2024 · 0 comments

Comments

@bob2402
Copy link
Collaborator

bob2402 commented May 8, 2024

Channel

For Blowater, we can divide permissions into two levels: Space and Channel. Roles are divided into Admin and Everyone.

The following two scopes, "server" and "selected", need to be implemented after the implementation of Invitation and Joining.

Channel Type

type Channel = {
  name: string;
  scope: "global" | "server"
} | {
  name: string;
  scope: "selected";
  selected: Set<Publickey>;
}

Channel List Event

This is a parameterized replaceable event.

{
  "kind": "Channel",
  "tags": {
    "t": "general",
    "scope": "global", // or server
    // ...
  },
  // ...
}
{
  "kind": "Channel",
  "tags": {
    "t": "general",
    "scope": "selected",
    "selected": ["npub1xxxx", "npub1yyyy", /* ... */]
    // ...
  },
  // ...
}

Only Admin can send this Event to create and edit Channels, and can send kind 5 to delete Channels.

The client can subscribe to the Channel type and receive the current list of channels for the Space.

Channel Message Event

{
  "kind": 1,
  "tags": [
    [ "channel", "general"],
    // ...
  ],
  "content": <arbitrary string>,
	// ...
}

When receiving this Event, Relayed queries the Channel configuration. If the Channel does not exist or has no write permission, an error is returned and the data is not written to the database.

For kind 1 Events without channel tags, they are displayed by default in the "Public" channel in Blowater.

How about other relay

Because there is no configuration related to the channel, other relays read all messages by default in the Public channel (if the relay allows everyone to read), and write messages according to the relay configuration.

References

Discord

Discord has implemented complex role and permission management, which is valuable for our reference when implementing channels.

Permissions

Permission management is divided into three levels: Server, Category, and Channel.

The permission configuration of the Channel will override the configuration of the Server. In addition to being at a level below Category on the UI, Channel can also choose to synchronize permissions with Category.

The following is a list of permissions configuration for Discord, omitting some permissions that are currently irrelevant or unimportant to Blowater.

  • GENERAL SERVER PERMISSIONS
    • View Channels
    • Manage Channels (create, edit and delete)
    • Manage Role
  • MEMBERSHIP PERMISSIONS
    • Create Invite
    • Kick Members
    • Ban Members
  • TEXT CHANNEL PERMISSIONS
    • Send Messages

Roles

The server has an "everyone" role by default, which can read and write messages in public channels by default. There is also a "highest" role, which is the creator of the server.

Blowater Channel Scopes

Scope Read Write Encrypted
Global (every single npub/user) Yes Yes or No No
Server (users joined the server/space) Yes Yes or No No
Selected (Handpicked users in an encrypted group chat) Yes Yes or No Yes or No

Discord does not have a global scope; it must be joined to a server in order to read messages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant