Skip to content

Commit 17bef42

Browse files
authored
Merge pull request #22 from CodeDead/release/2.0.3
Release/2.0.3
2 parents 7da30b5 + c429655 commit 17bef42

File tree

33 files changed

+1915
-1580
lines changed

33 files changed

+1915
-1580
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,4 @@ yarn-error.log*
2424

2525
.idea
2626
.idea/*
27+
dist/*

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
![DeadHash](https://codedead.com/wp-content/uploads/2020/01/deadhash-dark.png)
1+
![DeadHash](https://codedead.com/wp-content/uploads/2020/06/DeadHash.png)
22

33
# DeadHash
4+
45
DeadHash is a free and open-source utility to calculate file and text hashes. The following hash calculations are supported:
56
* MD5
67
* SHA1
@@ -14,13 +15,15 @@ DeadHash is a free and open-source utility to calculate file and text hashes. Th
1415
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app) and built using [Electron](https://electronjs.org/).
1516

1617
## Learn More
18+
1719
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
1820

1921
To learn React, check out the [React documentation](https://reactjs.org/).
2022

2123
To learn Electron, check out the [Electron documentation](https://electronjs.org/).
2224

2325
## About
26+
2427
This library is maintained by CodeDead. You can find more about us using the following links:
2528
* [Website](https://codedead.com)
2629
* [Twitter](https://twitter.com/C0DEDEAD)

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "deadhash",
3-
"version": "2.0.2",
3+
"version": "2.0.3",
44
"description": "File and text hash calculator",
55
"homepage": "./",
66
"private": true,
@@ -35,7 +35,7 @@
3535
},
3636
"main": "public/electron.js",
3737
"dependencies": {
38-
"@material-ui/core": "^4.9.9",
38+
"@material-ui/core": "^4.10.1",
3939
"@material-ui/icons": "^4.9.1",
4040
"axios": "^0.19.2",
4141
"cross-env": "^7.0.2",
@@ -45,8 +45,8 @@
4545
"react-contexify": "^4.1.1",
4646
"react-dom": "^16.13.1",
4747
"react-redux": "^7.2.0",
48-
"react-router": "^5.1.2",
49-
"react-router-dom": "^5.1.2",
48+
"react-router": "^5.2.0",
49+
"react-router-dom": "^5.2.0",
5050
"react-scripts": "3.4.1",
5151
"redux": "^4.0.5",
5252
"redux-actions": "^2.6.5"
@@ -77,9 +77,9 @@
7777
]
7878
},
7979
"devDependencies": {
80-
"concurrently": "^5.1.0",
81-
"electron": "^8.2.0",
82-
"electron-builder": "^22.4.1",
83-
"wait-on": "^4.0.1"
80+
"concurrently": "^5.2.0",
81+
"electron": "^9.0.2",
82+
"electron-builder": "^22.7.0",
83+
"wait-on": "^5.0.1"
8484
}
8585
}

public/electron.js

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const electron = require("electron");
22
const app = electron.app;
3+
const ipcMain = electron.ipcMain;
34
const BrowserWindow = electron.BrowserWindow;
45
const path = require("path");
56
const isDev = require("electron-is-dev");
@@ -12,8 +13,8 @@ const createWindow = () => {
1213
},
1314
frame: false,
1415
title: "DeadHash",
15-
width: 980,
16-
height: 550,
16+
width: 960,
17+
height: 520,
1718
icon: path.join(__dirname, '../build/Icon-512x512.png')
1819
});
1920

@@ -23,9 +24,6 @@ const createWindow = () => {
2324
electron.Menu.setApplicationMenu(null);
2425
}
2526

26-
// noinspection JSUndefinedPropertyAssignment
27-
global.mainWindow = mainWindow;
28-
2927
mainWindow.removeMenu();
3028
mainWindow.loadURL(isDev ? "http://localhost:3000" : `file://${path.join(__dirname, "../build/index.html")}`);
3129
mainWindow.on("closed", () => (mainWindow = null));
@@ -34,9 +32,17 @@ const createWindow = () => {
3432
event.preventDefault();
3533
electron.shell.openExternal(arg);
3634
});
35+
36+
mainWindow.on("maximize", () => {
37+
mainWindow.webContents.send("window-maximized");
38+
});
39+
40+
mainWindow.on("unmaximize", () => {
41+
mainWindow.webContents.send("window-unmaximized");
42+
})
3743
};
3844

39-
app.on("ready", createWindow);
45+
app.whenReady().then(createWindow);
4046

4147
app.on("window-all-closed", () => {
4248
if (process.platform !== "darwin") {
@@ -45,7 +51,27 @@ app.on("window-all-closed", () => {
4551
});
4652

4753
app.on("activate", () => {
48-
if (mainWindow === null) {
54+
if (BrowserWindow.getAllWindows().length === 0) {
4955
createWindow();
5056
}
5157
});
58+
59+
ipcMain.on("handle-close", () => {
60+
mainWindow.close();
61+
});
62+
63+
ipcMain.on("handle-maximize", () => {
64+
if (!mainWindow.isMaximized()) {
65+
mainWindow.maximize();
66+
} else {
67+
mainWindow.unmaximize();
68+
}
69+
});
70+
71+
ipcMain.on("handle-minimize", () => {
72+
mainWindow.minimize();
73+
});
74+
75+
ipcMain.on("get-version", (e) => {
76+
e.reply('get-version-reply', app.getVersion());
77+
});

src/components/App/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import Topbar from "../Topbar";
99
import About from "../../routes/About";
1010
import File from "../../routes/File";
1111
import Text from "../../routes/Text";
12-
import Drawerbar from "../Drawerbar";
1312
import {CssBaseline} from "@material-ui/core";
1413
import DropZone from "../DropZone";
1514

16-
function App() {
15+
const App = () => {
1716

1817
let themeIndex = useSelector(state => state.MainReducer.themeIndex);
1918

@@ -36,7 +35,6 @@ function App() {
3635
<BrowserRouter>
3736
<DropZone>
3837
<Topbar/>
39-
<Drawerbar/>
4038
<CssBaseline/>
4139
<Switch>
4240
<Route path={"/settings"}>
@@ -59,6 +57,6 @@ function App() {
5957
</BrowserRouter>
6058
</ThemeProvider>
6159
);
62-
}
60+
};
6361

6462
export default App;

src/components/BackButton/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const BackButton = () => {
99

1010
return (
1111
<Button color={"primary"} onClick={() => history.goBack()}>
12-
<ArrowLeftIcon />
12+
<ArrowLeftIcon/>
1313
</Button>
1414
);
1515
};
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
import React from "react";
2+
import {useSelector} from "react-redux";
3+
import Dialog from "@material-ui/core/Dialog";
4+
import DialogTitle from "@material-ui/core/DialogTitle";
5+
import DialogContent from "@material-ui/core/DialogContent";
6+
import DialogContentText from "@material-ui/core/DialogContentText";
7+
import DialogActions from "@material-ui/core/DialogActions";
8+
import Button from "@material-ui/core/Button";
9+
10+
const ConfirmationDialog = ({open, title, content, onAccept, onCancel, onClose}) => {
11+
12+
const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);
13+
14+
/**
15+
* Close the AlertDialog instance
16+
*/
17+
const handleClose = () => {
18+
if (onClose) onClose();
19+
};
20+
21+
/**
22+
* Accept the confirmation
23+
*/
24+
const accept = () => {
25+
if (onAccept) onAccept();
26+
handleClose();
27+
}
28+
29+
/**
30+
* Cancel the confirmation
31+
*/
32+
const cancel = () => {
33+
if (onCancel) onCancel();
34+
handleClose();
35+
}
36+
37+
return (
38+
<Dialog
39+
open={open}
40+
onClose={handleClose}
41+
aria-labelledby="alert-dialog-title"
42+
aria-describedby="alert-dialog-description"
43+
>
44+
<DialogTitle id="alert-dialog-title">{title}</DialogTitle>
45+
<DialogContent>
46+
<DialogContentText id="alert-dialog-description">
47+
{content}
48+
</DialogContentText>
49+
</DialogContent>
50+
<DialogActions>
51+
<Button onClick={cancel} color="primary">
52+
{language.no}
53+
</Button>
54+
<Button onClick={accept} color="primary" autoFocus>
55+
{language.yes}
56+
</Button>
57+
</DialogActions>
58+
</Dialog>
59+
);
60+
}
61+
62+
export default ConfirmationDialog;

