forked from 0x2620/pandora
add share link at /m/, add share dialog in view menu, fix preview for documents
This commit is contained in:
parent
17801df8de
commit
bea0d301a4
30 changed files with 2704 additions and 4 deletions
25
static/mobile/js/api.js
Normal file
25
static/mobile/js/api.js
Normal 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]
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue