diff --git a/app/js/post/post.js b/app/js/post/post.js
index e86da973..2fcda3d5 100644
--- a/app/js/post/post.js
+++ b/app/js/post/post.js
@@ -148,10 +148,17 @@ function post(mode, postvis) {
}
}
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()
httpreq.open('POST', start, true)
httpreq.setRequestHeader('Content-Type', 'application/json')
httpreq.setRequestHeader('Authorization', 'Bearer ' + at)
+ httpreq.setRequestHeader('Idempotency-Key', ideKey)
httpreq.responseType = 'json'
httpreq.send(JSON.stringify(toot))
httpreq.onreadystatechange = function() {
@@ -159,6 +166,8 @@ function post(mode, postvis) {
var json = httpreq.response
if (this.status !== 200) {
setLog(start, this.status, json)
+ } else {
+ $('#ideKey').val('')
}
var box = localStorage.getItem('box')
if (box == 'yes' || !box) {
@@ -255,6 +264,7 @@ function misskeyPost() {
//クリア(Shift+C)
function clear() {
$('#textarea').val('')
+ $('#ideKey').val('')
if (localStorage.getItem('stable')) {
$('#textarea').val('#' + localStorage.getItem('stable') + ' ')
}
diff --git a/app/js/post/status.js b/app/js/post/status.js
index b3773238..929ba983 100644
--- a/app/js/post/status.js
+++ b/app/js/post/status.js
@@ -454,6 +454,9 @@ function redraft(id, acct_id) {
$('#nsfw').html('visibility')
$('#nsfw').addClass('nsfw-avail')
}
+ if(json.in_reply_to_id){
+ $('#reply').val(json.in_reply_to_id)
+ }
}
}
}
diff --git a/app/view/make/index.sample.html b/app/view/make/index.sample.html
index 54ca70df..ed5db95e 100644
--- a/app/view/make/index.sample.html
+++ b/app/view/make/index.sample.html
@@ -258,6 +258,7 @@
+