Skip to content

Commit

Permalink
Merge pull request #9 from zonayedpca/v0.8.0-beta
Browse files Browse the repository at this point in the history
V0.8.0 beta
  • Loading branch information
zonayedpca authored Sep 20, 2019
2 parents 2701c07 + e9eda80 commit f349905
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 155 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ node_js:
cache:
directories:
- node_modules
env:
- ELECTRON_FORCE_WINDOW_MENU_BAR=true
after_success:
- if [ $TRAVIS_BRANCH == "master" ]; then npm run pack; fi
5 changes: 4 additions & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,16 @@ const WINDOW_URL = isDev()
: `file://${__dirname}/client/build/index.html`;
const iconName =
process.platform === 'darwin' ? 'iconTemplate.png' : 'windows-icon.png';
const iconPath = path.join(__dirname, `./src/assets/img/${iconName}`);
const iconPath = path.join(__dirname, `src/assets/img/${iconName}`);

let mainWindow;
// eslint-disable-next-line no-unused-vars
let tray;

app.on('ready', () => {
if (process.platform === 'darwin') {
app.dock.hide();
}
setScreenSize();
mainWindow = new MainWindow(
{
Expand Down
1 change: 0 additions & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ branches:

platform:
- x64
# - x86

cache:
- node_modules
Expand Down
208 changes: 106 additions & 102 deletions client/src/actions/optionAction.js
Original file line number Diff line number Diff line change
@@ -1,124 +1,128 @@
import axios from 'axios';

import {
TOKEN_RIGHT,
TOKEN_WRONG,
TOKEN_RESET,
TOKEN_LOADING
} from './type';
import { TOKEN_RIGHT, TOKEN_WRONG, TOKEN_RESET, TOKEN_LOADING } from './type';

import { getLocalStorageData, setLocalStorageData, unSetLocalStorageData } from '../utils';
import {
getLocalStorageData,
setLocalStorageData,
unSetLocalStorageData,
} from '../utils';

const GITHUB_LINK = `https://api.github.com`;
const BITLY_LINK = `https://api-ssl.bitly.com/v4`;

export const getLocalAuth = () => {
const [github_token, bitly_token] = getLocalStorageData(['github', 'bitly']);
return dispatch => {
if(github_token) {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'github',
token: github_token.token
const [github_token, bitly_token] = getLocalStorageData([
'github',
'bitly',
]);
return dispatch => {
if (github_token) {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'github',
token: github_token.token,
},
});
}
});
}
if(bitly_token) {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'bitly',
token: {
token: bitly_token.token.token,
id: bitly_token.token.id
}
if (bitly_token) {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'bitly',
token: {
token: bitly_token.token.token,
id: bitly_token.token.id,
},
},
});
}
});
}
}
}
};
};

export const verifyGithubToken = token => {
return async dispatch => {
dispatch({
type: TOKEN_LOADING,
payload: {
name: 'github'
}
});
try {
const { data } = await axios(`${GITHUB_LINK}/gists`, {
headers: {
Authorization: `Bearer ${token}`
}
});
if(data.length) {
return async dispatch => {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'github',
token
}
type: TOKEN_LOADING,
payload: {
name: 'github',
},
});
setLocalStorageData('github', { token });
}
} catch (e) {
dispatch({
type: TOKEN_WRONG,
payload: {
name: 'github',
error: true
try {
const { data } = await axios(`${GITHUB_LINK}/user`, {
headers: {
Authorization: `Bearer ${token}`,
},
});
if (data.login) {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'github',
token,
},
});
setLocalStorageData('github', { token });
}
} catch (e) {
dispatch({
type: TOKEN_WRONG,
payload: {
name: 'github',
error: true,
},
});
}
});
}
}
}
};
};

export const verifyBitlyToken = token => {
return async dispatch => {
dispatch({
type: TOKEN_LOADING,
payload: {
name: 'bitly'
}
});
try {
const { data } = await axios(`${BITLY_LINK}/user`, {
headers: {
Authorization: `Bearer ${token}`
}
});
if(data.login) {
return async dispatch => {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'bitly',
token: {
token,
id: data.default_group_guid
}
}
type: TOKEN_LOADING,
payload: {
name: 'bitly',
},
});
setLocalStorageData('bitly', { token: { token, id: data.default_group_guid } });
}
} catch (e) {
dispatch({
type: TOKEN_WRONG,
payload: {
name: 'bitly',
error: true
try {
const { data } = await axios(`${BITLY_LINK}/user`, {
headers: {
Authorization: `Bearer ${token}`,
},
});
if (data.login) {
dispatch({
type: TOKEN_RIGHT,
payload: {
name: 'bitly',
token: {
token,
id: data.default_group_guid,
},
},
});
setLocalStorageData('bitly', {
token: { token, id: data.default_group_guid },
});
}
} catch (e) {
dispatch({
type: TOKEN_WRONG,
payload: {
name: 'bitly',
error: true,
},
});
}
});
}
}
}
};
};

export const resetTokens = () => {
return dispatch => {
dispatch({
type: TOKEN_RESET
});
unSetLocalStorageData(['github', 'bitly']);
}
}
return dispatch => {
dispatch({
type: TOKEN_RESET,
});
unSetLocalStorageData(['github', 'bitly']);
};
};
14 changes: 11 additions & 3 deletions client/src/components/Tools/Code/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import { getCode } from '../../../actions';

import './index.css';

const MAX_GIST = 30;

class Code extends Component {
state = {
page: 1,
Expand Down Expand Up @@ -110,9 +112,15 @@ class Code extends Component {
<FiArrowLeftCircle />
</li>
)}
<li onClick={() => this.setState({ page: page + 1 })}>
<FiArrowRightCircle />
</li>
{codes.data.length === MAX_GIST && (
<li
onClick={() =>
this.setState({ page: page + 1 })
}
>
<FiArrowRightCircle />
</li>
)}
</ul>
</div>
);
Expand Down
5 changes: 4 additions & 1 deletion electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ linux:
arch:
- x64
- ia32
# - target: 'deb'
- target: 'deb'
arch:
- x64
- ia32
- target: 'rpm'
arch:
- x64
Expand Down
Loading

0 comments on commit f349905

Please sign in to comment.