Skip to content

Commit

Permalink
refactor(uri): refactor uri implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
eythaann committed Aug 15, 2024
1 parent fda986e commit acf9f25
Show file tree
Hide file tree
Showing 15 changed files with 320 additions and 205 deletions.
247 changes: 182 additions & 65 deletions Cargo.lock

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ tauri-plugin-shell = "2.0.0-beta.2"
tauri-plugin-process = "2.0.0-beta.2"
tauri-plugin-log = "2.0.0-beta.2"
tauri-plugin-updater = "2.0.0-beta.2"
tauri-plugin-deep-link = "2.0.0-beta.10"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
serde_yaml = "0.9.34"
Expand All @@ -55,12 +56,11 @@ getset = "0.1.2"
phf = "0.11.2"
sysinfo = "0.30.12"
battery = "0.7.8"
# Windows Crates
notify = "6.1.1"
winvd = { git = "https://github.com/eythaann/virtualdesktopaccessor.git" }
winreg = "0.52.0"
windows-core = "=0.57.0" # windows-rs already depends and reexports this, but we need it as a direct dependency (implement macro)
win-screenshot = "4.0.8"
windows-core = "=0.57.0" # windows-rs already depends and reexports this, but we need it as a direct dependency (implement macro)
notify = "6.1.1"

[dependencies.windows]
version = "=0.57.0"
Expand Down
29 changes: 15 additions & 14 deletions capabilities/migrated.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,15 @@
"fancy-toolbar-hitbox/*"
],
"permissions": [
"path:default",
"event:default",
"window:default",
"webview:default",
"app:default",
"resources:default",
"menu:default",
"tray:default",
"core:path:default",
"core:event:default",
"core:window:default",
"core:webview:default",
"core:app:default",
"core:resources:default",
"core:menu:default",
"core:tray:default",
"deep-link:default",

"fs:allow-read-text-file",
"fs:allow-write-text-file",
Expand All @@ -45,12 +46,12 @@
]
},

"window:allow-show",
"window:allow-close",
"window:allow-start-dragging",
"window:allow-set-size",
"window:allow-set-position",
"window:allow-set-ignore-cursor-events",
"core:window:allow-show",
"core:window:allow-close",
"core:window:allow-start-dragging",
"core:window:allow-set-size",
"core:window:allow-set-position",
"core:window:allow-set-ignore-cursor-events",

"autostart:allow-enable",
"autostart:allow-disable",
Expand Down
4 changes: 2 additions & 2 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changelog

## [Unreleased]
## [1.9.2]
### enhancements
- add file associations with .slu files
- add file associations for .slu files
- add uri associations for seelen-ui:uri
- improve settings editor experience by adding live reload feature.

### fix
Expand Down
173 changes: 93 additions & 80 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@
"license": "Polyform Strict License",
"dependencies": {
"@tauri-apps/plugin-autostart": "^2.0.0-beta.2",
"@tauri-apps/plugin-deep-link": "^2.0.0-beta.10",
"@tauri-apps/plugin-dialog": "^2.0.0-beta.2",
"@tauri-apps/plugin-fs": "^2.0.0-beta.2",
"@tauri-apps/plugin-log": "^2.0.0-beta.2",
"@tauri-apps/plugin-process": "^2.0.0-beta.2",
"@tauri-apps/plugin-shell": "^2.0.0-beta.2",
"@tauri-apps/plugin-updater": "^2.0.0-beta.2",
"react-icons": "^5.1.0"
"@tauri-apps/plugin-updater": "^2.0.0-beta.2"
},
"devDependencies": {
"@commitlint/cli": "^19.3.0",
Expand Down Expand Up @@ -67,6 +67,7 @@
"react": "18.2.0",
"react-dom": "18.2.0",
"react-i18next": "^15.0.0",
"react-icons": "^5.3.0",
"react-redux": "^9.1.0",
"readable-types": "^4.0.0",
"redux": "^5.0.1",
Expand Down
4 changes: 2 additions & 2 deletions src/background/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use exposed::register_invoke_handler;
use itertools::Itertools;
use modules::{
cli::{
application::{attach_console, handle_cli_info, SEELEN_COMMAND_LINE},
application::{attach_console, is_just_getting_info, SEELEN_COMMAND_LINE},
infrastructure::Client,
},
tray::application::ensure_tray_overflow_creation,
Expand Down Expand Up @@ -124,7 +124,7 @@ fn main() -> Result<()> {
}
};

if handle_cli_info(&matches)? {
if is_just_getting_info(&matches)? {
return Ok(());
}

Expand Down
16 changes: 11 additions & 5 deletions src/background/modules/cli/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,16 @@ lazy_static! {
}

pub fn attach_console() -> Result<()> {
unsafe { AttachConsole(ATTACH_PARENT_PROCESS)? };
if !tauri::is_dev() {
unsafe { AttachConsole(ATTACH_PARENT_PROCESS)? };
}
Ok(())
}

pub fn detach_console() -> Result<()> {
unsafe { FreeConsole()? };
if !tauri::is_dev() {
unsafe { FreeConsole()? };
}
Ok(())
}

Expand All @@ -129,20 +133,22 @@ pub fn loader_command() -> Command {
])
}

