Skip to content

Commit

Permalink
feat: Add WebDav Backup
Browse files Browse the repository at this point in the history
  • Loading branch information
Pylogmon committed Aug 30, 2023
1 parent 90aab03 commit a5f9e65
Show file tree
Hide file tree
Showing 14 changed files with 684 additions and 88 deletions.
85 changes: 79 additions & 6 deletions src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ tauri-build = { version = "1.4", features = [] }

[dependencies]

tauri = { version = "1.4", features = [ "protocol-asset", "shell-all", "clipboard-all", "os-all", "http-all", "http-multipart", "updater", "notification-all", "global-shortcut-all", "window-all", "path-all", "system-tray"] }
tauri = { version = "1.4", features = [ "fs-read-file", "fs-write-file", "protocol-asset", "shell-all", "clipboard-all", "os-all", "http-all", "http-multipart", "updater", "notification-all", "global-shortcut-all", "window-all", "path-all", "system-tray"] }
tauri-plugin-single-instance = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-autostart = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
tauri-plugin-fs-watch = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v1" }
Expand All @@ -35,6 +35,7 @@ arboard = "3.2.0"
libloader = "0.1.4"
libloading = "0.8.0"
lingua = { version = "1.5.0", default-features = false,features = ["chinese", "japanese", "english", "korean", "french", "spanish", "german", "russian", "italian", "portuguese", "turkish", "arabic", "vietnamese", "thai", "indonesian", "malay", "hindi", "mongolian",] }
reqwest_dav = {git="https://github.com/pot-app/reqwest_dav.git"}

[target.'cfg(target_os = "macos")'.dependencies]
window-shadows = "0.2"
Expand Down
79 changes: 0 additions & 79 deletions src-tauri/src/cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,82 +141,3 @@ pub fn unset_proxy() -> Result<bool, ()> {
std::env::remove_var("all_proxy");
Ok(true)
}

pub fn init_lang_detect() {
use lingua::{Language, LanguageDetectorBuilder};
let languages = vec![
Language::Chinese,
Language::Japanese,
Language::English,
Language::Korean,
Language::French,
Language::Spanish,
Language::German,
Language::Russian,
Language::Italian,
Language::Portuguese,
Language::Turkish,
Language::Arabic,
Language::Vietnamese,
Language::Thai,
Language::Indonesian,
Language::Malay,
Language::Hindi,
Language::Mongolian,
];
let detector = LanguageDetectorBuilder::from_languages(&languages)
.with_preloaded_language_models()
.build();
let _ = detector.detect_language_of("Hello Language");
}
#[tauri::command]
pub fn lang_detect(text: &str) -> Result<&str, ()> {
use lingua::{Language, LanguageDetectorBuilder};
let languages = vec![
Language::Chinese,
Language::Japanese,
Language::English,
Language::Korean,
Language::French,
Language::Spanish,
Language::German,
Language::Russian,
Language::Italian,
Language::Portuguese,
Language::Turkish,
Language::Arabic,
Language::Vietnamese,
Language::Thai,
Language::Indonesian,
Language::Malay,
Language::Hindi,
Language::Mongolian,
];
let detector = LanguageDetectorBuilder::from_languages(&languages)
.with_preloaded_language_models()
.build();
if let Some(lang) = detector.detect_language_of(text) {
match lang {
Language::Chinese => Ok("zh_cn"),
Language::Japanese => Ok("ja"),
Language::English => Ok("en"),
Language::Korean => Ok("ko"),
Language::French => Ok("fr"),
Language::Spanish => Ok("es"),
Language::German => Ok("de"),
Language::Russian => Ok("ru"),
Language::Italian => Ok("it"),
Language::Portuguese => Ok("pt_pt"),
Language::Turkish => Ok("tr"),
Language::Arabic => Ok("ar"),
Language::Vietnamese => Ok("vi"),
Language::Thai => Ok("th"),
Language::Indonesian => Ok("id"),
Language::Malay => Ok("ms"),
Language::Hindi => Ok("hi"),
Language::Mongolian => Ok("mn_cy"),
}
} else {
return Ok("");
}
}
78 changes: 78 additions & 0 deletions src-tauri/src/lang_detect.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
pub fn init_lang_detect() {
use lingua::{Language, LanguageDetectorBuilder};
let languages = vec![
Language::Chinese,
Language::Japanese,
Language::English,
Language::Korean,
Language::French,
Language::Spanish,
Language::German,
Language::Russian,
Language::Italian,
Language::Portuguese,
Language::Turkish,
Language::Arabic,
Language::Vietnamese,
Language::Thai,
Language::Indonesian,
Language::Malay,
Language::Hindi,
Language::Mongolian,
];
let detector = LanguageDetectorBuilder::from_languages(&languages)
.with_preloaded_language_models()
.build();
let _ = detector.detect_language_of("Hello Language");
}
#[tauri::command]
pub fn lang_detect(text: &str) -> Result<&str, ()> {
use lingua::{Language, LanguageDetectorBuilder};
let languages = vec![
Language::Chinese,
Language::Japanese,
Language::English,
Language::Korean,
Language::French,
Language::Spanish,
Language::German,
Language::Russian,
Language::Italian,
Language::Portuguese,
Language::Turkish,
Language::Arabic,
Language::Vietnamese,
Language::Thai,
Language::Indonesian,
Language::Malay,
Language::Hindi,
Language::Mongolian,
];
let detector = LanguageDetectorBuilder::from_languages(&languages)
.with_preloaded_language_models()
.build();
if let Some(lang) = detector.detect_language_of(text) {
match lang {
Language::Chinese => Ok("zh_cn"),
Language::Japanese => Ok("ja"),
Language::English => Ok("en"),
Language::Korean => Ok("ko"),
Language::French => Ok("fr"),
Language::Spanish => Ok("es"),
Language::German => Ok("de"),
Language::Russian => Ok("ru"),
Language::Italian => Ok("it"),
Language::Portuguese => Ok("pt_pt"),
Language::Turkish => Ok("tr"),
Language::Arabic => Ok("ar"),
Language::Vietnamese => Ok("vi"),
Language::Thai => Ok("th"),
Language::Indonesian => Ok("id"),
Language::Malay => Ok("ms"),
Language::Hindi => Ok("hi"),
Language::Mongolian => Ok("mn_cy"),
}
} else {
return Ok("");
}
}
Loading

1 comment on commit a5f9e65

@Pylogmon
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.