embeded pandora mobile view

This commit is contained in:
j 2023-07-15 13:00:36 +05:30
commit b420bf43b7
45 changed files with 3437 additions and 0 deletions

25
app/static/js/api.js Normal file
View file

@ -0,0 +1,25 @@
var pandora = {
format: getFormat(),
hostname: document.location.hostname || 'pad.ma'
}
var pandoraURL = document.location.hostname ? "" : `https://${pandora.hostname}`
var cache = cache || {}
async function pandoraAPI(action, data) {
var url = pandoraURL + '/api/'
var key = JSON.stringify([action, data])
if (!cache[key]) {
var response = await fetch(url, {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
action: action,
data: data
})
})
cache[key] = await response.json()
}
return cache[key]
}