Kuingsmile / PicList

An image upload and manage tool, base on PicGo
https://piclist.cn
MIT License
2.17k stars 91 forks source link

[Bug]: 远程服务器部署的 docker 版 piclist, 无法上传 #127

Closed lvbibir closed 10 months ago

lvbibir commented 10 months ago

前置阅读 | Pre-reading

PicList的版本 | PicList Version

v1.7.0 (docker image tag)

系统信息 | System Information

Windows

问题重现 | Bug reproduce

obsidian 中使用域名调用接口, 通过 nginx proxy 转发到 piclist 容器, 看 nginx 日志是正常转发了的, piclist 容器报错 Unauthorized access , 像是图片文件并没有传到服务器, 另外找不到实际日志在哪, 只有 docker logs 有一些信息 image

相关日志 | Logs

docker logs -f piclist

[PicList Server] get the request {"list":["C:\Users\lvbibir\OneDrive\1-lvbibir\obsidian\lvbibir\assets\Pasted image 20231228210447.png"]} [PicList Server] Unauthorized access [PicList Server] upload failed, see log for more detail ↑ [PicList Server] get the request {"list":["C:\Users\lvbibir\OneDrive\1-lvbibir\obsidian\lvbibir\assets\Pasted image 20231228210447.png"]} [PicList Server] Unauthorized access [PicList Server] upload failed, see log for more detail ↑

lvbibir commented 10 months ago

另附 piclist 配置文件 (文档没有说明, 直接用的桌面端配置文件)

{
  "picBed": {
    "current": "aliyun",
    "uploader": "aliyun",
    "picgoPlugins": {}
  },
  "aliyun": {
    "accessKeyId": "************",
    "accessKeySecret": "************",
    "bucket": "lvbibir-image",
    "area": "oss-cn-beijing",
    "path": "blog/",
    "customUrl": "https://image.lvbibir.cn",
    "options": ""
  },
  "picgoPlugins": {}
}
Kuingsmile commented 10 months ago

部署docker的时候,命令里有个-k 参数,在obsidian里填上传地址的时候,需要最后加上?key=xxx,xxx是你的-k 参数对应的值

Kuingsmile commented 10 months ago

还有obsidian插件需要打开远程服务器模式

lvbibir commented 10 months ago

我把 key 改简单后 Unauthorized access 报错没了, 但是新报错找不到 aliyun 配置, 我上面提供的配置文件有问题吗

(13)$ docker logs -f piclist
startup
[PicList Server] is listening at 36677
[PicList Server] upload files in list
[PicList INFO]: Before transform
[PicList INFO]: Transforming... Current transformer is [path]
[PicList INFO]: Before upload
[PicList INFO]: Uploading... Current uploader is [aliyun]
[PicList WARN]: failed
[PicList ERROR]: Error: Can't find aliYun OSS config
    at Object.Ht [as handle] (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:55247)
    at dt.doUpload (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:37203)
    at dt.start (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:35943)
    at async Lr.upload (/usr/local/share/.config/yarn/global/node_modules/piclist/dist/index.cjs.js:1:128266)
    at async /usr/local/share/.config/yarn/global/node_modules/piclist/bin/picgo-server:197:22
[PicList Server] upload result
Kuingsmile commented 10 months ago
{
  "picBed": {
    "uploader": "local",
    "current": "local",
    "aliyun": {
      "accessKeyId": "xxx",
      "accessKeySecret": "xxx",
      "bucket": "xxx",
      "area": "oss-cn-hangzhou",
      "path": "test/",
      "customUrl": "",
      "options": ""
    },
  },
}

类似这样写

lvbibir commented 10 months ago
{
  "picBed": {
    "uploader": "local",
    "current": "local",
    "aliyun": {
      "accessKeyId": "xxx",
      "accessKeySecret": "xxx",
      "bucket": "xxx",
      "area": "oss-cn-hangzhou",
      "path": "test/",
      "customUrl": "",
      "options": ""
    },
  },
}

类似这样写

这样改可以了 image

还有两个小问题

Kuingsmile commented 10 months ago
{
  "picBed": {
    "uploader": "local",
    "current": "local",
    "aliyun": {
      "accessKeyId": "xxx",
      "accessKeySecret": "xxx",
      "bucket": "xxx",
      "area": "oss-cn-hangzhou",
      "path": "test/",
      "customUrl": "",
      "options": ""
    },
  },
}

类似这样写

这样改可以了 image

还有两个小问题

  • 最开始的 Unauthorized access 报错, 我最开始设置的 key 包含 !@# 等字符, 是我写法的问题还是暂不支持
  • 删除的接口应该如何调用, 必须使用客户端嘛

key里如果有特殊字符,应该需要做URL编码,然后删除接口只有客户端有

lvbibir commented 10 months ago

可以了,完美解决,删除接口我问问插件作者