--- title: Gridea 魔改使其支持 Gitee Pages cover: https://pic.rmb.bdstatic.com/bjh/0d9eb92f67ba93b514f2555a70eacebe.png date: 2020-05-09 tags: - Gridea - 博客 categories: - 写 BUG 日常 - 野生技术协会 --- Gridea 是一款很好用的博客写作软件。它功能全面但可惜部署不支持国内的 Gitee 代码储存仓库。本篇文章将对 Gridea 进行源码上的修改使其支持 Gitee Pages。 {% raw %}
{% endraw %} 这篇文章中对 Gridea 的修改已经合并到 Gridea 再 GitHub 仓库的主分支,所以没有必要再进行下面的处理。 你可以去 Gridea 的 [Releses](https://github.com/getgridea/gridea/releases/latest) 中下载 Gridea 的最新构建。 Gitee Pages 的支持在 [v0.9.3](https://github.com/getgridea/gridea/releases/tag/v0.9.3) 中被加入。 {% raw %}
{% endraw %} ## 教程 ### 克隆源代码 ``` # Github 官方 git clone https:/github.com/getgridea/gridea.git # Gitee 镜像 git clone https://gitee.com/mirrors/gridea.git # Gitee git clone https://gitee.com/fehey/gridea.git ``` 以上四个仓库都是可以的。你可以自行选择。 ``` # 进入 Gridea 的目录 cd gridea ``` ## 修改源码 ``` diff src/server/deploy.ts >folded this.platformAddress = ({ // 18行 github: 'github.com', coding: 'e.coding.net', + gitee: 'gitee.com', } as any)[setting.platform || 'github'] const preUrl = ({ github: `${setting.username}:${setting.token}`, coding: `${setting.tokenUsername}:${setting.token}`, + gitee: `${setting.username}:${setting.token}`, } as any)[setting.platform || 'github'] this.remoteUrl = `https://${preUrl}@${this.platformAddress}/${setting.username}/${setting.repository}.git` ``` ``` diff src/server/events/deploy.ts>folded ipcMain.removeAllListeners('remote-detected') // 17行 ipcMain.on('site-publish', async (event: IpcMainEvent, params: any) => { + console.log(platform) const client = ({ 'github': deploy, 'coding': deploy, + 'gitee': deploy, 'sftp': sftp, } as any)[platform] const client = ({ // 38行 'github': deploy, 'coding': deploy, + 'gitee': deploy, 'sftp': sftp, } as any)[platform] const result = await client.remoteDetect() event.sender.send('remote-detected', result) }) ``` ``` diff src/views/setting/includes/BasicSetting.vue >folded // 5行 Github Pages Coding Pages + Gitee Pages SFTP -