yushijinhun / authlib-injector

Build your own Minecraft authentication system.
https://authlib-injector.yushi.moe
GNU Affero General Public License v3.0
752 stars 68 forks source link

[proposal] 自定义验证服务器图标 - Customized authentication server icon #110

Open yushijinhun opened 3 years ago

yushijinhun commented 3 years ago

技术细节

该提案在验证服务器元数据的 meta 中增加了一个 icon 字段,其值是指向验证服务器图标的一个 URL。

启动器可以在验证服务器名称前显示该图标。

对图标的要求:

例子

验证服务器元数据:

{
    "meta": {
        "icon": "https://example.com/authserver-icon.png",
        ...
    },
    ...
}

English translation ## Technical details This proposal adds a `icon` property to the `meta` object in the authentication server metadata. The value of `icon` property is a URL pointing to the icon of the authentication server. Launchers can display the icon alongside the name of the authentication server. Requirements for icons: * Must be in PNG format * Width and height must be equal ## Examples Authentication server metadata: ```js { "meta": { "icon": "https://example.com/authserver-icon.png", ... }, ... } ```

/cc @huanghongxun @g-plane @erickskrauch

qwq233 commented 3 years ago

你要考虑五花八门的图片格式和诡异的路径 还有恶意链接 最好的方式就是直接提供base64的图片

erickskrauch commented 3 years ago

Overall, looks good to me. But you really need to add the ability to embed an icon in the meta-information for preached meta info format.

yushijinhun commented 3 years ago

Overall, looks good to me. But you really need to add the ability to embed an icon in the meta-information for preached meta info format.

If you want to embed the icon in the metadata, we can use Base64 data URLs. But I'm afraid that an embedded icon will make the metadata too long. The metadata will be Base64-encoded again and passed to the game as an argument, which will definitely exceed the Windows max command line length (32767 characters).

Maybe authlib-injector has to use a different parameter passing mechanism to bypass the limit.

g-plane commented 3 years ago

只能 PNG 格式是启动器的限制吗?

erickskrauch commented 3 years ago

In general, I would say that this is not our problem :) The point is to mention in the documentation that the icon field might contain the base64-encoded contents so that integrators take into account the possibility of finding such value.

qwq233 commented 3 years ago

Overall, looks good to me. But you really need to add the ability to embed an icon in the meta-information for preached meta info format.

If you want to embed the icon in the metadata, we can use Base64 data URLs. But I'm afraid that an embedded icon will make the metadata too long. The metadata will be Base64-encoded again and passed to the game as an argument, which will definitely exceed the Windows max command line length (32767 characters).

Maybe authlib-injector has to use a different parameter passing mechanism to bypass the limit.

my idea is to provide a boolean value, if it is true, the base64 of the picture will be retrieved from an address of the api(for example: /getfavicon ). If it is false, default or none.

yushijinhun commented 3 years ago

只能 PNG 格式是启动器的限制吗?

@g-plane It means if you use formats other than PNG, the behavior is undefined.

yushijinhun commented 3 years ago

In general, I would say that this is not our problem :) The point is to mention in the documentation that the icon field might contain the base64-encoded contents so that integrators take into account the possibility of finding such value.

Currently, we require launchers to add a JVM argument that encodes the metadata, so authlib-injector doesn't need to fetch the metadata again. (-Dauthlibinjector.yggdrasil.prefetched={Base64-encoded metadata})

If the metadata is too long, the game will be unable to start.

g-plane commented 3 years ago

Is this icon used in launchers only?

yushijinhun commented 3 years ago

Is this icon used in launchers only?

So far, yes.

mochaaP commented 3 years ago

我觉得可以单独加一个 manifest.json 指定不同 size 的 URL,如下


{
  "icons": {
    "32": "https://example.com/icon/32x32.png",
    "64": "https://example.com/icon/64x64.png",
    "512": "https://example.com/icon/512x512.png"
  }
}