style: Refine Segmented component styling with transparent background and rounded corners
This commit is contained in:
parent
741d84b4d3
commit
59b1d8bcc4
@ -1,12 +1,12 @@
|
|||||||
import { WebDavConfig } from '@types'
|
import { WebDavConfig } from '@types'
|
||||||
import AdmZip from 'adm-zip'
|
import AdmZip from 'adm-zip'
|
||||||
|
import { exec } from 'child_process'
|
||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
import Logger from 'electron-log'
|
import Logger from 'electron-log'
|
||||||
import * as fs from 'fs-extra'
|
import * as fs from 'fs-extra'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
|
||||||
import WebDav from './WebDav'
|
import WebDav from './WebDav'
|
||||||
import { exec } from 'child_process'
|
|
||||||
|
|
||||||
class BackupManager {
|
class BackupManager {
|
||||||
private tempDir = path.join(app.getPath('temp'), 'cherry-studio', 'backup', 'temp')
|
private tempDir = path.join(app.getPath('temp'), 'cherry-studio', 'backup', 'temp')
|
||||||
@ -21,25 +21,25 @@ class BackupManager {
|
|||||||
|
|
||||||
private async setWritableRecursive(dirPath: string): Promise<void> {
|
private async setWritableRecursive(dirPath: string): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const items = await fs.readdir(dirPath, { withFileTypes: true });
|
const items = await fs.readdir(dirPath, { withFileTypes: true })
|
||||||
|
|
||||||
for (const item of items) {
|
for (const item of items) {
|
||||||
const fullPath = path.join(dirPath, item.name);
|
const fullPath = path.join(dirPath, item.name)
|
||||||
|
|
||||||
// 先处理子目录
|
// 先处理子目录
|
||||||
if (item.isDirectory()) {
|
if (item.isDirectory()) {
|
||||||
await this.setWritableRecursive(fullPath);
|
await this.setWritableRecursive(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 统一设置权限(Windows需要特殊处理)
|
// 统一设置权限(Windows需要特殊处理)
|
||||||
await this.forceSetWritable(fullPath);
|
await this.forceSetWritable(fullPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 确保根目录权限
|
// 确保根目录权限
|
||||||
await this.forceSetWritable(dirPath);
|
await this.forceSetWritable(dirPath)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
Logger.error(`权限设置失败:${dirPath}`, error);
|
Logger.error(`权限设置失败:${dirPath}`, error)
|
||||||
throw error;
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,20 +48,20 @@ class BackupManager {
|
|||||||
try {
|
try {
|
||||||
// Windows系统需要先取消只读属性
|
// Windows系统需要先取消只读属性
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
await fs.chmod(targetPath, 0o666); // Windows会忽略权限位但能移除只读
|
await fs.chmod(targetPath, 0o666) // Windows会忽略权限位但能移除只读
|
||||||
} else {
|
} else {
|
||||||
const stats = await fs.stat(targetPath);
|
const stats = await fs.stat(targetPath)
|
||||||
const mode = stats.isDirectory() ? 0o777 : 0o666;
|
const mode = stats.isDirectory() ? 0o777 : 0o666
|
||||||
await fs.chmod(targetPath, mode);
|
await fs.chmod(targetPath, mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 双重保险:使用文件属性命令(Windows专用)
|
// 双重保险:使用文件属性命令(Windows专用)
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
await exec(`attrib -R "${targetPath}" /L /D`);
|
await exec(`attrib -R "${targetPath}" /L /D`)
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
|
if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
|
||||||
Logger.warn(`权限设置警告:${targetPath}`, error);
|
Logger.warn(`权限设置警告:${targetPath}`, error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -14,16 +14,16 @@ export default class WebDav {
|
|||||||
constructor(params: WebDavConfig) {
|
constructor(params: WebDavConfig) {
|
||||||
this.webdavPath = params.webdavPath
|
this.webdavPath = params.webdavPath
|
||||||
|
|
||||||
const httpAgent = new HttpProxyAgent(proxyManager.getProxyUrl() || '')
|
const httpProxy = proxyManager.getProxyUrl() || ''
|
||||||
const httpsAgent = new HttpsProxyAgent(proxyManager.getProxyUrl() || '')
|
const httpsProxy = proxyManager.getProxyUrl() || ''
|
||||||
|
|
||||||
this.instance = createClient(params.webdavHost, {
|
this.instance = createClient(params.webdavHost, {
|
||||||
username: params.webdavUser,
|
username: params.webdavUser,
|
||||||
password: params.webdavPass,
|
password: params.webdavPass,
|
||||||
maxBodyLength: Infinity,
|
maxBodyLength: Infinity,
|
||||||
maxContentLength: Infinity,
|
maxContentLength: Infinity,
|
||||||
httpAgent: httpAgent,
|
httpAgent: httpProxy ? new HttpProxyAgent(httpProxy) : undefined,
|
||||||
httpsAgent: httpsAgent
|
httpsAgent: httpsProxy ? new HttpsProxyAgent(httpsProxy) : undefined
|
||||||
})
|
})
|
||||||
|
|
||||||
this.putFileContents = this.putFileContents.bind(this)
|
this.putFileContents = this.putFileContents.bind(this)
|
||||||
|
|||||||
@ -405,6 +405,7 @@
|
|||||||
"reset.double.confirm.content": "All data will be lost, do you want to continue?",
|
"reset.double.confirm.content": "All data will be lost, do you want to continue?",
|
||||||
"reset.double.confirm.title": "DATA LOST !!!",
|
"reset.double.confirm.title": "DATA LOST !!!",
|
||||||
"restore.success": "Restored successfully",
|
"restore.success": "Restored successfully",
|
||||||
|
"restore.failed": "Restore failed",
|
||||||
"save.success.title": "Saved successfully",
|
"save.success.title": "Saved successfully",
|
||||||
"searching": "Searching the internet...",
|
"searching": "Searching the internet...",
|
||||||
"success.notion.export": "Successfully exported to Notion",
|
"success.notion.export": "Successfully exported to Notion",
|
||||||
|
|||||||
@ -405,6 +405,7 @@
|
|||||||
"reset.double.confirm.content": "すべてのデータが失われます。続行しますか?",
|
"reset.double.confirm.content": "すべてのデータが失われます。続行しますか?",
|
||||||
"reset.double.confirm.title": "データが失われます!!!",
|
"reset.double.confirm.title": "データが失われます!!!",
|
||||||
"restore.success": "復元に成功しました",
|
"restore.success": "復元に成功しました",
|
||||||
|
"restore.failed": "復元に失敗しました",
|
||||||
"save.success.title": "保存に成功しました",
|
"save.success.title": "保存に成功しました",
|
||||||
"searching": "インターネットで検索中...",
|
"searching": "インターネットで検索中...",
|
||||||
"success.notion.export": "Notionへのエクスポートに成功しました",
|
"success.notion.export": "Notionへのエクスポートに成功しました",
|
||||||
|
|||||||
@ -405,6 +405,7 @@
|
|||||||
"reset.double.confirm.content": "Все данные будут утеряны, хотите продолжить?",
|
"reset.double.confirm.content": "Все данные будут утеряны, хотите продолжить?",
|
||||||
"reset.double.confirm.title": "ДАННЫЕ БУДУТ УТЕРЯНЫ !!!",
|
"reset.double.confirm.title": "ДАННЫЕ БУДУТ УТЕРЯНЫ !!!",
|
||||||
"restore.success": "Успешно восстановлено",
|
"restore.success": "Успешно восстановлено",
|
||||||
|
"restore.failed": "Восстановление не удалось",
|
||||||
"save.success.title": "Успешно сохранено",
|
"save.success.title": "Успешно сохранено",
|
||||||
"searching": "Поиск в Интернете...",
|
"searching": "Поиск в Интернете...",
|
||||||
"success.notion.export": "Успешный экспорт в Notion",
|
"success.notion.export": "Успешный экспорт в Notion",
|
||||||
|
|||||||
@ -405,6 +405,7 @@
|
|||||||
"reset.double.confirm.content": "你的全部数据都会丢失,如果没有备份数据,将无法恢复,确定要继续吗?",
|
"reset.double.confirm.content": "你的全部数据都会丢失,如果没有备份数据,将无法恢复,确定要继续吗?",
|
||||||
"reset.double.confirm.title": "数据丢失!!!",
|
"reset.double.confirm.title": "数据丢失!!!",
|
||||||
"restore.success": "恢复成功",
|
"restore.success": "恢复成功",
|
||||||
|
"restore.failed": "恢复失败",
|
||||||
"save.success.title": "保存成功",
|
"save.success.title": "保存成功",
|
||||||
"searching": "正在联网搜索...",
|
"searching": "正在联网搜索...",
|
||||||
"success.notion.export": "成功导出到Notion",
|
"success.notion.export": "成功导出到Notion",
|
||||||
|
|||||||
@ -405,6 +405,7 @@
|
|||||||
"reset.double.confirm.content": "所有資料將會被清除,您確定要繼續嗎?",
|
"reset.double.confirm.content": "所有資料將會被清除,您確定要繼續嗎?",
|
||||||
"reset.double.confirm.title": "資料將會丟失!!!",
|
"reset.double.confirm.title": "資料將會丟失!!!",
|
||||||
"restore.success": "恢復成功",
|
"restore.success": "恢復成功",
|
||||||
|
"restore.failed": "恢復失敗",
|
||||||
"save.success.title": "保存成功",
|
"save.success.title": "保存成功",
|
||||||
"searching": "正在網路搜索...",
|
"searching": "正在網路搜索...",
|
||||||
"success.notion.export": "成功導出到 Notion",
|
"success.notion.export": "成功導出到 Notion",
|
||||||
@ -841,7 +842,8 @@
|
|||||||
"blacklist_tooltip": "請使用以下格式(換行分隔)\nexample.com\nhttps://www.example.com\nhttps://example.com\n*://*.example.com",
|
"blacklist_tooltip": "請使用以下格式(換行分隔)\nexample.com\nhttps://www.example.com\nhttps://example.com\n*://*.example.com",
|
||||||
"search_max_result": "搜索結果個數",
|
"search_max_result": "搜索結果個數",
|
||||||
"search_result_default": "預設"
|
"search_result_default": "預設"
|
||||||
}
|
},
|
||||||
|
"display.assistant.title": "助手設定"
|
||||||
},
|
},
|
||||||
"translate": {
|
"translate": {
|
||||||
"any.language": "任意語言",
|
"any.language": "任意語言",
|
||||||
|
|||||||
@ -131,9 +131,14 @@ const ModelsContainer = styled(Scrollbar)`
|
|||||||
`
|
`
|
||||||
|
|
||||||
const Segmented = styled(AntdSegmented)`
|
const Segmented = styled(AntdSegmented)`
|
||||||
|
&.ant-segmented {
|
||||||
|
background: transparent !important;
|
||||||
|
}
|
||||||
.ant-segmented-item {
|
.ant-segmented-item {
|
||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
|
border-radius: var(--list-item-border-radius) !important;
|
||||||
|
box-shadow: none !important;
|
||||||
&:hover {
|
&:hover {
|
||||||
background: transparent !important;
|
background: transparent !important;
|
||||||
}
|
}
|
||||||
@ -143,6 +148,8 @@ const Segmented = styled(AntdSegmented)`
|
|||||||
background-color: transparent !important;
|
background-color: transparent !important;
|
||||||
border: 0.5px solid var(--color-border);
|
border: 0.5px solid var(--color-border);
|
||||||
transition: none !important;
|
transition: none !important;
|
||||||
|
border-radius: var(--list-item-border-radius) !important;
|
||||||
|
box-shadow: none !important;
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
|
|
||||||
|
|||||||
@ -28,9 +28,9 @@ import {
|
|||||||
} from '@renderer/utils'
|
} from '@renderer/utils'
|
||||||
import {
|
import {
|
||||||
exportMarkdownToNotion,
|
exportMarkdownToNotion,
|
||||||
|
exportMarkdownToYuque,
|
||||||
exportMessageAsMarkdown,
|
exportMessageAsMarkdown,
|
||||||
messageToMarkdown,
|
messageToMarkdown
|
||||||
exportMarkdownToYuque
|
|
||||||
} from '@renderer/utils/export'
|
} from '@renderer/utils/export'
|
||||||
import { Button, Dropdown, Popconfirm, Tooltip } from 'antd'
|
import { Button, Dropdown, Popconfirm, Tooltip } from 'antd'
|
||||||
import dayjs from 'dayjs'
|
import dayjs from 'dayjs'
|
||||||
|
|||||||
@ -57,4 +57,3 @@ export function formatDomains(urls: string[]): FormatDomainsResult {
|
|||||||
|
|
||||||
return { formattedDomains, hasError }
|
return { formattedDomains, hasError }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user