Compare commits
2 Commits
main
...
yash-priv-
Author | SHA1 | Date | |
---|---|---|---|
56599bfdb3 | |||
546c09cca2 |
@ -9,6 +9,9 @@ from data_handler import DataHandler
|
|||||||
|
|
||||||
app: Flask = Flask(__name__)
|
app: Flask = Flask(__name__)
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
app.run(debug=True)
|
||||||
|
|
||||||
|
|
||||||
def handle_first_launched():
|
def handle_first_launched():
|
||||||
"""
|
"""
|
||||||
|
37
backend/rest_api.spec
Normal file
37
backend/rest_api.spec
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['rest_api.py', 'encryption_handler.py', 'data_handler.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=[],
|
||||||
|
hiddenimports=[],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
noarchive=False,
|
||||||
|
)
|
||||||
|
pyz = PYZ(a.pure)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
a.binaries,
|
||||||
|
a.datas,
|
||||||
|
[],
|
||||||
|
name='rest_api',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
runtime_tmpdir=None,
|
||||||
|
console=True,
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
@ -3,6 +3,13 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
|
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://fonts.googleapis.com;
|
||||||
|
font-src 'self' https://fonts.gstatic.com;
|
||||||
|
connect-src 'self' http://127.0.0.1:5000;
|
||||||
|
style-src 'self' https://fonts.googleapis.com 'unsafe-inline';
|
||||||
|
script-src 'self' 'unsafe-inline';
|
||||||
|
script-src-elem 'self' 'unsafe-inline';
|
||||||
|
img-src 'self' http://www.google.com/s2/favicons https://t1.gstatic.com https://t0.gstatic.com https://t2.gstatic.com">
|
||||||
<title>DashBoard</title>
|
<title>DashBoard</title>
|
||||||
<link rel="stylesheet" href="../styles/dashboard.css"/>
|
<link rel="stylesheet" href="../styles/dashboard.css"/>
|
||||||
</head>
|
</head>
|
||||||
|
@ -3,6 +3,14 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
|
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://fonts.googleapis.com;
|
||||||
|
font-src 'self' https://fonts.gstatic.com;
|
||||||
|
connect-src 'self' http://127.0.0.1:5000;
|
||||||
|
style-src 'self' https://fonts.googleapis.com 'unsafe-inline';">
|
||||||
|
<meta
|
||||||
|
http-equiv="X-Content-Security-Policy"
|
||||||
|
content="default-src 'self'; script-src 'self'"
|
||||||
|
/>
|
||||||
<link rel="stylesheet" href="../styles/index.css"/>
|
<link rel="stylesheet" href="../styles/index.css"/>
|
||||||
<title>Login</title>
|
<title>Login</title>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
|
@ -3,6 +3,12 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
|
<meta http-equiv="CONTENT-TYPE" content="text/html; charset=UTF-8">
|
||||||
|
<meta http-equiv="Content-Security-Policy" content="default-src 'self' https://fonts.googleapis.com;
|
||||||
|
font-src 'self' https://fonts.gstatic.com;
|
||||||
|
connect-src 'self' http://127.0.0.1:5000;
|
||||||
|
style-src 'self' https://fonts.googleapis.com 'unsafe-inline';
|
||||||
|
script-src 'self' 'unsafe-inline';
|
||||||
|
script-src-elem 'self' 'unsafe-inline'">
|
||||||
<link rel="stylesheet" href="../styles/register.css"/>
|
<link rel="stylesheet" href="../styles/register.css"/>
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||||
|
77
frontend/main.js
Normal file
77
frontend/main.js
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
const { app, BrowserWindow, shell } = require('electron')
|
||||||
|
const path = require('path')
|
||||||
|
const { spawn } = require('node:child_process');
|
||||||
|
const rest_api = spawn('python', ['./backend/rest_api.py']);
|
||||||
|
|
||||||
|
function createWindow () {
|
||||||
|
|
||||||
|
const win = new BrowserWindow({
|
||||||
|
width: 800,
|
||||||
|
height: 600,
|
||||||
|
webPreferences: {
|
||||||
|
nodeIntegration: false,
|
||||||
|
contextIsolation: true,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
win.loadFile('frontend/html/index.html')
|
||||||
|
|
||||||
|
win.setMenu(null);
|
||||||
|
|
||||||
|
win.webContents.setWindowOpenHandler(({ url }) => {
|
||||||
|
shell.openExternal(url);
|
||||||
|
return { action: 'deny' };
|
||||||
|
});
|
||||||
|
|
||||||
|
win.webContents.openDevTools();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
app.whenReady().then(() => {
|
||||||
|
createWindow()
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (BrowserWindow.getAllWindows().length === 0) {
|
||||||
|
createWindow()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
rest_api.stdout.on('data', (data) => {
|
||||||
|
console.log(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
rest_api.stderr.on('data', (data) => {
|
||||||
|
console.error(data.toString());
|
||||||
|
});
|
||||||
|
|
||||||
|
rest_api.on('exit', (code) => {
|
||||||
|
console.log(`Child exited with code ${code}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('before-quit', () => {
|
||||||
|
rest_api.kill();
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
app.on('web-contents-created', (event, contents) => {
|
||||||
|
contents.on('new-window', (event, navigationUrl) => {
|
||||||
|
event.preventDefault();
|
||||||
|
require('electron').shell.openExternal(navigationUrl);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -14,9 +14,11 @@
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------------------(Getting Data)
|
//-----------------------------------------------------------------------------------------(Getting Data)
|
||||||
|
|
||||||
|
const PORT = 5000;
|
||||||
|
|
||||||
async function getData() {
|
async function getData() {
|
||||||
try {
|
try {
|
||||||
let response = await fetch('/get_data', {
|
let response = await fetch(`http://127.0.0.1:${PORT}/get_data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
@ -223,7 +225,7 @@ const errorlabel = document.querySelector('.fieldcontainer label')
|
|||||||
|
|
||||||
async function sendData(formData){
|
async function sendData(formData){
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/add_entry', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/add_entry`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -401,7 +403,7 @@ async function deleteEntry() {
|
|||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append("entry_name", localStorage.getItem("editVal"))
|
formData.append("entry_name", localStorage.getItem("editVal"))
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/delete_entry', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/delete_entry`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -479,7 +481,7 @@ async function sendPass(password) {
|
|||||||
const formData = new FormData()
|
const formData = new FormData()
|
||||||
formData.append("password", password)
|
formData.append("password", password)
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/change_password', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/change_password`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -599,7 +601,7 @@ async function addNewField(sitename, field, value) {
|
|||||||
formData.append("field_value", value)
|
formData.append("field_value", value)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/add_field', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/add_field`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -628,7 +630,7 @@ async function editFieldValue(sitename, field, value) {
|
|||||||
formData.append("field_value", value)
|
formData.append("field_value", value)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/edit_field_value', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/edit_field_value`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -655,7 +657,7 @@ async function changeEntryName(entryname, sitename) {
|
|||||||
formData.append("new_entry_name", sitename)
|
formData.append("new_entry_name", sitename)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/edit_entry_name', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/edit_entry_name`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -795,7 +797,7 @@ function closePopup() {
|
|||||||
|
|
||||||
async function logOut() {
|
async function logOut() {
|
||||||
try{
|
try{
|
||||||
await fetch("/logout", {
|
await fetch(`http://127.0.0.1:${PORT}/logout`, {
|
||||||
method:'POST',
|
method:'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json',
|
'Content-Type': 'application/json',
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
const PORT = 5000;
|
||||||
|
|
||||||
let loginb = document.getElementById("loginb");
|
let loginb = document.getElementById("loginb");
|
||||||
|
|
||||||
loginb.addEventListener("click", validateLogin);
|
loginb.addEventListener("click", validateLogin);
|
||||||
@ -48,7 +50,7 @@ formData.append('password', _password);
|
|||||||
// console.log(formData)
|
// console.log(formData)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/login', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/login`, {
|
||||||
method: "post",
|
method: "post",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -88,7 +90,7 @@ register.addEventListener("click", function(event) {
|
|||||||
|
|
||||||
window.onload = async function() {
|
window.onload = async function() {
|
||||||
try {
|
try {
|
||||||
let response = await fetch('/get_data', {
|
let response = await fetch(`http://127.0.0.1:${PORT}/get_data`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'application/json'
|
'Content-Type': 'application/json'
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
|
const PORT = 5000
|
||||||
const errlabel = document.getElementById('errlabel')
|
const errlabel = document.getElementById('errlabel')
|
||||||
|
|
||||||
function validateRegister() {
|
function validateRegister() {
|
||||||
@ -29,7 +29,7 @@ async function createUser(username,password) {
|
|||||||
formData.append("password", password)
|
formData.append("password", password)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/add_user', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/add_user`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
@ -40,7 +40,7 @@ async function createUser(username,password) {
|
|||||||
const errorMessage = await response.text();
|
const errorMessage = await response.text();
|
||||||
errlabel.textContentL = errorMessage;
|
errlabel.textContentL = errorMessage;
|
||||||
setTimeout(()=> {
|
setTimeout(()=> {
|
||||||
errorlabel.textContent = "";
|
errlabel.textContent = "";
|
||||||
},3000)
|
},3000)
|
||||||
throw new Error(errorMessage);
|
throw new Error(errorMessage);
|
||||||
}
|
}
|
||||||
@ -55,7 +55,7 @@ async function Login(username,password){
|
|||||||
formData.append('password', password);
|
formData.append('password', password);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await fetch('/login', {
|
const response = await fetch(`http://127.0.0.1:${PORT}/login`, {
|
||||||
method: "post",
|
method: "post",
|
||||||
body: formData
|
body: formData
|
||||||
});
|
});
|
||||||
|
@ -1193,7 +1193,6 @@ footer p{
|
|||||||
@media (max-width: 860px) {
|
@media (max-width: 860px) {
|
||||||
.container{
|
.container{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
width: 774px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1030
package-lock.json
generated
Normal file
1030
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
18
package.json
Normal file
18
package.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "password-manager",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "A Password Manager",
|
||||||
|
"main": "frontend/main.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "electronmon .",
|
||||||
|
"start": "electron ."
|
||||||
|
},
|
||||||
|
"author": "",
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"electron": "^27.0.2"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"electronmon": "^2.0.2"
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user