Skip to content

Commit

Permalink
ready for packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
cmexdev committed May 19, 2021
1 parent be2e7f1 commit e47a1de
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 11 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@

Small password generator "utility" for Windows, Mac, & *possibly* Linux.

## Install
# Usage

No installer yet.
Simply start the app. It automatically generates a password on startup. However, it does not copy to clipboard.

## Reference
**To copy to clipboard**, simply click `Copy`. You should get a notification saying that it was copied.

## "tray mode"

Right-click the tray icon, then hover over `Password` a click `Generate new and copy`. That will generate a new password (cannot be seen until pasted) and copy it to clipboard. It will also send a notification.

# Reference

https://github.com/dwyl/english-words

Expand All @@ -16,7 +22,7 @@ https://www.npmjs.com/package/hsimp

https://www.tekuris.com/products/arcana/

## Building from source
# Building from source

```sh
npm install
Expand Down
4 changes: 3 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
<input type="text" id="gen" placeholder="Generated password will go here..." readonly class="w-full m-1">
<p class="font-bold m-1" id="time">Nothing to see here.</p>
<button class="bg-blue-700 text-white py-2 px-4 m-1 font-semibold rounded hover:bg-blue-800" id="gennew">Generate</button>
<p class="text-gray-400 text-sm">Automatically copies to clipboard.</p>
<button class="bg-blue-700 text-white py-2 px-4 m-1 font-semibold rounded hover:bg-blue-800" id="gencopy">Copy</button>

<p class="mt-5 text-sm text-gray-400 font-semibold">&copy; Owen Magill 2021</p>
</div>
</body>
</html>
21 changes: 16 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { app, BrowserWindow, Tray, Menu, clipboard } = require('electron')
const { app, BrowserWindow, Tray, Menu, clipboard, shell, Notification } = require('electron')
const fs = require('fs')
const path = require('path')

Expand Down Expand Up @@ -35,12 +35,14 @@ function createWindow() {
win.hide()
}
},
{
type: 'separator'
},
{
label: 'Quit PPG',
type: 'normal',
role: 'quit',
click() {
app.quit()
app.exit()
}
}
]
Expand All @@ -66,6 +68,9 @@ function createWindow() {
win.webContents.openDevTools()
}
},
{
type: 'separator'
},
{
label: 'New window',
type: 'normal',
Expand All @@ -81,7 +86,9 @@ function createWindow() {
type: 'submenu',
submenu: [
{
label: 'GitHub'
label: 'GitHub', click() {
shell.openExternal('https://github.com/cmexdev/ppg')
}
}
]
}
Expand Down Expand Up @@ -131,8 +138,12 @@ app.on('ready', () => {
{
label: 'Password', type: 'submenu', submenu: [
{
label: 'New', type: 'normal', click() {
label: 'Generate new and copy', type: 'normal', click() {
clipboard.writeText(genPassword())
new Notification({
title: 'PPG copied to clipboard!',
body: 'Your new password was copied to your clipboard.',
}).show()
}
}
]
Expand Down
9 changes: 8 additions & 1 deletion split.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ window.addEventListener('DOMContentLoaded', () => {
document.getElementById('gennew').addEventListener('click', () => {
var val = gen()
document.getElementById('gen').value = val[0]
clipboard.writeText(val[0])
document.getElementById('time').textContent = 'It\'d take a computer around ' + val[1].time + ' to crack this password. You\'re all set.'
})

document.getElementById('gencopy').addEventListener('click', () => {
clipboard.writeText(document.getElementById('gen').value)

new window.Notification('PPG copied to clipboard!', {
body: 'Your new password was copied to your clipboard.'
})
})
})

function gen() {
Expand Down

0 comments on commit e47a1de

Please sign in to comment.