diff --git a/VERSION.properties b/VERSION.properties index 2de39460..5928cca4 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.4.18 +client.version=1.4.19 server.version=1.4.5 diff --git a/shine-UI/js/components/arweave-attachment-manager.js b/shine-UI/js/components/arweave-attachment-manager.js index 3c77f75b..a2539914 100644 --- a/shine-UI/js/components/arweave-attachment-manager.js +++ b/shine-UI/js/components/arweave-attachment-manager.js @@ -10,6 +10,7 @@ import { addArweaveWalletSecret, getArweaveBalance, getArweaveWalletChoices } fr import { escapeHtml, formatBytes, normalizeAttachment } from '../services/attachment-format.js'; const HISTORY_KEY = 'shine-ui-arweave-attachment-history-v1'; +const LAST_WALLET_KEY_PREFIX = 'shine-ui-arweave-last-wallet-v1:'; const MAX_HISTORY_ITEMS = 100; const RECENT_UPLOAD_MS = 20 * 60 * 1000; @@ -135,6 +136,27 @@ function shortAddress(value) { return `${raw.slice(0, 8)}...${raw.slice(-6)}`; } +function lastWalletStorageKey(login) { + return `${LAST_WALLET_KEY_PREFIX}${String(login || '').trim().toLowerCase() || 'anonymous'}`; +} + +function readLastWalletId(login) { + try { + return sessionStorage.getItem(lastWalletStorageKey(login)) || ''; + } catch { + return ''; + } +} + +function writeLastWalletId(login, walletId) { + try { + const clean = String(walletId || '').trim(); + if (clean) sessionStorage.setItem(lastWalletStorageKey(login), clean); + } catch { + // Если sessionStorage недоступен, выбор сохраняется хотя бы в текущем окне менеджера. + } +} + async function resizeImageFileToAvatar(file) { const source = file instanceof File ? file : null; if (!source) throw new Error('Выберите изображение.'); @@ -186,7 +208,7 @@ export function openArweaveAttachmentManager({ let closed = false; let wallets = []; - let selectedWalletId = 'derived-client-key'; + let selectedWalletId = readLastWalletId(cleanLogin) || 'derived-client-key'; let selectedFile = null; let selectedSha256 = ''; let priceInfo = null; @@ -235,6 +257,7 @@ export function openArweaveAttachmentManager({ if (!wallets.some((item) => String(item.id) === String(selectedWalletId))) { selectedWalletId = String(wallets[0]?.id || 'derived-client-key'); } + writeLastWalletId(cleanLogin, selectedWalletId); } catch (error) { setText(errorEl, error?.message || 'Не удалось загрузить Arweave-кошельки.'); } @@ -246,7 +269,7 @@ export function openArweaveAttachmentManager({