Hook step2 uploading
This commit is contained in:
parent
1ceba0b035
commit
5a6ccf22cb
2 changed files with 26 additions and 4 deletions
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form class="hook__page__content__meme right">
|
<form class="hook__page__content__meme right" v-on:submit.prevent="submit">
|
||||||
|
|
||||||
<h2>Image Text</h2>
|
<h2>Image Text</h2>
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<input type="submit" class="__button-black" v-on:click="submit" value="Submit"/>
|
<input type="submit" class="__button-black" value="Submit"/>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
@ -167,8 +167,15 @@ export default {
|
||||||
ctx.fillText(this.bottomLine.toUpperCase(), canvasWidth / 2, (canvasHeight - 40));
|
ctx.fillText(this.bottomLine.toUpperCase(), canvasWidth / 2, (canvasHeight - 40));
|
||||||
},
|
},
|
||||||
submit () {
|
submit () {
|
||||||
// TODO: Do the upload
|
var component = this;
|
||||||
EventBus.$emit('HookFileUploaded', 'txhashhere');
|
component.isLoading = true;
|
||||||
|
component.$http.post('https:/lbry.tech/upload-image', document.getElementById('meme-canvas').toDataURL('image/png')).then(function(response) {
|
||||||
|
component.isLoading = false;
|
||||||
|
console.log(response);
|
||||||
|
});
|
||||||
|
|
||||||
|
//EventBus.$emit('HookFileUploaded', 'txhashhere');
|
||||||
|
|
||||||
},
|
},
|
||||||
imagesLoaded (instance) {
|
imagesLoaded (instance) {
|
||||||
var component = this;
|
var component = this;
|
||||||
|
|
15
server.js
15
server.js
|
@ -102,6 +102,21 @@ app.get('/github-feed', function(req, res) {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
app.post('/upload-image', function(req, res) {
|
||||||
|
|
||||||
|
request({
|
||||||
|
method: "PUT",
|
||||||
|
url: "http://daemon.lbry.tech/images.php",
|
||||||
|
qs: {
|
||||||
|
access_token: process.env.LBRY_DAEMON_ACCESS_TOKEN
|
||||||
|
},
|
||||||
|
body: req.body,
|
||||||
|
}, function(error, response, body) {
|
||||||
|
res.json(body);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
app.get('/*', function(req, res) {
|
app.get('/*', function(req, res) {
|
||||||
|
|
||||||
if(fs.existsSync(__dirname + "/.vuepress/dist" + req.path + ".html")) {
|
if(fs.existsSync(__dirname + "/.vuepress/dist" + req.path + ".html")) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue