Skip to content

Commit

Permalink
Merge branch 'v1.3.x' into login-issues
Browse files Browse the repository at this point in the history
  • Loading branch information
pixtron committed Feb 14, 2020
2 parents 48445af + 6faa295 commit d6df43b
Show file tree
Hide file tree
Showing 14 changed files with 348 additions and 221 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
**Maintainer**: balloon-team <[email protected]>\
**Date**:

### Bugfixes
* Logger should be able to serialize BigInt #229
* Do not use format.json() in logger #228
* Send feedback to new api endpoint #217
* Trailing slash in server url leads to error #235

### Changes
* Upgrade to electron v7 #132
* Use requestSingleInstanceLock instead of makeSingleInstance #141
Expand All @@ -16,6 +22,8 @@
* Do not unbind closed event before successful login #211
* Add hint when account has been unlinked by client #171
* Display a meaningful error message if login fails with EPERM #161
* New tray behaviour for linux #207
* Improve sync error messages displayed to users #216


## 1.2.1
Expand Down
16 changes: 11 additions & 5 deletions app/i18n/de-CH.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"startup.auth.mfaDescription": "Dieses Konto ist mit multi factor authentication geschützt. Bitte gib den Code vom google authenticator ein:",
"startup.auth.message": "Melde dich bei deinem balloon an:",
"startup.selective.edit": "Selektion anpassen",
"startup.selective.message": "Hinweis: Freigaben werden standardmässig nicht synchronisiert und müssen separat in der Selektiven Synchronisation aktiviert werden.",
"startup.selective.message": "Freigaben werden standardmässig nicht synchronisiert und müssen separat in der Selektiven Synchronisation aktiviert werden.",
"startup.clientInitiatedLogoutWarning.title": "Account getrennt",
"startup.clientInitiatedLogoutWarning.warning": "Dein Account wurde getrennt, Du musst Dich erneut anmelden. Es sind keine Daten verloren gegangen.",

Expand All @@ -98,13 +98,19 @@
"status.nav.quota": "Speicher",

"status.activities.waiting": "Ausstehend...",
"status.activities.upload": "%s (Upload)",
"status.activities.download": "%s (Download)",
"status.activities.upload_failed": "%s (Upload fehlgeschlagen)",
"status.activities.download_failed": "%s (Download fehlgeschagen)",
"status.activities.upload": "%s: Hochgeladen",
"status.activities.download": "%s: Heruntergeladen",
"status.activities.upload_failed": "%s: Upload fehlgeschlagen",
"status.activities.download_failed": "%s: Download fehlgeschagen",
"status.activities.empty": "Keine Aktivitäten vorhanden.",
"status.errors.empty": "Gute Arbeit, keine Fehler vorhanden.",

"status.activities.upload_failed.errors.code.E_BLN_API_REQUEST_QUOTA_FULL": "%s: Upload fehlgeschlagen, kein freier Speicherplatz",
"status.activities.upload_failed.errors.code.E_BLN_API_UPLOAD_SRC_NOTEXISTS": "%s: Upload fehlgeschlagen, die Datei existiert nicht mehr",
"status.activities.upload_failed.errors.code.E_BLN_API_OUT_OF_RANGE": "%s: Upload fehlgeschlagen, die Datei ist zu gross",
"status.activities.upload_failed.errors.code.E_BLN_API_REQUEST_NETWORK": "%s: Upload fehlgeschlagen, der Server ist nicht erreichbar",
"status.activities.download_failed.errors.code.E_BLN_API_REQUEST_NETWORK": "%s: Download fehlgeschlagen, der Server ist nicht erreichbar",

"status.quota.used": "Benutzt",
"status.quota.left": "Frei",
"status.quota.max": "Gesamt",
Expand Down
16 changes: 11 additions & 5 deletions app/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"startup.auth.mfaDescription": "Your account has been protected with multi factor authentication. Please enter the code from your google authenticator:",
"startup.auth.message": "Authenticate your account with balloon:",
"startup.selective.edit": "Change selection",
"startup.selective.message": "Note: shares are not synced by default and need to be activated in the selective synchronisation",
"startup.selective.message": "Shares are not synced by default and need to be activated separately in the selective synchronisation.",
"startup.clientInitiatedLogoutWarning.title": "Account unlinked",
"startup.clientInitiatedLogoutWarning.warning": "Your account has been unlinked, please log in again. No data has been lost.",

Expand All @@ -98,13 +98,19 @@
"status.nav.quota": "Storage",

"status.activities.waiting": "Waiting...",
"status.activities.upload": "%s (uploaded)",
"status.activities.download": "%s (downloaded)",
"status.activities.upload_failed": "%s (upload failed)",
"status.activities.download_failed": "%s (download failed)",
"status.activities.upload": "%s: uploaded",
"status.activities.download": "%s: downloaded",
"status.activities.upload_failed": "%s: upload failed",
"status.activities.download_failed": "%s: download failed",
"status.activities.empty": "There is no activity yet.",
"status.errors.empty": "Good job, there are no errors.",

