halo-dev / halo

强大易用的开源建站工具。
https://www.halo.run
GNU General Public License v3.0
34.13k stars 9.72k forks source link

Request to build attachments' link with unified format #6961

Open JohnNiang opened 4 weeks ago

JohnNiang commented 4 weeks ago

Your current Halo version

2.20.7

Describe this feature

Currently, if we upload a file into S3 bucket with private read permission, the object cannot be accessed directly. We have to build a presigned URL to share the object, but the URL has expiration. So we cannot put the presigned URL into attachment permalink.

If we set the attachment permalink like <http://localhost:8090/attachments/{attachment.metadata.name}/{attachment.spec.displayName} and redirect to presigned URL when accessing the permalink, the problem will be resolved.

References

Additional information

/kind feature /area core

guqing commented 4 weeks ago

目前上传完附件之后总是需要轮训等待链接才行包括 vscode halo 插件这些实现,但是这样例如 PicGo 这些工具上传之后将无法显示图片,如果实现了此功能是否就可以不需要轮训等待 permalink 了

JohnNiang commented 3 weeks ago

目前上传完附件之后总是需要轮训等待链接才行包括 vscode halo 插件这些实现,但是这样例如 PicGo 这些工具上传之后将无法显示图片,如果实现了此功能是否就可以不需要轮训等待 permalink 了

Halo Core 可以先提供这个能力,最终是否使用这种链接,完全取决于插件。例如 S3 插件就可以在 AttachmentHandler#getPermalink 方法中返回这样的附件链接形式。但是,permalink 仍然是异步设置的,可能还是无法解决轮训等待 permalink 的问题。