mirror of
https://github.com/catlog22/Claude-Code-Workflow.git
synced 2026-03-02 15:23:19 +08:00
fix: CSRF token accessibility and hook installation status
- Remove HttpOnly from XSRF-TOKEN cookie for JavaScript readability - Add hook installation status detection in system settings API - Update InjectionControlTab to show installed hooks status - Add brace expansion support in globToRegex utility
This commit is contained in:
@@ -46,7 +46,7 @@ import {
|
||||
Layers,
|
||||
Filter,
|
||||
} from 'lucide-react';
|
||||
import { useInstallRecommendedHooks } from '@/hooks/useSystemSettings';
|
||||
import { useInstallRecommendedHooks, useSystemSettings } from '@/hooks/useSystemSettings';
|
||||
import type { InjectionPreviewFile, InjectionPreviewResponse } from '@/lib/api';
|
||||
import { getInjectionPreview, COMMAND_PREVIEWS, type CommandPreviewConfig } from '@/lib/api';
|
||||
|
||||
@@ -197,6 +197,9 @@ export function InjectionControlTab({ className }: InjectionControlTabProps) {
|
||||
// State for hooks installation
|
||||
const [installingHookIds, setInstallingHookIds] = useState<string[]>([]);
|
||||
|
||||
// Fetch system settings (for hooks installation status)
|
||||
const systemSettingsQuery = useSystemSettings();
|
||||
|
||||
// State for injection preview
|
||||
const [previewMode, setPreviewMode] = useState<'required' | 'all'>('required');
|
||||
const [categoryFilter, setCategoryFilter] = useState<SpecCategory | 'all'>('all');
|
||||
@@ -349,10 +352,18 @@ export function InjectionControlTab({ className }: InjectionControlTabProps) {
|
||||
|
||||
const installedHookIds = useMemo(() => {
|
||||
const installed = new Set<string>();
|
||||
const hooks = systemSettingsQuery.data?.recommendedHooks;
|
||||
if (hooks) {
|
||||
hooks.forEach(hook => {
|
||||
if (hook.installed) {
|
||||
installed.add(hook.id);
|
||||
}
|
||||
});
|
||||
}
|
||||
return installed;
|
||||
}, []);
|
||||
}, [systemSettingsQuery.data?.recommendedHooks]);
|
||||
|
||||
const installedCount = 0;
|
||||
const installedCount = installedHookIds.size;
|
||||
const allHooksInstalled = installedCount === RECOMMENDED_HOOKS.length;
|
||||
|
||||
const handleInstallHook = useCallback(async (hookId: string) => {
|
||||
|
||||
@@ -7555,6 +7555,7 @@ export interface SystemSettings {
|
||||
description: string;
|
||||
scope: 'global' | 'project';
|
||||
autoInstall: boolean;
|
||||
installed: boolean;
|
||||
}>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"cancel": "Cancel",
|
||||
"save": "Save",
|
||||
"aria": {
|
||||
"toggleNavigation": "Toggle navigation menu",
|
||||
"refreshWorkspace": "Refresh workspace",
|
||||
|
||||
@@ -303,13 +303,16 @@
|
||||
"hookCommand": "Command",
|
||||
"hookScope": "Scope",
|
||||
"hookTimeout": "Timeout (ms)",
|
||||
"hookFailMode": "Fail Mode"
|
||||
"hookFailMode": "Fail Mode",
|
||||
"editTitle": "Edit Spec: {title}",
|
||||
"editDescription": "Modify spec metadata and settings."
|
||||
},
|
||||
|
||||
"form": {
|
||||
"readMode": "Read Mode",
|
||||
"priority": "Priority",
|
||||
"keywords": "Keywords",
|
||||
"keywordsPlaceholder": "Enter keywords, press Enter or comma to add",
|
||||
"title": "Title",
|
||||
"titlePlaceholder": "Enter spec title",
|
||||
"addKeyword": "Add Keyword",
|
||||
@@ -322,11 +325,6 @@
|
||||
"titleRequired": "Title is required"
|
||||
},
|
||||
|
||||
"dialog": {
|
||||
"editTitle": "Edit Spec: {title}",
|
||||
"editDescription": "Modify spec metadata and settings."
|
||||
},
|
||||
|
||||
"hooks": {
|
||||
"installSuccess": "Hook installed successfully",
|
||||
"installError": "Failed to install hook",
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{
|
||||
"cancel": "取消",
|
||||
"save": "保存",
|
||||
"aria": {
|
||||
"toggleNavigation": "切换导航菜单",
|
||||
"refreshWorkspace": "刷新工作区",
|
||||
|
||||
@@ -310,13 +310,16 @@
|
||||
"hookCommand": "执行命令",
|
||||
"hookScope": "作用域",
|
||||
"hookTimeout": "超时时间(ms)",
|
||||
"hookFailMode": "失败模式"
|
||||
"hookFailMode": "失败模式",
|
||||
"editTitle": "编辑规范:{title}",
|
||||
"editDescription": "修改规范元数据和设置。"
|
||||
},
|
||||
|
||||
"form": {
|
||||
"readMode": "读取模式",
|
||||
"priority": "优先级",
|
||||
"keywords": "关键词",
|
||||
"keywordsPlaceholder": "输入关键词,按回车或逗号添加",
|
||||
"title": "标题",
|
||||
"titlePlaceholder": "输入规范标题",
|
||||
"addKeyword": "添加关键词",
|
||||
@@ -329,11 +332,6 @@
|
||||
"titleRequired": "标题为必填项"
|
||||
},
|
||||
|
||||
"dialog": {
|
||||
"editTitle": "编辑规范:{title}",
|
||||
"editDescription": "修改规范元数据和设置。"
|
||||
},
|
||||
|
||||
"hooks": {
|
||||
"installSuccess": "钩子安装成功",
|
||||
"installError": "钩子安装失败",
|
||||
|
||||
Reference in New Issue
Block a user