authlib-injector icon indicating copy to clipboard operation
authlib-injector copied to clipboard

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

Open yushijinhun opened this issue 3 years ago • 11 comments

技术细节

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

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

对图标的要求:

  • PNG 格式
  • 长宽等高

例子

验证服务器元数据:

{
    "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:

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

/cc @huanghongxun @g-plane @erickskrauch

yushijinhun avatar Mar 06 '21 14:03 yushijinhun

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

qwq233 avatar Mar 06 '21 14:03 qwq233

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.

erickskrauch avatar Mar 06 '21 14:03 erickskrauch

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.

yushijinhun avatar Mar 06 '21 14:03 yushijinhun

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

g-plane avatar Mar 06 '21 15:03 g-plane

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.

erickskrauch avatar Mar 06 '21 15:03 erickskrauch

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.

qwq233 avatar Mar 06 '21 15:03 qwq233

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

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

yushijinhun avatar Mar 06 '21 15:03 yushijinhun

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.

yushijinhun avatar Mar 06 '21 15:03 yushijinhun

Is this icon used in launchers only?

g-plane avatar Mar 06 '21 15:03 g-plane

Is this icon used in launchers only?

So far, yes.

yushijinhun avatar Mar 06 '21 15:03 yushijinhun

我觉得可以单独加一个 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"
  }
}

mochaaP avatar Jul 27 '21 07:07 mochaaP