Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-online committed Apr 30, 2019
2 parents 27e3eb9 + 8f9c227 commit cc9d4fd
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 7 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Expand Up @@ -5,7 +5,10 @@ npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Release builds
release/
release-builds/

# Runtime data
pids
*.pid
Expand Down Expand Up @@ -61,5 +64,6 @@ typings/
# next.js build output
.next

#testing images
.vscode/sftp.json
# local uploads
public/feeds/
4 changes: 2 additions & 2 deletions README.md
@@ -1,8 +1,8 @@
[![spruce-banner](./public/images/logo/banner.png)](http://mygurukulonline.in)

Spruce is a tiny but powerful open-source social networking platform made with Node.js and MongoDB

_Deployed on an Amazon EC2 instance [here](http://mygurukulonline.in)_
[![Gitter](https://badges.gitter.im/spruce-social/community.svg)](https://gitter.im/spruce-social/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
_Deployed on an Amazon EC2 instance [here](http://spruce.divy.work)_

Get the live MongoDB stats out [here](https://cloud.mongodb.com/freemonitoring/cluster/SQXXT6OAMR757LIEYJRN3WDUCIRAEYYV).

Expand Down
81 changes: 81 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Expand Up @@ -24,6 +24,8 @@
"morgan": "~1.9.0",
"mv": "2.1.1",
"newsapi": "^2.4.0",
"passport": "^0.4.0",
"passport-google-oauth": "^2.0.0",
"request": "2.88.0",
"time-ago": "0.2.1"
},
Expand Down
10 changes: 7 additions & 3 deletions routes/settings.js
Expand Up @@ -3,6 +3,7 @@ var router = express.Router();
var path = require('path');
var guid = require('guid');
var mv = require('mv');
const mime = require('mime-types')
var db = require('../utils/handlers/user');
var formParser = require('../utils/form-parser.js');
const fs = require('file-system');
Expand Down Expand Up @@ -58,9 +59,12 @@ router.post('/upload', formParser,function(req, res, next) {
var final_location = `/feeds/${req.session.user}_${random_id}${req.files.filetoupload.name}`;

console.log(`${oldpath} - OldPath\n ${newpath} - Newpath\n ${final_location} - DiskLocation\n`)
// Finally upload the file to disk and save the feed to users profile
// Finally upload the file to disk and save the feed to users profile.
var type = mime.lookup(req.files.filetoupload.name).split("/")[1]

mv(oldpath, newpath, function (err) {
console.log('moving files')
console.log('moving files');

db.findOne({username:req.session.user}, (err, u) => {
console.log(u)
u.posts.push({
Expand All @@ -71,7 +75,7 @@ router.post('/upload', formParser,function(req, res, next) {
category:req.body.type,
comments:[],
likes:[],
type:'image',
type:type,
createdAt:new Date(),
lastEditedAt:new Date()
})
Expand Down
9 changes: 8 additions & 1 deletion views/main.ejs
Expand Up @@ -32,7 +32,14 @@
<br>
<br>
<div class="gram-card-image">
<center><img author="<%= people[i].posts[z].author %>" src="<%= people[i].posts[z].static_url %>" id="<%= people[i].posts[z]._id %>" class="post img-responsive"></center>
<center>
<% if(people[i].posts[z].type == "image") { %>
<img author="<%= people[i].posts[z].author %>" src="<%= people[i].posts[z].static_url %>" id="<%= people[i].posts[z]._id %>" class="post img-responsive">
<% } %>
<% if(people[i].posts[z].type == "mp4") { %>
<video author="<%= people[i].posts[z].author %>" src="<%= people[i].posts[z].static_url %>" id="<%= people[i].posts[z]._id %>" class="post img-responsive" controls></video>
<% } %>
</center>
</div>
<div class="gram-card-content">
Expand Down
1 change: 1 addition & 0 deletions views/upload/file-upload.ejs
Expand Up @@ -94,6 +94,7 @@
var reader = new FileReader();
reader.onload = function (e) {
console.log(e)
$('#blah')
.attr('src', e.target.result);
/* $('#postBtn')
Expand Down

0 comments on commit cc9d4fd

Please sign in to comment.