-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.js
83 lines (83 loc) · 1.77 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/**
* ip or domain name
*/
// OAuth address
const ipAddressToken = 'https://github.com'
// Trending address
const ipAddressTrending = 'https://hackertab.pupubird.com'
// after authorized
const ipAddress = 'https://api.github.com'
// contributions
const ipAddressContributions = 'https://ghchart.rshah.org'
const ipAddress3dContri = 'https://github-3d-contribution.herokuapp.com'
// github raw url
const githubRawUrl = 'https://raw.githubusercontent.com'
/**
* github secure authorize address
*/
const githubClientId = ''
const githubClientSecret = ''
const githubAuthUrl = ipAddressToken + '/#/oauth/authorize?client_id=' + githubClientId + '&state=funcode&scope=notifications,user,repo'
/**
* api prefix
*/
const apiPrefixToken = '/apiToken'
const apiPrefixTrending = '/apiTrending'
const apiPrefix = '/apiGithub'
const apiPrefix3dContri = '/apiContri'
/**
* OAuth baseUrl
*/
const getBaseUrlToken = () => {
// #ifdef H5
return apiPrefixToken
// #endif
// #ifdef APP-PLUS
return ipAddressToken
// #endif
}
/**
* trending for repos baseURL
*/
const getBaseUrlTrending = () => {
// #ifdef H5
return apiPrefixTrending
// #endif
// #ifdef APP-PLUS
return ipAddressTrending
// #endif
}
/**
* api after authorized
*/
const getBaseUrl = () => {
// #ifdef H5
return apiPrefix
// #endif
// #ifdef APP-PLUS
return ipAddress
// #endif
}
/**
* get 3d contribution url
*/
const get3dContriBaseUrl = () => {
// #ifdef H5
return apiPrefix3dContri
// #endif
// #ifdef APP-PLUS
return ipAddress3dContri
// #endif
}
export default {
baseUrl: getBaseUrl(),
baseUrlToken: getBaseUrlToken(),
baseUrlTrending: getBaseUrlTrending(),
baseUrl3dContri: get3dContriBaseUrl(),
githubClientId,
githubClientSecret,
githubAuthUrl,
ipAddressContributions,
ipAddressToken,
githubRawUrl
}