post mirc to HTTP, thx chz

This commit is contained in:
Hugh Bord 2021-08-21 10:13:56 +10:00
bovenliggende 60087da06c e944309433
commit 96ede27286
3 gewijzigde bestanden met toevoegingen van 54 en 83 verwijderingen

Bestand weergeven

@ -88,6 +88,8 @@ ASCIIBIRD is mostly usable. There are some bugs however to note at the moment. R
## User Feedback Requests
* Toolbars and panels follow when scrolling down
* Rename Layers
* Move brush with keys and space to paint
# Keyboard Shortcuts
@ -105,6 +107,7 @@ ASCIIBIRD is mostly usable. There are some bugs however to note at the moment. R
* When the character picker is open, you can also press any key on your keyboard to set the character.
## Toolbar Keyboard Shortcuts
The toolbar keyboard shorts are used with the ALT key.
* Alt 1 to 8 - Will toggle the corresponding toolbar icon

Bestand weergeven

@ -8,15 +8,12 @@
:selected-blocks="selectedBlocks"
:text-editing="textEditing"
:selecting="selecting"
:showing-post-url="showingPostUrl"
@updatecanvas="updatecanvas"
:is-inputting-brush-size="this.isInputtingBrushSize"
/>
<context-menu
:display="showContextMenu"
ref="menu"
class="z-50"
>
<context-menu :display="showContextMenu" ref="menu" class="z-50">
<ul>
<li
@click="$store.commit('openModal', 'new-ascii')"
@ -38,13 +35,8 @@
v-if="asciibirdMeta.length"
>
Close Ascii
</li>
<li
@click="startImport('mirc')"
class="ml-1"
>
Import mIRC from File
</li>
<li @click="startImport('mirc')" class="ml-1">Import mIRC from File</li>
<li
@click="startExport('file')"
class="ml-1 border-b"
@ -52,14 +44,11 @@
>
Export mIRC to File
</li>
<li
class="ml-1"
@click="$store.commit('openModal', 'paste-ascii')"
>
<li class="ml-1" @click="$store.commit('openModal', 'paste-ascii')">
Import mIRC from Clipboard
</li>
<li
class="ml-1 border-b"
class="ml-1"
@click="startExport('clipboard')"
v-if="asciibirdMeta.length"
>
@ -70,7 +59,7 @@
@click="startExport('post')"
v-if="asciibirdMeta.length"
>
Post to HTTP
Export mIRC to HTTP POST
</li>
<li
@click="exportAsciibirdState()"
@ -79,18 +68,8 @@
>
Save Asciibird State
</li>
<li
@click="startImport('asb')"
class="ml-1"
>
Load Asciibird State
</li>
<li
@click="clearCache()"
class="ml-1"
>
Reset State
</li>
<li @click="startImport('asb')" class="ml-1">Load Asciibird State</li>
<li @click="clearCache()" class="ml-1">Reset State</li>
</ul>
</context-menu>
@ -105,18 +84,14 @@
style="display: none"
ref="asciiInput"
@change="onImport()"
>
/>
<template v-if="asciibirdMeta.length">
<div class="bg-gray-500 z-50">
<t-button
class="p-1 rounded-xl"
@click="openContextMenu"
>
<t-button class="p-1 rounded-xl" @click="openContextMenu">
:::
</t-button>
<span
v-for="(value, key) in asciibirdMeta"
:key="key"
@ -129,21 +104,12 @@
>
{{ value.title }}
<t-button
class="z-50"
@click="closeTab(key)"
>
X
</t-button>
<t-button class="z-50" @click="closeTab(key)"> X </t-button>
</t-button>
</span>
</div>
<Toolbar
:canvas-x="canvasX"
:canvas-y="canvasY"
class="z-10"
/>
<Toolbar :canvas-x="canvasX" :canvas-y="canvasY" class="z-10" />
<DebugPanel
:canvas-x="canvasX"
:canvas-y="canvasY"
@ -160,19 +126,13 @@
class="z-10"
/>
<CharPicker
v-if="toolbarState.isChoosingChar"
class="z-10"
/>
<CharPicker v-if="toolbarState.isChoosingChar" class="z-10" />
<ColourPicker
v-if="toolbarState.isChoosingFg || toolbarState.isChoosingBg"
class="z-10"
/>
<BrushLibrary
v-if="brushLibraryState.visible"
class="z-10"
/>
<BrushLibrary v-if="brushLibraryState.visible" class="z-10" />
<BrushPreview class="z-10" @inputtingbrush="inputtingbrush" />
<LayersLibrary class="z-10" />
</template>
@ -189,9 +149,7 @@
@mouseup.right="openContextMenu"
@contextmenu.prevent
>
<h1 class="text-4xl">
ASCIIBIRD
</h1>
<h1 class="text-4xl">ASCIIBIRD</h1>
<h3>Right click to start</h3>
<BrushCanvas :blocks="splashAscii" />
@ -248,7 +206,7 @@ export default {
BrushCanvas,
BrushPreview,
KeyboardShortcuts,
LayersLibrary
LayersLibrary,
},
name: "Dashboard",
data: () => ({
@ -263,6 +221,7 @@ export default {
updateCanvas: false,
selecting: null,
isInputtingBrushSize: false,
showingPostUrl: false,
}),
computed: {
splashAscii() {
@ -319,13 +278,13 @@ export default {
},
methods: {
inputtingbrush(val) {
this.isInputtingBrushSize = val
this.isInputtingBrushSize = val;
},
buttonStyle(key) {
return (this.currentTab === key)
return this.currentTab === key
? `text-sm pl-1 p-1 h-10 text-white border border-transparent shadow-sm hover:bg-blue-500 bg-gray-900`
: `text-sm pl-1 p-1 h-10 text-white border border-transparent shadow-sm hover:bg-blue-500 bg-gray-400`;
},
},
openContextMenu(e) {
e.preventDefault();
this.$refs.menu.open(e);
@ -335,16 +294,16 @@ export default {
this.canvasY = value.y;
},
selectedblocks(value) {
this.selectedBlocks = value
this.selectedBlocks = value;
},
updateSelecting(value) {
this.selecting = value
this.selecting = value;
},
textediting(value) {
this.textEditing = value
this.textEditing = value;
},
updatecanvas() {
this.updateCanvas = !this.updateCanvas
this.updateCanvas = !this.updateCanvas;
},
async onImport() {
const { files } = this.$refs.asciiInput;
@ -433,22 +392,31 @@ export default {
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"));
this.showingPostUrl = true;
this.$dialog
.prompt({
title: "Enter URL",
text: "Enter URL for POST command",
icon: "question",
inputValue: this.lastPostURL,
clickToClose: false,
})
.then((result) => {
if (result.isOk) {
this.lastPostURL = result.input;
const requestOptions = {
method: "POST",
headers: { "Content-Type": "application/octet-stream" },
body: ascii.output.join(""),
};
fetch(this.lastPostURL, requestOptions)
.then((response) => this.$toasted.show("POSTed ascii!"))
.catch((error) => this.$toasted.show("Error POSTing"));
}
this.showingPostUrl = false;
});
break;
}
},

Bestand weergeven

@ -23,7 +23,7 @@ export default {
// Stop blocking input when modals are open
// Whatever this char "'\0'" is it'd occur even without pressing any keys
// This fixes it
if (this.isModalOpen || e.key === "\0" || this.isInputtingBrushSize) {
if (this.isModalOpen || e.key === "\0" || this.isInputtingBrushSize || this.showingPostUrl) {
return;
}
@ -393,7 +393,7 @@ export default {
data: () => ({
isPressed: false,
}),
props: ["selectedBlocks", "textEditing", "selecting", "isInputtingBrushSize"],
props: ["selectedBlocks", "textEditing", "selecting", "isInputtingBrushSize", "showingPostUrl"],
computed: {
isModalOpen() {
return this.$store.getters.isModalOpen;