Skip to content

Commit 7244b61

Browse files
committed
cleanup
1 parent c625458 commit 7244b61

File tree

2 files changed

+2
-15
lines changed

2 files changed

+2
-15
lines changed

src/core/webview/ClineProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
722722
content security policy of your webview to only allow scripts that have a specific nonce
723723
create a content security policy meta tag so that only loading scripts with a nonce is allowed
724724
As your extension grows you will likely want to add custom styles, fonts, and/or images to your webview. If you do, you will need to update the content security policy meta tag to explicity allow for these resources. E.g.
725-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; font-src ${webview.cspSource}; img-src ${webview.cspSource} https:; script-src 'nonce-${nonce}' https://us-assets.i.posthog.com; connect-src https://openrouter.ai https://api.requesty.ai https://us.i.posthog.com https://us-assets.i.posthog.com;">
725+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src ${webview.cspSource}; font-src ${webview.cspSource}; img-src ${webview.cspSource} https:; script-src 'nonce-${nonce}';">
726726
- 'unsafe-inline' is required for styles due to vscode-webview-toolkit's dynamic style injection
727727
- since we pass base64 images to the webview, we need to specify img-src ${webview.cspSource} data:;
728728

webview-ui/src/components/settings/AutoApproveToggle.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type AutoApproveConfig = {
2525
descriptionKey: string
2626
icon: string
2727
testId: string
28-
order?: number
2928
}
3029

3130
export const autoApproveSettingsConfig: Record<AutoApproveSetting, AutoApproveConfig> = {
@@ -35,71 +34,62 @@ export const autoApproveSettingsConfig: Record<AutoApproveSetting, AutoApproveCo
3534
descriptionKey: "settings:autoApprove.readOnly.description",
3635
icon: "eye",
3736
testId: "always-allow-readonly-toggle",
38-
order: 1,
3937
},
4038
alwaysAllowWrite: {
4139
key: "alwaysAllowWrite",
4240
labelKey: "settings:autoApprove.write.label",
4341
descriptionKey: "settings:autoApprove.write.description",
4442
icon: "edit",
4543
testId: "always-allow-write-toggle",
46-
order: 2,
4744
},
4845
alwaysAllowBrowser: {
4946
key: "alwaysAllowBrowser",
5047
labelKey: "settings:autoApprove.browser.label",
5148
descriptionKey: "settings:autoApprove.browser.description",
5249
icon: "globe",
5350
testId: "always-allow-browser-toggle",
54-
order: 3,
5551
},
5652
alwaysApproveResubmit: {
5753
key: "alwaysApproveResubmit",
5854
labelKey: "settings:autoApprove.retry.label",
5955
descriptionKey: "settings:autoApprove.retry.description",
6056
icon: "refresh",
6157
testId: "always-approve-resubmit-toggle",
62-
order: 4,
6358
},
6459
alwaysAllowMcp: {
6560
key: "alwaysAllowMcp",
6661
labelKey: "settings:autoApprove.mcp.label",
6762
descriptionKey: "settings:autoApprove.mcp.description",
6863
icon: "plug",
6964
testId: "always-allow-mcp-toggle",
70-
order: 5,
7165
},
7266
alwaysAllowExtTools: {
7367
key: "alwaysAllowExtTools",
7468
labelKey: "settings:autoApprove.ext.label",
7569
descriptionKey: "settings:autoApprove.ext.description",
7670
icon: "extensions",
7771
testId: "always-allow-ext-tools-toggle",
78-
order: 6,
7972
},
8073
alwaysAllowModeSwitch: {
8174
key: "alwaysAllowModeSwitch",
8275
labelKey: "settings:autoApprove.modeSwitch.label",
8376
descriptionKey: "settings:autoApprove.modeSwitch.description",
8477
icon: "sync",
8578
testId: "always-allow-mode-switch-toggle",
86-
order: 7,
8779
},
8880
alwaysAllowSubtasks: {
8981
key: "alwaysAllowSubtasks",
9082
labelKey: "settings:autoApprove.subtasks.label",
9183
descriptionKey: "settings:autoApprove.subtasks.description",
9284
icon: "list-tree",
9385
testId: "always-allow-subtasks-toggle",
94-
order: 8,
9586
},
9687
alwaysAllowExecute: {
9788
key: "alwaysAllowExecute",
9889
labelKey: "settings:autoApprove.execute.label",
9990
descriptionKey: "settings:autoApprove.execute.description",
10091
icon: "terminal",
10192
testId: "always-allow-execute-toggle",
102-
order: 9,
10393
},
10494
}
10595

@@ -110,9 +100,6 @@ type AutoApproveToggleProps = AutoApproveToggles & {
110100
export const AutoApproveToggle = ({ onToggle, ...props }: AutoApproveToggleProps) => {
111101
const { t } = useAppTranslation()
112102

113-
// Sort buttons by order property
114-
const orderedSettings = Object.values(autoApproveSettingsConfig).sort((a, b) => (a.order || 0) - (b.order || 0))
115-
116103
return (
117104
<div
118105
className={cn(
@@ -121,7 +108,7 @@ export const AutoApproveToggle = ({ onToggle, ...props }: AutoApproveToggleProps
121108
"[@media(min-width:800px)]:grid-cols-5",
122109
"[@media(min-width:1200px)]:grid-cols-5",
123110
)}>
124-
{orderedSettings.map(({ key, descriptionKey, labelKey, icon, testId }) => (
111+
{Object.values(autoApproveSettingsConfig).map(({ key, descriptionKey, labelKey, icon, testId }) => (
125112
<Button
126113
key={key}
127114
variant={props[key] ? "default" : "outline"}

0 commit comments

Comments
 (0)