Skip to content

Commit

Permalink
Merge pull request #9 from tasnimzotder/dev
Browse files Browse the repository at this point in the history
add word list & fix errors v1.1.0
  • Loading branch information
tasnimzotder authored Feb 20, 2021
2 parents 55cf86c + dbcb70c commit 1fd9a4d
Show file tree
Hide file tree
Showing 12 changed files with 154 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- main

jobs:
check-build:
check-build-win:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,5 @@ typings/

# Electron-Forge
out/

testDir/
35 changes: 32 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,46 @@
</p>

<p align="center">
<img width="256px" src="src/assets/app_screenshot.png" alt="App Screenshot"/>
<img src="src/assets/app_screenshot_new.png" alt="App Screenshot"/>
</p>

# password-generator

Password Generator
Password Generator 🔑

## Framework

- Electron.js

## Wanna Develop ?

### Requirements

- `Node.js` - Download from [https://nodejs.org/](https://nodejs.org/).
- `Electron.js` - Docs on [https://www.electronjs.org/](https://www.electronjs.org/).

### All Clear. Let's Start

1. Clone the repository
```bash
git clone https://github.com/tasnimzotder/password-generator.git
```

2. Go to the project directory
```bash
cd password-generator
```

3. Install the dependencies
```bash
npm install
```

4. Run the app
```bash
npm run start
```

## License

This app is licensed upder [MIT License](LICENSE)
This app is licensed upder the [MIT License](LICENSE)
Binary file added src/assets/app_screenshot_new.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 0 additions & 10 deletions src/close_win.js

This file was deleted.

28 changes: 28 additions & 0 deletions src/components/frame-ctrl.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.frame-ctrl {
background-color: rgba(255, 0, 0, 0.666);
color: white;
position: absolute;
top: 0;
right: 0;
display: flex;
flex-direction: row;
width: 70px;
height: 30px;
justify-content: center;
align-items: stretch;
font-size: 120%;
}

.frame-ctrl > div {
display: flex;
/* background-color: rgb(70, 70, 18); */
width: 100%;
justify-content: center;
align-items: center;
}

.frame-ctrl > div:hover {
font-size: 110%;
cursor: pointer;
background-color: rgba(97, 0, 0, 0.747);
}
13 changes: 13 additions & 0 deletions src/components/frame-ctrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const remote = require('electron').remote;

const close_ctrl = document.querySelector(".close-ctrl");
const minimize_ctrl = document.querySelector(".minimize-ctrl");


close_ctrl.addEventListener('click', function (e) {
remote.getCurrentWindow().close();
});

minimize_ctrl.addEventListener('click', function (e) {
remote.getCurrentWindow().minimize();
});
24 changes: 19 additions & 5 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,22 @@

<link rel="stylesheet" href="style.css" />
<script defer src="script.js"></script>
<script defer src="close_win.js"></script>

<!-- Components - frame-ctrl -->
<link rel="stylesheet" href="components/frame-ctrl.css" />
<script defer src="components/frame-ctrl.js"></script>
</head>
<body onload="generatePassword()">
<!-- Frame Controller -->
<div class="frame-ctrl">
<div class="minimize-ctrl"></div>
<div class="close-ctrl"></div>
</div>

<!-- Main App -->
<div class="div-1">
<div class="div-hdr">
<span>Password Generator</span>
<div>Password Generator</div>
</div>

<div class="div-bdy">
Expand Down Expand Up @@ -145,12 +155,16 @@
<span>2021</span>
</div>
<div class="ghub_logo">
<a href="https://github.com/tasnimzotder/password-generator">
<img src="assets/github.png" alt="github" />
<a href="#">
<img
src="assets/github.png"
alt="github"
onclick="openLinkInBrowser('https://github.com/tasnimzotder/password-generator')"
/>
</a>
</div>
<div class="version">
<span>v1.0.1</span>
<span>v1.1.0</span>
</div>
</div>
</div>
Expand Down
5 changes: 3 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ const createWindow = () => {
width: 350,
height: 540,
webPreferences: {
nodeIntegration: true
nodeIntegration: true,
enableRemoteModule: true
},
maximizable: false,
// frame: false,
frame: false,
resizable: false
});

Expand Down
27 changes: 10 additions & 17 deletions src/script.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// const remote = require('electron').remote;
const shell = require('electron').shell;
const words = require("./words");

const op_bar = document.querySelector("#op_bar");
const refresh_btn = document.querySelector("#refresh_btn");
Expand Down Expand Up @@ -38,16 +39,7 @@ const passKeys = {
symbol: '~`!@#$%^&*()_-+={[}]|\:;\"\'<,>.?/'
};

// ToDo: Make a complete wordlist
const wordList = {
1: ['a', 'b'],
2: ['an', 'is', 'on', 'it', 'me', 'he'],
3: ['one', 'two', 'six', 'ten', 'she', 'fix'],
4: ['zero', 'four', 'five', 'nine'],
5: ['three', 'seven', 'eight'],
99: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
999: ['$', '%', '*', '@']
}
const wordList = words;

function generatePassword() {
if (mode_select.checked == true) {
Expand Down Expand Up @@ -80,7 +72,7 @@ function toggleSwitches(state) {
switch_label[i].style.opacity = 1;
}

currSelectedOne.disabled = true;
// currSelectedOne.disabled = true;
switch_label[currSelectedOneNum].style.opacity = 0.3;
}
}
Expand Down Expand Up @@ -173,7 +165,6 @@ function copyToClipboard() {
el.select();
document.execCommand('copy');
document.body.removeChild(el);
// alert("Copied: " + el.value);
} catch (error) {
console.log(error);
}
Expand Down Expand Up @@ -274,8 +265,8 @@ function generatePassComplex() {
break;
}

var _keyToPassIdx = getPassKeysInt(incl_upper.checked,
incl_lower.checked, incl_num.checked, incl_symbol.checked);
var _keyToPassIdx = getPassKeysInt(incl_lower.checked,
incl_upper.checked, incl_num.checked, incl_symbol.checked);
// console.log(_keyToPassIdx);
var _keyToPass = keyToPass[_keyToPassIdx];
var _passKeys = passKeys[_keyToPass];
Expand All @@ -288,7 +279,9 @@ function generatePassComplex() {
_count--;
}

// console.log(password);
op_bar.value = password;
// console.log(incl_upper.checked);
}

