-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f1bcd71
commit 295a210
Showing
36 changed files
with
12,995 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
OLD_HOME=$HOME | ||
|
||
export HOME=$OPENSHIFT_REPO_DIR | ||
|
||
if [ -f "${OPENSHIFT_REPO_DIR}"/Gulpfile.js ]; then | ||
(cd "${OPENSHIFT_REPO_DIR}"; node_modules/.bin/gulp) | ||
fi | ||
|
||
export HOME=$OLD_HOME |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
var gulp = require("gulp"); | ||
var uglify = require("gulp-uglify"); | ||
var concat = require("gulp-concat"); | ||
var streamqueue = require('streamqueue'); | ||
var minifyCSS = require("gulp-minify-css"); | ||
|
||
gulp.task("js", function () { | ||
|
||
var stream = streamqueue({ objectMode: true }); | ||
|
||
stream.queue( | ||
gulp.src([ | ||
"public/js/vendor/*.min.js" | ||
]) | ||
); | ||
|
||
stream.queue( | ||
gulp.src([ | ||
"public/js/vendor/*.js", | ||
"!public/js/vendor/*.min.js", | ||
"public/js/script.js" | ||
]) | ||
.pipe(uglify({preserveComments: "some"})) | ||
); | ||
|
||
return stream.done() | ||
.pipe(concat("scripts.js")) | ||
.pipe(gulp.dest("public/build/")); | ||
|
||
}); | ||
|
||
gulp.task("css", function () { | ||
|
||
var stream = streamqueue({ objectMode: true }); | ||
|
||
stream.queue( | ||
gulp.src("public/css/*.css") | ||
); | ||
|
||
return stream.done() | ||
.pipe(concat("style.css")) | ||
.pipe(minifyCSS()) | ||
.pipe(gulp.dest("public/build/")); | ||
|
||
}); | ||
|
||
gulp.task('default', ['js', 'css']); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
var express = require('express'); | ||
var fs = require('fs'); | ||
var mongo = require('mongodb'); | ||
var Grid = require('gridfs-stream'); | ||
var path = require('path'); | ||
var multiparty = require('multiparty'); | ||
var shortid = require('shortid'); | ||
var cron = require('cron'); | ||
|
||
var app_port = process.env.OPENSHIFT_NODEJS_PORT || 3000; | ||
var app_ip = process.env.OPENSHIFT_NODEJS_IP || "127.0.0.1"; | ||
|
||
var db_host = process.env.OPENSHIFT_MONGODB_DB_HOST || '127.0.0.1'; | ||
var db_port = process.env.OPENSHIFT_MONGODB_DB_PORT || 27017; | ||
var db_name = process.env.OPENSHIFT_APP_NAME || 'sendshit'; | ||
var db_user = process.env.OPENSHIFT_MONGODB_DB_USERNAME || 'admin'; | ||
var db_pass = process.env.OPENSHIFT_MONGODB_DB_PASSWORD || null; | ||
|
||
var db = new mongo.Db(db_name, new mongo.Server(db_host, db_port), { safe : false }); | ||
var gfs = new Grid(db, mongo); | ||
|
||
db.open(function (err) { | ||
|
||
if (err) throw err; | ||
|
||
db.authenticate(db_user, db_pass, function(err, res) { | ||
|
||
if (err) throw err; | ||
|
||
var pruneJob = cron.job("0 */1 * * * *", function() { | ||
|
||
var yesterday = new Date(new Date().getTime() - (24 * 60 * 60 * 1000)); | ||
|
||
gfs.files.find({ uploadDate: {$lt: yesterday } }).forEach(function (file) { | ||
|
||
gfs.remove({ filename: file.filename }, function () { | ||
|
||
console.log('Pruned ' + file.filename); | ||
|
||
}); | ||
|
||
}); | ||
|
||
}); | ||
|
||
pruneJob.start(); | ||
|
||
var app = express(); | ||
|
||
app.use(express.static(path.join(__dirname, 'public'))); | ||
|
||
app.post('/upload', function(req, res) { | ||
|
||
var form = new multiparty.Form({ | ||
maxFilesSize: 5000000 | ||
}); | ||
|
||
form.on('error', function(err) { | ||
|
||
res.status(400).json({ file: 'File is too large.' }); | ||
|
||
}).on('file', function(name, file) { | ||
|
||
var slug = shortid.generate(); | ||
var writestream = gfs.createWriteStream({ filename: slug }); | ||
|
||
fs.createReadStream(file.path).on('error', function() { | ||
|
||
res.json({ error: 'Upload failed.' }); | ||
|
||
}).pipe(writestream); | ||
|
||
res.json({ id: slug }); | ||
|
||
}).parse(req); | ||
|
||
}); | ||
|
||
app.get('/download', function(req, res) { | ||
|
||
gfs.findOne({ filename: req.query.id }, function (err, file) { | ||
|
||
if (err || file === null) return res.json({ error: 'File not found.' }); | ||
|
||
gfs.createReadStream({ filename: req.query.id }).on('close', function () { | ||
|
||
gfs.remove({ filename: req.query.id }, function () {}); | ||
|
||
}).pipe(res); | ||
|
||
}); | ||
|
||
}); | ||
|
||
app.listen(app_port, app_ip); | ||
|
||
}); | ||
|
||
}); |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"name": "sendsh.it", | ||
"version": "1.0.0", | ||
"description": "Send and recieve files encrypted in the browser", | ||
"main": "app.js", | ||
"scripts": { | ||
"start": "node app.js" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://bitbucket.org/BenSpeakman/sendsh.it" | ||
}, | ||
"author": "Ben Speakman", | ||
"license": "MIT", | ||
"dependencies": { | ||
"cron": "^1.0.9", | ||
"express": "^4.12.4", | ||
"gridfs-stream": "^1.1.1", | ||
"gulp": "^3.8.11", | ||
"gulp-concat": "^2.5.2", | ||
"gulp-minify-css": "^1.1.1", | ||
"gulp-uglify": "^1.2.0", | ||
"mongodb": "^2.0.33", | ||
"multiparty": "^4.1.2", | ||
"shortid": "^2.2.2", | ||
"streamqueue": "^0.1.3" | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Please read: https://msdn.microsoft.com/en-us/library/ie/dn455106.aspx --> | ||
<browserconfig> | ||
<msapplication> | ||
<tile> | ||
<square70x70logo src="tile.png"/> | ||
<square150x150logo src="tile.png"/> | ||
<wide310x150logo src="tile-wide.png"/> | ||
<square310x310logo src="tile.png"/> | ||
</tile> | ||
</msapplication> | ||
</browserconfig> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0"?> | ||
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> | ||
<cross-domain-policy> | ||
<!-- Read this: https://www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html --> | ||
|
||
<!-- Most restrictive policy: --> | ||
<site-control permitted-cross-domain-policies="none"/> | ||
|
||
<!-- Least restrictive policy: --> | ||
<!-- | ||
<site-control permitted-cross-domain-policies="all"/> | ||
<allow-access-from domain="*" to-ports="*" secure="false"/> | ||
<allow-http-request-headers-from domain="*" headers="*" secure="false"/> | ||
--> | ||
</cross-domain-policy> |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/* Make clicks pass-through */ | ||
#nprogress { | ||
pointer-events: none; | ||
-webkit-pointer-events: none; | ||
} | ||
|
||
#nprogress .bar { | ||
background: #3cb8f1; | ||
|
||
position: fixed; | ||
z-index: 100; | ||
top: 0; | ||
left: 0; | ||
|
||
width: 100%; | ||
height: 2px; | ||
} | ||
|
||
/* Fancy blur effect */ | ||
#nprogress .peg { | ||
display: block; | ||
position: absolute; | ||
right: 0px; | ||
width: 100px; | ||
height: 100%; | ||
box-shadow: 0 0 10px #3cb8f1, 0 0 5px #3cb8f1; | ||
opacity: 1.0; | ||
|
||
-webkit-transform: rotate(3deg) translate(0px, -4px); | ||
-moz-transform: rotate(3deg) translate(0px, -4px); | ||
-ms-transform: rotate(3deg) translate(0px, -4px); | ||
-o-transform: rotate(3deg) translate(0px, -4px); | ||
transform: rotate(3deg) translate(0px, -4px); | ||
} | ||
|
||
/* Remove these to get rid of the spinner */ | ||
#nprogress .spinner { | ||
display: block; | ||
position: fixed; | ||
z-index: 100; | ||
top: 15px; | ||
right: 15px; | ||
} | ||
|
||
#nprogress .spinner-icon { | ||
width: 14px; | ||
height: 14px; | ||
|
||
border: solid 2px transparent; | ||
border-top-color: #3cb8f1; | ||
border-left-color: #3cb8f1; | ||
border-radius: 10px; | ||
|
||
-webkit-animation: nprogress-spinner 400ms linear infinite; | ||
-moz-animation: nprogress-spinner 400ms linear infinite; | ||
-ms-animation: nprogress-spinner 400ms linear infinite; | ||
-o-animation: nprogress-spinner 400ms linear infinite; | ||
animation: nprogress-spinner 400ms linear infinite; | ||
} | ||
|
||
@-webkit-keyframes nprogress-spinner { | ||
0% { -webkit-transform: rotate(0deg); transform: rotate(0deg); } | ||
100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } | ||
} | ||
@-moz-keyframes nprogress-spinner { | ||
0% { -moz-transform: rotate(0deg); transform: rotate(0deg); } | ||
100% { -moz-transform: rotate(360deg); transform: rotate(360deg); } | ||
} | ||
@-o-keyframes nprogress-spinner { | ||
0% { -o-transform: rotate(0deg); transform: rotate(0deg); } | ||
100% { -o-transform: rotate(360deg); transform: rotate(360deg); } | ||
} | ||
@-ms-keyframes nprogress-spinner { | ||
0% { -ms-transform: rotate(0deg); transform: rotate(0deg); } | ||
100% { -ms-transform: rotate(360deg); transform: rotate(360deg); } | ||
} | ||
@keyframes nprogress-spinner { | ||
0% { transform: rotate(0deg); transform: rotate(0deg); } | ||
100% { transform: rotate(360deg); transform: rotate(360deg); } | ||
} | ||
|
Oops, something went wrong.