Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.
Python agent-orchestrationaiai-agentschatopsdiscordlangchainmcpmicrosoft-teamsmulti-agentopen-sourceopenaiself-hostedslack
fix: remove the feedback feature and close the webhook-scanning gap (CHOO-2040) (#182)
Louis Amaudruzc4081d37d0ae
diff --git a/.gitleaks.toml b/.gitleaks.tomlindex e97630c30..3c56aee28 100644--- a/.gitleaks.toml+++ b/.gitleaks.toml@@ -5,6 +5,38 @@[extend]useDefault = true+# Incoming-webhook URLs are bearer credentials: the URL *is* the secret, so+# whoever holds it can post as the integration. The default ruleset keys off+# `name = value` assignments near a vendor word and so misses URL-shaped+# credentials — which is how a Discord webhook reached main (CHOO-2040).+#+# Slack is left to the default `slack-webhook-url` rule, which already covers+# it. The rules below fill the gaps that one leaves.++[[rules]]+id = "discord-webhook-url"+description = "Discord incoming webhook URL (the id + token pair grants posting rights)"+regex = '''https?://(?:canary\.|ptb\.)?discord(?:app)?\.com/api(?:/v\d+)?/webhooks/\d+/[A-Za-z0-9_-]{20,}'''+keywords = ["discord.com/api/webhooks", "discordapp.com/api/webhooks"]++# Broader than the default `microsoft-teams-webhook`, which requires a+# hyphen-free tenant and lowercase GUIDs and so misses e.g.+# `contoso-corp.webhook.office.com` or an uppercased id.+[[rules]]+id = "microsoft-teams-webhook-url"+description = "Microsoft Teams incoming webhook URL"+regex = '''(?i)https?://[a-z0-9.-]*\.(?:webhook\.office\.com/webhookb2|office\.com/webhook)/[a-z0-9@/_-]{20,}'''+keywords = ["webhook.office.com", "office.com/webhook"]++# Vendor-agnostic backstop: any URL whose path goes through `webhook(s)/` and+# ends in a long opaque token. Catches the vendors nobody thought to enumerate,+# which is the failure mode this whole section exists to prevent.+[[rules]]+id = "generic-webhook-url-with-token"+description = "Webhook URL carrying an embedded token"+regex = '''https?://[A-Za-z0-9.-]+/[A-Za-z0-9._/-]*webhooks?/[A-Za-z0-9._-]*/[A-Za-z0-9_-]{32,}'''+keywords = ["webhook"]+[allowlist]description = "Known false positives"regexTarget = "line"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cba56922d..f705f4ce8 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -510,6 +510,14 @@ version of their own to them without also giving them a release of their own.### [Unreleased]+#### Removed++- The "Give Feedback" feature — modal, Help menu entry, command-palette command+ and its event — along with the hardcoded third-party Discord webhook it posted+ to. The webhook arrived with the initial emdash import and is already revoked+ upstream. **Help → Report Issue** remains the way to send us something; it+ opens an issue on this repository (CHOO-2040).+### [0.24.0] - 2026-08-14#### Addeddiff --git a/console/AGENTS.md b/console/AGENTS.mdindex 00ac6d11a..8f5f52d65 100644--- a/console/AGENTS.md+++ b/console/AGENTS.md@@ -384,17 +384,19 @@ pnpm run lint- Application secrets are stored through encrypted app secret services and Electronsafe storage.- The app ships no telemetry or analytics; do not add tracking or phone-home behavior.- Logs are local-only: they leave the machine solely when the user attaches them to a- feedback report, via `getDiagnosticLogAttachment()`. Do not add any other path that- transmits log content.+ Logs are local-only and no code path transmits them off the machine. Do not add one.+ `getDiagnosticLogAttachment()` builds a redacted export and is the only function+ intended to ever feed such a path; anything that ships log content must go through it+ rather than reading the log itself.- **Redaction is split by destination, and both halves must be preserved:**- **Secrets** (tokens, keys, JWTs, PEM blocks, URL credentials) are redacted on thewrite path by `redactSecrets()` and must never reach disk.- **Personal data** (home directories, IP and MAC addresses, emails) is deliberately*retained* in the local log file — it is what makes a user's own log debuggable —and is redacted by `redactDiagnosticLog()` in `getDiagnosticLogAttachment()`, the- single point at which content leaves the machine. Do not "fix" the local file by- scrubbing it on write; that reinstates the problem this split exists to solve.+ single point at which content is prepared to leave the machine. Do not "fix" the+ local file by scrubbing it on write; that reinstates the problem this split exists+ to solve.- Anything contributed via `registerDiagnosticSection()` passes through the sameexport scrub. Never read the raw log file from outside `file-logger.ts`.- **An agent's Switch API token lives in exactly one file:**diff --git a/console/apps/switch-console-desktop/src/main/app/menu.ts b/console/apps/switch-console-desktop/src/main/app/menu.tsindex 50e0ded5f..30cb12189 100644--- a/console/apps/switch-console-desktop/src/main/app/menu.ts+++ b/console/apps/switch-console-desktop/src/main/app/menu.ts@@ -3,7 +3,6 @@ import { events } from '@main/lib/events';import { PRODUCT_NAME } from '@shared/app-identity';import {menuCheckForUpdatesChannel,- menuGiveFeedbackChannel,menuOpenSettingsChannel,menuQuitRequestedChannel,menuRedoChannel,@@ -184,10 +183,6 @@ export function setupApplicationMenu(): void {},],},- {- label: 'Give Feedback',- click: () => events.emit(menuGiveFeedbackChannel, undefined),- },],},];diff --git a/console/apps/switch-console-desktop/src/renderer/app/app-menu-events.tsx b/console/apps/switch-console-desktop/src/renderer/app/app-menu-events.tsxindex 3fa0b3a4e..0d0318323 100644--- a/console/apps/switch-console-desktop/src/renderer/app/app-menu-events.tsx+++ b/console/apps/switch-console-desktop/src/renderer/app/app-menu-events.tsx@@ -6,7 +6,6 @@ import { toggleSettingsView } from '@renderer/lib/layout/settings-toggle';import { useWorkspaceSlots } from '@renderer/lib/layout/workspace-slots';import { useShowModal } from '@renderer/lib/modal/modal-provider';import {- menuGiveFeedbackChannel,menuOpenSettingsChannel,menuQuitRequestedChannel,notificationFocusSessionChannel,@@ -17,7 +16,6 @@ export function AppMenuEvents({ onOpenSettings }: { onOpenSettings?: () => booleconst { navigate } = useNavigate();const { currentView, lastNonSettingsView } = useWorkspaceSlots();const showConfirmQuitModal = useShowModal('confirmActionModal');- const showFeedbackModal = useShowModal('feedbackModal');useEffect(() => {return events.on(menuOpenSettingsChannel, () => {@@ -43,12 +41,6 @@ export function AppMenuEvents({ onOpenSettings }: { onOpenSettings?: () => boole});}, [showConfirmQuitModal]);- useEffect(() => {- return events.on(menuGiveFeedbackChannel, () => {- showFeedbackModal({});- });- }, [showFeedbackModal]);-useEffect(() => {return events.on(browserLinkCopiedChannel, ({ kind }) => {const title =diff --git a/console/apps/switch-console-desktop/src/renderer/app/modal-registry.ts b/console/apps/switch-console-desktop/src/renderer/app/modal-registry.tsindex ac118e1f8..3a860b044 100644--- a/console/apps/switch-console-desktop/src/renderer/app/modal-registry.ts+++ b/console/apps/switch-console-desktop/src/renderer/app/modal-registry.ts@@ -15,7 +15,6 @@ import { DeleteServerModal } from '@renderer/features/switch-servers/DeleteServeimport { RenameServerModal } from '@renderer/features/switch-servers/RenameServerModal';import { ConfirmActionDialog } from '@renderer/lib/components/confirm-action-dialog';import { ExternalLinkChoiceDialog } from '@renderer/lib/components/external-link-choice-dialog';-import { FeedbackModal } from '@renderer/lib/components/feedback-modal/feedback-modal';import { UnsavedChangesDialog } from '@renderer/lib/components/unsaved-changes-dialog';import { type ModalComponent } from '@renderer/lib/modal/modal-provider';@@ -51,7 +50,6 @@ export const modalRegistry = {resetAgentModal: createModal(ResetAgentModal, { size: 'sm' }),confirmExternalLinkModal: createModal(ExternalLinkChoiceDialog, { size: 'sm' }),unsavedChangesModal: createModal(UnsavedChangesDialog, { size: 'xs' }),- feedbackModal: createModal(FeedbackModal, { dismissOnOutsideClick: false }),renameSessionModal: createModal(RenameSessionModal, {size: 'xs',dismissOnOutsideClick: false,diff --git a/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsx b/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsxindex 71d609835..272f013eb 100644--- a/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsx+++ b/console/apps/switch-console-desktop/src/renderer/features/command-palette/command-palette-modal.tsx@@ -119,15 +119,9 @@ const SESSION_SUGGESTED = ['session.sidebarFiles','session.toggleTerminalDrawer','resource-monitor',- 'app.giveFeedback',];-const LOCATION_SUGGESTED = [- 'app.newSession',- 'app.settings',- 'resource-monitor',- 'app.giveFeedback',-];-const APP_SUGGESTED = ['app.newLocation', 'app.settings', 'resource-monitor', 'app.giveFeedback'];+const LOCATION_SUGGESTED = ['app.newSession', 'app.settings', 'resource-monitor'];+const APP_SUGGESTED = ['app.newLocation', 'app.settings', 'resource-monitor'];function PaletteItem({value,diff --git a/console/apps/switch-console-desktop/src/renderer/lib/commands/app-commands.ts b/console/apps/switch-console-desktop/src/renderer/lib/commands/app-commands.tsindex bf3de90eb..3aa399b6a 100644--- a/console/apps/switch-console-desktop/src/renderer/lib/commands/app-commands.ts+++ b/console/apps/switch-console-desktop/src/renderer/lib/commands/app-commands.ts@@ -22,7 +22,6 @@ function createAppCommandProvider(): CommandProvider {const settingsDef = appDef('app.settings');const newLocationDef = appDef('app.newLocation');const addServerDef = appDef('app.addServer');- const giveFeedbackDef = appDef('app.giveFeedback');const toggleThemeDef = appDef('app.toggleTheme');const navigateBackDef = appDef('app.navigateBack');const navigateForwardDef = appDef('app.navigateForward');@@ -64,17 +63,6 @@ function createAppCommandProvider(): CommandProvider {},];- commands.push({- id: giveFeedbackDef.id,- label: giveFeedbackDef.label,- description: giveFeedbackDef.description,- shortcutKey: giveFeedbackDef.shortcutKey,- group: giveFeedbackDef.group,- execute() {- showModal('feedbackModal', {});- },- });-commands.push({id: toggleThemeDef.id,label: toggleThemeDef.label,diff --git a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/feedback-modal.tsx b/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/feedback-modal.tsxdeleted file mode 100644index 2835c413a..000000000--- a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/feedback-modal.tsx+++ /dev/null@@ -1,280 +0,0 @@-import { ImageIcon, Info, Paperclip, XIcon } from 'lucide-react';-import React, { useCallback, useState } from 'react';-import { useAttachments } from '@renderer/lib/hooks/use-attachments';-import { rpc } from '@renderer/lib/ipc';-import { type BaseModalProps } from '@renderer/lib/modal/modal-provider';-import { appState } from '@renderer/lib/stores/app-state';-import { Button } from '@renderer/lib/ui/button';-import { Checkbox } from '@renderer/lib/ui/checkbox';-import { ConfirmButton } from '@renderer/lib/ui/confirm-button';-import {- DialogContentArea,- DialogDescription,- DialogFooter,- DialogHeader,- DialogTitle,-} from '@renderer/lib/ui/dialog';-import { Input } from '@renderer/lib/ui/input';-import { Spinner } from '@renderer/lib/ui/spinner';-import { Textarea } from '@renderer/lib/ui/textarea';-import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@renderer/lib/ui/tooltip';-import { cn } from '@renderer/utils/utils';-import { useFeedbackSubmit } from './use-feedback-submit';--type FeedbackModalArgs = {- blurb?: string;-};--type Props = BaseModalProps<void> & FeedbackModalArgs;--function AttachmentThumbnail({- name,- previewUrl,- onRemove,- disabled,-}: {- name: string;- previewUrl: string;- onRemove: () => void;- disabled: boolean;-}) {- return (- <div className="group relative size-14 shrink-0 overflow-hidden rounded-md border border-border bg-background">- <img src={previewUrl} alt={name} className="size-full object-cover" />- <button- type="button"- onClick={onRemove}- aria-label={`Remove ${name}`}- disabled={disabled}- className="absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:enabled:opacity-100 disabled:cursor-not-allowed"- >- <XIcon className="size-3.5 text-white" />- </button>- </div>- );-}--export function FeedbackModal({ onSuccess, blurb }: Props) {- const [includeDiagnosticLogs, setIncludeDiagnosticLogs] = useState(false);- const appVersion = appState.update.currentVersion;- const {- attachments,- isDraggingOver,- fileInputRef,- removeAttachment,- openFilePicker,- handleFileInputChange,- handlePaste,- handleDrop,- handleDragOver,- handleDragEnter,- handleDragLeave,- reset: resetAttachments,- } = useAttachments();-- const {- feedbackDetails,- setFeedbackDetails,- contactEmail,- setContactEmail,- submitting,- errorMessage,- contactEmailError,- clearError,- clearContactEmailError,- handleSubmit,- canSubmit,- } = useFeedbackSubmit({- appVersion,- onSuccess: () => {- resetAttachments();- setIncludeDiagnosticLogs(false);- onSuccess();- },- });-- const handleFormSubmit = useCallback(- async (event: React.FormEvent<HTMLFormElement>) => {- event.preventDefault();- const loadDiagnosticLog = includeDiagnosticLogs- ? async () => {- const attachment = await rpc.app.getDiagnosticLogAttachment();- return new File([attachment.content], attachment.filename, {- type: attachment.mimeType,- });- }- : undefined;- await handleSubmit(- attachments.map((attachment) => attachment.file),- loadDiagnosticLog- );- },- [handleSubmit, attachments, includeDiagnosticLogs]- );-- return (- <div- className="relative flex min-h-0 flex-1 flex-col"- onDrop={handleDrop}- onDragOver={handleDragOver}- onDragEnter={handleDragEnter}- onDragLeave={handleDragLeave}- >- {isDraggingOver && (- <div className="border-primary bg-primary/5 absolute inset-0 z-10 flex items-center justify-center rounded-xl border-2 border-dashed">- <div className="text-primary flex flex-col items-center gap-1">- <ImageIcon className="size-6" />- <span className="text-xs font-medium">Drop image here</span>- </div>- </div>- )}- <DialogHeader>- <div className="flex flex-col gap-1">- <DialogTitle>Feedback</DialogTitle>- {blurb ? <DialogDescription className="text-xs">{blurb}</DialogDescription> : null}- </div>- </DialogHeader>- <DialogContentArea>- <form id="feedback-form" className="space-y-4 pt-0.5" onSubmit={handleFormSubmit}>- <div className="space-y-1.5">- <label htmlFor="feedback-details" className="sr-only">- Feedback details- </label>- <Textarea- id="feedback-details"- autoFocus- rows={5}- placeholder="What do you like? How can we improve?"- className="resize-none"- value={feedbackDetails}- onChange={(event) => {- setFeedbackDetails(event.target.value);- if (errorMessage) clearError();- }}- onPaste={handlePaste}- />- </div>-- <div className="space-y-1.5">- <label htmlFor="feedback-contact" className="sr-only">- Contact email- </label>- <Input- id="feedback-contact"- type="text"- placeholder="[email protected] (optional)"- value={contactEmail}- aria-invalid={contactEmailError ? 'true' : undefined}- aria-describedby={contactEmailError ? 'feedback-contact-error' : undefined}- onChange={(event) => {- setContactEmail(event.target.value);- if (errorMessage) clearError();- if (contactEmailError) clearContactEmailError();- }}- />- {contactEmailError ? (- <p- id="feedback-contact-error"- className="text-xs text-foreground-destructive"- role="alert"- >- {contactEmailError}- </p>- ) : null}- </div>-- <div className="space-y-2">- <div className="flex items-center gap-1.5">- <label className="flex items-center gap-2 text-sm">- <Checkbox- checked={includeDiagnosticLogs}- onCheckedChange={(checked) => setIncludeDiagnosticLogs(Boolean(checked))}- disabled={submitting}- />- <span className="min-w-0">Include diagnostic logs</span>- </label>- <TooltipProvider delay={150}>- <Tooltip>- <TooltipTrigger>- <button- type="button"- className="text-muted-foreground mt-1 inline-flex size-4 items-center justify-center hover:text-foreground"- aria-label="More information about diagnostic logs"- >- <Info className="size-3.5" aria-hidden="true" />- </button>- </TooltipTrigger>- <TooltipContent side="top" className="max-w-xs text-xs">- Attaches recent app logs with sensitive details redacted.- </TooltipContent>- </Tooltip>- </TooltipProvider>- </div>-- <input- ref={fileInputRef}- type="file"- accept="image/*"- className="hidden"- multiple- onChange={handleFileInputChange}- disabled={submitting}- />- {attachments.length > 0 ? (- <div- className={cn(- 'flex flex-wrap gap-2 rounded-md border border-dashed border-border p-2',- submitting && 'opacity-50'- )}- >- {attachments.map((attachment, index) => (- <AttachmentThumbnail- key={attachment.id}- name={attachment.file.name}- previewUrl={attachment.previewUrl}- onRemove={() => removeAttachment(index)}- disabled={submitting}- />- ))}- </div>- ) : null}- </div>-- {errorMessage ? (- <p className="text-destructive text-sm" role="alert">- {errorMessage}- </p>- ) : null}- </form>- </DialogContentArea>- <DialogFooter className="sm:justify-between">- <Button- type="button"- variant="outline"- onClick={openFilePicker}- className="gap-2"- disabled={submitting}- >- <Paperclip className="h-4 w-4" aria-hidden="true" />- <span>Attach image</span>- </Button>- <ConfirmButton- type="submit"- form="feedback-form"- className="gap-2 px-4"- disabled={!canSubmit}- aria-busy={submitting}- >- {submitting ? (- <>- <Spinner size="sm" />- <span>Sending...</span>- </>- ) : (- <span>Send Feedback</span>- )}- </ConfirmButton>- </DialogFooter>- </div>- );-}diff --git a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/schemas/feedback-email.ts b/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/schemas/feedback-email.tsdeleted file mode 100644index c5c31ebf5..000000000--- a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/schemas/feedback-email.ts+++ /dev/null@@ -1,6 +0,0 @@-import * as z from 'zod';--export const FEEDBACK_EMAIL_SCHEMA = z.union([- z.literal(''),- z.string().email('Please enter a valid email address.'),-]);diff --git a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.test.ts b/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.test.tsdeleted file mode 100644index 1bf5ee08b..000000000--- a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.test.ts+++ /dev/null@@ -1,72 +0,0 @@-import { describe, expect, it } from 'vitest';-import { FEEDBACK_EMAIL_SCHEMA } from './schemas/feedback-email';-import { buildFeedbackContent } from './use-feedback-submit';--describe('buildFeedbackContent', () => {- it('includes feedback, metadata, and app version when provided', () => {- const content = buildFeedbackContent({- feedback: 'Great app',- contactEmail: '[email protected]',- githubUser: { login: 'octocat', name: 'Octo Cat' },- appVersion: '1.2.3',- });-- expect(content).toContain('Great app');- expect(content).toContain('Contact: [email protected]');- expect(content).toContain('GitHub: Octo Cat (@octocat)');- expect(content).toContain('Switch Console Version: 1.2.3');- });-- it('notes diagnostic logs when user opts in', () => {- const content = buildFeedbackContent({- feedback: 'Something broke',- contactEmail: '',- githubUser: null,- appVersion: '1.2.3',- includeDiagnosticLogs: true,- });-- expect(content).toContain('Diagnostic Logs: attached by user opt-in');- });-- it('omits diagnostic-log note when user does not opt in', () => {- const content = buildFeedbackContent({- feedback: 'Something broke',- contactEmail: '',- githubUser: null,- appVersion: '1.2.3',- });-- expect(content).not.toContain('Diagnostic Logs');- });-- it('omits empty metadata fields', () => {- const content = buildFeedbackContent({- feedback: 'Needs improvement',- contactEmail: ' ',- githubUser: null,- appVersion: '',- });-- expect(content).toBe('Needs improvement');- });-});--describe('FEEDBACK_EMAIL_SCHEMA', () => {- it('accepts blank optional email', () => {- expect(FEEDBACK_EMAIL_SCHEMA.safeParse('').success).toBe(true);- });-- it('accepts valid email', () => {- expect(FEEDBACK_EMAIL_SCHEMA.safeParse('[email protected]').success).toBe(true);- });-- it('rejects invalid email', () => {- const result = FEEDBACK_EMAIL_SCHEMA.safeParse('person');-- expect(result.success).toBe(false);- if (!result.success) {- expect(result.error.issues[0]?.message).toBe('Please enter a valid email address.');- }- });-});diff --git a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.ts b/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.tsdeleted file mode 100644index ae95d552f..000000000--- a/console/apps/switch-console-desktop/src/renderer/lib/components/feedback-modal/use-feedback-submit.ts+++ /dev/null@@ -1,206 +0,0 @@-import { useCallback, useState } from 'react';-import { useToast } from '@renderer/lib/hooks/use-toast';-import { log } from '@renderer/utils/logger';-import { FEEDBACK_EMAIL_SCHEMA } from './schemas/feedback-email';--const DISCORD_WEBHOOK_URL =- 'https://discord.com/api/webhooks/1473390363388416230/eRIo1UhylapH94KpqUUp5PDzkLhjBvcnjjyE_JezfHiAyfN3QEbRyEIJaSl8QQUz7Mak';--const DISCORD_MAX_FILES = 10;-const DISCORD_MAX_PAYLOAD_BYTES = 8 * 1024 * 1024;--interface GithubUser {- login?: string;- name?: string;- html_url?: string;- email?: string;-}--interface FeedbackSubmitOptions {- githubUser?: GithubUser | null;- appVersion?: string | null;- onSuccess: () => void;-}--interface BuildFeedbackContentOptions {- feedback: string;- contactEmail: string;- githubUser?: GithubUser | null;- appVersion?: string | null;- includeDiagnosticLogs?: boolean;-}--export function buildFeedbackContent({- feedback,- contactEmail,- githubUser,- appVersion,- includeDiagnosticLogs,-}: BuildFeedbackContentOptions): string {- const trimmedFeedback = feedback.trim();- const trimmedContact = contactEmail.trim();- const metadataLines: string[] = [];-- if (trimmedContact) {- metadataLines.push(`Contact: ${trimmedContact}`);- }-- const githubLogin = githubUser?.login?.trim();- const githubName = githubUser?.name?.trim();- if (githubLogin || githubName) {- const parts: string[] = [];- if (githubName && githubLogin) {- parts.push(`${githubName} (@${githubLogin})`);- } else if (githubName) {- parts.push(githubName);- } else if (githubLogin) {- parts.push(`@${githubLogin}`);- }- metadataLines.push(`GitHub: ${parts.join(' ')}`);- }-- const trimmedAppVersion = appVersion?.trim();- if (trimmedAppVersion) {- metadataLines.push(`Switch Console Version: ${trimmedAppVersion}`);- }-- if (includeDiagnosticLogs) {- metadataLines.push('Diagnostic Logs: attached by user opt-in');- }-- return [trimmedFeedback, metadataLines.join('\n')].filter(Boolean).join('\n\n');-}--export function useFeedbackSubmit({ githubUser, appVersion, onSuccess }: FeedbackSubmitOptions) {- const [feedbackDetails, setFeedbackDetails] = useState('');- const [contactEmail, setContactEmail] = useState('');- const [submitting, setSubmitting] = useState(false);- const [errorMessage, setErrorMessage] = useState<string | null>(null);- const [contactEmailError, setContactEmailError] = useState<string | null>(null);- const { toast } = useToast();-- const clearError = useCallback(() => {- setErrorMessage(null);- }, []);-- const clearContactEmailError = useCallback(() => {- setContactEmailError(null);- }, []);-- const reset = useCallback(() => {- setFeedbackDetails('');- setContactEmail('');- setSubmitting(false);- setErrorMessage(null);- setContactEmailError(null);- }, []);-- const handleSubmit = useCallback(- async (attachments: File[], loadDiagnosticLog?: () => Promise<File | null>) => {- const trimmedFeedback = feedbackDetails.trim();- const trimmedContactEmail = contactEmail.trim();- if (!trimmedFeedback) {- setErrorMessage('Please enter some feedback before sending.');- return;- }-- const emailValidation = FEEDBACK_EMAIL_SCHEMA.safeParse(trimmedContactEmail);- if (!emailValidation.success) {- setContactEmailError(emailValidation.error.issues[0]?.message ?? 'Invalid email address.');- return;- }-- setSubmitting(true);- setErrorMessage(null);- setContactEmailError(null);-- let diagnosticLog: File | null = null;- if (loadDiagnosticLog) {- try {- diagnosticLog = await loadDiagnosticLog();- } catch (error) {- log.error('Failed to read diagnostic logs:', error);- setErrorMessage('Could not read diagnostic logs. Uncheck the option or try again.');- setSubmitting(false);- return;- }- }-- const files = diagnosticLog ? [...attachments, diagnosticLog] : attachments;-- if (files.length > DISCORD_MAX_FILES) {- setErrorMessage(- `Too many attachments (max ${DISCORD_MAX_FILES}). Remove some and try again.`- );- setSubmitting(false);- return;- }-- const totalBytes = files.reduce((sum, file) => sum + file.size, 0);- if (totalBytes > DISCORD_MAX_PAYLOAD_BYTES) {- setErrorMessage('Attachments exceed the 8 MB total limit. Remove some and try again.');- setSubmitting(false);- return;- }-- const content = buildFeedbackContent({- feedback: trimmedFeedback,- contactEmail: trimmedContactEmail,- githubUser,- appVersion,- includeDiagnosticLogs: Boolean(diagnosticLog),- });-- try {- let response: Response;- if (files.length > 0) {- const formData = new FormData();- formData.append('content', content);- files.forEach((file, index) => {- formData.append(`file${index}`, file);- });- response = await fetch(DISCORD_WEBHOOK_URL, { method: 'POST', body: formData });- } else {- response = await fetch(DISCORD_WEBHOOK_URL, {- method: 'POST',- headers: { 'Content-Type': 'application/json' },- body: JSON.stringify({ content }),- });- }-- if (!response.ok) {- throw new Error(`Discord webhook returned ${response.status}`);- }-- onSuccess();- toast({ title: 'Feedback sent', description: 'Thanks for your feedback!' });- } catch (error) {- log.error('Failed to submit feedback:', error);- setErrorMessage('Unable to send feedback. Please try again.');- toast({- title: 'Failed to send feedback',- description: 'Please try again.',- variant: 'destructive',- });- } finally {- setSubmitting(false);- }- },- [appVersion, contactEmail, feedbackDetails, githubUser, onSuccess, toast]- );-- return {- feedbackDetails,- setFeedbackDetails,- contactEmail,- setContactEmail,- submitting,- errorMessage,- contactEmailError,- clearError,- clearContactEmailError,- reset,- handleSubmit,- canSubmit: feedbackDetails.trim().length > 0 && !submitting && !contactEmailError,- };-}diff --git a/console/apps/switch-console-desktop/src/shared/commands.ts b/console/apps/switch-console-desktop/src/shared/commands.tsindex 6e14d16c3..d17c79dd3 100644--- a/console/apps/switch-console-desktop/src/shared/commands.ts+++ b/console/apps/switch-console-desktop/src/shared/commands.ts@@ -64,14 +64,6 @@ export const APP_COMMAND_DEFS = defineCommandDefs([group: 'App',iconKey: 'square-plus',},- {- id: 'app.giveFeedback',- label: 'Give Feedback',- description: 'Send feedback to the Switch Console team',- scope: 'app',- group: 'App',- iconKey: 'message-square-share',- },{id: 'app.toggleTheme',label: 'Toggle Theme',diff --git a/console/apps/switch-console-desktop/src/shared/events/appEvents.ts b/console/apps/switch-console-desktop/src/shared/events/appEvents.tsindex 5c74ad045..bcf60c6a4 100644--- a/console/apps/switch-console-desktop/src/shared/events/appEvents.ts+++ b/console/apps/switch-console-desktop/src/shared/events/appEvents.ts@@ -13,7 +13,6 @@ export const menuCheckForUpdatesChannel = defineEvent<void>('menu:check-for-updaexport const menuUndoChannel = defineEvent<void>('menu:undo');export const menuRedoChannel = defineEvent<void>('menu:redo');export const menuQuitRequestedChannel = defineEvent<void>('menu:quit-requested');-export const menuGiveFeedbackChannel = defineEvent<void>('menu:give-feedback');export const externalLinkOpenRequestedChannel = defineEvent<{ url: string }>('external-link:open-requested'