-
Notifications
You must be signed in to change notification settings - Fork 1
feat(plugins): add SDK access and group chat gates #1
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
Changes from all commits
cf5c89b
fd56619
ea15541
d7332c3
6c0f508
160fc1b
cd62b64
9d5256b
23dc815
48ed0a0
c5e054d
71fec51
6bbceee
bea72a3
dd335e6
b6cdc28
71efca9
6dd2995
080c37c
c4f4ad5
9396c72
1ec2fde
f095ebf
c8e26e7
d8be803
7b4b84c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,8 +12,8 @@ | |
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "dependencies": { | ||
| "@larksuiteoapi/node-sdk": "^1.60.0", | ||
| "@marswave/cola-plugin-sdk": "^0.0.1" | ||
| "@larksuiteoapi/node-sdk": "^1.61.1", | ||
| "@marswave/cola-plugin-sdk": "0.0.4-dev.202606041251.c8b2bed3" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This line moves Feishu onto the new dev SDK and the same commit starts using host features such as Useful? React with 👍 / 👎. |
||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^22.0.0", | ||
|
|
||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| import type { PluginLogger, PluginRuntime } from "@marswave/cola-plugin-sdk"; | ||
| import type { LegacyFeishuAccountConfig } from "../api/types.js"; | ||
|
|
||
| /** | ||
| * Parse a legacy `authorizedOpenIds` config value (comma/space separated string | ||
| * or array) into a set of open_ids. Retained only to migrate pre-SDK-gate config. | ||
| */ | ||
| export function parseAuthorizedOpenIds(value: unknown): Set<string> { | ||
| if (Array.isArray(value)) { | ||
| return new Set( | ||
| value.filter((item): item is string => isNonEmptyString(item)).map((s) => s.trim()), | ||
| ); | ||
| } | ||
|
|
||
| if (typeof value !== "string") return new Set(); | ||
|
|
||
| return new Set( | ||
| value | ||
| .split(/[\s,]+/) | ||
| .map((item) => item.trim()) | ||
| .filter(Boolean), | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * One-time migration: bind every legacy `authorizedOpenIds` entry as an identity | ||
| * binding so existing authorized users keep access under the SDK access gate. | ||
| * Idempotent — re-binding an already-bound sender is a no-op on the host side. | ||
| */ | ||
| export async function migrateLegacyAllowlist( | ||
| accounts: Iterable<LegacyFeishuAccountConfig>, | ||
| identity: PluginRuntime["identity"], | ||
| logger: PluginLogger, | ||
| ): Promise<void> { | ||
| const seen = new Set<string>(); | ||
| for (const acct of accounts) { | ||
| for (const openId of parseAuthorizedOpenIds(acct.authorizedOpenIds)) { | ||
| if (seen.has(openId)) continue; | ||
| seen.add(openId); | ||
| await identity.bind(openId); | ||
| } | ||
| } | ||
| if (seen.size > 0) { | ||
| logger.info(`Migrated ${seen.size} legacy authorizedOpenId(s) to identity bindings`); | ||
| } | ||
| } | ||
|
|
||
| function isNonEmptyString(value: unknown): value is string { | ||
| return typeof value === "string" && value.trim().length > 0; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This commit changes the Feishu plugin's runtime behavior and dependencies while the package still declares version
0.1.2;scripts/build-registry.tsbuilds the release URL from{id}-{version}.tar.gz, so publishing this under the same version would either overwrite an immutable tarball or leave clients/caches unable to distinguish the new SDK-gated build from the old one. Please bump the affected plugin package versions before release; the same issue applies to the Telegram package changed in this commit.Useful? React with 👍 / 👎.