Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
raisfeld-ori committed Mar 27, 2024
2 parents d9e037b + da9304b commit ad39d18
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 24 deletions.
27 changes: 22 additions & 5 deletions src-tauri/src/fs/commands.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::{fs, path::PathBuf};
use std::{f32::consts::E, fs, path::PathBuf};
use base64::{encode_config, URL_SAFE};
use serde::{Deserialize, Serialize};
use serde_json::Error;
use std::fs::{read, write};
use crate::get_user_dir;
use crate::{aes_decrypt, get_user_dir};

use super::encryption::aes_encrypt;

Expand Down Expand Up @@ -48,6 +48,7 @@ pub fn upload_file(name: &str, password: &str, file_path: String) -> Result<(),
let new_file = File::new(name, password,file_name, unsafe {&FS.current_dir});
return Ok(());
}

#[derive(Clone, Debug, PartialEq, PartialOrd, Serialize, Deserialize)]
pub struct Home{
path: Vec<Directory>,
Expand Down Expand Up @@ -118,11 +119,20 @@ impl File{
if save.is_err() {return Err(save.unwrap_err());}
return Ok(());
}
pub fn export(&self, name: &str, password: &str) -> Result<(), std::io::Error>{
let encrypted_content = read(self.location.as_path());
if encrypted_content.is_err(){return Err(encrypted_content.unwrap_err());}
let decrypted_content = aes_decrypt(name, password, &encrypted_content.unwrap());
return Ok(());
}
pub fn delete(&self, name: &str, password: &str) -> Result<(), std::io::Error>{
fs::remove_file(self.location.as_path())
}
pub fn open(&self) -> Option<Vec<u8>> {
let data = read(self.location.as_path());
if data.is_err(){return None;}
// i'l keep on working on it later
None
Some(data.unwrap())
}

}
Expand All @@ -145,6 +155,13 @@ fn test_upload(){
unsafe{FS.init_fs();}
let name = "some";
let password = "thing";
File::new(name, password, String::from("test.txt"), unsafe {&FS.current_dir});
assert!(upload_file(name, password, String::from("/test.txt")).is_ok());
let data = b"helloworlddigmas";
let mut dir = Directory::new(String::from("dir"));
let file = File::new(name, password, String::from("test.txt"), &dir).unwrap();
file.save(name, password, data).unwrap();
dir.files.push(DirectoryItems::File(file.clone()));
file.delete(name, password).unwrap();
println!("dir: {:?}", dir)


}
8 changes: 4 additions & 4 deletions src/pages/login/login.css
Original file line number Diff line number Diff line change
Expand Up @@ -533,10 +533,10 @@ a:hover {
}
}

.flip2 { animation: flip2 6s cubic-bezier(0.23, 1, 0.32, 1.2); }
.flip3 { animation: flip3 6s cubic-bezier(0.23, 1, 0.32, 1.2); }
.flip4 { animation: flip4 6s cubic-bezier(0.23, 1, 0.32, 1.2); }
.flip5 { animation: flip5 6s cubic-bezier(0.23, 1, 0.32, 1.2); }
.flip2 { animation: flip2 9s cubic-bezier(0.23, 1, 0.32, 1.2) infinite; }
.flip3 { animation: flip3 9s cubic-bezier(0.23, 1, 0.32, 1.2) infinite; }
.flip4 { animation: flip4 9s cubic-bezier(0.23, 1, 0.32, 1.2) infinite; }
.flip5 { animation: flip5 14s cubic-bezier(0.23, 1, 0.32, 1.2) infinite; }

