Files
adaptive-music/src/foundry/connection-draft.mjs
T
Jason 1ed30567fb
Validate and generate manual release / package (push) Waiting to run
Release v0.7.0 - Automatic pairing and validated MA audio playback
2026-12-04 08:58:47 -05:00

8 lines
528 B
JavaScript

// 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};
}