Skip to content

Commit

Permalink
refactor: 🔥 Remove unused code and dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jisu-Woniu committed Nov 7, 2023
1 parent 185eae2 commit 467832d
Show file tree
Hide file tree
Showing 8 changed files with 109 additions and 174 deletions.
79 changes: 0 additions & 79 deletions src-tauri/Cargo.lock

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

1 change: 0 additions & 1 deletion src-tauri/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ edition = "2021"
ed25519 = { version = "2.2.3", features = ["pkcs8", "pem"] }
ed25519-dalek = { version = "2.0.0", features = ["rand_core"] }
rand = "0.8.5"
rsa = { version = "0.9.3", features = ["sha2", "getrandom"] }
signature = { version = "2.1.0", features = ["digest"] }
thiserror = "1.0.50"

Expand Down
3 changes: 1 addition & 2 deletions src-tauri/crypto/src/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ use std::{
};

use ed25519::{
pkcs8::{EncodePrivateKey, EncodePublicKey},
pkcs8::{spki::der::pem::LineEnding, EncodePrivateKey, EncodePublicKey},
KeypairBytes, PublicKeyBytes,
};
use ed25519_dalek::SigningKey;
use rand::thread_rng;
use rsa::pkcs8::LineEnding;
use tokio::{
fs::{self, DirBuilder},
try_join,
Expand Down
14 changes: 0 additions & 14 deletions src-tauri/crypto/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
pub mod error;
pub mod keygen;
mod secret_file;
pub fn add(left: usize, right: usize) -> usize {
left + right
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
6 changes: 1 addition & 5 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,10 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

// Learn more about Tauri commands at https://tauri.app/v1/guides/features/command
#[tauri::command]
fn greet(name: &str) -> String {
format!("Hello, {}! You've been greeted from Rust!", name)
}

fn main() {
tauri::Builder::default()
.invoke_handler(tauri::generate_handler![greet])
.invoke_handler(tauri::generate_handler![])
.run(tauri::generate_context!())
.expect("error while running tauri application");
}
73 changes: 6 additions & 67 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,78 +1,17 @@
<script setup lang="ts">
import { onMounted, onUnmounted, ref } from "vue";
import { ref } from "vue";
import FileSelector from "@/components/FileSelector.vue";
import { TauriEvent, listen, type UnlistenFn } from "@tauri-apps/api/event";
const onUpdate = (e: Event) => {
console.log((e.target as HTMLInputElement).value);
};
const files = ref<string[]>([]);
const hover = ref(false);
const onFilesSelected = (files_selected: string[]) => {
console.log(files_selected);
files.value = files_selected;
};
let unlistenFileDrop: UnlistenFn | undefined;
let unlistenFileDropHover: UnlistenFn | undefined;
let unlistenFileDropCanceled: UnlistenFn | undefined;
let unlistenBlur: UnlistenFn | undefined;
onMounted(async () => {
unlistenFileDrop = await listen<string[]>(
TauriEvent.WINDOW_FILE_DROP,
(e) => {
files.value = e.payload;
hover.value = false;
},
);
unlistenFileDropHover = await listen<string[]>(
TauriEvent.WINDOW_FILE_DROP_HOVER,
(e) => {
console.log(e.payload);
hover.value = true;
},
);
unlistenFileDropCanceled = await listen<void>(
TauriEvent.WINDOW_FILE_DROP_CANCELLED,
() => {
hover.value = false;
},
);
unlistenBlur = await listen<void>(TauriEvent.WINDOW_BLUR, () => {
console.log("Blur");
hover.value = false;
});
});
onUnmounted(() => {
[
unlistenFileDrop,
unlistenFileDropHover,
unlistenFileDropCanceled,
unlistenBlur,
].forEach((unlisten) => {
if (unlisten) {
unlisten();
}
});
});
const file = ref<string>();
</script>

<template>
<FileSelector @file-selected="onFilesSelected" />
<ul>
<li v-for="file in files" :key="file">
{{ file }}
</li>
</ul>
<div v-if="hover" class="red">Hovering</div>
<FileSelector v-model="file" />
<div v-if="file">
{{ file }}
</div>
</template>

<style scoped>
.red {
color: red;
}
</style>
Loading

0 comments on commit 467832d

Please sign in to comment.