Skip to content

Commit

Permalink
Build UI
Browse files Browse the repository at this point in the history
Co-authored-by: Kartik Sharma <[email protected]>
  • Loading branch information
ajeetdsouza and crazystylus committed Apr 27, 2024
1 parent 9bc81c0 commit db2149b
Show file tree
Hide file tree
Showing 13 changed files with 586 additions and 204 deletions.
Binary file modified bun.lockb
Binary file not shown.
Empty file removed dist/.gitkeep
Empty file.
8 changes: 5 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<!DOCTYPE html>
<html lang="en">
<html lang="en" style="min-height: -webkit-fill-available">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>otadump</title>
<script>

<!-- <script>
document.addEventListener("contextmenu", (event) =>
event.preventDefault()
);
</script>
</script> -->
</head>

<body
style="
height: 100vh;
user-select: none;
-webkit-user-select: none;
-moz-user-select: none;
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
"@fluentui/react-components": "^9.47.3",
"@tauri-apps/api": "^1",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"reset-css": "^5.0.2"
},
"devDependencies": {
"@types/react": "^18.2.15",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ serde = { version = "1.0.197", features = ["derive"] }
serde_json = "1.0.115"
sha2 = "0.10.6"
sync-unsafe-cell = "0.1.0"
tauri = { version = "1.6.1", features = ["dialog-open", "shell-open"] }
tauri = { version = "1.6.1", features = [ "shell-open", "process-exit", "dialog-open"] }
tempfile = "3.6.0"
zip = { version = "0.6.6", features = [
"deflate",
Expand Down
268 changes: 190 additions & 78 deletions src-tauri/src/core/extract.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src-tauri/src/core/payload.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl<'a> Payload<'a> {
// TODO: this outputs the entire bytes of the file in the event of a
// parser error. Use nom's VerboseError here.
let (_, payload): (_, Payload) = Parse::parse(bytes)
.map_err(|e| anyhow!(e.to_string()).context("failed to parse payload"))?;
.map_err(|e| anyhow!(e.to_string()).context("Failed to parse payload"))?;
Ok(payload)
}
}
6 changes: 3 additions & 3 deletions src-tauri/src/gui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ impl crate::core::Reporter for Reporter {
}

fn report_error(&self, error: Box<dyn Error>) {
let error = format!("{}", error);
let message = Message::Error { error };
let error = format!("{:?}", error);
let message = Message::Error { message: error };
self.emit_all(message);
}
}
Expand All @@ -52,5 +52,5 @@ impl crate::core::Reporter for Reporter {
enum Message {
Progress { value: f64 },
Completed,
Error { error: String },
Error { message: String },
}
13 changes: 11 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::path::PathBuf;
use std::thread;

use anyhow::{Context as _, Result};
use anyhow::{Context, Result};
use otadump::core::ExtractOptions;
use otadump::gui;
use tauri::AppHandle;
Expand All @@ -18,8 +18,17 @@ fn extract(app: AppHandle, payload_file: PathBuf, output_dir: PathBuf) {
}

fn main() -> Result<()> {
// let options = ExtractOptions {
// payload_file:
// "/home/ajeet/ws/otadump-payloads/bluejay-ota-sd2a.220601.001.a1-bacd4108.zip"
// .into(),
// output_dir: "/tmp/asdf".into(),
// };
// otadump::tui::extract(options);
// Ok(())

tauri::Builder::default()
.invoke_handler(tauri::generate_handler![extract])
.run(tauri::generate_context!())
.context("error running application")
.context("Error running application")
}
6 changes: 5 additions & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,13 @@
"dialog": {
"open": true
},
"process": {
"all": false,
"exit": true
},
"shell": {
"all": false,
"open": true
"open": ".*"
}
},
"windows": [
Expand Down
Loading

0 comments on commit db2149b

Please sign in to comment.