@keyframes flip2 {
0% { margin-top: -180px; }
Expand Down
9 changes: 5 additions & 4 deletions src/pages/login/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,13 @@ function login(){
<div id='form'>

<h4 className="wordCarousel">
<div>
<div>
<ul className="flip5">
<li>Hello 👋</li>
<li>olá 👋</li>
<li>mrhban 👋</li>
<li>Shalom 👋</li>
<li>Hola 👋</li>

<li>Hello 👋</li>
</ul>
</div>
</h4>
Expand All @@ -66,7 +67,7 @@ function login(){
<span className="circle" aria-hidden="true">
<span className="icon arrow"></span>
</span>
<span className="button-text">Login</span>
<span className="button-text" onClick={() => navigate("main_page")}>Login</span>
</button>
<br />
<p id='error'>{error}</p>
Expand Down
12 changes: 12 additions & 0 deletions src/pages/login/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,18 @@ function Login() {
<div id='menu'>
<div id='form'>

<h4 className="wordCarousel">
<div>
<ul className="flip5">
<li>Bem-vindo 👋</li>
<li>mrhbaan 👋</li>
<li>Baroh Aba 👋</li>
<li>bienvenidas 👋</li>
<li>Welcome 👋</li>
</ul>
</div>
</h4>

<h1 className='login' >Welcome!</h1>
<p className='login2'>Enter your credentials to Sign Up</p>

Expand Down
11 changes: 9 additions & 2 deletions src/pages/main_page/internal_apps/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,15 @@ border-radius: 20px;
}

.ContextMenu{
height: 10svh;
height: 19svh;
width: 15svh;
position: absolute;
background-color: aliceblue;
background-color: rgb(252, 252, 252);
z-index: 99;
border: 2px #c5c5c56c;
border-style: solid;
border-radius: 10px;



}
53 changes: 48 additions & 5 deletions src/pages/main_page/internal_apps/apps/file_system.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,34 @@
justify-content: flex-start;
}

.file_img{
height: 10svh;
width: 5svw;
.file_img {
margin-top: 1svh; /* Adjust as needed */
height: 3.5svh;
width: 2svw;
}

.editing {
border: 2px solid transparent;
width: 6em;
height: 2.5em;
padding-left: 0.8em;
outline: none;
overflow: hidden;
background-color: #F3F3F3;
border-radius: 10px;
transition: all 0.5s;
}

.editing:hover, .editing:focus {
border: 2px solid #525252;
box-shadow: 0px 0px 0px 4px rgba(0, 0, 0, 0.2);
background-color: white;
}





.file_grid {
display:grid;
width: 100%;
Expand All @@ -27,7 +50,6 @@
position:relative;
display: block;
margin-bottom: 1px;
height: 10svh;
border-top: 2px #0202022f;
border-left: 2px #0202022f;
border-top-right-radius: 20px;
Expand Down Expand Up @@ -64,4 +86,25 @@
height: 50svh;
backdrop-filter: blur(10px);

}
}

.buttoncontextmenu {
display: flex;
margin-left: 3svh;
flex-direction: column;
justify-content: center; /* Horizontally centers the context menu */
align-items: center; /* Vertically centers the buttons */
margin-top: 1svh;
}



.linecontextmenu::after {
content: "";
display: block;
margin-top: 10px;
width: 100%; /* Adjust width as needed */
height: 2px; /* Adjust height as needed */
background-color: rgba(167, 167, 167, 0.474); /* Change color as desired */
margin-right: 100%; /* This pushes the line to the left */
}
13 changes: 9 additions & 4 deletions src/pages/main_page/internal_apps/apps/file_system.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import App from '../App';
import { invoke } from '@tauri-apps/api';
import { useState, useEffect } from 'react';
import img from '../../assets/terminal.png';
import img from '../../assets/folder.png';
import { open } from '@tauri-apps/api/dialog';
import folder from '../../assets/folder.png';
import alpha from '../../assets/daddyishome.png'
Expand Down Expand Up @@ -104,9 +104,14 @@ function file_system() : [JSX.Element, React.Dispatch<React.SetStateAction<strin
left: dx + 2 + 'px',
display: `${ctx_display}`,
}}>
<button onClick={() => make_files(FileType.Directory)}>create dir</button>
<br />
<button onClick={async () => await upload_file(update_fs, set_files)}>upload file</button>

<button className='buttoncontextmenu' onClick={() => make_files(FileType.Directory)}>Create File</button>

<button className='buttoncontextmenu' onClick={async () => await upload_file(update_fs, set_files)}>Upload File</button>
<button className='buttoncontextmenu' >Rename</button>
<p className='linecontextmenu'></p>
<button className='buttoncontextmenu' >Delete</button>
<button className='buttoncontextmenu' >Copy</button>
</div>;
let Application = <div className='ApplicationDirectory'>
<h1 className='filesystemtxt2'>{location}</h1>
Expand Down

0 comments on commit ad39d18

Please sign in to comment.