Record your screen, ship a demo. Free and open-source, GPU-accelerated, no watermarks, no subscriptions. Windows, macOS, Linux. Actively maintained.
TypeScript cross-platformelectronffmpegopen-sourceproduct-demorustscreen-capturescreen-recorderscreen-recordingscreen-studioscreencastspeech-to-texttypescriptvideo-editingvideo-editorwaylandwgpuwhisper
fix(ci): address maintainer review feedback
psychosomat7216a7e8a82e
diff --git a/.github/scripts/discord-pr-sync.mjs b/.github/scripts/discord-pr-sync.mjsindex 177ccecb7..3a62dc819 100644--- a/.github/scripts/discord-pr-sync.mjs+++ b/.github/scripts/discord-pr-sync.mjs@@ -1,5 +1,6 @@import { info, warning } from "@actions/core";import { context, getOctokit } from "@actions/github";+import { validateThreadChannel } from "./discord-thread-validator.mjs";const WEBHOOK_USERNAME = (process.env.DISCORD_WEBHOOK_USERNAME || "OpenScreen").trim();const WEBHOOK_AVATAR = (process.env.DISCORD_WEBHOOK_AVATAR_URL || "").trim();@@ -51,42 +52,6 @@ function extractThreadId(body) {return match ? match[1] : null;}-async function validateThreadChannel(threadId, prNumber) {- if (!botToken) {- warning(- "DISCORD_BOT_TOKEN not set; cannot validate thread channel ownership. Rejecting marker.",- );- return false;- }- try {- const res = await fetch(`https://discord.com/api/v10/channels/${threadId}`, {- headers: { Authorization: `Bot ${botToken}` },- });- if (!res.ok) {- warning(`Thread validation failed: channel ${threadId} returned ${res.status}`);- return false;- }- const channel = await res.json();- if (forumChannelId && channel.parent_id !== forumChannelId) {- warning(- `Thread ${threadId} parent_id=${channel.parent_id} does not match expected forum ${forumChannelId}; treating marker as untrusted.`,- );- return false;- }- const expectedPrefix = `PR #${prNumber} -`;- if (!channel.name || !channel.name.startsWith(expectedPrefix)) {- warning(- `Thread ${threadId} name "${channel.name}" does not match expected prefix "${expectedPrefix}"; treating marker as untrusted.`,- );- return false;- }- return true;- } catch (err) {- warning(`Thread validation threw: ${err && err.message ? err.message : err}`);- return false;- }-}-function upsertThreadMarker(body, threadId) {const cleaned = (body || "").replace(THREAD_MARKER_REGEX, "").trim();return `${cleaned}\n\n<!-- discord-thread-id:${threadId} -->`.trim();@@ -304,7 +269,7 @@ async function main() {return;}- if (!(await validateThreadChannel(threadId, number))) {+ if (!(await validateThreadChannel(threadId, number, { botToken, forumChannelId }))) {info("Thread ID in PR body failed channel validation; ignoring marker.");return;}diff --git a/.github/scripts/discord-thread-validator.mjs b/.github/scripts/discord-thread-validator.mjsnew file mode 100644index 000000000..4def9d9f1--- /dev/null+++ b/.github/scripts/discord-thread-validator.mjs@@ -0,0 +1,37 @@+import { warning } from "@actions/core";++export async function validateThreadChannel(threadId, prNumber, { botToken, forumChannelId } = {}) {+ if (!botToken) {+ warning(+ "DISCORD_BOT_TOKEN not set; cannot validate thread channel ownership. Rejecting marker.",+ );+ return false;+ }+ try {+ const res = await fetch(`https://discord.com/api/v10/channels/${threadId}`, {+ headers: { Authorization: `Bot ${botToken}` },+ });+ if (!res.ok) {+ warning(`Thread validation failed: channel ${threadId} returned ${res.status}`);+ return false;+ }+ const channel = await res.json();+ if (forumChannelId && channel.parent_id !== forumChannelId) {+ warning(+ `Thread ${threadId} parent_id=${channel.parent_id} does not match expected forum ${forumChannelId}; treating marker as untrusted.`,+ );+ return false;+ }+ const expectedPrefix = `PR #${prNumber} -`;+ if (!channel.name || !channel.name.startsWith(expectedPrefix)) {+ warning(+ `Thread ${threadId} name "${channel.name}" does not match expected prefix "${expectedPrefix}"; treating marker as untrusted.`,+ );+ return false;+ }+ return true;+ } catch (err) {+ warning(`Thread validation threw: ${err && err.message ? err.message : err}`);+ return false;+ }+}diff --git a/.github/scripts/discord-thread-validator.test.mjs b/.github/scripts/discord-thread-validator.test.mjsnew file mode 100644index 000000000..ae5d77dc6--- /dev/null+++ b/.github/scripts/discord-thread-validator.test.mjs@@ -0,0 +1,92 @@+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";+import { validateThreadChannel } from "./discord-thread-validator.mjs";++beforeEach(() => {+ vi.stubGlobal("fetch", vi.fn());+});++afterEach(() => {+ vi.unstubAllGlobals();+});++describe("validateThreadChannel", () => {+ const botToken = "bot-token";+ const number = 42;++ it("fails closed when botToken is unset", async () => {+ const result = await validateThreadChannel("123", number, { botToken: "" });+ expect(result).toBe(false);+ expect(fetch).not.toHaveBeenCalled();+ });++ it("rejects a forged marker pointing at a random thread (wrong parent)", async () => {+ vi.mocked(fetch).mockResolvedValue({+ ok: true,+ json: async () => ({+ id: "111",+ parent_id: "999999999999999999",+ name: `PR #${number} - Some PR`,+ }),+ });++ const result = await validateThreadChannel("111", number, {+ botToken,+ forumChannelId: "888888888888888888",+ });++ expect(result).toBe(false);+ });++ it("rejects a marker pointing at a sibling PR thread in the same forum", async () => {+ vi.mocked(fetch).mockResolvedValue({+ ok: true,+ json: async () => ({+ id: "222",+ parent_id: "888888888888888888",+ name: `PR #99 - Other PR`,+ }),+ });++ const result = await validateThreadChannel("222", number, {+ botToken,+ forumChannelId: "888888888888888888",+ });++ expect(result).toBe(false);+ });++ it("accepts a valid bot-created thread for PR #N", async () => {+ vi.mocked(fetch).mockResolvedValue({+ ok: true,+ json: async () => ({+ id: "333",+ parent_id: "888888888888888888",+ name: `PR #${number} - My feature`,+ }),+ });++ const result = await validateThreadChannel("333", number, {+ botToken,+ forumChannelId: "888888888888888888",+ });++ expect(result).toBe(true);+ });++ it("returns false when Discord API returns non-ok", async () => {+ vi.mocked(fetch).mockResolvedValue({+ ok: false,+ status: 404,+ });++ const result = await validateThreadChannel("404", number, { botToken });+ expect(result).toBe(false);+ });++ it("returns false when fetch throws", async () => {+ vi.mocked(fetch).mockRejectedValue(new Error("network error"));++ const result = await validateThreadChannel("500", number, { botToken });+ expect(result).toBe(false);+ });+});diff --git a/.github/scripts/discord-weekly-leaderboard.mjs b/.github/scripts/discord-weekly-leaderboard.mjsindex 75590425c..bcf3192cf 100644--- a/.github/scripts/discord-weekly-leaderboard.mjs+++ b/.github/scripts/discord-weekly-leaderboard.mjs@@ -1,4 +1,4 @@-import { info, setFailed, warning } from "@actions/core";+import { info, warning } from "@actions/core";import { context, getOctokit } from "@actions/github";const spotlightWebhook = (process.env.DISCORD_SPOTLIGHT_WEBHOOK_URL || "").trim();@@ -71,7 +71,7 @@ async function main() {if (!res.ok) {const txt = await res.text();- setFailed(`Leaderboard post failed ${res.status}: ${txt}`);+ warning(`Leaderboard post failed ${res.status}: ${txt}`);}}diff --git a/docs/github-actions-workflows.md b/docs/github-actions-workflows.mdindex 9b1dcc965..282fa20dd 100644--- a/docs/github-actions-workflows.md+++ b/docs/github-actions-workflows.md@@ -21,7 +21,6 @@ graph TDendsubgraph Tier 2 - Release build- build_native_mac[build-native-mac.yml<br/>workflow_call]build[build.yml<br/>tag v* / dispatch]build_win[build-windows]build_mac[build-macos<br/>matrix arm64 x64]@@ -30,7 +29,6 @@ graph TDbuild --> build_winbuild --> build_macbuild --> build_linux- build_mac -.->|reusable| build_native_macbuild_win --> build_releasebuild_mac --> build_releasebuild_linux --> build_release@@ -53,7 +51,6 @@ graph TDdiag_mac[build-macos<br/>matrix arm64 x64]diag --> diag_windiag --> diag_mac- diag_mac -.->|reusable| build_native_macendbuild_release -->|gh release create| homebrew@@ -79,10 +76,6 @@ All jobs use the shared composite action `.github/actions/setup` for Node.js ins## Tier 2: Release build and publish-### build-native-mac.yml--Reusable workflow triggered via `workflow_call`. Accepts an `arch` input (`arm64` or `x64`) and produces native ScreenCaptureKit helpers. Called by both `build.yml` (release packaging) and `diagnostic-artifact.yml` (diagnostic bundle). This workflow is not triggered by repository events directly.-### build.ymlTriggered by version tags (`v*`) or manual `workflow_dispatch` (with optional macOS architecture selection and release tag override).diff --git a/vitest.config.ts b/vitest.config.tsindex 5a52a9bea..e6b1497f9 100644--- a/vitest.config.ts+++ b/vitest.config.ts@@ -5,7 +5,7 @@ export default defineConfig({test: {globals: true,environment: "jsdom",- include: ["{src,electron}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],+ include: ["{src,electron,.github}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}"],exclude: ["src/**/*.browser.test.{ts,tsx}"],},resolve: {