Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

chore(web): add Slack app manifest

Richie McIlroy4e99fb821c36
diff --git a/apps/web/__tests__/unit/slack-app-manifest.test.ts b/apps/web/__tests__/unit/slack-app-manifest.test.ts
new file mode 100644
index 000000000..2d3a17e61
--- /dev/null
+++ b/apps/web/__tests__/unit/slack-app-manifest.test.ts
@@ -0,0 +1,68 @@
+import { readFileSync } from "node:fs";
+import { join } from "node:path";
+import { describe, expect, it } from "vitest";
+
+type SlackAppManifest = {
+ display_information: {
+ description: string;
+ background_color: string;
+ };
+ features: {
+ unfurl_domains: string[];
+ };
+ oauth_config: {
+ redirect_urls: string[];
+ scopes: {
+ bot: string[];
+ };
+ };
+ settings: {
+ event_subscriptions: {
+ request_url: string;
+ bot_events: string[];
+ };
+ };
+};
+
+describe("Slack app manifest", () => {
+ it("declares the complete and minimal video unfurl contract", () => {
+ const manifest = JSON.parse(
+ readFileSync(join(process.cwd(), "slack-app-manifest.json"), "utf8"),
+ ) as SlackAppManifest;
+
+ expect(manifest.display_information).toMatchObject({
+ description: "Use Cap directly inside Slack.",
+ background_color: "#4785FF",
+ });
+ expect(manifest.features.unfurl_domains).toEqual(["cap.so", "cap.link"]);
+ expect(manifest.oauth_config.scopes.bot).toEqual([
+ "links:read",
+ "links:write",
+ "links.embed:write",
+ ]);
+ expect(manifest.oauth_config.redirect_urls).toEqual([
+ "https://cap.so/api/integrations/slack/callback",
+ ]);
+ expect(manifest.settings.event_subscriptions).toEqual({
+ request_url: "https://cap.so/api/integrations/slack/events",
+ bot_events: ["link_shared", "app_uninstalled"],
+ });
+ });
+
+ it("removes encrypted Slack credentials before deleting an organization", () => {
+ const source = readFileSync(
+ join(
+ process.cwd(),
+ "../../packages/web-backend/src/Organisations/index.ts",
+ ),
+ "utf8",
+ );
+ const integrationDelete = source.indexOf(
+ ".delete(Db.integrationInstallations)",
+ );
+ const organizationDelete = source.indexOf(".delete(Db.organizations)");
+
+ expect(integrationDelete).toBeGreaterThan(-1);
+ expect(organizationDelete).toBeGreaterThan(integrationDelete);
+ });
+});
diff --git a/apps/web/slack-app-manifest.json b/apps/web/slack-app-manifest.json
new file mode 100644
index 000000000..87744a5bb
--- /dev/null
+++ b/apps/web/slack-app-manifest.json
@@ -0,0 +1,33 @@
+{
+ "_metadata": {
+ "major_version": 1,
+ "minor_version": 1
+ },
+ "display_information": {
+ "name": "Cap",
+ "description": "Use Cap directly inside Slack.",
+ "background_color": "#4785FF"
+ },
+ "features": {
+ "bot_user": {
+ "display_name": "cap",
+ "always_online": false
+ },
+ "unfurl_domains": ["cap.so", "cap.link"]
+ },
+ "oauth_config": {
+ "redirect_urls": ["https://cap.so/api/integrations/slack/callback"],
+ "scopes": {
+ "bot": ["links:read", "links:write", "links.embed:write"]
+ }
+ },
+ "settings": {
+ "event_subscriptions": {
+ "request_url": "https://cap.so/api/integrations/slack/events",
+ "bot_events": ["link_shared", "app_uninstalled"]
+ },
+ "org_deploy_enabled": false,
+ "socket_mode_enabled": false,
+ "token_rotation_enabled": false
+ }
+}