feat: 初始化项目基础架构和核心功能
- 添加项目基础结构:Cargo.toml、.gitignore、设备UID和密钥文件 - 实现前端Vue3项目结构:路由、登录页面、设备管理页面 - 添加核心协议定义(crates/protocol):设备状态、资产、USB事件等 - 实现客户端监控模块:系统状态收集、资产收集 - 实现服务端基础API和插件系统 - 添加数据库迁移脚本:设备管理、资产跟踪、告警系统等 - 实现前端设备状态展示和基本交互 - 添加使用时长统计和水印功能插件
This commit is contained in:
28
migrations/003_usb.sql
Normal file
28
migrations/003_usb.sql
Normal file
@@ -0,0 +1,28 @@
|
||||
-- 003_usb.sql: USB control tables
|
||||
|
||||
CREATE TABLE IF NOT EXISTS usb_events (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
device_uid TEXT NOT NULL REFERENCES devices(device_uid) ON DELETE CASCADE,
|
||||
vendor_id TEXT,
|
||||
product_id TEXT,
|
||||
serial_number TEXT,
|
||||
device_name TEXT,
|
||||
event_type TEXT NOT NULL CHECK(event_type IN ('inserted', 'removed', 'blocked')),
|
||||
event_time TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS usb_policies (
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
name TEXT NOT NULL,
|
||||
policy_type TEXT NOT NULL CHECK(policy_type IN ('all_block', 'whitelist', 'blacklist')),
|
||||
target_group TEXT,
|
||||
rules TEXT NOT NULL,
|
||||
enabled INTEGER NOT NULL DEFAULT 1,
|
||||
created_at TEXT NOT NULL DEFAULT (datetime('now')),
|
||||
updated_at TEXT NOT NULL DEFAULT (datetime('now'))
|
||||
);
|
||||
|
||||
-- Indexes
|
||||
CREATE INDEX IF NOT EXISTS idx_usb_events_device_time ON usb_events(device_uid, event_time);
|
||||
CREATE INDEX IF NOT EXISTS idx_usb_events_time ON usb_events(event_time);
|
||||
CREATE INDEX IF NOT EXISTS idx_usb_policies_target ON usb_policies(target_group);
|
||||
Reference in New Issue
Block a user