Skip to content

Commit f349905

Browse files
authored
Merge pull request #9 from zonayedpca/v0.8.0-beta
V0.8.0 beta
2 parents 2701c07 + e9eda80 commit f349905

File tree

7 files changed

+177
-155
lines changed

7 files changed

+177
-155
lines changed

.travis.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@ node_js:
88
cache:
99
directories:
1010
- node_modules
11+
env:
12+
- ELECTRON_FORCE_WINDOW_MENU_BAR=true
1113
after_success:
1214
- if [ $TRAVIS_BRANCH == "master" ]; then npm run pack; fi

app.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,16 @@ const WINDOW_URL = isDev()
1515
: `file://${__dirname}/client/build/index.html`;
1616
const iconName =
1717
process.platform === 'darwin' ? 'iconTemplate.png' : 'windows-icon.png';
18-
const iconPath = path.join(__dirname, `./src/assets/img/${iconName}`);
18+
const iconPath = path.join(__dirname, `src/assets/img/${iconName}`);
1919

2020
let mainWindow;
2121
// eslint-disable-next-line no-unused-vars
2222
let tray;
2323

2424
app.on('ready', () => {
25+
if (process.platform === 'darwin') {
26+
app.dock.hide();
27+
}
2528
setScreenSize();
2629
mainWindow = new MainWindow(
2730
{

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ branches:
66

77
platform:
88
- x64
9-
# - x86
109

1110
cache:
1211
- node_modules

client/src/actions/optionAction.js

Lines changed: 106 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,124 +1,128 @@
11
import axios from 'axios';
22

3-
import {
4-
TOKEN_RIGHT,
5-
TOKEN_WRONG,
6-
TOKEN_RESET,
7-
TOKEN_LOADING
8-
} from './type';
3+
import { TOKEN_RIGHT, TOKEN_WRONG, TOKEN_RESET, TOKEN_LOADING } from './type';
94

10-
import { getLocalStorageData, setLocalStorageData, unSetLocalStorageData } from '../utils';
5+
import {
6+
getLocalStorageData,
7+
setLocalStorageData,
8+
unSetLocalStorageData,
9+
} from '../utils';
1110

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

1514
export const getLocalAuth = () => {
16-
const [github_token, bitly_token] = getLocalStorageData(['github', 'bitly']);
17-
return dispatch => {
18-
if(github_token) {
19-
dispatch({
20-
type: TOKEN_RIGHT,
21-
payload: {
22-
name: 'github',
23-
token: github_token.token
15+
const [github_token, bitly_token] = getLocalStorageData([
16+
'github',
17+
'bitly',
18+
]);
19+
return dispatch => {
20+
if (github_token) {
21+
dispatch({
22+
type: TOKEN_RIGHT,
23+
payload: {
24+
name: 'github',
25+
token: github_token.token,
26+
},
27+
});
2428
}
25-
});
26-
}
27-
if(bitly_token) {
28-
dispatch({
29-
type: TOKEN_RIGHT,
30-
payload: {
31-
name: 'bitly',
32-
token: {
33-
token: bitly_token.token.token,
34-
id: bitly_token.token.id
35-
}
29+
if (bitly_token) {
30+
dispatch({
31+
type: TOKEN_RIGHT,
32+
payload: {
33+
name: 'bitly',
34+
token: {
35+
token: bitly_token.token.token,
36+
id: bitly_token.token.id,
37+
},
38+
},
39+
});
3640
}
37-
});
38-
}
39-
}
40-
}
41+
};
42+
};
4143

4244
export const verifyGithubToken = token => {
43-
return async dispatch => {
44-
dispatch({
45-
type: TOKEN_LOADING,
46-
payload: {
47-
name: 'github'
48-
}
49-
});
50-
try {
51-
const { data } = await axios(`${GITHUB_LINK}/gists`, {
52-
headers: {
53-
Authorization: `Bearer ${token}`
54-
}
55-
});
56-
if(data.length) {
45+
return async dispatch => {
5746
dispatch({
58-
type: TOKEN_RIGHT,
59-
payload: {
60-
name: 'github',
61-
token
62-
}
47+
type: TOKEN_LOADING,
48+
payload: {
49+
name: 'github',
50+
},
6351
});
64-
setLocalStorageData('github', { token });
65-
}
66-
} catch (e) {
67-
dispatch({
68-
type: TOKEN_WRONG,
69-
payload: {
70-
name: 'github',
71-
error: true
52+
try {
53+
const { data } = await axios(`${GITHUB_LINK}/user`, {
54+
headers: {
55+
Authorization: `Bearer ${token}`,
56+
},
57+
});
58+
if (data.login) {
59+
dispatch({
60+
type: TOKEN_RIGHT,
61+
payload: {
62+
name: 'github',
63+
token,
64+
},
65+
});
66+
setLocalStorageData('github', { token });
67+
}
68+
} catch (e) {
69+
dispatch({
70+
type: TOKEN_WRONG,
71+
payload: {
72+
name: 'github',
73+
error: true,
74+
},
75+
});
7276
}
73-
});
74-
}
75-
}
76-
}
77+
};
78+
};
7779

7880
export const verifyBitlyToken = token => {
79-
return async dispatch => {
80-
dispatch({
81-
type: TOKEN_LOADING,
82-
payload: {
83-
name: 'bitly'
84-
}
85-
});
86-
try {
87-
const { data } = await axios(`${BITLY_LINK}/user`, {
88-
headers: {
89-
Authorization: `Bearer ${token}`
90-
}
91-
});
92-
if(data.login) {
81+
return async dispatch => {
9382
dispatch({
94-
type: TOKEN_RIGHT,
95-
payload: {
96-
name: 'bitly',
97-
token: {
98-
token,
99-
id: data.default_group_guid
100-
}
101-
}
83+
type: TOKEN_LOADING,
84+
payload: {
85+
name: 'bitly',
86+
},
10287
});
103-
setLocalStorageData('bitly', { token: { token, id: data.default_group_guid } });
104-
}
105-
} catch (e) {
106-
dispatch({
107-
type: TOKEN_WRONG,
108-
payload: {
109-
name: 'bitly',
110-
error: true
88+
try {
89+
const { data } = await axios(`${BITLY_LINK}/user`, {
90+
headers: {
91+
Authorization: `Bearer ${token}`,
92+
},
93+
});
94+
if (data.login) {
95+
dispatch({
96+
type: TOKEN_RIGHT,
97+
payload: {
98+
name: 'bitly',
99+
token: {
100+
token,
101+
id: data.default_group_guid,
102+
},
103+
},
104+
});
105+
setLocalStorageData('bitly', {
106+
token: { token, id: data.default_group_guid },
107+
});
108+
}
109+
} catch (e) {
110+
dispatch({
111+
type: TOKEN_WRONG,
112+
payload: {
113+
name: 'bitly',
114+
error: true,
115+
},
116+
});
111117
}
112-
});
113-
}
114-
}
115-
}
118+
};
119+
};
116120

117121
export const resetTokens = () => {
118-
return dispatch => {
119-
dispatch({
120-
type: TOKEN_RESET
121-
});
122-
unSetLocalStorageData(['github', 'bitly']);
123-
}
124-
}
122+
return dispatch => {
123+
dispatch({
124+
type: TOKEN_RESET,
125+
});
126+
unSetLocalStorageData(['github', 'bitly']);
127+
};
128+
};

client/src/components/Tools/Code/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ import { getCode } from '../../../actions';
1616

1717
import './index.css';
1818

19+
const MAX_GIST = 30;
20+
1921
class Code extends Component {
2022
state = {
2123
page: 1,
@@ -110,9 +112,15 @@ class Code extends Component {
110112
<FiArrowLeftCircle />
111113
</li>
112114
)}
113-
<li onClick={() => this.setState({ page: page + 1 })}>
114-
<FiArrowRightCircle />
115-
</li>
115+
{codes.data.length === MAX_GIST && (
116+
<li
117+
onClick={() =>
118+
this.setState({ page: page + 1 })
119+
}
120+
>
121+
<FiArrowRightCircle />
122+
</li>
123+
)}
116124
</ul>
117125
</div>
118126
);

electron-builder.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@ linux:
4444
arch:
4545
- x64
4646
- ia32
47-
# - target: 'deb'
47+
- target: 'deb'
48+
arch:
49+
- x64
50+
- ia32
4851
- target: 'rpm'
4952
arch:
5053
- x64

0 commit comments

Comments
 (0)