Skip to content

Commit

Permalink
Merge branch 'release/2.4.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirPal committed Jan 18, 2018
2 parents 35657fa + aa37de8 commit 216d62f
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 27 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
<a name="2.4.6"></a>
## [2.4.6](https://github.com/web-pal/chronos-timetracker/compare/v2.4.4...v2.4.6) (2018-01-18)


### Bug Fixes

* dev initMixpanel ([a0f58cb](https://github.com/web-pal/chronos-timetracker/commit/a0f58cb))
* mixpanel init ([9713921](https://github.com/web-pal/chronos-timetracker/commit/9713921))
* store-credentials ([b1735c7](https://github.com/web-pal/chronos-timetracker/commit/b1735c7))
* **Authorization:** media for renderedFields ([3fae957](https://github.com/web-pal/chronos-timetracker/commit/3fae957)), closes [#21](https://github.com/web-pal/chronos-timetracker/issues/21)



<a name="2.4.4"></a>
## [2.4.4](https://github.com/web-pal/chronos-timetracker/compare/v2.4.3...v2.4.4) (2018-01-16)

Expand Down
8 changes: 6 additions & 2 deletions app/containers/Main/Main.jsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
// @flow
import React from 'react';
import { ThemeProvider } from 'styled-components2';
import {
ThemeProvider,
} from 'styled-components2';
import type {
StatelessFunctionalComponent,
Node,
} from 'react';
import { Flex } from 'components';
import {
Flex,
} from 'components';

import {
AlertModal,
Expand Down
1 change: 1 addition & 0 deletions app/containers/Main/index.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
import Main from './Main';

export default Main;
28 changes: 26 additions & 2 deletions app/main.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
import path from 'path';
import keytar from 'keytar';
import storage from 'electron-json-storage';
import { app, Tray, Menu, MenuItem, ipcMain, BrowserWindow, screen } from 'electron';
import {
app,
Tray,
Menu,
MenuItem,
ipcMain,
BrowserWindow,
screen,
session,
} from 'electron';
import notifier from 'node-notifier';
import fs from 'fs';
import MenuBuilder from './menu';
Expand Down Expand Up @@ -244,7 +253,7 @@ ipcMain.on('store-credentials', (event, credentials) => {
event.returnValue = true; // eslint-disable-line no-param-reassign
});

ipcMain.on('get-credentials', (event, username) => {
ipcMain.on('get-credentials', (event, { username, host }) => {
keytar.getPassword('Chronos', username)
.then(
(password) => {
Expand All @@ -253,6 +262,21 @@ ipcMain.on('get-credentials', (event, username) => {
password,
};
event.returnValue = credentials; // eslint-disable-line no-param-reassign
const filter = {
urls: [
'*://atlassian.net',
`*//${host}`,
],
};
// Basic auth for jira links(media in renderedFields)
session.defaultSession.webRequest.onBeforeSendHeaders(filter, (details, callback) => {
details.requestHeaders['Authorization'] = // eslint-disable-line
`Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`;
callback({
cancel: false,
requestHeaders: details.requestHeaders,
});
});
},
);
});
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Chronos",
"productName": "Chronos",
"version": "2.4.5",
"version": "2.4.6",
"description": "Native app for time-tracking fully integrated with JIRA",
"main": "./main.prod.js",
"scripts": {
Expand Down
33 changes: 19 additions & 14 deletions app/sagas/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,21 +178,26 @@ export function* oAuthLoginForm(): Generator<*, void, *> {
export function* logoutFlow(): Generator<*, *, *> {
while (true) {
yield take(types.LOGOUT_REQUEST);
const { getGlobal } = remote;
const { running, uploading } = getGlobal('sharedObj');
try {
const { getGlobal } = remote;
const { running, uploading } = getGlobal('sharedObj');

if (running) {
// eslint-disable-next-line no-alert
window.alert('Tracking in progress, save worklog before logout!');
}
if (uploading) {
// eslint-disable-next-line no-alert
window.alert('Currently app in process of saving worklog, wait few seconds please');
}
if (!running && !uploading) {
yield call(removeFromStorage, 'desktop_tracker_jwt');
yield call(removeFromStorage, 'jira_credentials');
yield put(clearAllReducers());
if (running) {
// eslint-disable-next-line no-alert
window.alert('Tracking in progress, save worklog before logout!');
}
if (uploading) {
// eslint-disable-next-line no-alert
window.alert('Currently app in process of saving worklog, wait few seconds please');
}
if (!running && !uploading) {
yield call(removeFromStorage, 'desktop_tracker_jwt');
yield call(removeFromStorage, 'jira_credentials');
yield put(clearAllReducers());
}
} catch (err) {
Raven.captureException(err);
console.log(err);
}
}
}
Expand Down
17 changes: 10 additions & 7 deletions app/sagas/initializeApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
call,
put,
fork,
cancel,
} from 'redux-saga/effects';
import {
ipcRenderer,
Expand Down Expand Up @@ -65,13 +64,13 @@ function identifyInSentryAndMixpanel(host: URL, userData: User): void {
function* initializeMixpanel(): Generator<*, void, *> {
if (process.env.DISABLE_MIXPANEL === '1') {
yield call(infoLog, 'mixpanel disabled with ENV var');
yield cancel();
}
if (!process.env.MIXPANEL_API_TOKEN) {
yield call(throwError, 'MIXPANEL_API_TOKEN not set!');
yield cancel();
}
yield call(mixpanel.init, process.env.MIXPANEL_API_TOKEN);
if (process.env.DISABLE_MIXPANEL !== '1' && process.env.MIXPANEL_API_TOKEN) {
yield call(mixpanel.init, process.env.MIXPANEL_API_TOKEN);
}
}

export function* initialConfigureApp({
Expand Down Expand Up @@ -137,7 +136,10 @@ function* getInitializeAppData(): Generator<*, void, *> {
basicAuthCredentials.path_prefix = host.pathname;
const passwordManagerCredentials = ipcRenderer.sendSync(
'get-credentials',
basicAuthCredentials.username,
{
username: basicAuthCredentials.username,
host: host.hostname,
},
);
basicAuthCredentials.password = passwordManagerCredentials.password;
}
Expand Down Expand Up @@ -191,8 +193,9 @@ export function* initializeApp(): Generator<*, void, *> {
yield call(loginFunc, authData);
yield call(initialConfigureApp, { host: authData.host });
}
} catch (e) {
console.log(e);
} catch (err) {
Raven.captureException(err);
console.log(err);
}
yield put(uiActions.setInitializeState(false));
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Chronos",
"version": "2.4.5",
"version": "2.4.6",
"description": "Full functionality time tracking software with direct JIRA integration",
"scripts": {
"build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",
Expand Down

0 comments on commit 216d62f

Please sign in to comment.