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

Commit

Permalink
did stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
raisfeld-ori committed Mar 6, 2024
1 parent 6589718 commit 3a4ba9e
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 40 deletions.
10 changes: 4 additions & 6 deletions src-tauri/src/data/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,11 @@ pub fn authenticate_user(name: &str, password: &str) -> bool {
}

#[tauri::command]
pub fn load_user<R: Runtime>(app: tauri::AppHandle<R>, window: tauri::Window<R>, name: &str, password: &str) -> bool {
pub fn load_user<R: Runtime>(app: tauri::AppHandle<R>, window: tauri::Window<R>, name: &str, password: &str) {
println!("{}, {}", name, password);
let location: &[u8] = &aes_encrypt(name, password, name.as_bytes());
let location = dir().join(format!("{:?}", location));
window.emit("rust_event", 0);

return true;

}

#[tauri::command]
Expand Down Expand Up @@ -75,6 +73,6 @@ fn test_authentication(){
init_dir().expect("failed to create the main directory");
let name = "test";
let password = "test";
// save_user(name, password);
// authenticate_user(name, password);
save_user(name, password);
authenticate_user(name, password);
}
2 changes: 0 additions & 2 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ load_user - load an existing user
"#)
}
fn main() {


tauri::Builder::default().invoke_handler(tauri::generate_handler![
first_init, list_commands, printf, user_get, authenticate_user, update, save_user, load_user
]).run(tauri::generate_context!()).expect("failed to run the code");
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { invoke } from "@tauri-apps/api/tauri";
import {useEffect} from "react";
import login from './pages/login/login';
import signup from './pages/login/signup';
import loading from './pages/login/loading';
import { Route, Routes } from "react-router-dom";
import Loading from "./pages/login/loading";

function App() {
const init = () => useEffect(() => {
Expand All @@ -15,7 +15,7 @@ function App() {
return <Routes>
<Route path="/" element={login()}></Route>
<Route path="/signup" element={signup()}></Route>
<Route path="/loading" element={loading()}></Route>
<Route path="/loading" element={<Loading />}></Route>
</Routes>
}

Expand Down
Binary file removed src/assets/OK-I-PULL-UP.ogg
Binary file not shown.
Binary file removed src/assets/Okiupp.mp3
Binary file not shown.
Binary file not shown.
44 changes: 14 additions & 30 deletions src/pages/login/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,28 @@ import { invoke } from '@tauri-apps/api';
import { useState } from 'react';
// import { useNavigate } from 'react-router-dom';
import { useLocation } from 'react-router-dom';
import miku from '../../assets/alpha.png';
import pullup from '../../assets/Okiupp.mp3';
import okpullup from '../../assets/OK-I-PULL-UP.ogg';
import {useEffect} from "react";


// loading the page requires a username and a password
function loading(){
const [value, setvalue] = useState(0);
export default function Loading(){
const location = useLocation();
useEffect(() => {
if (!location.state) {
return;
}
const loadUser = async () => {
await invoke("load_user", location.state);
};
loadUser();
}, [location.state]);
if (!location.state){return <h1>DONT ACCESS THIS PAGE WITHOUT LOGGING IN</h1>}
document.addEventListener('rust_event', () => {invoke("printf", {value: "yiipee"})});
function run_loading(){invoke("load_user", location.state);}
document.addEventListener('rust_event', () => {});
invoke("user_", location.state);


return <div id='background'>

<div className='triangle down'></div>
<div className='triangle down'></div>
<div className='triangle left'></div>
<div id='user'>
<p>{value}</p>
<h1>welcome {location.state.name}!</h1>

<div className="dot">
<img src={miku} alt="Descriptive text" />
</div>
<h1>kys</h1>
<progress className='rotating' max={10} value={1}></progress>
<p id='melody'>enjoy this melody while ori is fixing the progress bar</p>
<audio controls autoPlay>
<source src={okpullup} type="audio/ogg" />
<source src={pullup} type="audio/mpeg" />
Your browser does not support the audio element.
</audio>

<progress max={10} value={1}></progress>
</div>
</div>
}

export default loading;
}

0 comments on commit 3a4ba9e

Please sign in to comment.