Skip to content

Commit

Permalink
fix consent fallback
Browse files Browse the repository at this point in the history
  • Loading branch information
sugoidogo committed Oct 29, 2023
1 parent 0f973ed commit d877fbc
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions v3/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -505,13 +505,26 @@ <h1>Clippy is Loading</h1>
if(response.ok){
return response.json()
}
consent=window.localStorage.getItem('consent')||'[]'
let postbody='[]'
try{
consent=window.localStorage.getItem('consent')
if(typeof consent === 'string' || consent instanceof String){
postbody=consent
consent=JSON.parse(postbody)
}else{
postbody=JSON.stringify(consent)
}
}catch(e){
console.warn(e)
consent=[]
postbody='[]'
}
fetch('https://ts.sugoidogo.com/consent.json',{
headers: tokens.auth_headers,
method: 'POST',
body:JSON.stringify(consent)
body:postbody
})
return JSON.parse(consent)
return consent
}).then(json=>consent=json)

</script>

0 comments on commit d877fbc

Please sign in to comment.