Skip to content

内容源参考:manifest 全字段 ​

ContentSourceManifest 的完整字段表。讲解见 manifest.json 字段。

完整形状 ​

ts
interface ContentSourceManifest {
	id: string
	name: string
	version: string
	description?: string
	author?: string
	homepage?: string
	icon?: string
	color?: string
	detail_format?: SourceDetailFormat
	api_version: number
	entry: string
	content_types: ContentType[]
	capabilities: SourceCapabilities
	hosts: string[]
	auth?: { required: boolean; login_url?: string; help_url?: string }
	manual_entry?: ManualEntryField[]
	settings?: SourceSettingField[]
}

字段表 ​

字段类型必填默认约束
idstring✅字母数字 . - _;≤128;不以 . 开头/结尾;不含 ..
namestring✅非空
versionstring✅非空;发布时与 tag 一致
descriptionstring
authorstring
homepagestring
iconstring相对路径,无 ..、无绝对路径
colorstring#rrggbb
detail_formatSourceDetailFormatmarkdownmarkdown | text
api_versionnumber1必须是 1
entrystring✅相对路径,无 ..
content_typesContentType[]✅非空,取值见下
capabilitiesSourceCapabilities全 false
hostsstring[][]域名或 *.域名
authSourceAuth
manual_entryManualEntryField[][]
settingsSourceSettingField[][]select 必须有 options

ContentType ​

ts
type ContentType =
	| 'mod'
	| 'modpack'
	| 'resourcepack'
	| 'shader'
	| 'datapack'
	| 'world'
	| 'skin'

SourceCapabilities ​

ts
interface SourceCapabilities {
	search: boolean
	browse: boolean
	detail: boolean
	versions: boolean
	resolve_download: boolean // ← snake_case
	update_check: boolean // ← snake_case
}

resolve_download / update_check 是 snake_case

manifest 里的字段名全是 snake_case,但对应的 provider 方法名是 camelCase(resolveDownload、checkUpdate)。别搞反。

SourceDetailFormat ​

ts
type SourceDetailFormat = 'markdown' | 'text'

SourceAuth ​

ts
{
	required: boolean
	login_url?: string
	help_url?: string
}

SourceSettingField / SourceSettingOption ​

ts
SourceSettingField {
	key: string // 非空
	label: string
	description?: string
	type: 'toggle' | 'text' | 'number' | 'select'
	default?: string // 字符串
	options?: SourceSettingOption[] // select 必须有
}

SourceSettingOption {
	value: string
	label?: string
}

ManualEntryField ​

ts
ManualEntryField {
	key: string
	label: string
	description?: string
	placeholder?: string
	pattern?: string // 正则字符串
	options?: SourceSettingOption[] // 有它则渲染成下拉框
	required?: boolean
}

用户填的条目存在 api.storage 的 'manualEntries' 键下,是 JSON 数组。

ContentSort ​

ts
type ContentSort = 'relevance' | 'downloads' | 'follows' | 'newest' | 'updated'

下一篇:内容类型表。

Celestial Launcher 基于 Modrinth App 构建,遵循其开源许可。