fixed publish issues
This commit is contained in:
parent
6d9523ff39
commit
d7a35bed78
12 changed files with 27 additions and 24 deletions
|
@ -7,6 +7,6 @@
|
||||||
},
|
},
|
||||||
"Database": {
|
"Database": {
|
||||||
"MySqlConnectionUri": "none",
|
"MySqlConnectionUri": "none",
|
||||||
"DownloadAddress": "C:\\lbry\\speech\\hosted_content"
|
"PublishUploadPath": "none"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,6 +6,7 @@
|
||||||
"googleId": "UA-100747990-1"
|
"googleId": "UA-100747990-1"
|
||||||
},
|
},
|
||||||
"Database": {
|
"Database": {
|
||||||
"MySqlConnectionUri": "none"
|
"MySqlConnectionUri": "none",
|
||||||
|
"PublishUploadPath": "C:\\lbry\\speech\\hosted_content"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,6 @@
|
||||||
},
|
},
|
||||||
"Database": {
|
"Database": {
|
||||||
"MySqlConnectionUri": "none",
|
"MySqlConnectionUri": "none",
|
||||||
"DownloadAddress": "~/Downloads/"
|
"PublishUploadPath": "~/Downloads/"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,6 @@
|
||||||
},
|
},
|
||||||
"Database": {
|
"Database": {
|
||||||
"MySqlConnectionUri": "none",
|
"MySqlConnectionUri": "none",
|
||||||
"DownloadAddress": "~/Downloads/"
|
"PublishUploadPath": "~/Downloads/"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,21 +5,22 @@ var errorHandlers = require("../helpers/libraries/errorHandlers.js");
|
||||||
|
|
||||||
var walledAddress = config.get('WalletConfig.lbryAddress');
|
var walledAddress = config.get('WalletConfig.lbryAddress');
|
||||||
|
|
||||||
function createPublishParams(name, filePath, license, nsfw) {
|
function createPublishParams(claim, filePath, license, nsfw) {
|
||||||
|
console.log("nsfw:", nsfw, typeof nsfw);
|
||||||
var publishParams = {
|
var publishParams = {
|
||||||
"name": name,
|
"name": claim,
|
||||||
"file_path": filePath,
|
"file_path": filePath,
|
||||||
"bid": 0.01,
|
"bid": 0.01,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"description": name + " published via spee.ch",
|
"description": claim + " published via spee.ch",
|
||||||
"title": name,
|
"title": claim,
|
||||||
"author": "spee.ch",
|
"author": "spee.ch",
|
||||||
"language": "en",
|
"language": "en",
|
||||||
"license": license,
|
"license": license,
|
||||||
"nsfw": (nsfw.toLowerCase() === "true")
|
"nsfw": (nsfw.toLowerCase() === "on")
|
||||||
},
|
},
|
||||||
"claim_address": walledAddress,
|
"claim_address": walledAddress,
|
||||||
"change_address": walledAddress //requires daemon 0.12.2rc1 or above
|
"change_address": walledAddress
|
||||||
};
|
};
|
||||||
return publishParams;
|
return publishParams;
|
||||||
}
|
}
|
||||||
|
@ -32,19 +33,19 @@ function deleteTemporaryFile(filePath) {
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
publish: function(name, filePath, fileType, license, nsfw, socket, visitor) {
|
publish: function(claim, fileName, filePath, fileType, license, nsfw, socket, visitor) {
|
||||||
// update the client
|
// update the client
|
||||||
socket.emit("publish-status", "Your image is being published (this might take a second)...");
|
socket.emit("publish-status", "Your image is being published (this might take a second)...");
|
||||||
// send to analytics
|
// send to analytics
|
||||||
visitor.event("Publish Route", "Publish Request", filePath).send();
|
visitor.event("Publish Route", "Publish Request", filePath).send();
|
||||||
// create the publish object
|
// create the publish object
|
||||||
var publishParams = createPublishParams(name, filePath, license, nsfw);
|
var publishParams = createPublishParams(claim, filePath, license, nsfw);
|
||||||
// get a promise to publish
|
// get a promise to publish
|
||||||
lbryApi.publishClaim(publishParams, fileType)
|
lbryApi.publishClaim(publishParams, fileName, fileType)
|
||||||
.then(function(result){
|
.then(function(result){
|
||||||
visitor.event("Publish Route", "Publish Success", filePath).send();
|
visitor.event("Publish Route", "Publish Success", filePath).send();
|
||||||
console.log("publish promise success. Tx info:", result)
|
console.log("publish promise success. Tx info:", result)
|
||||||
socket.emit("publish-complete", {name: name, result: result});
|
socket.emit("publish-complete", {name: claim, result: result});
|
||||||
})
|
})
|
||||||
.catch(function(error){
|
.catch(function(error){
|
||||||
visitor.event("Publish Route", "Publish Failure", filePath).send();
|
visitor.event("Publish Route", "Publish Failure", filePath).send();
|
||||||
|
|
|
@ -2,6 +2,6 @@ var getAllFreePublicClaims = require("../helpers/functions/getAllFreePublicClaim
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
getAllClaims: function(claimName){
|
getAllClaims: function(claimName){
|
||||||
return getAllFreePublicClaims(claimName); // to-do: does this need to be returned?
|
return getAllFreePublicClaims(claimName);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
module.exports = function(claim){
|
module.exports = function(claim){
|
||||||
console.log(">> isFreePublicClaim? claim:", claim);
|
console.log(">> check: isFreePublicClaim?");
|
||||||
if (((claim.value.stream.metadata.license.indexOf("Public Domain") != -1 ) || (claim.value.stream.metadata.license.indexOf("Creative Commons") != -1 ))
|
if (((claim.value.stream.metadata.license.indexOf("Public Domain") != -1 ) || (claim.value.stream.metadata.license.indexOf("Creative Commons") != -1 ))
|
||||||
&&
|
&&
|
||||||
(!claim.value.stream.metadata.fee || claim.value.stream.metadata.fee.amount === 0)) {
|
(!claim.value.stream.metadata.fee || claim.value.stream.metadata.fee.amount === 0)) {
|
||||||
|
|
|
@ -2,20 +2,20 @@ var axios = require('axios');
|
||||||
var db = require("../../models");
|
var db = require("../../models");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
publishClaim: function(publishParams, fileType){
|
publishClaim: function(publishParams, fileName, fileType){
|
||||||
var deferred = new Promise(function(resolve, reject){
|
var deferred = new Promise(function(resolve, reject){
|
||||||
console.log(">> lbryApi >> publishClaim:", publishParams);
|
console.log(">> lbryApi >> publishClaim:", publishParams);
|
||||||
axios.post('http://localhost:5279/lbryapi', {
|
axios.post('http://localhost:5279/lbryapi', {
|
||||||
"method": "publish",
|
"method": "publish",
|
||||||
"params": publishParams
|
"params": publishParams
|
||||||
}).then(function (response) {
|
}).then(function (response) {
|
||||||
console.log(">> 'publish' success");
|
console.log(">> 'publish' success", response);
|
||||||
var result = response.data.result;
|
var result = response.data.result;
|
||||||
db.File.create({
|
db.File.create({
|
||||||
name: publishParams.name,
|
name: publishParams.name,
|
||||||
claim_id: result.claim_id,
|
claim_id: result.claim_id,
|
||||||
outpoint: result.txid + ":" + result.nout,
|
outpoint: result.txid + ":" + result.nout,
|
||||||
file_name: "test",
|
file_name: fileName,
|
||||||
file_path: publishParams.file_path,
|
file_path: publishParams.file_path,
|
||||||
file_type: fileType,
|
file_type: fileType,
|
||||||
nsfw: publishParams.metadata.nsfw,
|
nsfw: publishParams.metadata.nsfw,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
var errorHandlers = require("../helpers/libraries/errorHandlers.js");
|
var errorHandlers = require("../helpers/libraries/errorHandlers.js");
|
||||||
var showController = require("../controllers/serveController.js");
|
var showController = require("../controllers/showController.js");
|
||||||
|
|
||||||
module.exports = function(app, ua, googleAnalyticsId){
|
module.exports = function(app, ua, googleAnalyticsId){
|
||||||
// route to fetch all free public claims
|
// route to fetch all free public claims
|
||||||
|
|
|
@ -23,12 +23,13 @@ module.exports = function(app, siofu, hostedContentPath, ua, googleAnalyticsId)
|
||||||
socket.emit("publish-status", event.error)
|
socket.emit("publish-status", event.error)
|
||||||
});
|
});
|
||||||
uploader.on("saved", function(event){
|
uploader.on("saved", function(event){
|
||||||
console.log("saved ", event.file.name, "deets:", event.file);
|
console.log("uploaded ", event.file.name);
|
||||||
if (event.file.success){
|
if (event.file.success){
|
||||||
socket.emit("publish-status", "file upload successfully completed");
|
socket.emit("publish-status", "file upload successfully completed");
|
||||||
publishController.publish(event.file.meta.name, event.file.pathName, event.file.meta.type, event.file.meta.license, event.file.meta.nsfw, socket, visitor)
|
publishController.publish(event.file.meta.name, event.file.name, event.file.pathName, event.file.meta.type, event.file.meta.license, event.file.meta.nsfw, socket, visitor)
|
||||||
} else {
|
} else {
|
||||||
socket.emit("publish-failure", "file uploaded, but with errors")
|
socket.emit("publish-failure", "file uploaded, but with errors")
|
||||||
|
// to-do: remove the file
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
// handle disconnect
|
// handle disconnect
|
||||||
|
|
|
@ -10,7 +10,7 @@ var config = require('config');
|
||||||
var ua = require('universal-analytics');
|
var ua = require('universal-analytics');
|
||||||
|
|
||||||
var googleAnalyticsId = config.get('AnalyticsConfig.googleId');
|
var googleAnalyticsId = config.get('AnalyticsConfig.googleId');
|
||||||
var hostedContentPath = config.get('Database.DownloadAddress');
|
var hostedContentPath = config.get('Database.PublishUploadPath');
|
||||||
|
|
||||||
// set port
|
// set port
|
||||||
var PORT = 3000;
|
var PORT = 3000;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
<img class="all-claims-img" src="https://spee.ch/{{this.name}}/{{this.claim_id}}" />
|
<img class="all-claims-img" src="https://spee.ch/{{this.name}}/{{this.claim_id}}" />
|
||||||
<div class="card card-block">
|
<div class="card card-block">
|
||||||
<p>claim_id: {{this.claim_id}}</p>
|
<p>claim_id: {{this.claim_id}}</p>
|
||||||
<p>direct link <a href="https://spee.ch/{{this.name}}/{{this.claim_id}}">here</a></p>
|
<p>direct link <a href="/{{this.name}}/{{this.claim_id}}">here</a></p>
|
||||||
<p>author: {{this.value.stream.metadata.author}}</p>
|
<p>author: {{this.value.stream.metadata.author}}</p>
|
||||||
<p>description: {{this.value.stream.metadata.description}}</p>
|
<p>description: {{this.value.stream.metadata.description}}</p>
|
||||||
<p>license: {{this.value.stream.metadata.license}}</p>
|
<p>license: {{this.value.stream.metadata.license}}</p>
|
||||||
|
|
Loading…
Add table
Reference in a new issue