prepare for pubsub depreciation, switch to ebs services
This commit is contained in:
+1
-76
@@ -95,79 +95,4 @@
|
||||
overflow: hidden;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
import('https://cdn.jsdelivr.net/npm/@sentry/browser@8/+esm').then(sentry=>{
|
||||
sentry.init({
|
||||
dsn:'https://f5fe0dec9f2f42dc80153b67e7e00dd0@app.glitchtip.com/8359',
|
||||
environment:location.hostname,
|
||||
release:"1.1.0",
|
||||
integrations: [
|
||||
sentry.feedbackIntegration({colorScheme:"light"})
|
||||
]
|
||||
})
|
||||
}).catch(e=>{
|
||||
console.warn('automatic error reporting failed to load',e)
|
||||
})
|
||||
|
||||
try{
|
||||
if(window.location.search.includes('remotejs')){
|
||||
const channel=new URLSearchParams(window.location.search).get('remotejs')
|
||||
const script=document.createElement('script')
|
||||
script.src='https://remotejs.com/agent/agent.js'
|
||||
script.setAttribute("data-consolejs-channel",channel)
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
}catch(e){
|
||||
console.warn('remotejs load failed',e)
|
||||
}
|
||||
|
||||
window.onload=async function(){
|
||||
const client_id='ib2n7v7mur7ab2mcxv7rjju2ctsyoi'
|
||||
const scope='moderator:read:followers channel:read:subscriptions bits:read channel:read:charity chat:read chat:edit'
|
||||
const status_div=document.querySelector('div#status')
|
||||
status_div.innerHTML='Logging in to twitch...'
|
||||
const TBA=await import('https://tba.sugoidogo.com/tba.mjs')
|
||||
const tokens=await TBA.get_tokens(client_id,scope)
|
||||
document.querySelector('#timer-link').href+='?refresh_token='+tokens.refresh_token
|
||||
status_div.innerHTML='Loading settings...'
|
||||
const FormDataDeep=await import('https://sugoidogo.github.io/js-util/FormDataDeep.mjs')
|
||||
const config=await fetch('https://ts.sugoidogo.com/config.json',{headers:tokens.auth_headers})
|
||||
.then(async response=>{
|
||||
if(response.ok){
|
||||
try {
|
||||
return await response.json()
|
||||
} catch {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
console.warn(response.code,await response.text())
|
||||
return {}
|
||||
}
|
||||
).then(config=>{
|
||||
for(const checkbox of document.querySelectorAll('input[type=checkbox]')){
|
||||
checkbox.checked=false
|
||||
}
|
||||
for(const key in config){
|
||||
const input=document.querySelector('[name='+key+']')
|
||||
if(!input){
|
||||
continue
|
||||
}
|
||||
if(input.type=='checkbox'){
|
||||
input.checked=true
|
||||
}else{
|
||||
input.value=config[key]
|
||||
}
|
||||
}
|
||||
})
|
||||
status_div.innerHTML='Ready!'
|
||||
document.querySelector('form#config').onsubmit=function(event){
|
||||
event.preventDefault()
|
||||
const config=Object.fromEntries(new FormData(event.target))
|
||||
fetch('https://ts.sugoidogo.com/config.json',{
|
||||
headers:tokens.auth_headers,
|
||||
method:'POST',
|
||||
body:JSON.stringify(config)
|
||||
})
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script type="module" src="js/config.js"></script>
|
||||
Reference in New Issue
Block a user