Files
adaptive-music/src/foundry/connection-draft.mjs
T

7 lines
528 B
JavaScript
Raw Normal View History

// Secrets stay in closure memory across failed attempts and window rerenders.
// Never carry a token to a changed server, including a scheme/port change.
export function connectionDraft(previous,profile,campaign){
let same=false;try{same=new URL(previous?.maUrl).origin===new URL(profile.maUrl).origin;}catch{}
const old=same?previous:{};
return {...old,...profile,token:profile.token||old?.token,identityStorage:profile.identityStorage?.['sendspin-identity-sk']?profile.identityStorage:old?.identityStorage,campaign};
}