dashboard: POST to HTTP (#11)
Adds a menu option to POST the ASCII to a URL. Co-authored-by: chzchzchz <chzchzchz@users.noreply.github.com>
This commit is contained in:
szülő
8d5b82cd5b
commit
60087da06c
|
@ -65,6 +65,13 @@
|
|||
>
|
||||
Export mIRC to Clipboard
|
||||
</li>
|
||||
<li
|
||||
class="ml-1 border-b"
|
||||
@click="startExport('post')"
|
||||
v-if="asciibirdMeta.length"
|
||||
>
|
||||
Post to HTTP
|
||||
</li>
|
||||
<li
|
||||
@click="exportAsciibirdState()"
|
||||
class="ml-1"
|
||||
|
@ -425,6 +432,24 @@ export default {
|
|||
case "file":
|
||||
downloadFile(ascii.output.join(""), ascii.filename, "text/plain");
|
||||
break;
|
||||
case "post":
|
||||
if (!this.lastPostURL) {
|
||||
this.lastPostURL = "http://localhost:9991/bot/efnet?target=%23jrh";
|
||||
}
|
||||
let postURL = prompt("Enter URL for POST command", this.lastPostURL);
|
||||
if (postURL == null) {
|
||||
break;
|
||||
}
|
||||
this.lastPostURL = postURL;
|
||||
const requestOptions = {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/octet-stream" },
|
||||
body: ascii.output.join("")
|
||||
};
|
||||
fetch(postURL, requestOptions)
|
||||
.then(response => this.$toasted.show("POSTed ascii!"))
|
||||
.catch(error => this.$toasted.show("Error POSTing"));
|
||||
break;
|
||||
}
|
||||
},
|
||||
changeTab(key) {
|
||||
|
|
Betöltés…
Reference in New Issue