mirror of
https://github.com/EchoSixHIYA/WebSpeak-client-for-TeamSpeak.git
synced 2026-12-03 03:52:50 +08:00
release: prepare v0.2.8
This commit is contained in:
1 parent
4375f01d05
commit
54e154be1a
36 files changed
+1158
-195
No files matched your search
@@ -147,6 +147,25 @@ test("server list skins may display only the host-provided TeamSpeak icon image"
|
||||
errorCode(() => parseSkinPluginDocument(document), "SKIN_PLUGIN_ATTRIBUTE_INVALID");
|
||||
});
|
||||
|
||||
test("skin-owned localization messages are available without adding host permissions", () => {
|
||||
const document = validDocument();
|
||||
document.schemaVersion = 3;
|
||||
document.components[0].name = "{{skin.messages.demo.title}}";
|
||||
document.components[0].accessibleName = "{{skin.messages.accessibleName}}";
|
||||
document.components[0].permissions = [];
|
||||
document.components[0].actions = {};
|
||||
document.components[0].root = {
|
||||
tag: "section",
|
||||
attributes: { "aria-label": "{{skin.messages.demo.accessibility.label}}" },
|
||||
children: [{ text: "{{skin.messages.demo.greeting}}" }],
|
||||
};
|
||||
|
||||
const component = parseSkinPluginDocument(document).components[0];
|
||||
assert.equal(component.name, "{{skin.messages.demo.title}}");
|
||||
assert.equal(component.accessibleName, "{{skin.messages.accessibleName}}");
|
||||
assert.equal(component.root.children?.[0].text, "{{skin.messages.demo.greeting}}");
|
||||
});
|
||||
|
||||
test("chat panel visibility is host-controlled and its toggle requires chat access", () => {
|
||||
const document = validDocument();
|
||||
document.schemaVersion = 3;
|
||||
|
||||
@@ -327,10 +327,12 @@ function bindingPermissions(value: string, aliases: ReadonlyMap<string, string>,
|
||||
const found = new Set<SkinPluginPermission>();
|
||||
for (const match of value.matchAll(/\{\{\s*([a-z][a-zA-Z0-9]*(?:\.[a-z][a-zA-Z0-9]*){0,5})\s*\}\}/g)) {
|
||||
const path = match[1].split(".");
|
||||
if (path[0] === "state") {
|
||||
if (path.length !== 2 || !stateKeys.has(path[1])) fail("SKIN_PLUGIN_BINDING_INVALID", "A state binding must reference a declared local state key.");
|
||||
continue;
|
||||
}
|
||||
if (path[0] === "state") {
|
||||
if (path.length !== 2 || !stateKeys.has(path[1])) fail("SKIN_PLUGIN_BINDING_INVALID", "A state binding must reference a declared local state key.");
|
||||
continue;
|
||||
}
|
||||
if (path[0] === "skin" && path[1] === "locale" && path.length === 2) continue;
|
||||
if (path[0] === "skin" && path[1] === "messages" && path.length >= 3) continue;
|
||||
const aliasCollection = aliases.get(path[0]);
|
||||
if (aliasCollection) {
|
||||
if (path.length !== 2 || !COLLECTION_FIELDS[aliasCollection]?.has(path[1])) fail("SKIN_PLUGIN_BINDING_INVALID", "A repeated item binding references an unsupported public field.");
|
||||
|
||||
Reference in new issue
Block a user