add addons-webgl, protected with clientsettings flag (#532)

This commit is contained in:
Mike Sawka
2024-03-28 23:19:39 -07:00
committed by GitHub
parent 7c2265f3e3
commit 8a3d9628ba
6 changed files with 47 additions and 1 deletions
+13 -1
View File
@@ -5849,8 +5849,20 @@ func ClientSetCommand(ctx context.Context, pk *scpacket.FeCommandPacketType) (sc
return nil, fmt.Errorf("error updating client openai base url: %v", err)
}
}
if webglStr, found := pk.Kwargs["webgl"]; found {
webglVal := resolveBool(webglStr, false)
if webglVal {
varsUpdated = append(varsUpdated, "webgl")
}
clientOpts := clientData.ClientOpts
clientOpts.WebGL = webglVal
err = sstore.SetClientOpts(ctx, clientOpts)
if err != nil {
return nil, fmt.Errorf("error updating client webgl: %v", err)
}
}
if len(varsUpdated) == 0 {
return nil, fmt.Errorf("/client:set requires a value to set: %s", formatStrs([]string{"termfontsize", "termfontfamily", "openaiapitoken", "openaimodel", "openaibaseurl", "openaimaxtokens", "openaimaxchoices"}, "or", false))
return nil, fmt.Errorf("/client:set requires a value to set: %s", formatStrs([]string{"termfontsize", "termfontfamily", "openaiapitoken", "openaimodel", "openaibaseurl", "openaimaxtokens", "openaimaxchoices", "webgl"}, "or", false))
}
clientData, err = sstore.EnsureClientData(ctx)
if err != nil {
+1
View File
@@ -246,6 +246,7 @@ type ClientOptsType struct {
RightSidebar *SidebarValueType `json:"rightsidebar,omitempty"`
GlobalShortcut string `json:"globalshortcut,omitempty"`
GlobalShortcutEnabled bool `json:"globalshortcutenabled,omitempty"`
WebGL bool `json:"webgl,omitempty"`
}
type FeOptsType struct {