const openLinkInBrowser = (link) => {
shell.openExternal(link);
}
2 changes: 2 additions & 0 deletions src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ body {
padding-left: 20px;
font-family: 'Gruppo';
text-align: left;
-webkit-app-region: drag;
user-select: auto;
}

.div-bdy {
Expand Down
44 changes: 44 additions & 0 deletions src/words.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const words = {
1: ['a'],
2: [
'at', 'my', 'of', 'be',
'an', 'to', 'in', 'or',
'is', 'do', 'by', 'it',
'if', 'he', 'up', 'on',
'go', 'as', 'we', 'no',
'so'
],
3: [
'the', 'use', 'her', 'and',
'she', 'him', 'one', 'who',
'you', 'had', 'how', 'oil',
'has', 'its', 'now', 'but',
'two', 'was', 'not', 'for',
'all', 'day', 'are', 'out',
'see', 'did', 'get', 'his',
'way', 'can', 'may', 'god'
],
4: [
'some', 'than', 'this', 'have',
'from', 'like', 'been', 'call',
'into', 'time', 'that', 'word',
'look', 'will', 'find', 'more',
'long', 'what', 'down', 'were',
'many', 'with', 'when', 'then',
'come', 'your', 'them', 'made',
'they', 'said', 'part'
],
5: [
'there', 'would',
'first', 'water',
'which', 'their',
'other', 'write',
'about', 'these',
'could', 'earth'
],
6: ['number', 'people'],
99: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
999: ['$', '%', '*', '@']
}

module.exports = words;

0 comments on commit 1fd9a4d

Please sign in to comment.