修复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') var prodEnv = require('./prod.env')
module.exports = merge(prodEnv, { 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", "name": "stackedit",
"version": "5.15.1", "version": "5.15.2",
"description": "Free, open-source, full-featured Markdown editor", "description": "Free, open-source, full-featured Markdown editor",
"author": "Benoit Schweblin", "author": "Benoit Schweblin",
"license": "Apache-2.0", "license": "Apache-2.0",

View File

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

View File

@ -50,6 +50,18 @@
<span>{{token.name}}</span> <span>{{token.name}}</span>
</menu-entry> </menu-entry>
</div> </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"> <div v-for="token in gitlabTokens" :key="token.sub">
<menu-entry @click.native="openGitlab(token)"> <menu-entry @click.native="openGitlab(token)">
<icon-provider slot="icon" provider-id="gitlab"></icon-provider> <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 googleDriveProvider from '../../services/providers/googleDriveProvider';
import dropboxProvider from '../../services/providers/dropboxProvider'; import dropboxProvider from '../../services/providers/dropboxProvider';
import githubProvider from '../../services/providers/githubProvider'; import githubProvider from '../../services/providers/githubProvider';
import giteeProvider from '../../services/providers/giteeProvider';
import gitlabProvider from '../../services/providers/gitlabProvider'; import gitlabProvider from '../../services/providers/gitlabProvider';
import syncSvc from '../../services/syncSvc'; import syncSvc from '../../services/syncSvc';
import store from '../../store'; import store from '../../store';
@ -263,6 +276,27 @@ export default {
badgeSvc.addBadge('saveOnGithub'); badgeSvc.addBadge('saveOnGithub');
} catch (e) { /* cancel */ } } 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) { async saveGist(token) {
try { try {
await openSyncModal(token, 'gistSync'); await openSyncModal(token, 'gistSync');

View File

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

View File

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