gitee 接口限制兼容
This commit is contained in:
parent
e1eb7ec350
commit
72f9fea42e
@ -35,7 +35,6 @@ exports.publicValues = {
|
||||
dropboxAppKey,
|
||||
dropboxAppKeyFull,
|
||||
githubClientId,
|
||||
giteeClientId,
|
||||
googleClientId,
|
||||
googleApiKey,
|
||||
wordpressClientId,
|
||||
|
@ -34,7 +34,11 @@ module.exports = (app) => {
|
||||
app.post('/paypalIpn', bodyParser.urlencoded({
|
||||
extended: false,
|
||||
}), user.paypalIpn);
|
||||
|
||||
app.get('/giteeClientId', (req, res) => {
|
||||
const giteeClientIds = conf.values.giteeClientId.split(',');
|
||||
const clientId = giteeClientIds[Math.floor((giteeClientIds.length * Math.random()))];
|
||||
res.send(clientId);
|
||||
});
|
||||
// Serve landing.html
|
||||
app.get('/', (req, res) => res.sendFile(resolvePath('static/landing/index.html')));
|
||||
// Serve privacy_policy.html
|
||||
|
@ -56,7 +56,6 @@ import GithubWorkspaceModal from './modals/providers/GithubWorkspaceModal';
|
||||
import GithubPublishModal from './modals/providers/GithubPublishModal';
|
||||
import GistSyncModal from './modals/providers/GistSyncModal';
|
||||
import GistPublishModal from './modals/providers/GistPublishModal';
|
||||
import GiteeAccountModal from './modals/providers/GiteeAccountModal';
|
||||
import GiteeOpenModal from './modals/providers/GiteeOpenModal';
|
||||
import GiteeSaveModal from './modals/providers/GiteeSaveModal';
|
||||
import GiteeWorkspaceModal from './modals/providers/GiteeWorkspaceModal';
|
||||
@ -120,7 +119,6 @@ export default {
|
||||
GithubPublishModal,
|
||||
GistSyncModal,
|
||||
GistPublishModal,
|
||||
GiteeAccountModal,
|
||||
GiteeOpenModal,
|
||||
GiteeSaveModal,
|
||||
GiteeWorkspaceModal,
|
||||
|
@ -252,7 +252,6 @@ export default {
|
||||
},
|
||||
async addGiteeAccount() {
|
||||
try {
|
||||
await store.dispatch('modal/open', { type: 'giteeAccount' });
|
||||
await giteeHelper.addAccount();
|
||||
} catch (e) { /* cancel */ }
|
||||
},
|
||||
|
@ -1,31 +0,0 @@
|
||||
<template>
|
||||
<modal-inner aria-label="链接Gitee账号">
|
||||
<div class="modal__content">
|
||||
<div class="modal__image">
|
||||
<icon-provider provider-id="gitee"></icon-provider>
|
||||
</div>
|
||||
<p>将您的<b>Gitee</b>账号链接到<b>StackEdit</b>。</p>
|
||||
<div class="form-entry">
|
||||
<div class="form-entry__checkbox">
|
||||
<label>
|
||||
<input type="checkbox" v-model="repoFullAccess"> 授予您私人仓库的访问权限
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal__button-bar">
|
||||
<button class="button" @click="config.reject()">取消</button>
|
||||
<button class="button button--resolve" @click="config.resolve()">确认</button>
|
||||
</div>
|
||||
</modal-inner>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import modalTemplate from '../common/modalTemplate';
|
||||
|
||||
export default modalTemplate({
|
||||
computedLocalSettings: {
|
||||
repoFullAccess: 'giteeRepoFullAccess',
|
||||
},
|
||||
});
|
||||
</script>
|
@ -70,7 +70,6 @@ export default new Provider({
|
||||
token = store.getters['data/giteeTokensBySub'][workspace.sub];
|
||||
}
|
||||
if (!token) {
|
||||
await store.dispatch('modal/open', { type: 'giteeAccount' });
|
||||
token = await giteeHelper.addAccount();
|
||||
}
|
||||
|
||||
|
@ -69,10 +69,12 @@ export default {
|
||||
* https://developer.gitee.com/apps/building-oauth-apps/authorization-options-for-oauth-apps/
|
||||
*/
|
||||
async startOauth2(lastToken, silent = false, isMain) {
|
||||
const giteeClientIds = store.getters['data/serverConf'].giteeClientId.split(',');
|
||||
const clientId = giteeClientIds[Math.floor((giteeClientIds.length * Math.random()))];
|
||||
let tokenBody;
|
||||
if (!silent) {
|
||||
const clientId = (await networkSvc.request({
|
||||
method: 'GET',
|
||||
url: 'giteeClientId',
|
||||
})).body;
|
||||
// Get an OAuth2 code
|
||||
const { code } = await networkSvc.startOauth2(
|
||||
'https://gitee.com/oauth/authorize',
|
||||
|
Loading…
Reference in New Issue
Block a user