修复Open On Gitee 和 Save On Gitee 的bug

This commit is contained in:
xiaoqi.cxq 2022-05-24 03:13:23 +08:00
parent e7e335d958
commit d52c677acd
6 changed files with 63 additions and 6 deletions

View File

@ -2,5 +2,10 @@ var merge = require('webpack-merge')
var prodEnv = require('./prod.env')
module.exports = merge(prodEnv, {
NODE_ENV: '"development"'
NODE_ENV: '"development"',
GITHUB_CLIENT_ID: '"845b8f75df48f2ee0563"',
GITHUB_CLIENT_SECRET: '"80df676597abded1450926861965cc3f9bead6a0"',
GITEE_CLIENT_ID: '"925ba7c78b85dec984f7877e4aca5cab10ae333c6d68e761bdb0b9dfb8f55672"',
GITEE_CLIENT_SECRET: '"f05731066e42d307339dc8ebbb037a103881dafc7207a359a393b87749f1c562"',
GITEE_CALLBACK: '"http://test.local.com/oauth2/callback"'
})

View File

@ -1,6 +1,6 @@
{
"name": "stackedit",
"version": "5.15.1",
"version": "5.15.2",
"description": "Free, open-source, full-featured Markdown editor",
"author": "Benoit Schweblin",
"license": "Apache-2.0",

View File

@ -39,8 +39,6 @@ module.exports = (app) => {
app.get('/', (req, res) => res.sendFile(resolvePath('static/landing/index.html')));
// Serve sitemap.xml
app.get('/sitemap.xml', (req, res) => res.sendFile(resolvePath('static/sitemap.xml')));
// Serve google-api.js
app.get('/google-api.js', (req, res) => res.sendFile(resolvePath('static/google-api.js')));
// Serve callback.html
app.get('/oauth2/callback', (req, res) => res.sendFile(resolvePath('static/oauth2/callback.html')));
// Google Drive action receiver

View File

@ -50,6 +50,18 @@
<span>{{token.name}}</span>
</menu-entry>
</div>
<div v-for="token in giteeTokens" :key="token.sub">
<menu-entry @click.native="openGitee(token)">
<icon-provider slot="icon" provider-id="gitee"></icon-provider>
<div>Open from Gitee</div>
<span>{{token.name}}</span>
</menu-entry>
<menu-entry @click.native="saveGitee(token)">
<icon-provider slot="icon" provider-id="gitee"></icon-provider>
<div>Save on Gitee</div>
<span>{{token.name}}</span>
</menu-entry>
</div>
<div v-for="token in gitlabTokens" :key="token.sub">
<menu-entry @click.native="openGitlab(token)">
<icon-provider slot="icon" provider-id="gitlab"></icon-provider>
@ -110,6 +122,7 @@ import gitlabHelper from '../../services/providers/helpers/gitlabHelper';
import googleDriveProvider from '../../services/providers/googleDriveProvider';
import dropboxProvider from '../../services/providers/dropboxProvider';
import githubProvider from '../../services/providers/githubProvider';
import giteeProvider from '../../services/providers/giteeProvider';
import gitlabProvider from '../../services/providers/gitlabProvider';
import syncSvc from '../../services/syncSvc';
import store from '../../store';
@ -263,6 +276,27 @@ export default {
badgeSvc.addBadge('saveOnGithub');
} catch (e) { /* cancel */ }
},
async openGitee(token) {
try {
const syncLocation = await store.dispatch('modal/open', {
type: 'giteeOpen',
token,
});
store.dispatch(
'queue/enqueue',
async () => {
await giteeProvider.openFile(token, syncLocation);
badgeSvc.addBadge('openFromGitee');
},
);
} catch (e) { /* cancel */ }
},
async saveGitee(token) {
try {
await openSyncModal(token, 'giteeSave');
badgeSvc.addBadge('saveOnGitee');
} catch (e) { /* cancel */ }
},
async saveGist(token) {
try {
await openSyncModal(token, 'gistSync');

View File

@ -174,7 +174,7 @@ export default [
),
new Feature(
'addGiteeWorkspace',
'GitHub workspace creator',
'Gitee workspace creator',
'Use the workspace menu to create a Gitee workspace.',
),
new Feature(
@ -219,6 +219,11 @@ export default [
'GitHub user',
'Link your GitHub account to StackEdit.',
),
new Feature(
'addGiteeAccount',
'Gitee user',
'Link your Gitee account to StackEdit.',
),
new Feature(
'addGitLabAccount',
'GitLab user',
@ -276,6 +281,16 @@ export default [
'GitHub writer',
'Use the "Synchronize" menu to save a file in a GitHub repository.',
),
new Feature(
'openFromGitee',
'Gitee reader',
'Use the "Synchronize" menu to open a file from a Gitee repository.',
),
new Feature(
'saveOnGitee',
'Gitee writer',
'Use the "Synchronize" menu to save a file in a Gitee repository.',
),
new Feature(
'saveOnGist',
'Gist writer',
@ -348,6 +363,11 @@ export default [
'Gist publisher',
'Use the "Publish" menu to publish a file to a Gist.',
),
new Feature(
'publishToGitee',
'Gitee publisher',
'Use the "Publish" menu to publish a file to a Gitee repository.',
),
new Feature(
'publishToGitlab',
'GitLab publisher',

View File

@ -8,11 +8,11 @@ const request = (token, options) => networkSvc.request({
...options,
headers: {
...options.headers || {},
Authorization: `token ${token.accessToken}`,
},
params: {
...options.params || {},
t: Date.now(), // Prevent from caching
access_token: token.accessToken,
},
});