Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit

Permalink
Update styles, fix buffer security bug #41 and other bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
HR committed Jun 29, 2019
1 parent 0618ddc commit 5fd05a8
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 11 deletions.
6 changes: 3 additions & 3 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ module.exports = {
DECRYPT: 'Not a Crypter file (can not get salt, iv and authTag)',
MS: {
INVALID_FILE: 'Invalid tar header. Maybe the tar is corrupted or it needs to be gunzipped?',
AUTH_FAIL: 'Unsupported state or unable to authenticate data'
AUTH_FAIL: 'Unsupported state or unable to authenticate data',
}
},
COLORS: {
bad: '#9F3A38',
good: '#2ECC71',
bad: '#dc3545',
good: '#28a745',
highlight: '#333333'
},
SETTINGS: {
Expand Down
4 changes: 3 additions & 1 deletion app/script/logger.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
* Custom logger for debugging
******************************/
const { createLogger, format, transports } = require('winston')
const { isRenderer } = require('./utils')

// const { app } = require('electron')
if (process.env.TEST_RUN) {
if (process.env.TEST_RUN || isRenderer()) {
module.exports = createLogger({
silent: true,
exitOnError: false
Expand Down
14 changes: 14 additions & 0 deletions app/script/utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module.exports = {
isRenderer: function () {
// running in a web browser
if (typeof process === 'undefined') return true

// node-integration is disabled
if (!process) return true

// We're in node.js somehow
if (!process.type) return false

return process.type === 'renderer'
}
}
15 changes: 9 additions & 6 deletions app/src/crypter.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,15 @@ exports.window = function (global, callback) {
.catch((err) => {
logger.info(`decryptFile error`)
logger.error(err)
if (err.message == ERRORS.MS.INVALID_FILE) {
webContents.send('cryptErr', ERRORS.INVALID_FILE)
} else if (err.message == ERRORS.MS.AUTH_FAIL) {
webContents.send('cryptErr', ERRORS.AUTH_FAIL)
} else {
webContents.send('cryptErr', err.message)
switch (err.message.trim()) {
case ERRORS.MS.INVALID_FILE:
webContents.send('cryptErr', ERRORS.INVALID_FILE)
break;
case ERRORS.MS.AUTH_FAIL:
webContents.send('cryptErr', ERRORS.AUTH_FAIL)
break;
default:
webContents.send('cryptErr', err.message)
}
})
})
Expand Down
2 changes: 1 addition & 1 deletion app/static/styles/settings.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions app/static/styles/settings.less
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ section#settings {
background-color: @white;
}

p#errLabel {
text-align: center;
}

a:not(.navigationLink) {
font-size: 0.8rem;
color: @blacker;
Expand Down

0 comments on commit 5fd05a8

Please sign in to comment.