Skip to content

Commit 260e278

Browse files
VirxECswz-git
authored andcommitted
Properly clear icon (from #92)
1 parent a664925 commit 260e278

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

frontend/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function draggablePlayerToPlayerJs(d: DraggablePlayer): PlayerJs {
8585
}
8686
// We don't need to know the icon to start a bot.
8787
// This fixes oversized requests that result in a CORS error on windows (WebView2)
88-
player.config.settings.logoFile = "";
88+
player.icon = "";
8989

9090
return {
9191
sort: "rlbot",

frontend/src/pages/Home.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ async function updateBots() {
220220
distinguishDuplicates(result).map(([x, uniquePathSegment]) => {
221221
return {
222222
displayName: x.config.settings.name,
223-
icon: x.config.settings.logoFile,
223+
icon: x.icon,
224224
player: new BotInfo(x),
225225
id: crypto.randomUUID(),
226226
tags: x.config.details.tags,

players.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ type BotInfo struct {
163163
Config BotConfig `json:"config"`
164164
Loadout *LoadoutConfig `json:"loadout,omitempty"`
165165
TomlPath string `json:"tomlPath"`
166+
Icon string `json:"icon"`
166167
}
167168

168169
func (botInfo BotInfo) ToPlayerConfig(team uint32) *flat.PlayerConfigurationT {
@@ -279,6 +280,7 @@ func (a *App) GetBots(paths []string) []BotInfo {
279280
}
280281

281282
// Read logo file and convert it to data url so the frontend can use it
283+
var icon string;
282284
logo_data, err := os.ReadFile(logo_file)
283285
if err != nil {
284286
// only warn if the logo file was explicitly set
@@ -288,7 +290,7 @@ func (a *App) GetBots(paths []string) []BotInfo {
288290
} else {
289291
mtype := mimetype.Detect(logo_data)
290292
b64data := base64.StdEncoding.EncodeToString(logo_data)
291-
conf.Settings.LogoFile = "data:" + mtype.String() + ";base64," + b64data
293+
icon = "data:" + mtype.String() + ";base64," + b64data
292294
}
293295

294296
var loadout *LoadoutConfig = nil
@@ -304,6 +306,7 @@ func (a *App) GetBots(paths []string) []BotInfo {
304306
Config: conf,
305307
Loadout: loadout,
306308
TomlPath: potentialConfigPath,
309+
Icon: icon,
307310
})
308311
}
309312

0 commit comments

Comments
 (0)