Fix: Pleroma image upload
This commit is contained in:
parent
6ddc613b5a
commit
b2564cfabb
|
@ -133,6 +133,14 @@ async function media(b64, type, no, stamped) {
|
|||
//v2/media
|
||||
try {
|
||||
var id = await v2MediaUpload(domain, at, fd)
|
||||
if(!id) {
|
||||
var start = 'https://' + domain + '/api/v1/media'
|
||||
httpreq.open('POST', start, true)
|
||||
httpreq.upload.addEventListener('progress', progshow, false)
|
||||
httpreq.responseType = 'json'
|
||||
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
|
||||
httpreq.send(fd)
|
||||
} else {
|
||||
var mediav = $('#media').val()
|
||||
var regExp = new RegExp('tmp_' + r, 'g')
|
||||
mediav = mediav.replace(regExp, id)
|
||||
|
@ -152,6 +160,7 @@ async function media(b64, type, no, stamped) {
|
|||
$('#imgup').text('')
|
||||
$('#imgsel').show()
|
||||
localStorage.removeItem('image')
|
||||
}
|
||||
} catch {
|
||||
var start = 'https://' + domain + '/api/v1/media'
|
||||
httpreq.open('POST', start, true)
|
||||
|
|
Loading…
Reference in New Issue
Block a user