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,26 +5,23 @@ spee.ch is a single-serving site that reads and publishes images to and from the
* start lbry
* install the [`lbry`](https://github.com/lbryio/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
* create a folder called `Uploads` in the same root directory where you cloned the repo
* run `npm install`
* from your terminal, run `npm start`
* 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)
## site navigation
* spee.ch.
* spee.ch
* 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.
* E.g. spee.ch/doitlive.
* spee.ch/< the name of the claim >/< the claim_id >
* To view a specific file at a claim
* E.g. spee.ch/doitlive/c496c8c55ed79816fec39e36a78645aa4458edb5
* spee.ch/<the name of the claim>/all
* spee.ch/< the name of the claim >/all
* To view a batch of files at a claim
* E.g. spee.ch/doitlive/all
@ -39,6 +36,6 @@ spee.ch is a single-serving site that reads and publishes images to and from the
Note: these are being used for testing durring spee.ch development and may not be maintained
* A GET request to spee.ch/claim_list/<the name of the claim>
* A GET request to spee.ch/claim_list/< the name of the claim >
* Will return the claim_list for the claim in json format.
* E.g. spee.ch/claim_list/doitlive

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"/>
<br/>
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="Creative Commons">Creative Commons</option>
</select>
<br/>
NSFW: <select type="text" id="publish-nsfw" name="nsfw" value="false">
@ -85,12 +85,10 @@
// define global variables
var socket = io();
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 previewFile(){
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 previewReader = new FileReader();
previewReader.onloadend = function () {
@ -98,7 +96,8 @@
}
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 {
preview.src = "";
};
@ -117,6 +116,9 @@
uploader.listenOnSubmit(document.getElementById("publish-submit"), document.getElementById("siofu_input"));
// add listeners to the uploader
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
event.file.meta.name = name;
event.file.meta.license = license;
@ -124,7 +126,6 @@
});
uploader.addEventListener("progress", function(event){
var percent = event.bytesLoaded / event.file.size * 100;
console.log();
updatePublishStatus("File is " + percent.toFixed(2) + "% loaded to the server");
})
// add listener for publish status updates

View file

@ -14,7 +14,7 @@ module.exports = function(app) {
"file_path": filepath,
"bid": 0.1,
"metadata": {
"description": name + "published via spee.ch",
"description": name + " published via spee.ch",
"title": name,
"author": "spee.ch",
"language": "en",
@ -53,7 +53,7 @@ module.exports = function(app) {
console.log('a user connected');
// listener for uploader
var uploader = new siofu();
uploader.dir = path.join(__dirname, '../temp');
uploader.dir = path.join(__dirname, '../../Uploads');
uploader.listen(socket);
// attach upload listeners
uploader.on("error", function(event){