publish status displays full size
This commit is contained in:
parent
fab8216abb
commit
2e2533da62
2 changed files with 10 additions and 7 deletions
|
@ -105,7 +105,7 @@
|
|||
}
|
||||
// helper function to update status
|
||||
function updatePublishStatus(msg){
|
||||
document.getElementById("upload-status").innerHTML = msg;
|
||||
document.getElementById("publish").innerHTML = msg;
|
||||
}
|
||||
// call the previewFile function
|
||||
previewFile();
|
||||
|
@ -125,7 +125,7 @@
|
|||
uploader.addEventListener("progress", function(event){
|
||||
var percent = event.bytesLoaded / event.file.size * 100;
|
||||
console.log();
|
||||
updatePublishStatus("File is " + percent.toFixed(2) + "% loaded");
|
||||
updatePublishStatus("File is " + percent.toFixed(2) + "% loaded to the server");
|
||||
})
|
||||
// add listener for publish status updates
|
||||
socket.on("publish-status", function(msg){
|
||||
|
@ -133,7 +133,11 @@
|
|||
})
|
||||
socket.on("publish-complete", function(msg){
|
||||
console.log("publish complete", msg);
|
||||
var publishResults = `<p>You're publish is complete!</p><p>The Claim Id is ${msg.result.claim_id}</p><p>The TX Id is ${msg.result.txid}</p><p>Note: the transaction still needs to be published by the network. Click the tx id link to view the tx on the blockchain explorer</p><button id="reset-publish">Publish another</button>`;
|
||||
var publishResults = `<p>You're publish is complete!</p>`;
|
||||
publishResults += `<p>The Claim ID is: ${msg.result.claim_id}</p>`;
|
||||
publishResults += `<p>The TX ID is: <a href="https://explorer.lbry.io/#!/transaction?id=${msg.result.txid}">${msg.result.txid}</a></p>`;
|
||||
publishResults += `<p>Note: the transaction still needs to be published by the network. Click the tx id link to view the tx on the blockchain explorer</p>`
|
||||
publishResults += `<p><a href="/">Reload the page to publish another (fancy button coming soon)</a></p>`;
|
||||
document.getElementById("publish").innerHTML = publishResults;
|
||||
})
|
||||
|
||||
|
|
|
@ -6,13 +6,12 @@ module.exports = function(app) {
|
|||
var lbryApi = require('../helpers/lbryApi.js');
|
||||
var queueApi = require('../helpers/queueApi.js');
|
||||
var siofu = require("socketio-file-upload");
|
||||
var rootDirectory = "C:\\Users\\Bones\\development\\Lbry\\spee.ch\\";
|
||||
|
||||
// functions to create a publishing object
|
||||
function createPublishParams(name, filepath, license, nsfw){
|
||||
var publishParams = {
|
||||
"name": name,
|
||||
"file_path": rootDirectory + filepath,
|
||||
"file_path": filepath,
|
||||
"bid": 0.1,
|
||||
"metadata": {
|
||||
"description": name + "published via spee.ch",
|
||||
|
@ -28,7 +27,7 @@ module.exports = function(app) {
|
|||
// publish an image to lbry
|
||||
function publish(name, filepath, license, nsfw, socket){
|
||||
// update the client
|
||||
socket.emit("publish-status", "starting publishing...");
|
||||
socket.emit("publish-status", "Your image is being published (this might take a second)...");
|
||||
// create the publish object
|
||||
var publishParams = createPublishParams(name, filepath, license, nsfw);
|
||||
// get a promise to publish
|
||||
|
@ -54,7 +53,7 @@ module.exports = function(app) {
|
|||
console.log('a user connected');
|
||||
// listener for uploader
|
||||
var uploader = new siofu();
|
||||
uploader.dir = "./temp";
|
||||
uploader.dir = path.join(__dirname, '../temp');
|
||||
uploader.listen(socket);
|
||||
// attach upload listeners
|
||||
uploader.on("error", function(event){
|
||||
|
|
Loading…
Reference in a new issue