halo
halo copied to clipboard
附件功能设计
你当前使用的版本
2.0.0-SNAPSHOT
描述一下此特性
功能要求
- 附件管理主要包含附件本身和附件上传策略。针对附件本身,需要考虑到附件的分组和标签,附件的分组是树形结构,类似于文件夹形式。
- 关于附件的访问,我们统一通过固定链接访问,如:https://halo.run/uploads/favicon.ico 。我们不针对分组进行单独生成访问路径,如:https://halo.run/uploads/photos/mountain.jpg。
- 我们需要记录每个附件的上传者,上传策略。
- 文章附件的引用问题:每篇文章可引用多个附件,每个附件可被多个文章引用。故我们可定时扫描文章(无论是已发布还是草稿)的附件引用情况,并保存在“文章-附件-绑定”关系中。
- 附件允许自定义展示名称,并且可根据展示名称搜索。
- 根据不同存储策略上传文件。
- 分组只有一级目录
自定义模型设计
附件组(storage.halo.run/v1alpha1/Group)
apiVersion: storage.halo.run/v1alpha1
kind: Group
metadata:
name: group-a
spec:
displayName: 分组 A
附件(storage.halo.run/v1alpha1/Attachment)
apiVersion: storage.halo.run/v1alpha1
kind: Attachment
metadata:
name: attachment-a
annotations:
object-key: "photos/favicon.ico"
path: "favicon.ico"
exif: "{}"
spec:
displayName: 附件 A # 未来可支持 i18n。
group: group-a
storagePolicy: local
mediaType: image/jpeg
size: 1024000 # Unit: byte
uploadedBy: johnniang
tags:
- name: human
- name: animal
- name: plant
status:
permalink: https://halo.run/uploads/favicon.ico
存储策略(storage.halo.run/v1alpha1/Policy)
apiVersion: storage.halo.run/v1alpha1
kind: Policy
metadata:
name: local
spec:
displayName: 本地存储(local) # 未来可支持 i18n。
settingName: local-settings
configMapName: local-config-value
文章-附件绑定关系
apiVersion: storage.halo.run/v1alpha1
kind: PostBinding
metadata:
name: post-binding
spec:
ref:
name: hello-halo
attachments:
- name: attachment-a
- name: attachment-b
status:
lastUpdated: 2020-01-01T00:00:00Z
附加信息
需要讨论的地方:
- 插件作者如何开发支持新的 StoragePolicy。
- 关于 StoragePolicy 的配置项名称,是否应该固定或是由插件提供。
/kind feature /area core /milestone 2.0 /assign
文章-附件绑定关系
可能不只是文章和附件可以绑定,这个特性主要让使用者知道附件在哪里被引用到。其他的可能还有自定义页面、分类的封面图、系统的设置项(ConfigMap)、主题的设置项(ConfigMap)
ConfigMap 这种绑定关系似乎不是很好处理。如果 ConfigMap 某个配置项的值是 JSON 字符串,我们也需要建立绑定关系么?例如:
apiVersion: v1alpha1
kind: ConfigMap
metadata:
name: system
data:
settings: '''
{"avatar": "https://halo.run/logo"}
'''
I'm going to close this issue due to https://github.com/halo-dev/halo/pull/2354 being meregd.
/close
@JohnNiang: Closing this issue.
In response to this:
I'm going to close this issue due to https://github.com/halo-dev/halo/pull/2354 being meregd.
/close
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.