src/components/CryptographyMenu/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import KeyIcon from "@material-ui/icons/VpnKey";
1313
const useStyles = makeStyles(theme => ({
1414
nested: {
1515
paddingLeft: theme.spacing(4),
16-
},
16+
}
1717
}));
1818

1919
const CryptographyMenu = ({handleIndexChange, selectedIndex}) => {

src/components/CsvExport/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ const CsvExport = ({children, data, fileName}) => {
1515

1616
return (
1717
data ? (
18-
<a href={href} download={fileName} target={"_self"}
19-
style={{textDecoration: "none"}}>
20-
{children}
21-
</a>
22-
) : {children}
18+
<a href={href} download={fileName} target={"_self"}
19+
style={{textDecoration: "none"}}>
20+
{children}
21+
</a>
22+
) : {children}
2323
);
2424
};
2525

src/components/Drawerbar/index.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import ChevronRightIcon from '@material-ui/icons/ChevronRight';
99
import ListItem from '@material-ui/core/ListItem';
1010
import ListItemIcon from '@material-ui/core/ListItemIcon';
1111
import ListItemText from '@material-ui/core/ListItemText';
12-
import {useSelector, useDispatch} from "react-redux";
12+
import {useSelector} from "react-redux";
1313
import InfoIcon from '@material-ui/icons/Info';
1414
import BuildIcon from "@material-ui/icons/Build";
1515
import HelpIcon from "@material-ui/icons/Help";
@@ -35,33 +35,31 @@ const useStyles = makeStyles(theme => ({
3535
}
3636
}));
3737

