Skip to content

Commit

Permalink
添加存储
Browse files Browse the repository at this point in the history
  • Loading branch information
VirtualHotBar committed Apr 27, 2024
1 parent a7bcd79 commit d2885d9
Show file tree
Hide file tree
Showing 41 changed files with 4,270 additions and 2,455 deletions.
5,086 changes: 2,794 additions & 2,292 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions src-tauri/src/autostart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ use std::io;

#[cfg(target_os = "windows")]
pub fn set_autostart(enabled: bool) -> io::Result<()> {
use std::process::Command;
use std::{os::windows::process::CommandExt, process::Command};

let exe_path = env::current_exe()?;
let exe_path_str = exe_path.to_string_lossy().into_owned();

Expand All @@ -17,7 +18,8 @@ pub fn set_autostart(enabled: bool) -> io::Result<()> {
.to_string()
};

let cmd = Command::new("cmd").arg("/C").arg(command.clone()).spawn();
let cmd = Command::new("cmd").arg("/C").arg(command.clone()).creation_flags(0x08000000).spawn();


let output = cmd.unwrap().wait_with_output()?;

Expand Down
18 changes: 14 additions & 4 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,14 @@ fn main() {
// 确保应用程序只有一个实例运行
ensure_single_instance();

//设置运行目录
let exe_dir = env::current_exe().unwrap().parent().unwrap().to_path_buf();
if !cfg!(debug_assertions) {
env::set_current_dir(&exe_dir).expect("更改工作目录失败");
//run_command(&format!("cd {}", exe_dir.display())).expect("运行cd命令失败");
}


// 根据不同的操作系统配置Tauri Builder
let builder = tauri::Builder::default()
.system_tray(tray::menu()) // 设置系统托盘菜单
Expand Down Expand Up @@ -91,11 +99,13 @@ fn ensure_single_instance() {
}
}




/*
use std::error::Error;
use std::process::Command;
fn run_command(cmd: &str) -> Result<std::process::Child, Box<dyn Error>> {
fn run_command(cmd: &str) -> Result<(), Box<dyn Error>> {
let cmd_str = if cfg!(target_os = "windows") {
format!("{}", cmd.replace("/", "\\"))
} else {
Expand All @@ -107,8 +117,8 @@ fn run_command(cmd: &str) -> Result<std::process::Child, Box<dyn Error>> {
} else {
Command::new("sh").arg("-c").arg(cmd_str).spawn()?
};
Ok(child)
child.wait_with_output()?;
Ok(())
} */

#[cfg(target_os = "windows")]
Expand Down
1 change: 0 additions & 1 deletion src-tauri/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use std::fs;
use std::io::{self, Write};
//use tauri::AppHandle;

#[tauri::command]
pub fn set_window_shadow<R: Runtime>(app: &tauri::App<R>) {
#[cfg(target_os = "linux")]
{
Expand Down
8 changes: 2 additions & 6 deletions src/controller/errorHandling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ window.onerror = async function (msg, url, lineNo, columnNo, error) {
'Error object: ' + JSON.stringify(error)
].join(' - ');

/* if(message.includes('Message: ResizeObserver loop limit exceeded')){
return
} */

await errorThrowToUser(message)
return false;
};
Expand All @@ -29,15 +25,15 @@ window.addEventListener('error', async (event) => {

async function errorThrowToUser(message: string) {
//排除这个错误
if (message.toString().includes('ResizeObserver loop limit exceeded')) { return }
if (message.toString().includes('ResizeObserver')) { return }

let content = t('error_tips') + ',Error:' + message

//提示错误
await errorDialog(t('error'), content)
}
//错误对话框
export function errorDialog(title: string, content: ReactNode) {
function errorDialog(title: string, content: ReactNode) {
return new Promise((resolve) => {
Modal.error(
{
Expand Down
109 changes: 84 additions & 25 deletions src/controller/language/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,29 +178,88 @@
"UID": "UID",
"GID": "GID",
"Umask": "文件权限掩码",
"about":"关于",
"autostart":"开机自启",
"install":"安装",
"winfsp_not_installed":"需要安装依赖(WinFsp),才能挂载存储。",
"install_failed":"安装失败",
"install_success":"安装成功",
"components":"组件",
"log":"日志",
"start_hide":"启动时隐藏窗口",
"quit":"退出",
"tray_show":"显示主窗口",
"tray_hide":"隐藏主窗口",
"language":"语言",
"update_available":"发现新版本",
"current_version":"当前版本",
"latest_version":"最新版本",
"goto_the_website_get_latest_version_ask":"是否前往官网获取最新版?",
"netmount_slogan":"统一管理和挂载云存储设施",
"please_add_storage_tip":"当前无可用存储,请添加存储",
"transmission_overview":"传输概览",
"view_more":"详细",
"technology_stack":"技术栈",
"about_text":"由独立开发者 VirtualHotBar 开发并发布",
"licence":"许可证",
"error_tips":"请尝试重启程序,并记录控制台错误信息向开发者反馈"
"about": "关于",
"autostart": "开机自启",
"install": "安装",
"winfsp_not_installed": "需要安装依赖(WinFsp),才能挂载存储。",
"install_failed": "安装失败",
"install_success": "安装成功",
"components": "组件",
"log": "日志",
"start_hide": "启动时隐藏窗口",
"quit": "退出",
"tray_show": "显示主窗口",
"tray_hide": "隐藏主窗口",
"language": "语言",
"update_available": "发现新版本",
"current_version": "当前版本",
"latest_version": "最新版本",
"goto_the_website_get_latest_version_ask": "是否前往官网获取最新版?",
"netmount_slogan": "统一管理和挂载云存储设施",
"please_add_storage_tip": "当前无可用存储,请添加存储",
"transmission_overview": "传输概览",
"view_more": "详细",
"technology_stack": "技术栈",
"about_text": "由独立开发者 VirtualHotBar 开发并发布",
"licence": "许可证",
"error_tips": "请尝试重启程序,并记录控制台错误信息向开发者反馈",
"host": "主机",
"port": "端口",
"tls": "传输加密(TLS)",
"explicit_tls": "显式TLS",
"client_id": "客户端ID",
"client_secret": "客户端秘钥",
"region": "区域",
"global": "全球版",
"us": "美国版",
"de": "德国版",
"cn": "中国版",
"documentLibrary": "SharePoint(文档库)",
"personal": "个人版",
"business": "商业版",
"drive_type": "类型",
"token": "Token",
"root_folder_id": "根目录ID",
"drive_id": "驱动器ID",
"local_introduce": "本地存储",
"provider": "提供商",
"bucket": "",
"access_key_id": "Access Key ID",
"secret_access_key": "Secret Access Key",
"endpoint": "Endpoint",
"acl": "ACL",
"env_auth": "环境认证",
"location_constraint": "位置约束",
"storage_class": "存储类别",
"server_side_encryption": "服务器端加密",
"sse_kms_key_id": "SSE-KMS密钥ID",
"remote": "存储",
"filename_encryption": "文件名加密",
"directory_name_encryption": "目录名加密",
"password": "密码",
"password2": "加盐",
"key": "秘钥",

"ftp_introduce": "FTP(File Transfer Protocol)是一种广泛应用的网络协议,旨在通过客户端-服务器架构实现互联网上可靠、交互式的文件传输、共享与管理。",
"onedrive_introduce": "OneDrive 是微软提供的云存储服务,具备跨平台文件同步、分享功能,用户可从任何设备安全访问文档、照片及文件夹,同时提供付费方案以获得更大存储空间。",
"s3_introduce": "S3协议是Amazon定义的一套用于在云环境中进行对象存储操作的标准API接口,支持包括上传、下载、检索、管理对象及其元数据在内的多种功能,已被众多云存储提供商广泛采用作为兼容接口。",
"googledrive_introduce": "Google Drive是Google提供的云存储服务,集成于Google生态系统,支持文档协作、备份和共享。",
"dropbox_introduce": "Dropbox是知名个人与团队文件同步、备份和共享平台,具有跨设备访问和版本控制功能。",
"webdav_introduce": "WebDAV是一种基于HTTP协议的网络文件系统标准,允许用户通过标准文件操作(如复制、移动、删除)远程管理服务器上的文件。",
"box_introduce": "Box是企业级云内容管理平台,专注于安全文件共享、协作和流程自动化。",
"googlecloudstorage_introduce": "Google Cloud Storage是谷歌云平台的云存储服务,提供多种存储级别,适用于不同性能、成本和持久性需求。",
"http_introduce": "HTTP在此处可能指通过HTTP协议直接访问存储在Web服务器上的静态文件。",
"swift_introduce": "OpenStack Object Storage (Swift)是开源云存储项目,提供大规模、弹性、API可编程的对象存储服务。",
"jottacloud_introduce": "Jottacloud是挪威云备份和同步服务,注重数据隐私和安全性,提供无限存储计划。",
"mega_introduce": "Mega强调用户隐私保护的云存储服务,提供端到端加密和大容量存储选项。",
"opendrive_introduce": "OpenDrive提供文件备份、同步、共享及在线办公套件的全方位云存储解决方案。",
"pcloud_introduce": "Pcloud是云存储服务商,提供跨平台文件访问、自动照片备份及音乐播放等功能。",
"qingstor_introduce": "Qingstor是青云QingCloud的对象存储服务,具备高性能、高可靠性和丰富的数据处理能力。",
"sftp_introduce": "SFTP是安全文件传输协议,基于SSH,提供加密的文件访问、传输和管理功能。",
"yandex_introduce": "Yandex Disk是Yandex提供的云存储服务,支持文件同步、备份与分享,以及与Yandex生态系统的集成。",
"crypt_introduce": "加密,确保用户数据在云端存储时的安全性。",
"alias_introduce": "别名,便于访问和管理。",
"alist_introduce":"一个支持多种存储的文件列表程序,使用 Gin 和 Solidjs。",
"storage_name_already_exists":"存储名称已存在"

}
3 changes: 0 additions & 3 deletions src/controller/storage/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ function checkParams(storageName: string, parameters: { [key: string]: any }, de
}
}




// 返回结果前清理末尾的换行符,避免多余的空白
msg = msg.trimEnd();

Expand Down
Loading

0 comments on commit d2885d9

Please sign in to comment.