diff --git a/src/main.js b/src/main.js index ee31c8b..9590865 100644 --- a/src/main.js +++ b/src/main.js @@ -375,7 +375,8 @@ $(el.accountSettingsModal).on('click',e=>{if(e.target===el.accountSettingsModal| $(el.setUserAvatarBtn).on('click',()=>el.userAvatarInput.click()); $(el.userAvatarInput).on('change',async()=>{const f=el.userAvatarInput.files?.[0];if(!f)return;try{const v=await imgToWebp(f);USER.avatar=v;el.userAvatarPreview.src=v;el.userAvatarPreview.classList.remove('bg-gray-200');renderUserUI()}catch{}}); $(el.accountSettingsForm).on('submit',e=>{e.preventDefault();USER.provider=el.set_provider.value||'openrouter';USER.apiKeyOpenRouter=String(el.set_api_key_or.value||'').trim();USER.apiKeyOpenAI=String(el.set_api_key_oai.value||'').trim();USER.apiKeyGoogle=String(el.set_api_key_g.value||'').trim();USER.apiKeyAnthropic=String(el.set_api_key_ant.value||'').trim();USER.apiKeyCloudflare=String(el.set_api_key_cf.value||'').trim();USER.customKey1=String(el.set_api_key_custom1.value||'').trim();USER.masterPrompt=String(el.set_master_prompt.value||'').trim();USER.titleModel=String(el.set_title_model.value||'').trim();USER.githubToken=String(el.set_gh_token.value||'').trim();USER.name=String(el.set_user_name.value||'').trim();renderUserUI();closeAccountSettings()}) -$(el.accountPanelAPI).on('click',e=>{const b=e.target.closest('[data-reveal-for]');if(!b)return;const i=document.getElementById(b.dataset.revealFor);if(!i)return;const m=i.classList.toggle('key-mask');b.innerHTML=``;icons()}); +const setIco=(b,n)=>{b.innerHTML=``;icons()}; +$(el.accountPanelAPI).on('click',async e=>{const c=e.target.closest('[data-copy-for]');if(c){if(await copyToClipboard(document.getElementById(c.dataset.copyFor)?.value||''))setIco(c,'check'),setTimeout(()=>setIco(c,'copy'),1200);return}const b=e.target.closest('[data-reveal-for]'),i=b&&document.getElementById(b.dataset.revealFor);if(!i)return;const p=i.type==='password';i.type=p?'text':'password';setIco(b,p?'eye-off':'eye')}); el.accountTabGeneral.onclick=()=>showAccountTab('General');el.accountTabAPI.onclick=()=>showAccountTab('API');el.accountTabUser.onclick=()=>showAccountTab('User') el.exportAccountSettings.onclick=()=>dl(`sune-account-${ts()}.json`,{v:1,provider:USER.provider,apiKeyOpenRouter:USER.apiKeyOpenRouter,apiKeyOpenAI:USER.apiKeyOpenAI,apiKeyGoogle:USER.apiKeyGoogle,apiKeyAnthropic:USER.apiKeyAnthropic,apiKeyCloudflare:USER.apiKeyCloudflare,customKey1:USER.customKey1,masterPrompt:USER.masterPrompt,titleModel:USER.titleModel,githubToken:USER.githubToken,userName:USER.name,userAvatar:USER.avatar}); el.importAccountSettings.onclick=()=>{el.importAccountSettingsInput.value='';el.importAccountSettingsInput.click()}; diff --git a/src/parts/modals.html b/src/parts/modals.html index 299c1c2..8997de0 100644 --- a/src/parts/modals.html +++ b/src/parts/modals.html @@ -122,7 +122,7 @@

Stored locally.

Used for auto-generating thread titles.

- +