跳至主要內容

Typora + gitlab仓库图床上传图片配置

大约 3 分钟约 785 字

Typora + gitlab仓库图床上传图片配置

1 安装nodejs

下载系统对应版本的nodejs,强烈建议使用官网最新LTS版本open in new window 。

因为需要nodejs可以正常使用,额外工具需要安装,安装额外工具需要使用Chocolatey工具,务必设置Chocolatey官方社区仓库,以免软件无法安装。

choco source add -n=community -s=https://community.chocolatey.org/api/v2

安装过程就是一路next即可。

2 安装和配置picGO

picGO是Windows版本的Typora支持的图片上传插件,picGO工具支持通过插件扩展其功能。可以通过安装插件来支持往gitlab、github、gitee等版本控制系统的仓库中上传图片,仓库可以直接作为图床。当然想minio存储也是可以通过插件配置支持的。

picGO安装包下载。

picGO安装根据提示一路Next即可。

picGO集成配置gitlabopen in new window

在gitlab中创建public类型的仓库,并创建token(token需要api, write_repository权限)。

picGO需要安装gitlab-files插件,默认是不支持gitlab仓库作为图床的。

picGO插件配置如下:

picGO配置gitlab插件Typora搭配uPic使用minIO自建图床 open in new window

picGo也支持将Minio作为图床,需要安装插件picgo-plugin-minio, minio的插件配置如下:

picGO配置minio插件

picGO的配置文件内容如下:

{
  "picBed": {
    "current": "minio",
    "uploader": "minio",
    "smms": {
      "token": ""
    },
    "list": [
      {
        "type": "tcyun",
        "name": "腾讯云COS",
        "visible": false
      },
      {
        "type": "aliyun",
        "name": "阿里云OSS",
        "visible": false
      },
      {
        "type": "smms",
        "name": "SM.MS",
        "visible": false
      },
      {
        "type": "github",
        "name": "GitHub",
        "visible": false
      },
      {
        "type": "qiniu",
        "name": "七牛云",
        "visible": false
      },
      {
        "type": "imgur",
        "name": "Imgur",
        "visible": false
      },
      {
        "type": "upyun",
        "name": "又拍云",
        "visible": false
      },
      {
        "type": "gitlab-files-uploader",
        "name": "gitlab files 图片上传",
        "visible": true
      },
      {
        "type": "minio",
        "name": "MinIO图床",
        "visible": true
      }
    ],
    "gitlab-files-uploader": {
      "_configName": "Default",
      "_id": "d4359770-bf8c-4dd6-aaa6-aace7e11582b",
      "_createdAt": 1679385453159,
      "_updatedAt": 1679385485394,
      "gitUrl": "https://gitlab.leadchina.cn/",
      "projectId": "11",
      "branch": "main",
      "gitToken": "glpat-PuMBiMz27RefzUg5Cw2b",
      "gitVersionUnderThirteen": null,
      "fileName": null,
      "commitMessage": null,
      "deleteRemote": null,
      "deleteMessage": null,
      "deleteInform": null,
      "authorMail": null,
      "authorName": null
    },
    "proxy": "",
    "minio": {
      "_configName": "Default",
      "_id": "cb777499-127d-4be7-a003-9a2f4026b85d",
      "_createdAt": 1679395899070,
      "_updatedAt": 1679397838449,
      "endPoint": "10.30.162.18",
      "port": "9000",
      "useSSL": false,
      "accessKey": "Qwerty123456",
      "secretKey": "Qwerty123456",
      "bucket": "docs-images",
      "sameNameFileProcessingMode": "跳过",
      "baseDir": "",
      "customDomain": "",
      "isAutoArchive": false
    }
  },
  "settings": {
    "shortKey": {
      "picgo:upload": {
        "enable": true,
        "key": "Ctrl+Shift+U",
        "name": "upload",
        "label": "QUICK_UPLOAD"
      }
    },
    "showUpdateTip": true,
    "server": {
      "port": 36677,
      "host": "127.0.0.1",
      "enable": true
    },
    "uploadNotification": true,
    "privacyEnsure": true,
    "rename": false,
    "autoRename": false,
    "miniWindowOntop": true,
    "logLevel": [
      "all"
    ],
    "logFileSizeLimit": 10,
    "proxy": "",
    "registry": "https://registry.npmmirror.com",
    "autoStart": false,
    "useBuiltinClipboard": true
  },
  "needReload": false,
  "picgoPlugins": {
    "picgo-plugin-gitlab-files": true,
    "picgo-plugin-minio": true
  },
  "uploader": {
    "gitlab-files-uploader": {
      "configList": [
        {
          "_configName": "Default",
          "_id": "d4359770-bf8c-4dd6-aaa6-aace7e11582b",
          "_createdAt": 1679385453159,
          "_updatedAt": 1679385485394,
          "gitUrl": "https://gitlab.leadchina.cn/",
          "projectId": "11",
          "branch": "main",
          "gitToken": "glpat-PuMBiMz27RefzUg5Cw2b",
          "gitVersionUnderThirteen": null,
          "fileName": null,
          "commitMessage": null,
          "deleteRemote": null,
          "deleteMessage": null,
          "deleteInform": null,
          "authorMail": null,
          "authorName": null
        }
      ],
      "defaultId": "d4359770-bf8c-4dd6-aaa6-aace7e11582b"
    },
    "minio": {
      "configList": [
        {
          "_configName": "Default",
          "_id": "cb777499-127d-4be7-a003-9a2f4026b85d",
          "_createdAt": 1679395899070,
          "_updatedAt": 1679397838449,
          "endPoint": "10.30.162.18",
          "port": "9000",
          "useSSL": false,
          "accessKey": "Qwerty123456",
          "secretKey": "Qwerty123456",
          "bucket": "docs-images",
          "sameNameFileProcessingMode": "跳过",
          "baseDir": "",
          "customDomain": "",
          "isAutoArchive": false
        }
      ],
      "defaultId": "cb777499-127d-4be7-a003-9a2f4026b85d"
    }
  }
}

3 安装破解版的typora软件

官方下载typora安装包open in new window

安装过程一路next即可。

将winmm.dll复制的typora的安装目录即可完成激活操作,如果windows提示无法启动,可以先将windows系统的安全实时保护功能。

打开Tyora的文件-->偏好设置--> 图像。

Typora设置上传图片操作 可以单击验证图片上传选项来验证图片是否可以正常上传。