remove ccrsets

This commit is contained in:
musistudio
2026-01-01 15:54:40 +08:00
parent d149517026
commit ec7ac8cc9f
12 changed files with 116 additions and 319 deletions

View File

@@ -274,19 +274,15 @@ export function Presets() {
}
// 确定预设名称
const presetName = installName || (
installMethod === 'file'
? installFile!.name.replace('.ccrsets', '')
: installUrl!.split('/').pop()!.replace('.ccrsets', '')
);
const presetName = installName || '';
// Step 1: Install preset (extract to directory)
// Step 1: Install preset from GitHub repository
let installResult;
if (installMethod === 'url' && installUrl) {
installResult = await api.installPresetFromUrl(installUrl, presetName);
} else if (installMethod === 'file' && installFile) {
installResult = await api.uploadPresetFile(installFile, presetName);
// Install from GitHub repository
installResult = await api.installPresetFromGitHub(installUrl, presetName);
} else {
setToast({ message: t('presets.please_provide_url'), type: 'warning' });
return;
}
@@ -488,15 +484,7 @@ export function Presets() {
<div className="space-y-4 py-4">
<div className="flex gap-2">
<Button
variant={installMethod === 'file' ? 'default' : 'outline'}
onClick={() => setInstallMethod('file')}
className="flex-1"
>
<Upload className="mr-2 h-4 w-4" />
{t('presets.upload_file')}
</Button>
<Button
variant={installMethod === 'url' ? 'default' : 'outline'}
variant="default"
onClick={() => setInstallMethod('url')}
className="flex-1"
>
@@ -505,28 +493,17 @@ export function Presets() {
</Button>
</div>
{installMethod === 'file' ? (
<div className="space-y-2">
<Label htmlFor="preset-file">{t('presets.preset_file')}</Label>
<Input
id="preset-file"
type="file"
accept=".ccrsets"
onChange={(e) => setInstallFile(e.target.files?.[0] || null)}
/>
</div>
) : (
<div className="space-y-2">
<Label htmlFor="preset-url">{t('presets.preset_url')}</Label>
<Input
id="preset-url"
type="url"
placeholder={t('presets.preset_url_placeholder')}
value={installUrl}
onChange={(e) => setInstallUrl(e.target.value)}
/>
</div>
)}
<div className="space-y-2">
<Label htmlFor="preset-url">{t('presets.github_repository')}</Label>
<Input
id="preset-url"
type="url"
placeholder={t('presets.preset_url_placeholder')}
value={installUrl}
onChange={(e) => setInstallUrl(e.target.value)}
/>
<p className="text-xs text-gray-500">{t('presets.github_url_hint')}</p>
</div>
<div className="space-y-2">
<Label htmlFor="preset-name">{t('presets.preset_name')}</Label>

View File

@@ -260,15 +260,14 @@
"close": "Close",
"delete": "Delete",
"install_dialog_title": "Install Preset",
"install_dialog_description": "Install a preset from a file or URL",
"upload_file": "Upload File",
"from_url": "From URL",
"preset_file": "Preset File (.ccrsets)",
"preset_url": "Preset URL",
"preset_url_placeholder": "https://example.com/preset.ccrsets",
"install_dialog_description": "Install a preset from a GitHub repository",
"from_url": "From GitHub",
"github_repository": "GitHub Repository",
"preset_url": "Repository URL",
"preset_url_placeholder": "https://github.com/owner/repo",
"preset_name": "Preset Name (Optional)",
"preset_name_placeholder": "Auto-generated from file",
"please_provide_file_or_url": "Please provide a file or URL",
"preset_name_placeholder": "Auto-generated from repository",
"github_url_hint": "Enter GitHub repository URL (e.g., https://github.com/owner/repo)",
"detail_dialog_title": "Preset Details",
"required_information": "Required Information",
"delete_dialog_title": "Delete Preset",
@@ -284,8 +283,8 @@
"please_fill_field": "Please fill in {{field}}",
"load_market_failed": "Failed to load market presets",
"preset_installed_config_required": "Preset installed, please complete configuration",
"please_provide_file": "Please provide a preset file",
"please_provide_url": "Please provide a preset URL",
"please_provide_file": "Please provide a preset directory",
"please_provide_url": "Please provide a valid GitHub repository URL",
"form": {
"field_required": "{{field}} is required",
"must_be_number": "{{field}} must be a number",

View File

@@ -260,15 +260,14 @@
"close": "关闭",
"delete": "删除",
"install_dialog_title": "安装预设",
"install_dialog_description": "从文件或URL安装预设",
"upload_file": "上传文件",
"from_url": "从 URL",
"preset_file": "预设文件 (.ccrsets)",
"preset_url": "预设 URL",
"preset_url_placeholder": "https://example.com/preset.ccrsets",
"install_dialog_description": "从 GitHub 仓库安装预设",
"from_url": "从 GitHub",
"github_repository": "GitHub 仓库",
"preset_url": "仓库 URL",
"preset_url_placeholder": "https://github.com/owner/repo",
"preset_name": "预设名称 (可选)",
"preset_name_placeholder": "从文件自动生成",
"please_provide_file_or_url": "请提供文件或 URL",
"preset_name_placeholder": "从仓库自动生成",
"github_url_hint": "输入 GitHub 仓库 URL例如https://github.com/owner/repo",
"detail_dialog_title": "预设详情",
"required_information": "必需信息",
"delete_dialog_title": "删除预设",
@@ -284,8 +283,8 @@
"please_fill_field": "请填写 {{field}}",
"load_market_failed": "加载市场预设失败",
"preset_installed_config_required": "预设已安装,请完成配置",
"please_provide_file": "请提供预设文件",
"please_provide_url": "请提供预设 URL",
"please_provide_file": "请提供预设目录",
"please_provide_url": "请提供有效的 GitHub 仓库 URL",
"form": {
"field_required": "{{field}} 为必填项",
"must_be_number": "{{field}} 必须是数字",