SchemeDownloader: add support for spaces in names

This commit is contained in:
Ly-sec
2025-11-29 13:36:37 +01:00
parent e627e67463
commit d53a3d8de2
2 changed files with 21 additions and 6 deletions
@@ -241,9 +241,14 @@ Popup {
// Rate limit hit - try to use cache if available
downloadError = I18n.tr("settings.color-scheme.download.error.rate-limit");
Logger.w("ColorSchemeDownload", downloadError);
if (schemesCacheAdapter.schemes && schemesCacheAdapter.schemes.length > 0) {
availableSchemes = schemesCacheAdapter.schemes;
Logger.i("ColorSchemeDownload", "Using cached schemes due to rate limit");
if (typeof ShellState !== 'undefined' && ShellState.isLoaded) {
const cacheData = ShellState.getColorSchemesList();
const cachedSchemes = cacheData.schemes || [];
if (cachedSchemes.length > 0) {
availableSchemes = cachedSchemes;
hasInitialData = true;
Logger.i("ColorSchemeDownload", "Using cached schemes due to rate limit");
}
}
} else {
downloadError = I18n.tr("settings.color-scheme.download.error.api-error", {
@@ -740,7 +745,12 @@ Popup {
enabled: !fetching && !downloading
onClicked: {
// Force refresh by clearing cache timestamp and fetching directly from API
schemesCacheAdapter.timestamp = 0;
if (typeof ShellState !== 'undefined' && ShellState.isLoaded) {
ShellState.setColorSchemesList({
schemes: [],
timestamp: 0
});
}
// Fetch directly from API to avoid cache check delay
fetchAvailableSchemesFromAPI();
}