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
|
//v2/media
|
||||||
try {
|
try {
|
||||||
var id = await v2MediaUpload(domain, at, fd)
|
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 mediav = $('#media').val()
|
||||||
var regExp = new RegExp('tmp_' + r, 'g')
|
var regExp = new RegExp('tmp_' + r, 'g')
|
||||||
mediav = mediav.replace(regExp, id)
|
mediav = mediav.replace(regExp, id)
|
||||||
|
@ -152,6 +160,7 @@ async function media(b64, type, no, stamped) {
|
||||||
$('#imgup').text('')
|
$('#imgup').text('')
|
||||||
$('#imgsel').show()
|
$('#imgsel').show()
|
||||||
localStorage.removeItem('image')
|
localStorage.removeItem('image')
|
||||||
|
}
|
||||||
} catch {
|
} catch {
|
||||||
var start = 'https://' + domain + '/api/v1/media'
|
var start = 'https://' + domain + '/api/v1/media'
|
||||||
httpreq.open('POST', start, true)
|
httpreq.open('POST', start, true)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user