38-
const remote = window.require('electron').remote;
38+
const ipcRenderer = window.require('electron').ipcRenderer;
3939

40-
const Drawerbar = () => {
40+
const Drawerbar = ({open, onClose}) => {
4141

4242
const language = useSelector(state => state.MainReducer.languages[state.MainReducer.languageIndex]);
43-
const open = useSelector(state => state.MainReducer.drawerOpen);
4443
const selectedItem = useSelector(state => state.MainReducer.selectedListItem);
4544

4645
const history = useHistory();
4746

4847
const classes = useStyles();
4948
const theme = useTheme();
50-
const dispatch = useDispatch();
5149

5250
/**
5351
* Function that is called when the drawer should close
5452
*/
5553
const handleDrawerClose = () => {
56-
dispatch({type: "SET_DRAWEROPEN", drawerOpen: false});
54+
onClose();
5755
};
5856

5957
/**
6058
* Handle a page change
6159
* @param index The index of the page
6260
*/
6361
const handleIndexChange = (index) => {
64-
dispatch({type: "SET_DRAWEROPEN", drawerOpen: false});
62+
onClose();
6563
if (selectedItem === index) return;
6664

6765
switch (index) {
@@ -133,12 +131,11 @@ const Drawerbar = () => {
133131
<Divider/>
134132

135133
<List>
136-
<ListItem onClick={() => remote.getGlobal("mainWindow").close()} button>
134+
<ListItem onClick={() => ipcRenderer.send('handle-close')} button>
137135
<ListItemIcon><CloseIcon color="inherit"/></ListItemIcon>
138136
<ListItemText primary={language.exit}/>
139137
</ListItem>
140138
</List>
141-
142139
</Drawer>
143140
);
144141
};

src/components/DropZone/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ const DropZone = ({children}) => {
3535
{children}
3636
</div>
3737
);
38-
3938
};
4039

4140
export default DropZone;

src/components/Loadingbar/index.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import CircularProgress from "@material-ui/core/CircularProgress";
33

44
const Loadingbar = () => {
5+
56
return (
67
<div style={{display: 'flex', justifyContent: 'center'}}>
78
<CircularProgress/>

src/components/Theme/index.js

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,24 @@ import React from "react";
22
import {makeStyles} from '@material-ui/core/styles';
33
import Card from '@material-ui/core/Card';
44
import CardActionArea from '@material-ui/core/CardActionArea';
5-
import CardActions from '@material-ui/core/CardActions';
65
import CardContent from '@material-ui/core/CardContent';
76
import CardMedia from '@material-ui/core/CardMedia';
8-
import Button from '@material-ui/core/Button';
97
import Typography from '@material-ui/core/Typography';
108
import blank from "./blank.png";
119

1210
const useStyles = makeStyles({
1311
media: {
14-
height: 80,
12+
height: 60,
1513
},
1614
});
1715

18-
const Theme = ({title, description, color, selected, actionText, onAction}) => {
16+
const Theme = ({title, description, color, selected, onAction}) => {
1917

2018
const classes = useStyles();
21-
const variant = selected ? "contained" : "text";
2219
const action = onAction ? onAction : null;
2320

2421
return (
25-
<Card>
22+
<Card raised={!selected}>
2623
<CardActionArea onClick={action}>
2724
<CardMedia
2825
className={classes.media}
@@ -39,11 +36,6 @@ const Theme = ({title, description, color, selected, actionText, onAction}) => {
3936
</Typography>
4037
</CardContent>
4138
</CardActionArea>
42-
<CardActions>
43-
<Button size="small" color="primary" variant={variant} disabled={selected} onClick={action}>
44-
{actionText}
45-
</Button>
46-
</CardActions>
4739
</Card>
4840
)
4941
};

0 commit comments

Comments
 (0)