dev-1.7.0 #294

Merged
ZacharyZcR merged 73 commits from main into dev-1.7.0 2025-09-25 04:56:32 +00:00
3 changed files with 23 additions and 16 deletions
Showing only changes of commit dca4a89a1a - Show all commits

View File

@@ -22,7 +22,7 @@ class DataCrypto {
}
/**
* 加密记录 - 简单直接
* Encrypt record - simple and direct
*/
static encryptRecord(tableName: string, record: any, userId: string, userDataKey: Buffer): any {
const encryptedRecord = { ...record };
@@ -74,7 +74,7 @@ class DataCrypto {
}
/**
* 批量解密
* Batch decrypt
*/
static decryptRecords(tableName: string, records: any[], userId: string, userDataKey: Buffer): any[] {
if (!Array.isArray(records)) return records;
@@ -82,14 +82,14 @@ class DataCrypto {
}
/**
* 获取用户数据密钥
* Get user data key
*/
static getUserDataKey(userId: string): Buffer | null {
return this.userCrypto.getUserDataKey(userId);
}
/**
* 验证用户访问权限 - 简单直接
* Verify user access permissions - simple and direct
*/
static validateUserAccess(userId: string): Buffer {
const userDataKey = this.getUserDataKey(userId);
@@ -100,7 +100,7 @@ class DataCrypto {
}
/**
* 便捷方法:自动获取用户密钥并加密
* Convenience method: automatically get user key and encrypt
*/
static encryptRecordForUser(tableName: string, record: any, userId: string): any {
const userDataKey = this.validateUserAccess(userId);
@@ -108,7 +108,7 @@ class DataCrypto {
}
/**
* 便捷方法:自动获取用户密钥并解密
* Convenience method: automatically get user key and decrypt
*/
static decryptRecordForUser(tableName: string, record: any, userId: string): any {
const userDataKey = this.validateUserAccess(userId);
@@ -116,7 +116,7 @@ class DataCrypto {
}
/**
* 便捷方法:批量解密
* Convenience method: batch decrypt
*/
static decryptRecordsForUser(tableName: string, records: any[], userId: string): any[] {
const userDataKey = this.validateUserAccess(userId);
@@ -124,14 +124,14 @@ class DataCrypto {
}
/**
* 检查用户是否可以访问数据
* Check if user can access data
*/
static canUserAccessData(userId: string): boolean {
return this.userCrypto.isUserUnlocked(userId);
}
/**
* 测试加密功能
* Test encryption functionality
*/
static testUserEncryption(userId: string): boolean {
try {

View File

@@ -839,7 +839,7 @@ export function AdminSettings({
<Lock className="h-4 w-4 text-green-500" />
<div>
<div className="text-sm font-medium">{t("admin.encryptionStatus")}</div>
<div className="text-xs text-green-500"> (v2-kek-dek)</div>
<div className="text-xs text-green-500">{t("admin.encryptionEnabled")}</div>
</div>
</div>
</div>

View File

@@ -1,5 +1,6 @@
import React from "react";
import { cn } from "@/lib/utils";
import { useTranslation } from "react-i18next";
import {
Download,
FileDown,
@@ -30,6 +31,8 @@ export function DragIndicator({
error,
className,
}: DragIndicatorProps) {
const { t } = useTranslation();
if (!isVisible) return null;
const getIcon = () => {
@@ -54,18 +57,22 @@ export function DragIndicator({
const getStatusText = () => {
if (error) {
return `错误: ${error}`;
return t("dragIndicator.error", { error });
}
if (isDragging) {
return `正在拖拽${fileName ? ` ${fileName}` : ""}到桌面...`;
return t("dragIndicator.dragging", { fileName: fileName || "" });
}
if (isDownloading) {
return `正在准备拖拽${fileName ? ` ${fileName}` : ""}...`;
return t("dragIndicator.preparing", { fileName: fileName || "" });
}
return `准备拖拽${fileCount > 1 ? ` ${fileCount} 个文件` : fileName ? ` ${fileName}` : ""}`;
if (fileCount > 1) {
return t("dragIndicator.readyMultiple", { count: fileCount });
}
return t("dragIndicator.readySingle", { fileName: fileName || "" });
};
return (
@@ -86,7 +93,7 @@ export function DragIndicator({
<div className="flex-1 min-w-0">
{/* Title */}
<div className="text-sm font-medium text-foreground mb-2">
{fileCount > 1 ? "批量拖拽到桌面" : "拖拽到桌面"}
{fileCount > 1 ? t("dragIndicator.batchDrag") : t("dragIndicator.dragToDesktop")}
</div>
{/* Status text */}
@@ -127,7 +134,7 @@ export function DragIndicator({
{isDragging && !error && (
<div className="text-xs text-green-500 mt-2 flex items-center gap-1">
<Download className="w-3 h-3" />
{t("dragIndicator.canDragAnywhere")}
</div>
)}
</div>