#185 in reply id

This commit is contained in:
cutls 2019-11-26 23:48:22 +09:00
parent 3243602653
commit 87aee3764b
3 changed files with 14 additions and 0 deletions

View File

@ -148,10 +148,17 @@ function post(mode, postvis) {
} }
} }
console.table(toot) console.table(toot)
if($('#ideKey').val() != ''){
var ideKey = $('#ideKey').val()
} else {
var ideKey = Date.now() + '/' + Math.random().toString(32).substring(2)
$('#ideKey').val(ideKey)
}
var httpreq = new XMLHttpRequest() var httpreq = new XMLHttpRequest()
httpreq.open('POST', start, true) httpreq.open('POST', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json') httpreq.setRequestHeader('Content-Type', 'application/json')
httpreq.setRequestHeader('Authorization', 'Bearer ' + at) httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
httpreq.setRequestHeader('Idempotency-Key', ideKey)
httpreq.responseType = 'json' httpreq.responseType = 'json'
httpreq.send(JSON.stringify(toot)) httpreq.send(JSON.stringify(toot))
httpreq.onreadystatechange = function() { httpreq.onreadystatechange = function() {
@ -159,6 +166,8 @@ function post(mode, postvis) {
var json = httpreq.response var json = httpreq.response
if (this.status !== 200) { if (this.status !== 200) {
setLog(start, this.status, json) setLog(start, this.status, json)
} else {
$('#ideKey').val('')
} }
var box = localStorage.getItem('box') var box = localStorage.getItem('box')
if (box == 'yes' || !box) { if (box == 'yes' || !box) {
@ -255,6 +264,7 @@ function misskeyPost() {
//クリア(Shift+C) //クリア(Shift+C)
function clear() { function clear() {
$('#textarea').val('') $('#textarea').val('')
$('#ideKey').val('')
if (localStorage.getItem('stable')) { if (localStorage.getItem('stable')) {
$('#textarea').val('#' + localStorage.getItem('stable') + ' ') $('#textarea').val('#' + localStorage.getItem('stable') + ' ')
} }

View File

@ -454,6 +454,9 @@ function redraft(id, acct_id) {
$('#nsfw').html('visibility') $('#nsfw').html('visibility')
$('#nsfw').addClass('nsfw-avail') $('#nsfw').addClass('nsfw-avail')
} }
if(json.in_reply_to_id){
$('#reply').val(json.in_reply_to_id)
}
} }
} }
} }

View File

@ -258,6 +258,7 @@
</ul> </ul>
<!--hidden area--> <!--hidden area-->
<input type="hidden" id="reply"> <input type="hidden" id="reply">
<input type="hidden" id="ideKey">
<input type="hidden" id="quote"> <input type="hidden" id="quote">
<input type="hidden" id="media"> <input type="hidden" id="media">
<!--END hidden area--> <!--END hidden area-->