跳至主内容

插件仓库

· 1 分钟阅读
dkanada
Core Team
非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

新版本中对插件进行了一些改动。 这篇短文将介绍开发者和用户最关心的重大更新。

对所有人来说最明显的变化是,现在可以使用第三方插件仓库了! 您可以在仪表板 -> 插件 -> 仓库中访问当前列表,并可以按需添加或删除项目。 如果您希望避免外部调用我们的服务器,甚至官方仓库也可以移除。

对于开发者,唯一需要改动的是在任意位置放置一个JSON清单文件,其中的版本号指向任意位置的二进制发布文件。 我们不要求特定的文件托管方式,因为这违背了项目理念。 官方仓库使用nginx托管清单文件,使用GitHub Releases托管二进制文件,但您也可以在GitHub上托管清单。 以下是一个包含所有属性的清单示例。 请注意,为避免与其他插件冲突,GUID必须是唯一的(在清单和插件本身中都要唯一)。

[
{
"category": "Metadata",
"guid": "a4df60c5-6ab4-412a-8f79-2cab93fb2bc5",
"name": "Anime",
"description": "This plugin supports several different metadata providers and options for organizing your collection.",
"owner": "jellyfin",
"overview": "Manage Your Anime in Jellyfin",
"versions": [
{
"checksum": "ad6db5175f4732308b5dd166f79a1c2d",
"changelog": "bug fixes and improvements",
"targetAbi": "10.6.0.0",
"sourceUrl": "https://repo.jellyfin.org/releases/other/whats-this-plugin.zip.gif",
"timestamp": "2020-03-27 06:02:58",
"version": "1.0.3.0"
}
]
}
]

The official repository manifest for stable plugins can be used for more examples. You can also find the deprecated manifest on the same domain for the old format. However, all new plugin updates (on the official repository) will go to the new manifest, so older verions of Jellyfin won't receive plugin updates. Plugins do have official documentation on our DocFX instance. Please be aware that our documentation is still a work in progress, since a lot of the C# code still has very little information for tools like this. Things are improving thanks to the diligent server team though, who have been slowly adding information throughout the codebase.

工具

One excellent tool that might help with repository management is jellyfin-plugin-repository-manager by Oddstr13, a frequent contributor. He did mention that his tool works much better with nginx than GitHub releases, but feel free to check it out! Another useful tool might be the jellyfin-build repository, which used to be the method used for updates on the official repository. We'll probably be migrating to the repository manager linked above though, since most of the other build systems have moved to Azure.

代码

如果您维护插件,可能需要注意ABI的一些改动。 我将在此列出10.6.0版本中最重要的一些改动,希望能减少更新过程中的问题。

The first batch comes from the HTML for settings on the web client, which has been going through an overhaul lately. One of the long term goals we have is deprecating jQuery entirely, since it's not 2008 anymore and better tools have come along. That does mean plugin pages will have to migrate off it at some point, but we haven't made the full transition yet, don't worry. Although jQuery will stick around a bit longer, we did remove two custom scripts in the web source that...extended the functionality a bit. There was one for select menus and yet another for checkbox elements. I can only assume the goal was compatibility with older browsers or clients at the time, but we've been pushing extremely hard to modernize the web client. That means avoiding abandoned libraries, ancient JavaScript practices, and definitely custom extensions for dependencies we don't even want in the code. The easiest fix for this change is to migrate from jQuery to vanilla JavaScript for checkboxes and select menus in the HTML source.

C# ABI也有一些可能影响您插件的改动。 最麻烦的可能是ILogger的调整,该调整通过在每行日志后追加类名来改进服务器日志。 您还会发现由新数据库迁移(这些对象的新命名空间是Jellyfin.Data)引起的多处改动,以及一些无关项。

IExternalID.Name -> IExternalID.ProviderName
MediaBrowser.Controller.Entities.User -> Jellyfin.Data.Entities.User
MetadataProviders -> MetadataProvider
CompressionMethod -> CompressionMethods
RequestContentBytes = request -> RequestContent = Encoding.UTF8.GetString(request)
User.Name -> User.Username
item.GetDisplayExtras() -> item.GetExtras(BaseItem.DisplayExtraTypes)
user.RootFolder -> libraryManager.GetUserRootFolder()

未来计划

第三方仓库是我们提升代码库中插件使用率的更大计划的第一步。 它们允许任何人维护自己的插件并按需快速推送更新,无需通过中心化系统。 用户还可以随时移除所有仓库,从而减少对互联网连接的依赖。

我们知道其中一些改动在插件中更新可能很麻烦,但希望很快会有改进。 下一步目标(既然现在可以同时使用多个仓库)是建立插件的实验性仓库。 这将解决长期存在的实验版插件支持需求——这曾是许多用户的障碍。 它还会附带产生一个需求:为C# ABI建立实验性NuGet仓库,帮助第三方插件开发者在服务器更新前测试插件对ABI改动的兼容性。

如果您开发插件(或客户端)并希望加入第三方开发者邮件列表,请通过Matrix联系我们或发送邮件获取详情。 我们的主要目标是为插件和非官方客户端提供卓越支持,因此有任何建议请务必在公共论坛联系我们。 希望C# ABI能逐渐稳定,重大改动越来越少,这样我们就能专注于打造更强大的插件!