switched upload folder to ../Uploads

This commit is contained in:
bill bittner 2017-05-31 20:29:16 -07:00
parent 2e2533da62
commit ca90f571eb
7 changed files with 14 additions and 16 deletions

View file

@ -5,18 +5,15 @@ spee.ch is a single-serving site that reads and publishes images to and from the
* start lbry * start lbry
* install the [`lbry`](https://github.com/lbryio/lbry) daemon * install the [`lbry`](https://github.com/lbryio/lbry) daemon
* start the `lbry` daemon * start the `lbry` daemon
* start RabbitMQ (this will handle the queue for background processing)
* install & run [RabbitMQ](https://www.rabbitmq.com/#getstarted)
* clone this repo * clone this repo
* create a folder called `Uploads` in the same root directory where you cloned the repo
* run `npm install` * run `npm install`
* from your terminal, run `npm start` * from your terminal, run `npm start`
* to run hot, run `nodemon server.js` * to run hot, run `nodemon server.js`
* start a worker by running `node worker.js` in a separate session in your terminal
* visit [localhost:3000](http://localhost:3000) * visit [localhost:3000](http://localhost:3000)
## site navigation ## site navigation
* spee.ch
* spee.ch.
* To publish a file, navigate to the homepage. * To publish a file, navigate to the homepage.
* spee.ch/< the name of the claim > * spee.ch/< the name of the claim >
* To view the file with the largest bid at a claim. * To view the file with the largest bid at a claim.

BIN
Temp/name

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

View file

@ -27,8 +27,8 @@
Name: <input type="text" id="publish-name" name="name" value="name"/> Name: <input type="text" id="publish-name" name="name" value="name"/>
<br/> <br/>
License: <select type="text" id="publish-license" name="license" value="license"> License: <select type="text" id="publish-license" name="license" value="license">
<option value="Creative Commons">Creative Commons</option>
<option value="Public Domain">Public Domain</option> <option value="Public Domain">Public Domain</option>
<option value="Creative Commons">Creative Commons</option>
</select> </select>
<br/> <br/>
NSFW: <select type="text" id="publish-nsfw" name="nsfw" value="false"> NSFW: <select type="text" id="publish-nsfw" name="nsfw" value="false">
@ -85,12 +85,10 @@
// define global variables // define global variables
var socket = io(); var socket = io();
var uploader = new SocketIOFileUpload(socket); var uploader = new SocketIOFileUpload(socket);
var name = document.getElementById('publish-name').value;
var license = document.getElementById('publish-license').value;
var nsfw = document.getElementById('publish-nsfw').value;
// function to handle image preview // function to handle image preview
function previewFile(){ function previewFile(){
var preview = document.querySelector('img'); //selects the query named img var preview = document.querySelector('img'); //selects the query named img
var claimName = document.querySelector('input[name=name]');
var selectedFile = document.querySelector('input[name=file]').files[0]; var selectedFile = document.querySelector('input[name=file]').files[0];
var previewReader = new FileReader(); var previewReader = new FileReader();
previewReader.onloadend = function () { previewReader.onloadend = function () {
@ -98,7 +96,8 @@
} }
if (selectedFile) { if (selectedFile) {
previewReader.readAsDataURL(selectedFile); // reads the data as a URL previewReader.readAsDataURL(selectedFile); // reads the data and sets the img src
claimName.value = selectedFile.name.substring(0, selectedFile.name.indexOf("."));
} else { } else {
preview.src = ""; preview.src = "";
}; };
@ -117,6 +116,9 @@
uploader.listenOnSubmit(document.getElementById("publish-submit"), document.getElementById("siofu_input")); uploader.listenOnSubmit(document.getElementById("publish-submit"), document.getElementById("siofu_input"));
// add listeners to the uploader // add listeners to the uploader
uploader.addEventListener("start", function(event){ uploader.addEventListener("start", function(event){
var name = document.getElementById('publish-name').value;
var license = document.getElementById('publish-license').value;
var nsfw = document.getElementById('publish-nsfw').value;
// set meta data // set meta data
event.file.meta.name = name; event.file.meta.name = name;
event.file.meta.license = license; event.file.meta.license = license;
@ -124,7 +126,6 @@
}); });
uploader.addEventListener("progress", function(event){ uploader.addEventListener("progress", function(event){
var percent = event.bytesLoaded / event.file.size * 100; var percent = event.bytesLoaded / event.file.size * 100;
console.log();
updatePublishStatus("File is " + percent.toFixed(2) + "% loaded to the server"); updatePublishStatus("File is " + percent.toFixed(2) + "% loaded to the server");
}) })
// add listener for publish status updates // add listener for publish status updates

View file

@ -53,7 +53,7 @@ module.exports = function(app) {
console.log('a user connected'); console.log('a user connected');
// listener for uploader // listener for uploader
var uploader = new siofu(); var uploader = new siofu();
uploader.dir = path.join(__dirname, '../temp'); uploader.dir = path.join(__dirname, '../../Uploads');
uploader.listen(socket); uploader.listen(socket);
// attach upload listeners // attach upload listeners
uploader.on("error", function(event){ uploader.on("error", function(event){