This repository has been archived on 2026-05-23. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tribes-plugin-template/lib/aether/plugin.ex
T
self b4b8c83ddb feat: namespace plugin identity
Adopt canonical plugin id/slug manifest fields, vendor-prefixed OTP app naming, and fully-qualified capability ids for Aether.
2026-05-27 19:05:51 +02:00

112 lines
3.1 KiB
Elixir

defmodule TribeOne.TribesPlugin.Aether.Plugin do
@moduledoc """
Tribes plugin entry point.
"""
use Tribes.Plugin.Base, otp_app: :tribe_one_aether
@behaviour Tribes.Capabilities.Chat.V1
@impl true
def register(context) do
super(context)
|> Map.merge(%{
nav_items: [
%{
label: "Aether",
path: "/aether",
icon: nil,
requires: [],
order: 50
},
%{
label: "Chat",
path: "/aether/chat",
icon: nil,
requires: [],
order: 51
}
],
pages: [
%{
path: "/aether/chat",
live_view: TribeOne.TribesPlugin.AetherWeb.ChatLive,
layout: nil
},
%{
path: "/aether",
live_view: TribeOne.TribesPlugin.AetherWeb.TimelineLive,
layout: nil
}
],
ash_domains: [TribeOne.TribesPlugin.Aether.Chat],
config_schema: %{
title: "Aether",
description: "Social feed and chat defaults.",
groups: [
%{
id: "chat",
label: "Chat",
description: "Group chat backend defaults.",
order: 10,
settings: [
%{
key: "chat.default_backend",
label: "Default chat backend",
description:
"New standalone channels use public synced chat until Marmot is explicitly selected.",
type: :enum,
default: "public_sync",
options: [
%{label: "Public synced", value: "public_sync"},
%{label: "Marmot scaffold", value: "marmot"}
],
order: 10
},
%{
key: "chat.marmot_enabled",
label: "Enable Marmot chat UI",
description:
"Reserved for the Marmot browser transport once storage, relay, and signing adapters are complete.",
type: :boolean,
default: false,
order: 20
}
]
}
]
}
})
end
@impl Tribes.Capabilities.Chat.V1
def embedded_panel(slug, opts \\ []) when is_binary(slug) do
assigns = %{
slug: slug,
backend: Keyword.get(opts, :backend, :public_sync),
embedded?: true,
current_user: Keyword.get(opts, :current_user),
session_privkey: Keyword.get(opts, :session_privkey)
}
{:ok,
Tribes.Plugin.Surface.live_component(
TribeOne.TribesPlugin.AetherWeb.ChatPanelComponent,
Keyword.get(opts, :id, "aether-chat-panel-#{slug}"),
assigns,
capability: "org.tribe-one.caps.chat@1",
provider: __MODULE__
)}
end
@impl Tribes.Capabilities.Chat.V1
def standalone_path(slug), do: TribeOne.TribesPlugin.Aether.Chat.standalone_path(slug)
@impl Tribes.Capabilities.Chat.V1
def handle_surface_info(_surface, {:aether_chat, :message, message}) do
{:ok, %{incoming_message: message}}
end
def handle_surface_info(_surface, _message), do: :ignore
end