Skip to content

Commit 768d228

Browse files
committed
improved updater
1 parent 97c233c commit 768d228

34 files changed

Lines changed: 1261 additions & 1120 deletions

backend/i18n/i18n.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func flattenJSON(prefix string, value interface{}, result map[string]string) {
170170
// The original code lowercased keys, so we'll keep that behavior for the last segment?
171171
// Or better, lowercase the whole key to be case-insensitive?
172172
// Let's stick to the original logic: lowercasing keys.
173-
newKey = strings.ToLower(newKey)
173+
// newKey = strings.ToLower(newKey) // Removed to preserve case for nested keys like TITLE.window_title
174174

175175
switch val := v.(type) {
176176
case map[string]interface{}:

backend/updater/component_updater.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func (u *Updater) CheckForComponentUpdates() ([]ComponentUpdate, error) {
134134
Type: "theme",
135135
Name: name,
136136
Version: remoteInfo.Version,
137-
Changelog: remoteInfo.Changelog,
137+
Changelog: string(remoteInfo.Changelog),
138138
})
139139
}
140140
}
@@ -147,7 +147,7 @@ func (u *Updater) CheckForComponentUpdates() ([]ComponentUpdate, error) {
147147
Type: "locale",
148148
Name: name,
149149
Version: remoteInfo.Version,
150-
Changelog: remoteInfo.Changelog,
150+
Changelog: string(remoteInfo.Changelog),
151151
})
152152
}
153153
}
@@ -229,12 +229,12 @@ func (u *Updater) UpdateComponent(update ComponentUpdate) error {
229229
if update.Type == "theme" {
230230
local.Themes[update.Name] = version.ComponentInfo{
231231
Version: update.Version,
232-
Changelog: update.Changelog,
232+
Changelog: version.MultiLineString(update.Changelog),
233233
}
234234
} else {
235235
local.Locales[update.Name] = version.ComponentInfo{
236236
Version: update.Version,
237-
Changelog: update.Changelog,
237+
Changelog: version.MultiLineString(update.Changelog),
238238
}
239239
}
240240

backend/version/version.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,27 @@ import (
99
"strings"
1010
)
1111

12+
type MultiLineString string
13+
14+
func (m *MultiLineString) UnmarshalJSON(data []byte) error {
15+
var single string
16+
if err := json.Unmarshal(data, &single); err == nil {
17+
*m = MultiLineString(single)
18+
return nil
19+
}
20+
21+
var multi []string
22+
if err := json.Unmarshal(data, &multi); err == nil {
23+
*m = MultiLineString(strings.Join(multi, "\n"))
24+
return nil
25+
}
26+
27+
return nil
28+
}
29+
1230
type ComponentInfo struct {
13-
Version string `json:"version"`
14-
Changelog string `json:"changelog,omitempty"`
31+
Version string `json:"version"`
32+
Changelog MultiLineString `json:"changelog,omitempty"`
1533
}
1634

1735
type Manifest struct {

frontend/src/App.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import Watcher from './App/footer/Watcher.svelte';
66
import Actions from './App/footer/Actions.svelte';
77
import ConfigNotification from './App/ConfigNotification.svelte';
8-
import UpdaterNotification from './App/footer/UpdaterNotification.svelte';
8+
import UpdaterNotification from './App/UpdaterNotification.svelte';
99
import { onMount } from 'svelte';
1010
import { appSettings } from './App/lib/store/appSettings';
1111
import { openSettings, isSettingsOpen } from './App/lib/store/settingsModal';

frontend/src/App/ConfigNotification.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<div class="notification">
2727
<div class="notification-content">
2828
<span>{$t('config_not_found')}</span>
29-
<button onclick={openSettings}>{$t('select_path')}</button>
29+
<button onclick={openSettings}>{$t('SETTING.GENERAL.select_path')}</button>
3030
</div>
3131
</div>
3232
{/if}

frontend/src/App/Tabs.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
{#if icon}
4949
<span class="tab-icon">{@html icon}</span>
5050
{/if}
51-
<span class="tab-label">{$t(`${id.toLowerCase()}_tab`)}</span>
51+
<span class="tab-label">{$t(`${id.toUpperCase()}.${id.toLowerCase()}_tab`)}</span>
5252
</button>
5353
{/each}
5454
</div>

0 commit comments

Comments
 (0)