"status.activities.upload_failed.errors.code.E_BLN_API_REQUEST_QUOTA_FULL": "%s: upload failed, no free space on the server",
"status.activities.upload_failed.errors.code.E_BLN_API_UPLOAD_SRC_NOTEXISTS": "%s: upload failed, the file does not exist anymore",
"status.activities.upload_failed.errors.code.E_BLN_API_OUT_OF_RANGE": "%s: upload failed, the file is too big",
"status.activities.upload_failed.errors.code.E_BLN_API_REQUEST_NETWORK": "%s: upload failed, the server is not reachable",
"status.activities.download_failed.errors.code.E_BLN_API_REQUEST_NETWORK": "%s: download failed, the server is not reachable",

"status.quota.used": "Used",
"status.quota.left": "Available",
"status.quota.max": "Total",
Expand Down
9 changes: 9 additions & 0 deletions app/lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,22 @@ module.exports = function() {
}
}

function has(key) {
if(activeInstance) {
return settings.has(key);
} else {
return !!memorySettings[key];
}
}

return {
isActiveInstance: function() {
return instance.getActiveInstance();
},
hadConfig: function() {
return configExists;
},
has,
getAll: function(include_secret) {
if(activeInstance) {
var conf = settings.getAll();
Expand Down
37 changes: 19 additions & 18 deletions app/lib/logger-factory.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,20 @@ const logLevels = {error: 3, err: 3, warning: 4, warn: 4, notice: 5, info: 6, de
let logger;

const enrichLogInfo = format(function(info, options) {
info.level = info.level.toUpperCase();
const metadata = {...info.metadata};

info.level = info.level.toUpperCase();
info.thread = electron.remote ? electron.remote.getCurrentWindow().id : 'main';
if(!info.category) info.category = 'category';
const metadata = info.metadata;
info.category = metadata.category || 'N/A';
delete metadata.category;

info.meta = metadata && Object.keys(metadata).length > 0 ? `(${JSON.stringify(metadata)})` : '';
info.meta = '';
if(metadata && Object.keys(metadata).length > 0) {
const str = JSON.stringify(metadata, (key, value) =>
typeof value === 'bigint' ? value.toString() : value
);
info.meta = `(${str})`;
}

return info;
});
Expand All @@ -33,9 +39,9 @@ const cloneErrors = format(function(info, options) {
var value = srcValue[prop];

clone[prop] = value && typeof value === 'object' ?
// Recurse for objects, to handle inner exceptions
mergeWith({}, value, errorCloner) :
value;
// Recurse for objects, to handle inner exceptions
mergeWith({}, value, errorCloner) :
value;
});

return clone;
Expand All @@ -55,6 +61,11 @@ module.exports = function(config, logfile) {
logger = createLogger({
levels: logLevels,
transports: [],
format: format.combine(
format.metadata(),
cloneErrors(),
enrichLogInfo()
)
});

if(env.context !== 'test') {
Expand All @@ -66,22 +77,15 @@ module.exports = function(config, logfile) {
tailable: true,
zippedArchive: false,
format: format.combine(
format.metadata(),
cloneErrors(),
format.timestamp({format: 'YYYY-MM-DD HH:mm:ss'}),
enrichLogInfo(),
format.printf(info => `${info.timestamp} ${info.level} <${info.thread}> [${info.category}]: ${info.message} ${info.meta}`)
),
}));

if(logfile === 'sync.log') {
logger.add(new TrayTransport({
level: 'error',
config,
format: format.combine(
format.metadata(),
cloneErrors(),
)
config
}));
}
}
Expand All @@ -90,9 +94,6 @@ module.exports = function(config, logfile) {
logger.add(new transports.Console({
level: 'debug',
format: format.combine(
format.metadata(),
cloneErrors(),
enrichLogInfo(),
format.colorize(),
format.printf(info => `${info.level} <${info.thread}> [${info.category}]: ${info.message} ${info.meta}`)
),
Expand Down
4 changes: 2 additions & 2 deletions app/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ ipcMain.on('link-account', (event, id) => {
tray.toggleState('loggedout', false);
setDisconnectedState(false);
initializeSync();
event.sender.send('link-account-result', true);
tray.emit('link-account-result', true);
}).catch((error) => {
switch(error.code) {
case 'E_BLN_OAUTH_WINDOW_OPEN':
Expand All @@ -487,7 +487,7 @@ ipcMain.on('link-account', (event, id) => {
default:
if(!handleAuthError('link-account-event', error)) {
logger.error('login not successfull', {category: 'main', error});
event.sender.send('link-account-result', false);
tray.emit('link-account-result', false);
} else {
dialog.showMessageBox(null, {
type: 'warning',
Expand Down
Loading

0 comments on commit d6df43b

Please sign in to comment.