Local hook images, server upload

This commit is contained in:
Kristian Polso 2018-06-08 12:56:28 +03:00
parent 5a6ccf22cb
commit cc922830ac
7 changed files with 35 additions and 6 deletions

View file

@ -109,15 +109,15 @@ export default {
data () { data () {
var images = [ var images = [
{ {
src: 'https://spee.ch/4f6b953e605a602434246743fd246d3e1fd4f5fd/carlsagan2.jpeg', src: './carlsagan2.jpg',
alt: 'Carl Sagan' alt: 'Carl Sagan'
}, },
{ {
src: 'https://spee.ch/2f90f2d91441a4d33d3d4eb82bdfc4c56ec742c7/doge-meme.jpeg', src: './doge-meme.jpg',
alt: 'Doge' alt: 'Doge'
}, },
{ {
src: 'https://spee.ch/40ac6818bbac87a208722bf4467653341d460908/lbry-green.png', src: 'lbry-green.png',
alt: 'LBRY Logo With Green Background' alt: 'LBRY Logo With Green Background'
} }
]; ];
@ -169,6 +169,7 @@ export default {
submit () { submit () {
var component = this; var component = this;
component.isLoading = true; component.isLoading = true;
var canvas = document.getElementById('meme-canvas');
component.$http.post('https:/lbry.tech/upload-image', document.getElementById('meme-canvas').toDataURL('image/png')).then(function(response) { component.$http.post('https:/lbry.tech/upload-image', document.getElementById('meme-canvas').toDataURL('image/png')).then(function(response) {
component.isLoading = false; component.isLoading = false;
console.log(response); console.log(response);

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View file

@ -16,6 +16,7 @@
"dependencies": { "dependencies": {
"@octokit/rest": "^15.4.0", "@octokit/rest": "^15.4.0",
"async": "^2.6.0", "async": "^2.6.0",
"body-parser": "^1.18.3",
"cors": "^2.8.4", "cors": "^2.8.4",
"cron": "^1.3.0", "cron": "^1.3.0",
"dotenv": "^5.0.1", "dotenv": "^5.0.1",

View file

@ -13,6 +13,7 @@ var path = require('path');
var serveStatic = require('serve-static'); var serveStatic = require('serve-static');
var request = require('request'); var request = require('request');
var cors = require('cors'); var cors = require('cors');
var bodyParser = require('body-parser');
// Cron // Cron
var CronJob = require('cron').CronJob; var CronJob = require('cron').CronJob;
// Github API // Github API
@ -42,6 +43,8 @@ app.use(serveStatic(__dirname + "/content/.vuepress/dist"));
app.use(cors()); app.use(cors());
app.use(bodyParser.text());
app.get('/forward', function(req, res) { app.get('/forward', function(req, res) {
var allowedMethods = ["wallet_send", "resolve", "publish"]; var allowedMethods = ["wallet_send", "resolve", "publish"];

View file

@ -1134,6 +1134,21 @@ body-parser@1.18.2:
raw-body "2.3.2" raw-body "2.3.2"
type-is "~1.6.15" type-is "~1.6.15"
body-parser@^1.18.3:
version "1.18.3"
resolved "https://registry.yarnpkg.com/body-parser/-/body-parser-1.18.3.tgz#5b292198ffdd553b3a0f20ded0592b956955c8b4"
dependencies:
bytes "3.0.0"
content-type "~1.0.4"
debug "2.6.9"
depd "~1.1.2"
http-errors "~1.6.3"
iconv-lite "0.4.23"
on-finished "~2.3.0"
qs "6.5.2"
raw-body "2.3.3"
type-is "~1.6.16"
boolbase@~1.0.0: boolbase@~1.0.0:
version "1.0.0" version "1.0.0"
resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e" resolved "https://registry.yarnpkg.com/boolbase/-/boolbase-1.0.0.tgz#68dff5fbe60c51eb37725ea9e3ed310dcc1e776e"
@ -3222,7 +3237,7 @@ http-errors@1.6.2:
setprototypeof "1.0.3" setprototypeof "1.0.3"
statuses ">= 1.3.1 < 2" statuses ">= 1.3.1 < 2"
http-errors@^1.2.8, http-errors@^1.6.1, http-errors@~1.6.1, http-errors@~1.6.2: http-errors@1.6.3, http-errors@^1.2.8, http-errors@^1.6.1, http-errors@~1.6.1, http-errors@~1.6.2, http-errors@~1.6.3:
version "1.6.3" version "1.6.3"
resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d" resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-1.6.3.tgz#8b55680bb4be283a0b5bf4ea2e38580be1d9320d"
dependencies: dependencies:
@ -3269,7 +3284,7 @@ iconv-lite@0.4.19:
version "0.4.19" version "0.4.19"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.19.tgz#f7468f60135f5e5dad3399c0a81be9a1603a082b"
iconv-lite@^0.4.4: iconv-lite@0.4.23, iconv-lite@^0.4.4:
version "0.4.23" version "0.4.23"
resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63" resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.23.tgz#297871f63be507adcfbfca715d0cd0eed84e9a63"
dependencies: dependencies:
@ -5404,7 +5419,7 @@ qs@6.5.1, qs@~6.5.1:
version "6.5.1" version "6.5.1"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.1.tgz#349cdf6eef89ec45c12d7d5eb3fc0c870343a6d8"
qs@^6.5.1: qs@6.5.2, qs@^6.5.1:
version "6.5.2" version "6.5.2"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36" resolved "https://registry.yarnpkg.com/qs/-/qs-6.5.2.tgz#cb3ae806e8740444584ef154ce8ee98d403f3e36"
@ -5465,6 +5480,15 @@ raw-body@2.3.2:
iconv-lite "0.4.19" iconv-lite "0.4.19"
unpipe "1.0.0" unpipe "1.0.0"
raw-body@2.3.3:
version "2.3.3"
resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.3.3.tgz#1b324ece6b5706e153855bc1148c65bb7f6ea0c3"
dependencies:
bytes "3.0.0"
http-errors "1.6.3"
iconv-lite "0.4.23"
unpipe "1.0.0"
rc@^1.0.1, rc@^1.1.6, rc@^1.1.7: rc@^1.0.1, rc@^1.1.6, rc@^1.1.7:
version "1.2.8" version "1.2.8"
resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed" resolved "https://registry.yarnpkg.com/rc/-/rc-1.2.8.tgz#cd924bf5200a075b83c188cd6b9e211b7fc0d3ed"