pub fn handle_cli_info(matches: &clap::ArgMatches) -> Result<bool> {
pub fn is_just_getting_info(matches: &clap::ArgMatches) -> Result<bool> {
let mut r = false;
attach_console()?;

if matches.get_flag("verbose") {
attach_console()?;
println!("{:?}", matches);
detach_console()?;
}

if matches.get_flag("version") {
attach_console()?;
println!("{}", env!("CARGO_PKG_VERSION"));
detach_console()?;
r = true;
}

detach_console()?;
Ok(r)
}

Expand Down
1 change: 0 additions & 1 deletion src/background/modules/file_extensions/application.rs

This file was deleted.

26 changes: 0 additions & 26 deletions src/background/modules/file_extensions/infrastructure.rs

This file was deleted.

2 changes: 0 additions & 2 deletions src/background/modules/file_extensions/mod.rs

This file was deleted.

1 change: 0 additions & 1 deletion src/background/modules/mod.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pub mod cli;
pub mod file_extensions;
pub mod input;
pub mod media;
pub mod monitors;
Expand Down
1 change: 1 addition & 0 deletions src/background/plugins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,5 @@ pub fn register_plugins(app_builder: Builder<Wry>) -> Builder<Wry> {
Some(vec!["--silent"]),
))
.plugin(log_plugin_builder.build())
.plugin(tauri_plugin_deep_link::init())
}
6 changes: 6 additions & 0 deletions tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,12 @@
"endpoints": [
"https://github.com/eythaann/Seelen-UI/releases/latest/download/latest.json"
]
},
"deep-link": {
"mobile": [],
"desktop": {
"schemes": ["seelen-ui"]
}
}
}
}
4 changes: 2 additions & 2 deletions templates/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,7 @@ Section Install
; Create file associations
{{#each file_associations as |association| ~}}
{{#each association.ext as |ext| ~}}
!insertmacro APP_ASSOCIATE "{{ext}}" "{{or association.name ext}}" "{{association-description association.description ext}}" "$INSTDIR\${MAINBINARYNAME}.exe,0" "Open with ${PRODUCTNAME}" "$INSTDIR\${MAINBINARYNAME}.exe $\"%1$\""
!insertmacro APP_ASSOCIATE "{{ext}}" "{{or association.name ext}}" "{{association-description association.description ext}}" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\",0" "Open with ${PRODUCTNAME}" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" load file $\"%1$\""
{{/each}}
{{/each}}
!insertmacro UPDATEFILEASSOC
Expand All @@ -598,7 +598,7 @@ Section Install
WriteRegStr SHCTX "Software\Classes\\{{protocol}}" "URL Protocol" ""
WriteRegStr SHCTX "Software\Classes\\{{protocol}}" "" "URL:${BUNDLEID} protocol"
WriteRegStr SHCTX "Software\Classes\\{{protocol}}\DefaultIcon" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\",0"
WriteRegStr SHCTX "Software\Classes\\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" $\"%1$\""
WriteRegStr SHCTX "Software\Classes\\{{protocol}}\shell\open\command" "" "$\"$INSTDIR\${MAINBINARYNAME}.exe$\" load uri $\"%1$\""
{{/each}}

; Create uninstaller
Expand Down

0 comments on commit acf9f25

Please sign in to comment.