mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-08-14 06:47:28 +00:00
Add communication account plugin scaffolds
This commit is contained in:
parent
5cfeea6b57
commit
c23ce42948
48 changed files with 1949 additions and 13 deletions
41
plugins/social-accounts/src/index.ts
Normal file
41
plugins/social-accounts/src/index.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
import { createProviderRegistry } from "@logicsrc/account-core";
|
||||
import type { PluginDefinition } from "@logicsrc/plugin-core";
|
||||
import { socialAccountsManifest } from "./manifest.js";
|
||||
import { socialAccountProviderManifests } from "./providers/index.js";
|
||||
|
||||
export const socialAccountsPlugin: PluginDefinition = {
|
||||
manifest: socialAccountsManifest,
|
||||
configDefaults: {
|
||||
enabled: true,
|
||||
default_publish_policy: "approval_required",
|
||||
credential_broker: "${LOGICSRC_CREDENTIAL_BROKER}"
|
||||
},
|
||||
routes: [
|
||||
{ method: "GET", path: "/api/social/providers", capability: "social.providers.list" },
|
||||
{ method: "GET", path: "/api/social/accounts", capability: "accounts.list" },
|
||||
{ method: "GET", path: "/api/social/accounts/:id/profile", capability: "social.profile.read" },
|
||||
{ method: "POST", path: "/api/social/accounts/:id/drafts", capability: "social.post.draft" },
|
||||
{ method: "POST", path: "/api/social/accounts/:id/posts", capability: "social.post.publish" },
|
||||
{ method: "GET", path: "/api/social/accounts/:id/mentions", capability: "social.mentions.read" },
|
||||
{ method: "GET", path: "/api/social/accounts/:id/analytics", capability: "social.analytics.read" }
|
||||
],
|
||||
permissions: [
|
||||
"accounts:list",
|
||||
"accounts:read_metadata",
|
||||
"accounts:audit:read",
|
||||
"social:profile:read",
|
||||
"social:post:draft",
|
||||
"social:post:publish",
|
||||
"social:mentions:read",
|
||||
"social:analytics:read"
|
||||
],
|
||||
tuiPanels: [{ id: "social-accounts", title: "Social Accounts" }]
|
||||
};
|
||||
|
||||
const registry = createProviderRegistry(socialAccountProviderManifests);
|
||||
|
||||
export function listSocialAccountProviders() {
|
||||
return registry.list("social");
|
||||
}
|
||||
|
||||
export { socialAccountsManifest, socialAccountProviderManifests };
|
||||
37
plugins/social-accounts/src/manifest.ts
Normal file
37
plugins/social-accounts/src/manifest.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import type { PluginManifest } from "@logicsrc/plugin-core";
|
||||
|
||||
export const socialAccountsManifest: PluginManifest = {
|
||||
id: "social-accounts",
|
||||
name: "Social Accounts",
|
||||
version: "0.1.0",
|
||||
type: ["communication", "accounts", "social"],
|
||||
default: true,
|
||||
capabilities: [
|
||||
"accounts.connect",
|
||||
"accounts.list",
|
||||
"accounts.read_metadata",
|
||||
"accounts.test",
|
||||
"accounts.revoke",
|
||||
"accounts.sync",
|
||||
"accounts.audit.read",
|
||||
"social.providers.list",
|
||||
"social.profile.read",
|
||||
"social.post.draft",
|
||||
"social.post.publish",
|
||||
"social.media.upload",
|
||||
"social.mentions.read",
|
||||
"social.analytics.read"
|
||||
],
|
||||
commands: ["accounts", "social"],
|
||||
env: [
|
||||
"MASTODON_CLIENT_ID",
|
||||
"MASTODON_CLIENT_SECRET",
|
||||
"BLUESKY_APP_PASSWORD",
|
||||
"GITHUB_CLIENT_ID",
|
||||
"GITHUB_CLIENT_SECRET",
|
||||
"X_CLIENT_ID",
|
||||
"X_CLIENT_SECRET",
|
||||
"REDDIT_CLIENT_ID",
|
||||
"REDDIT_CLIENT_SECRET"
|
||||
]
|
||||
};
|
||||
49
plugins/social-accounts/src/providers/index.ts
Normal file
49
plugins/social-accounts/src/providers/index.ts
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
import type { LogicSrcAccountProviderManifest } from "@logicsrc/account-core";
|
||||
|
||||
export const socialAccountProviderManifests: LogicSrcAccountProviderManifest[] = [
|
||||
{
|
||||
id: "mastodon",
|
||||
name: "Mastodon",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish", "social.mentions.read"],
|
||||
defaultScopes: ["read:accounts", "read:statuses", "write:statuses"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "bluesky",
|
||||
name: "Bluesky",
|
||||
kind: "social",
|
||||
authMethods: ["api_key"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish"],
|
||||
defaultScopes: ["atproto.session", "atproto.repo.read", "atproto.repo.write"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "github",
|
||||
name: "GitHub",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2", "api_key"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish"],
|
||||
defaultScopes: ["read:user", "repo"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "x",
|
||||
name: "X / Twitter",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2", "api_key"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish", "social.mentions.read", "social.analytics.read"],
|
||||
defaultScopes: ["tweet.read", "tweet.write", "users.read", "offline.access"],
|
||||
status: "planned"
|
||||
},
|
||||
{
|
||||
id: "reddit",
|
||||
name: "Reddit",
|
||||
kind: "social",
|
||||
authMethods: ["oauth2"],
|
||||
capabilities: ["social.profile.read", "social.post.draft", "social.post.publish", "social.comments.read"],
|
||||
defaultScopes: ["identity", "read", "submit"],
|
||||
status: "planned"
|
||||
}
|
||||
];
|
||||
Loading…
Add table
Add a link
Reference in a new issue