minIO与picgo的结合

使用docker 安装 minIO

注意一下minIO官方已将最新的版本阉割了控制台功能,最近一个没有被删除的版本是2025-04-22T22-12-26Z

生成目录

1
mkdir -p /root/minio/{data,config}
1
2
3
4
5
6
7
8
9
10
11
12
docker run -d \
--name minio \
--restart unless-stopped \
-e MINIO_ROOT_USER=root \
-e MINIO_ROOT_PASSWORD=password \
-e TZ=Asia/Shanghai \
-p 9000:9000 \
-p 9001:9001 \
-v /root/minio/data:/data \
-v /root/minio/config:/root/.minio \
minio/minio:RELEASE.2025-04-22T22-12-26Z \
server /data --console-address :9001

配置minIO

访问 http://IP地址:9001访问minIO控制台

创建一下存储桶,并把AccessPolicy设置为public

创建Access Keys

  • 注意一下过期时间

Access Keys只有一次显示,请务必保存好

配置Picgo

下载Picgo:https://github.com/Molunerfinn/PicGo/releases

下载minIO的插件

配置好插件的基本信息

  • 测试一下连通性

切换一下上传方式,选到刚刚的minIO插件

上传后就可以在后台显示了

推荐多下载一个插件,可以配置上传路径

感觉开源大大:picgo-plugin-custom-path - npm


这样可以方便管理与防止重名图片:
我个人喜欢这样:{year}/{month}/{day}/{origin}-{hash}

与Typora联动

image-20250731160512343

这时直接在Typora上粘贴图片也可以直接,上传到minIO

注:为了之后更好的迁移,我推荐大家可以注册一个自己的域名,并将这些URL设置好,这样迁移的时这些URL也不需要修改

let artalkItem = null const option = null const isShuoshuo = GLOBAL_CONFIG_SITE.pageType === 'shuoshuo' const destroyArtalk = () => { if (artalkItem) { artalkItem.destroy() artalkItem = null } } const artalkChangeMode = theme => artalkItem && artalkItem.setDarkMode(theme === 'dark') const initArtalk = (el = document, pageKey = location.pathname) => { artalkItem = Artalk.init({ el: el.querySelector('#artalk-wrap'), server: 'https://interact.whoisjory.com', site: 'Jorysinteract', darkMode: document.documentElement.getAttribute('data-theme') === 'dark', ...option, pageKey: isShuoshuo ? pageKey : (option && option.pageKey) || pageKey, imgUpload: true }) if (GLOBAL_CONFIG.lightbox === 'null') return artalkItem.on('list-loaded', () => { artalkItem.ctx.get('list').getCommentNodes().forEach(comment => { const $content = comment.getRender().$content btf.loadLightbox($content.querySelectorAll('img:not([atk-emoticon])')) }) }) if (isShuoshuo) { window.shuoshuoComment.destroyArtalk = () => { destroyArtalk() if (el.children.length) { el.innerHTML = '' el.classList.add('no-comment') } } } btf.addGlobalFn('pjaxSendOnce', destroyArtalk, 'destroyArtalk') btf.addGlobalFn('themeChange', artalkChangeMode, 'artalk') } const loadArtalk = async (el, pageKey) => { if (typeof Artalk === 'object') initArtalk(el, pageKey) else { await btf.getCSS('https://lib.baomitu.com/artalk/2.9.1/Artalk.min.css') await btf.getScript('https://lib.baomitu.com/artalk/2.9.1/Artalk.min.js') initArtalk(el, pageKey) } } if (isShuoshuo) { 'Artalk' === 'Artalk' ? window.shuoshuoComment = { loadComment: loadArtalk } : window.loadOtherComment = loadArtalk return } if ('Artalk' === 'Artalk' || !false) { if (false) btf.loadComment(document.getElementById('artalk-wrap'), loadArtalk) else setTimeout(loadArtalk, 100) } else { window.loadOtherComment = loadArtalk } })()