forked from Miserlou/DirtyShare
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
Olivier Refalo
committed
Dec 5, 2012
1 parent
e5292eb
commit 186197a
Showing
37 changed files
with
20,388 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules | ||
/builtAssets |
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,35 @@ | ||
##TODO | ||
|
||
1. swich to sockjs | ||
2. drag and drop files to add | ||
3. drag and drop to desktop | ||
4. multiplex file transfers | ||
5. chat | ||
6. security | ||
|
||
##INSTALL | ||
|
||
1. clone the repo | ||
2. npm install | ||
3. to start in DEV: node app.js | ||
4. to start in PROD: npm start | ||
|
||
## FLOW | ||
|
||
|
||
Master Server Slave | ||
| ready(file) | | | ||
|-------------->| ready | | ||
| |<-----------| | ||
| | | | ||
| | start(file)| | ||
| |----------->| | ||
| getChunk | getChunk | | ||
|<--------------|<-----------| | ||
| sendChunk | sendChunk | | ||
|-------------->|----------->| | ||
. . . | ||
. . . | ||
. . . | ||
| done | done | | ||
|<--------------|<-----------| |
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,3 @@ | ||
var path = require('path'); | ||
|
||
require(path.join(__dirname, 'server', 'server.js'))(); |
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,32 @@ | ||
var http = require('http'), | ||
fileSystem = require('fs'), | ||
path = require('path'); | ||
|
||
var server = http.createServer(function (request, response) { | ||
var filePath = path.join(__dirname, 'AstronomyCast Ep. 216 - Archaeoastronomy.mp3'); | ||
var stat = fileSystem.statSync(filePath); | ||
|
||
response.writeHead(200, { | ||
'Content-Type':'audio/mpeg', | ||
'Content-Length':stat.size | ||
}); | ||
|
||
var readStream = fileSystem.createReadStream(filePath); | ||
readStream.on('data', function (data) { | ||
var flushed = response.write(data); | ||
// Pause the read stream when the write stream gets saturated | ||
if (!flushed) | ||
readStream.pause(); | ||
}); | ||
|
||
response.on('drain', function () { | ||
// Resume the read stream when the write stream gets hungry | ||
readStream.resume(); | ||
}); | ||
|
||
readStream.on('end', function () { | ||
response.end(); | ||
}); | ||
}); | ||
|
||
server.listen(2000); |
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,3 @@ | ||
|
||
@import "reset.less"; | ||
@import "style.less"; |
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,3 @@ | ||
|
||
@import "reset.less"; | ||
@import "style.less"; |
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,48 @@ | ||
/* http://meyerweb.com/eric/tools/css/reset/ | ||
v2.0 | 20110126 | ||
License: none (public domain) | ||
*/ | ||
|
||
html, body, div, span, applet, object, iframe, | ||
h1, h2, h3, h4, h5, h6, p, blockquote, pre, | ||
a, abbr, acronym, address, big, cite, code, | ||
del, dfn, em, img, ins, kbd, q, s, samp, | ||
small, strike, strong, sub, sup, tt, var, | ||
b, u, i, center, | ||
dl, dt, dd, ol, ul, li, | ||
fieldset, form, label, legend, | ||
table, caption, tbody, tfoot, thead, tr, th, td, | ||
article, aside, canvas, details, embed, | ||
figure, figcaption, footer, header, hgroup, | ||
menu, nav, output, ruby, section, summary, | ||
time, mark, audio, video { | ||
margin: 0; | ||
padding: 0; | ||
border: 0; | ||
font-size: 100%; | ||
font: inherit; | ||
vertical-align: baseline; | ||
} | ||
/* HTML5 display-role reset for older browsers */ | ||
article, aside, details, figcaption, figure, | ||
footer, header, hgroup, menu, nav, section { | ||
display: block; | ||
} | ||
body { | ||
line-height: 1; | ||
} | ||
ol, ul { | ||
list-style: none; | ||
} | ||
blockquote, q { | ||
quotes: none; | ||
} | ||
blockquote:before, blockquote:after, | ||
q:before, q:after { | ||
content: ''; | ||
content: none; | ||
} | ||
table { | ||
border-collapse: collapse; | ||
border-spacing: 0; | ||
} |
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,104 @@ | ||
body { | ||
font-family: 'PT Sans Narrow', sans-serif; | ||
font-weight: 400; | ||
color: white; | ||
text-align: center; | ||
font-size: 2em; | ||
} | ||
|
||
h1 { | ||
font-weight: 700; | ||
font-size: 3em; | ||
} | ||
|
||
#dropzone { | ||
|
||
font-size: 25px; | ||
text-align: center; | ||
-webkit-touch-callout: none; | ||
-webkit-user-select: none; | ||
-khtml-user-select: none; | ||
-moz-user-select: none; | ||
-ms-user-select: none; | ||
user-select: none; | ||
} | ||
|
||
#dropzone.hover { | ||
background-color: #f8ffd2; | ||
border-color: rgba(138, 138, 0, 1); | ||
} | ||
|
||
#dropzone p { | ||
margin-top: 40px; | ||
border-radius: 16px; | ||
} | ||
|
||
#arrow { | ||
position: relative; | ||
-webkit-animation-name: bounce; | ||
-webkit-animation-duration: 2s; | ||
-webkit-animation-iteration-count: infinite; | ||
-webkit-animation-timing-function: ease-in-out; | ||
-webkit-animation-delay: 0; | ||
-webkit-animation-play-state: running; | ||
} | ||
|
||
#panel { | ||
width:60%; | ||
} | ||
|
||
@-webkit-keyframes bounce { | ||
0%{ top:20px; } | ||
50%{ top:0; } | ||
100%{ top:20px; } | ||
} | ||
|
||
@dropZoneSize: 250px; | ||
@dropZoneBorder: 10px; | ||
|
||
#sliding_container { | ||
/* 250 + 2 * 10 width : 270 px; */ | ||
height: @dropZoneSize + (2 * @dropZoneBorder); | ||
width: @dropZoneSize + (2 * @dropZoneBorder); | ||
margin: 1em auto; | ||
overflow: hidden; | ||
position: relative; | ||
} | ||
|
||
.slide { | ||
float: left; | ||
height: @dropZoneSize ; | ||
width: @dropZoneSize ; | ||
border: @dropZoneBorder dashed #cacdd0; | ||
border-radius: @dropZoneBorder; | ||
} | ||
|
||
#slides { | ||
position: absolute; | ||
left: 0; | ||
|
||
/* ( 250 + 2 * 10 ) * 4 */ | ||
width: 4 * (@dropZoneSize + (2 * @dropZoneBorder)); | ||
-webkit-transition: all 1.0s ease-in-out; | ||
-moz-transition: all 1.0s ease-in-out; | ||
-o-transition: all 1.0s ease-in-out; | ||
transition: all 1.0s ease-in-out; | ||
} | ||
|
||
#BG { | ||
z-index: -1; | ||
position: absolute; | ||
top: 0; | ||
left: 0 | ||
} | ||
|
||
#footer { | ||
font-size: 0.5em; | ||
position: absolute; | ||
bottom: 5px; | ||
left: 0; | ||
width: 100%; | ||
height: 1em; | ||
visibility: visible; | ||
display: block | ||
} |
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,54 @@ | ||
/** | ||
* Background canvas with a radial gradient | ||
*/ | ||
var BG = BG || {}; | ||
|
||
BG.image = new Image(); | ||
|
||
BG.draw = function () { | ||
|
||
if (BG.image.src && BG.image.complete) | ||
BG.image.onload(); | ||
else { | ||
|
||
// start the drawing once the image is loaded | ||
BG.image.onload = function () { | ||
|
||
var canvas = $("#BG")[0]; | ||
var ctx = canvas.getContext("2d"); | ||
|
||
var width = $(window).width(); | ||
var height = $(window).height(); | ||
var halfWidth = width / 2; | ||
var halfHeight = height / 2; | ||
|
||
canvas.width = width; | ||
canvas.height = height; | ||
|
||
// set the pattern | ||
ctx.fillStyle = ctx.createPattern(BG.image, "repeat"); | ||
ctx.fillRect(0, 0, width, height); | ||
|
||
// set up gradient | ||
var grad = ctx.createRadialGradient(halfWidth, halfHeight, 0, | ||
halfWidth, halfHeight, halfWidth * 1.4); | ||
grad.addColorStop(0, 'rgba(0,0,0,0)'); | ||
grad.addColorStop(1, 'rgba(0,0,0,1)'); | ||
|
||
ctx.fillStyle = grad; | ||
ctx.fillRect(0, 0, width, height); | ||
ctx.fill(); | ||
}; | ||
|
||
BG.image.src = "images/moquette.jpeg"; | ||
} | ||
}; | ||
|
||
|
||
$(function () { | ||
|
||
BG.draw(); | ||
$(window).on('resize', function () { | ||
BG.draw(); | ||
}); | ||
}); |
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,24 @@ | ||
/** | ||
* Generate a random number of characters with the given len | ||
* | ||
*/ | ||
var RandomString = (function () { | ||
|
||
function RandomString() { | ||
} | ||
|
||
RandomString.chars = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""); | ||
|
||
RandomString.gen = function (len) { | ||
var uuid = new Array(len); | ||
var i = 0; | ||
while (i < len) { | ||
uuid[i] = RandomString.chars[0 | Math.random() * RandomString.chars.length]; | ||
i++; | ||
} | ||
return uuid.join(""); | ||
}; | ||
|
||
return RandomString; | ||
|
||
})(); |
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,19 @@ | ||
/** | ||
* parser = canonicalize("http://example.com:3000/pathname/?search=test#hash"); | ||
* | ||
* parser.protocol; // => "http:" | ||
* parser.hostname; // => "example.com" | ||
* parser.port; // => "3000" | ||
* parser.pathname; // => "/pathname/" | ||
* parser.search; // => "?search=test" | ||
* parser.hash; // => "#hash" | ||
* parser.host; // => "example.com:3000" | ||
* this code works on IE6 - http://www.joezimjs.com/javascript/the-lazy-mans-url-parsing/ | ||
**/ | ||
function canonicalize(url) { | ||
var div = document.createElement('div'); | ||
div.innerHTML = "<a></a>"; | ||
div.firstChild.href = url; // Ensures that the href is properly escaped | ||
div.innerHTML = div.innerHTML; // Run the current innerHTML back through the parser | ||
return div.firstChild; | ||
} |
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,19 @@ | ||
/** | ||
* Centers the dropzone on the visual area | ||
*/ | ||
$(function () { | ||
|
||
var w = $(window); | ||
var myResize = function () { | ||
|
||
var p = $('#panel'); | ||
p.css({ | ||
position:'absolute', | ||
left:(w.width() - p.outerWidth()) / 2, | ||
top:(w.height() - p.outerHeight()) / 2 | ||
}); | ||
}; | ||
|
||
myResize(); | ||
w.on('resize', myResize); | ||
}); |
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,7 @@ | ||
/** | ||
* Constants shared by master & peer clients | ||
* | ||
*/ | ||
var CHUNK_SIZE = 4096; | ||
|
||
var MAX_FILE_SIZE = 5 * 1024 * 1024; |
Oops, something went wrong.