gitea支持http
This commit is contained in:
parent
ce91307a9c
commit
492958702a
@ -264,8 +264,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async addGiteaAccount() {
|
async addGiteaAccount() {
|
||||||
try {
|
try {
|
||||||
const { serverUrl, applicationId, applicationSecret } = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
const applicationInfo = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
||||||
await giteaHelper.addAccount(serverUrl, applicationId, applicationSecret);
|
await giteaHelper.addAccount(applicationInfo);
|
||||||
} catch (e) { /* cancel */ }
|
} catch (e) { /* cancel */ }
|
||||||
},
|
},
|
||||||
async addGoogleDriveAccount() {
|
async addGoogleDriveAccount() {
|
||||||
|
@ -240,8 +240,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async addGiteaAccount() {
|
async addGiteaAccount() {
|
||||||
try {
|
try {
|
||||||
const { serverUrl, applicationId, applicationSecret } = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
const applicationInfo = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
||||||
await giteaHelper.addAccount(serverUrl, applicationId, applicationSecret);
|
await giteaHelper.addAccount(applicationInfo);
|
||||||
} catch (e) { /* cancel */ }
|
} catch (e) { /* cancel */ }
|
||||||
},
|
},
|
||||||
async addGoogleDriveAccount() {
|
async addGoogleDriveAccount() {
|
||||||
|
@ -95,8 +95,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async addGiteaWorkspace() {
|
async addGiteaWorkspace() {
|
||||||
try {
|
try {
|
||||||
const { serverUrl, applicationId, applicationSecret } = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
const applicationInfo = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
||||||
const token = await giteaHelper.addAccount(serverUrl, applicationId, applicationSecret);
|
const token = await giteaHelper.addAccount(applicationInfo);
|
||||||
store.dispatch('modal/open', {
|
store.dispatch('modal/open', {
|
||||||
type: 'giteaWorkspace',
|
type: 'giteaWorkspace',
|
||||||
token,
|
token,
|
||||||
|
@ -254,8 +254,8 @@ export default {
|
|||||||
},
|
},
|
||||||
async addGiteaAccount() {
|
async addGiteaAccount() {
|
||||||
try {
|
try {
|
||||||
const { serverUrl, applicationId, applicationSecret } = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
const applicationInfo = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
||||||
await giteaHelper.addAccount(serverUrl, applicationId, applicationSecret);
|
await giteaHelper.addAccount(applicationInfo);
|
||||||
} catch (e) { /* cancel */ }
|
} catch (e) { /* cancel */ }
|
||||||
},
|
},
|
||||||
async addGoogleDriveAccount() {
|
async addGoogleDriveAccount() {
|
||||||
|
@ -233,8 +233,8 @@ export default modalTemplate({
|
|||||||
},
|
},
|
||||||
async addGiteaImgStorage() {
|
async addGiteaImgStorage() {
|
||||||
try {
|
try {
|
||||||
const { serverUrl, applicationId, applicationSecret } = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
const applicationInfo = await store.dispatch('modal/open', { type: 'giteaAccount' });
|
||||||
const token = await giteaHelper.addAccount(serverUrl, applicationId, applicationSecret);
|
const token = await giteaHelper.addAccount(applicationInfo);
|
||||||
const imgStorageInfo = await store.dispatch('modal/open', {
|
const imgStorageInfo = await store.dispatch('modal/open', {
|
||||||
type: 'giteaImgStorage',
|
type: 'giteaImgStorage',
|
||||||
token,
|
token,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="modal__image">
|
<div class="modal__image">
|
||||||
<icon-provider provider-id="custom"></icon-provider>
|
<icon-provider provider-id="custom"></icon-provider>
|
||||||
</div>
|
</div>
|
||||||
<p>将您的<b>自定义图床</b>账号链接到<b>StackEdit</b>。</p>
|
<p>将您的<b>自定义图床</b>账号链接到<b>StackEdit中文版</b>。</p>
|
||||||
<form-entry label="自定义标识" error="name">
|
<form-entry label="自定义标识" error="name">
|
||||||
<input slot="field" class="textfield" type="text" v-model.trim="name" @keydown.enter="resolve()">
|
<input slot="field" class="textfield" type="text" v-model.trim="name" @keydown.enter="resolve()">
|
||||||
<div class="form-entry__info">
|
<div class="form-entry__info">
|
||||||
|
@ -38,13 +38,21 @@ import constants from '../../../data/constants';
|
|||||||
|
|
||||||
export default modalTemplate({
|
export default modalTemplate({
|
||||||
data: () => ({
|
data: () => ({
|
||||||
redirectUrl: constants.oauth2RedirectUri,
|
|
||||||
}),
|
}),
|
||||||
computedLocalSettings: {
|
computedLocalSettings: {
|
||||||
serverUrl: 'giteaServerUrl',
|
serverUrl: 'giteaServerUrl',
|
||||||
applicationId: 'giteaApplicationId',
|
applicationId: 'giteaApplicationId',
|
||||||
applicationSecret: 'giteaApplicationSecret',
|
applicationSecret: 'giteaApplicationSecret',
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
redirectUrl() {
|
||||||
|
let url = constants.oauth2RedirectUri;
|
||||||
|
if (this.serverUrl && this.serverUrl.indexOf('http://') === 0) {
|
||||||
|
url = url.replace('https://', 'http://');
|
||||||
|
}
|
||||||
|
return url;
|
||||||
|
},
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
resolve() {
|
resolve() {
|
||||||
const serverUrl = this.config.forceServerUrl || this.serverUrl;
|
const serverUrl = this.config.forceServerUrl || this.serverUrl;
|
||||||
@ -58,7 +66,7 @@ export default modalTemplate({
|
|||||||
this.setError('applicationSecret');
|
this.setError('applicationSecret');
|
||||||
}
|
}
|
||||||
if (serverUrl && this.applicationId) {
|
if (serverUrl && this.applicationId) {
|
||||||
const parsedUrl = serverUrl.match(/^(https:\/\/[^/]+)/);
|
const parsedUrl = serverUrl.match(/^(http[s]?:\/\/[^/]+)/);
|
||||||
if (!parsedUrl) {
|
if (!parsedUrl) {
|
||||||
this.setError('serverUrl');
|
this.setError('serverUrl');
|
||||||
} else {
|
} else {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<div class="modal__image">
|
<div class="modal__image">
|
||||||
<icon-provider provider-id="smms"></icon-provider>
|
<icon-provider provider-id="smms"></icon-provider>
|
||||||
</div>
|
</div>
|
||||||
<p>将您的<b>SM.MS</b>账号链接到<b>StackEdit</b>。</p>
|
<p>将您的<b>SM.MS</b>账号链接到<b>StackEdit中文版</b>。</p>
|
||||||
<form-entry label="跨域代理URL" error="proxyUrl">
|
<form-entry label="跨域代理URL" error="proxyUrl">
|
||||||
<input slot="field" class="textfield" type="text" v-model.trim="proxyUrl" @keydown.enter="resolve()">
|
<input slot="field" class="textfield" type="text" v-model.trim="proxyUrl" @keydown.enter="resolve()">
|
||||||
<div class="form-entry__info">
|
<div class="form-entry__info">
|
||||||
|
@ -83,31 +83,6 @@ StackEdit中文版 将您的文件存储在您的浏览器中,这意味着您
|
|||||||
|
|
||||||
由于一个文件可以与多个位置同步,您可以通过单击**同步**子菜单中的**文件同步**列出和管理同步位置。这允许您列出和删除链接到您的文件的同步位置。
|
由于一个文件可以与多个位置同步,您可以通过单击**同步**子菜单中的**文件同步**列出和管理同步位置。这允许您列出和删除链接到您的文件的同步位置。
|
||||||
|
|
||||||
|
|
||||||
# 发布
|
|
||||||
|
|
||||||
在 StackEdit中文版 中发布使您可以轻松地在线发布文件。对文件感到满意后,您可以将其发布到不同的托管平台,例如 **Blogger**、**Gitee**、**Gist**、**GitHub**、**WordPress** 和 **Zendesk**。使用 [Handlebars 模板](http://handlebarsjs.com/),您可以完全控制导出的内容。
|
|
||||||
|
|
||||||
> 在开始发布之前,您必须在**发布**子菜单中链接一个账号。
|
|
||||||
|
|
||||||
## 发布文件
|
|
||||||
|
|
||||||
您可以通过打开 **发布** 子菜单并单击 **发布到** 来发布您的文件。对于某些位置,您可以选择以下格式:
|
|
||||||
|
|
||||||
- Markdown:在可以解释的网站上发布 Markdown 文本(例如**GitHub**),
|
|
||||||
- HTML:通过 Handlebars 模板发布转换为 HTML 的文件(例如在博客上)。
|
|
||||||
|
|
||||||
## 更新发布
|
|
||||||
|
|
||||||
发布后,StackEdit中文版 会将您的文件链接到该发布,这使您可以轻松地重新发布它。一旦您修改了文件并想要更新您的发布,请单击导航栏中的**立即发布**按钮。
|
|
||||||
|
|
||||||
> **注意:** 如果您的文件尚未发布,则 **立即发布** 按钮将被禁用。
|
|
||||||
|
|
||||||
## 管理文件发布
|
|
||||||
|
|
||||||
由于一个文件可以发布到多个位置,您可以通过单击**发布**子菜单中的**文件发布**来列出和管理发布位置。这允许您列出和删除链接到您的文件的发布位置。
|
|
||||||
|
|
||||||
|
|
||||||
# Markdown扩展
|
# Markdown扩展
|
||||||
|
|
||||||
StackEdit中文版 通过添加额外的 **Markdown扩展** 扩展了标准 Markdown 语法,为您提供了一些不错的功能。
|
StackEdit中文版 通过添加额外的 **Markdown扩展** 扩展了标准 Markdown 语法,为您提供了一些不错的功能。
|
||||||
|
@ -75,11 +75,11 @@ export default new Provider({
|
|||||||
const sub = workspace ? workspace.sub : utils.queryParams.sub;
|
const sub = workspace ? workspace.sub : utils.queryParams.sub;
|
||||||
let token = store.getters['data/giteaTokensBySub'][sub];
|
let token = store.getters['data/giteaTokensBySub'][sub];
|
||||||
if (!token) {
|
if (!token) {
|
||||||
const { applicationId, applicationSecret } = await store.dispatch('modal/open', {
|
const applicationInfo = await store.dispatch('modal/open', {
|
||||||
type: 'giteaAccount',
|
type: 'giteaAccount',
|
||||||
forceServerUrl: serverUrl,
|
forceServerUrl: serverUrl,
|
||||||
});
|
});
|
||||||
token = await giteaHelper.addAccount(serverUrl, applicationId, applicationSecret, sub);
|
token = await giteaHelper.addAccount(applicationInfo, sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!workspace) {
|
if (!workspace) {
|
||||||
|
@ -173,8 +173,17 @@ export default {
|
|||||||
return this.startOauth2(serverUrl, applicationId, applicationSecret, sub);
|
return this.startOauth2(serverUrl, applicationId, applicationSecret, sub);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
async addAccount(serverUrl, applicationId, applicationSecret, sub = null) {
|
async addAccount({
|
||||||
const token = await this.startOauth2(serverUrl, applicationId, applicationSecret, sub);
|
serverUrl,
|
||||||
|
applicationId,
|
||||||
|
applicationSecret,
|
||||||
|
}, sub = null) {
|
||||||
|
const token = await this.startOauth2(
|
||||||
|
serverUrl,
|
||||||
|
applicationId,
|
||||||
|
applicationSecret,
|
||||||
|
sub,
|
||||||
|
);
|
||||||
badgeSvc.addBadge('addGiteaAccount');
|
badgeSvc.addBadge('addGiteaAccount');
|
||||||
return token;
|
return token;
|
||||||
},
|
},
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="keywords" content="Markdown编辑器,StackEdit中文版,StackEdit汉化版,StackEdit,在线Markdown,笔记利器,Markdown笔记">
|
<meta name="keywords" content="Markdown编辑器,StackEdit中文版,StackEdit汉化版,StackEdit,在线Markdown,笔记利器,Markdown笔记">
|
||||||
<meta name="description"
|
<meta name="description"
|
||||||
content="支持直接将码云(Gitee)、GitHub、Gitea等仓库且支持拖拽/粘贴上传图片,并且可以直接在页面编辑同步和管理的Markdown编辑器。">
|
content="支持直接将码云(Gitee)、GitHub、Gitea等仓库作为笔记存储仓库且支持拖拽/粘贴上传图片,并且可以直接在页面编辑同步和管理的Markdown编辑器。">
|
||||||
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1">
|
||||||
<meta name="baidu-site-verification" content="code-tGpn2BT069" />
|
<meta name="baidu-site-verification" content="code-tGpn2BT069" />
|
||||||
<meta name="msvalidate.01" content="90A9558158543277BD284CFA054E7F5B" />
|
<meta name="msvalidate.01" content="90A9558158543277BD284CFA054E7F5B" />
|
||||||
|
Loading…
Reference in New Issue
Block a user