Skip to content

Commit

Permalink
chore: add a readme for the app
Browse files Browse the repository at this point in the history
  • Loading branch information
FusionSid committed May 31, 2023
1 parent 4932d3a commit 7ea5226
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 12 deletions.
13 changes: 11 additions & 2 deletions api/src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,32 @@ async def shutdown_event() -> None:
)

# constant for the port the api will use
PORT: Final = 8443
PORT: Final = 8469

# check weather to startup api in dev mode or not
devmode = os.environ.get("DEVMODE", "").lower()
if devmode not in ["true", "false"]:
raise InvalidDevmodeValue(provided=devmode)

# set the uvicorn server options based one dev mode or not
SSL_CERTFILE_PATH: Final = os.path.join(os.path.dirname(__file__), "cert.pem")
SSL_KEYFILE_PATH: Final = os.path.join(os.path.dirname(__file__), "key.pem")

options = (
{"app": "main:app", "port": PORT, "reload": True}
{
"app": "main:app",
"port": PORT,
"reload": True,
}
if devmode == "true"
else {
"app": "main:app",
"reload": False,
"port": PORT,
"access_log": False,
"log_level": "critical",
"ssl_keyfile": SSL_KEYFILE_PATH,
"ssl_certfile": SSL_CERTFILE_PATH,
}
)

Expand Down
79 changes: 78 additions & 1 deletion app/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,78 @@
# App
# Password1 Application/Graphical User Interface

The application is made using React/Vite and Tauri. It provides users with an easy to use graphical user interface so they can use the password manager simply, and effectively.

## Running / Setup

To run the application you need to download the excutable binary from the github releases [tab](https://github.com/st22209/Password-Manager/releases). Download the release at the top of the list of releases.

## Code/File Structure
```bash
.
├── README.md # this readme
├── index.html # the html file where the react code will be injected into
├── package-lock.json
├── package.json # dependencies
├── postcss.config.js
├── src # most of the code written by me is here
│ ├── App.tsx # main file that loads all other pages
│ ├── assets # userful assets
│ │ ├── hero_vault.svg
│ │ ├── index.ts
│ │ └── user_background.svg
│ ├── components # reuasable react components
│ │ ├── edit_pswd_form.tsx # modal that displays for editing a password
│ │ ├── index.ts
│ │ ├── navbar.tsx # navbar that shows on left side of password manager
│ │ ├── pswd_form.tsx # form that shows when creating a new password
│ │ └── pswd_table.tsx # table that is showed on all passwords page
│ ├── core # THE COORRE FOLDER (reusable code/utility code here)
│ │ ├── backup.ts # code to encrypt/decrypt backups
│ │ ├── formCallbacks.ts # functions that run after a form is submited
│ │ ├── index.ts
│ │ ├── kdf.ts # functions used to derive keys, salts etc
│ │ ├── requests.ts # functions ot make requests to the REST API
│ │ ├── types.ts # most of the app's types
│ │ └── validators.ts # functions for validating things like passwords
│ ├── index.css # main css file, tailwind injected into this
│ ├── main.tsx # code that starts react app
│ ├── pages # all the app's different pages
│ │ ├── all_passwords.tsx
│ │ ├── backup.tss
│ │ ├── generate.tsx
│ │ ├── index.ts
│ │ ├── login.tsx
│ │ ├── new_user.tsx
│ │ ├── passwords.tsx
│ │ ├── #.tsx
│ │ └── wavy.tsx # used for wavy animation (in components folder now)
│ └── vite-env.d.ts
├── src-tauri
│ ├── Cargo.lock
│ ├── Cargo.toml
│ ├── build.rs
│ ├── icons
│ │ ├── 1024.png
│ │ ├── 128.png
│ │ ├── 16.png
│ │ ├── 256.png
│ │ ├── 32.png
│ │ ├── 512.png
│ │ ├── 64.png
│ │ ├── icon.icns
│ │ ├── icon.ico
│ │ └── icon.png
│ ├── src
│ │ └── main.rs # code that loads tauri plugins and starts app
│ └── tauri.conf.json
├── tailwind.config.js
├── tests # test code
│ └── argon_hash.test.js
├── tsconfig.json
├── tsconfig.node.json
└── vite.config.ts

10 directories, 53 files
```

Everything else is mostly config. And if the file isnt listed in the above tree, it doesnt matter and is generated when building.
9 changes: 1 addition & 8 deletions app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,16 @@ import { BrowserRouter, Routes, Route, useLocation } from "react-router-dom"
import {
isPermissionGranted,
requestPermission,
sendNotification,
} from "@tauri-apps/api/notification"

export const AnimatedRoutes = () => {
useEffect(() => {
(async () => {
;(async () => {
let permissionGranted = await isPermissionGranted()
if (!permissionGranted) {
const permission = await requestPermission()
permissionGranted = permission === "granted"
}
if (permissionGranted) {
sendNotification({
title: "Password1",
body: "Welcome to Password1",
})
}
})()
})
const location = useLocation()
Expand Down
2 changes: 1 addition & 1 deletion app/src/core/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
User,
} from "./types"

const BASE_URL = "http://127.0.0.1:8443/api"
const BASE_URL = "https://password.fusionsid.com/api"
const STATUS_CODES = {
INVALID: 422,
CONFLICT: 409,
Expand Down

0 comments on commit 7ea5226

Please # to comment.