hfs 0.1.6 → 0.26.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +674 -0
- package/README.md +102 -8
- package/admin/assets/index.dcc78777.css +1 -0
- package/admin/assets/index.f056db34.js +282 -0
- package/admin/assets/sha512.3c0e384c.js +8 -0
- package/admin/index.html +17 -0
- package/admin/logo.svg +36 -0
- package/frontend/assets/index.55c710c2.js +85 -0
- package/frontend/assets/index.ee805a6c.css +1 -0
- package/frontend/assets/sha512.634b743e.js +8 -0
- package/frontend/fontello.css +77 -0
- package/frontend/fontello.woff2 +0 -0
- package/frontend/index.html +18 -0
- package/package.json +93 -28
- package/plugins/antibrute/plugin.js +38 -0
- package/plugins/download-counter/plugin.js +47 -0
- package/plugins/download-counter/public/hits.js +5 -0
- package/plugins/updater-disabled/plugin.js +44 -0
- package/plugins/vhosting/plugin.js +42 -0
- package/src/QuickZipStream.js +285 -0
- package/src/ThrottledStream.js +93 -0
- package/src/adminApis.js +169 -0
- package/src/api.accounts.js +59 -0
- package/src/api.auth.js +130 -0
- package/src/api.file_list.js +103 -0
- package/src/api.helpers.js +32 -0
- package/src/api.monitor.js +102 -0
- package/src/api.plugins.js +125 -0
- package/src/api.vfs.js +164 -0
- package/src/apiMiddleware.js +136 -0
- package/src/block.js +33 -0
- package/src/commands.js +105 -0
- package/src/config.js +172 -0
- package/src/connections.js +57 -0
- package/src/const.js +83 -0
- package/src/crypt.js +21 -0
- package/src/debounceAsync.js +48 -0
- package/src/events.js +9 -0
- package/src/frontEndApis.js +38 -0
- package/src/github.js +102 -0
- package/src/index.js +53 -0
- package/src/listen.js +226 -0
- package/src/log.js +137 -0
- package/src/middlewares.js +154 -0
- package/src/misc.js +160 -0
- package/src/pbkdf2.js +74 -0
- package/src/perm.js +176 -0
- package/src/plugins.js +338 -0
- package/src/serveFile.js +104 -0
- package/src/serveGuiFiles.js +113 -0
- package/src/sse.js +29 -0
- package/src/throttler.js +91 -0
- package/src/update.js +69 -0
- package/src/util-files.js +141 -0
- package/src/util-generators.js +30 -0
- package/src/util-http.js +30 -0
- package/src/vfs.js +227 -0
- package/src/watchLoad.js +73 -0
- package/src/zip.js +69 -0
- package/.npmignore +0 -19
- package/admin-server.js +0 -212
- package/cli.js +0 -33
- package/file-server.js +0 -100
- package/lib/common.js +0 -10
- package/lib/extending.js +0 -158
- package/lib/mime.js +0 -19
- package/lib/misc.js +0 -75
- package/lib/serving.js +0 -81
- package/lib/vfs.js +0 -403
- package/main.js +0 -24
- package/note.txt +0 -104
- package/speedtest.js +0 -21
- package/static/backend.css +0 -14
- package/static/backend.html +0 -32
- package/static/backend.js +0 -694
- package/static/extending.js +0 -187
- package/static/frontend.css +0 -29
- package/static/frontend.html +0 -23
- package/static/frontend.js +0 -230
- package/static/icons/files/archive.png +0 -0
- package/static/icons/files/audio.png +0 -0
- package/static/icons/files/file.png +0 -0
- package/static/icons/files/folder.png +0 -0
- package/static/icons/files/image.png +0 -0
- package/static/icons/files/link.png +0 -0
- package/static/icons/files/video.png +0 -0
- package/static/jquery.js +0 -4
- package/static/jquery.rule-1.0.2.js +0 -273
- package/static/misc.js +0 -194
- package/static/tpl.js +0 -17
- package/todo.txt +0 -25
package/static/misc.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
jQuery.fn.log = function (msg) {
|
|
2
|
-
if (typeof window.console != 'undefined' && console.log)
|
|
3
|
-
if (msg) console.log(msg+": %o", this);
|
|
4
|
-
else console.log(this);
|
|
5
|
-
return this;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
// it says if any element of the set is exceeding its clipping area
|
|
9
|
-
jQuery.fn.isOverflowed = function(HorV) {
|
|
10
|
-
var res = false;
|
|
11
|
-
if (HorV) HorV = HorV[0].toUpperCase(); // so it accepts even 'horizontally'
|
|
12
|
-
this.each(function(){
|
|
13
|
-
var v = this.clientHeight < this.scrollHeight;
|
|
14
|
-
var h = this.clientWidth < this.scrollWidth;
|
|
15
|
-
return res = (!HorV ? h||v : (HorV == 'H' ? h : v));
|
|
16
|
-
});
|
|
17
|
-
return res;
|
|
18
|
-
}; // isOverflowed
|
|
19
|
-
|
|
20
|
-
/** ensure the element is verticaly visible */
|
|
21
|
-
jQuery.fn.scrollToMe = function(options){
|
|
22
|
-
if (!this.size()) return;
|
|
23
|
-
var top = this.offset().top;
|
|
24
|
-
var bottom = top+this.outerHeight();
|
|
25
|
-
var go;
|
|
26
|
-
if (top < scrollY) {
|
|
27
|
-
go = top; // on top?
|
|
28
|
-
}
|
|
29
|
-
else if (bottom > scrollY+innerHeight) { // below?
|
|
30
|
-
go = Math.min(top, bottom-innerHeight);
|
|
31
|
-
}
|
|
32
|
-
if (go) {
|
|
33
|
-
$('html,body').stop(true).animate({ scrollTop: go }, options);
|
|
34
|
-
}
|
|
35
|
-
return this;
|
|
36
|
-
}; // scrollToMe
|
|
37
|
-
|
|
38
|
-
var log = function() {
|
|
39
|
-
var last;
|
|
40
|
-
for (var k in arguments)
|
|
41
|
-
console.log(last = arguments[k]);
|
|
42
|
-
return last;
|
|
43
|
-
}; // log
|
|
44
|
-
|
|
45
|
-
function isTransparent(color) {
|
|
46
|
-
if (!color || color == "transparent") return true;
|
|
47
|
-
var m = color.match(/rgba *\( *(\d+) *, *(\d+) *, *(\d+) *, *(\d+) *\)/);
|
|
48
|
-
return m && !Number(m[4]);
|
|
49
|
-
} // isTransparent
|
|
50
|
-
|
|
51
|
-
// returns the supposed background color of the item, traversing upward the DOM and skipping transparent elements
|
|
52
|
-
jQuery.fn.getClosestBackgroundColor = function() {
|
|
53
|
-
if (!this.size()) return '';
|
|
54
|
-
var el = this.first();
|
|
55
|
-
while (1) {
|
|
56
|
-
try { // try, because it comes to the point the element is not an HTMLelement, and css() explodes
|
|
57
|
-
var c = el.css('background-color');
|
|
58
|
-
if (!isTransparent(c)) return c;
|
|
59
|
-
el = el.parent();
|
|
60
|
-
}
|
|
61
|
-
catch(err) { return '' }
|
|
62
|
-
}
|
|
63
|
-
} // getClosestBackgroundColor
|
|
64
|
-
|
|
65
|
-
function setCookie(name,value,days) {
|
|
66
|
-
if (days) {
|
|
67
|
-
var date = new Date();
|
|
68
|
-
date.setTime(date.getTime()+(days*24*60*60*1000));
|
|
69
|
-
var expires = "; expires="+date.toGMTString();
|
|
70
|
-
}
|
|
71
|
-
else var expires = "";
|
|
72
|
-
document.cookie = name+"="+value+expires+"; path=/";
|
|
73
|
-
} // setCookie
|
|
74
|
-
|
|
75
|
-
function getCookie(name) {
|
|
76
|
-
var a = document.cookie.match(new RegExp('(^|; *)('+name+'=)([^;]*)'));
|
|
77
|
-
return (a && a[2]) ? a[3] : null;
|
|
78
|
-
} // getCookie
|
|
79
|
-
|
|
80
|
-
function delCookie(name) {
|
|
81
|
-
setCookie(name,"",-1);
|
|
82
|
-
} // delCookie
|
|
83
|
-
|
|
84
|
-
function getFileExt(path) {
|
|
85
|
-
var v = path.match(/\.([^/.]+)$/);
|
|
86
|
-
return v ? v[1] : '';
|
|
87
|
-
} // getFileExt
|
|
88
|
-
|
|
89
|
-
function nameToType(name) {
|
|
90
|
-
switch (getFileExt(name).low()) {
|
|
91
|
-
case 'jpg': case 'jpeg': case 'gif': case 'png':
|
|
92
|
-
return 'image';
|
|
93
|
-
case 'avi': case 'mpg': case 'mp4': case 'mov':
|
|
94
|
-
return 'video';
|
|
95
|
-
default:
|
|
96
|
-
return '';
|
|
97
|
-
}
|
|
98
|
-
} // nameToType
|
|
99
|
-
|
|
100
|
-
// tries to access a deep property of object, following array "path" as for properties names
|
|
101
|
-
function getDeep(obj, path) {
|
|
102
|
-
for (var i=0, a=path, l=a.length; obj && i<l; ++i) {
|
|
103
|
-
obj = obj[a[i]];
|
|
104
|
-
}
|
|
105
|
-
return obj;
|
|
106
|
-
} // getDeep
|
|
107
|
-
|
|
108
|
-
function assert(condition, message) {
|
|
109
|
-
if (!condition) alert('ASSERTION ERROR: '+message);
|
|
110
|
-
return !condition;
|
|
111
|
-
} // assert
|
|
112
|
-
|
|
113
|
-
function formatBytes(n) {
|
|
114
|
-
if (isNaN(Number(n))) return 'N/A';
|
|
115
|
-
var x = [ '', 'K', 'M', 'G', 'T' ];
|
|
116
|
-
var prevMul = 1;
|
|
117
|
-
var mul = prevMul*1024;
|
|
118
|
-
for (var i=0, l=x.length; i<l && n > mul; ++i) {
|
|
119
|
-
prevMul = mul;
|
|
120
|
-
mul *= 1024;
|
|
121
|
-
}
|
|
122
|
-
n /= prevMul;
|
|
123
|
-
var c = x[i];
|
|
124
|
-
if (c) c = ' '+c;
|
|
125
|
-
return round(n,1)+c;
|
|
126
|
-
} // formatBytes
|
|
127
|
-
|
|
128
|
-
round = function(v, decimals) {
|
|
129
|
-
decimals = Math.pow(10, decimals||0);
|
|
130
|
-
return Math.round(v*decimals)/decimals;
|
|
131
|
-
} // round
|
|
132
|
-
|
|
133
|
-
function cmp(a,b) { return a>b ? 1 : a<b ? -1 : 0 }
|
|
134
|
-
|
|
135
|
-
function getIconURI(icon) { return "/~/icons/files/"+icon+".png"; }
|
|
136
|
-
|
|
137
|
-
function animate(object, property, endValue, options) {
|
|
138
|
-
options = options||{};
|
|
139
|
-
var freq = options.freq||30; // Hz
|
|
140
|
-
var duration = options.duration||0.5; // seconds
|
|
141
|
-
var steps = freq*duration; // number of steps to the end
|
|
142
|
-
if (!object || !property || !steps) return;
|
|
143
|
-
var trackingKey = 'animation_running_'+property;
|
|
144
|
-
var endParameter = { canceling:1 }; // at this stage, calling end() will inform the callback that we have been canceled by another animation
|
|
145
|
-
|
|
146
|
-
var end = function(){
|
|
147
|
-
object[property] = endValue;
|
|
148
|
-
clearInterval(object[trackingKey]);
|
|
149
|
-
delete object[trackingKey];
|
|
150
|
-
if (typeof options.onEnd == 'function') {
|
|
151
|
-
options.onEnd(endParameter);
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
if (object[trackingKey]) {
|
|
156
|
-
end(); // terminate previous
|
|
157
|
-
}
|
|
158
|
-
// we passed the stage of the cancellation
|
|
159
|
-
delete endParameter.canceling;
|
|
160
|
-
if (Object.keys(endParameter).length === 0) {
|
|
161
|
-
endParameter = undefined;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
var from;
|
|
165
|
-
var current;
|
|
166
|
-
var inc;
|
|
167
|
-
// track this operation. It would be nice to do it without touching, but we'd need an hash/id of the object, and i don't know a way to get it.
|
|
168
|
-
object[trackingKey] = setInterval(function(){
|
|
169
|
-
if (typeof from === 'undefined') { // initialize
|
|
170
|
-
from = current = Number(object[property]);
|
|
171
|
-
inc = (endValue-from)/steps;
|
|
172
|
-
}
|
|
173
|
-
object[property] = current += inc;
|
|
174
|
-
if (! --steps) end();
|
|
175
|
-
}, 1000/freq);
|
|
176
|
-
} // animate
|
|
177
|
-
|
|
178
|
-
/* CURRENTLY UNUSED
|
|
179
|
-
|
|
180
|
-
// reports how many pixels the element is exceeding the viewport, on the right side
|
|
181
|
-
jQuery.fn.overRightEdge = function() {
|
|
182
|
-
var w = $(window),
|
|
183
|
-
v = this.offset().left - w.scrollLeft() + this.outerWidth() - w.width();
|
|
184
|
-
return Math.max(0, v);
|
|
185
|
-
}; // overRightEdge
|
|
186
|
-
|
|
187
|
-
// reports how many pixels the element is exceeding the viewport, on the bottom side
|
|
188
|
-
jQuery.fn.overBottomEdge = function() {
|
|
189
|
-
var w = $(window),
|
|
190
|
-
v = this.offset().top - w.scrollTop() + this.outerHeight() - w.height();
|
|
191
|
-
return Math.max(0, v);
|
|
192
|
-
}; // overBottomEdge
|
|
193
|
-
|
|
194
|
-
*/
|
package/static/tpl.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
assert(TPL, 'tpl');
|
|
2
|
-
|
|
3
|
-
TPL.item =
|
|
4
|
-
"<a href='{url}' class='item-link'><img src='{icon-file}' /><span class='item-label'>{label}</span></a>"
|
|
5
|
-
+"<div class='item-details'><div class='item-details-wrapper'>"
|
|
6
|
-
+"<div class='item-type'>{type}</div>"
|
|
7
|
-
+"<div class='item-size'>{size}</div>"
|
|
8
|
-
+"</div></div>";
|
|
9
|
-
|
|
10
|
-
TPL.list_onObjectItem = function(item) {
|
|
11
|
-
item.size = item.size ? formatBytes(item.size)+'B' : 'folder';
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
TPL.tiles_onObjectItem = function(item) {
|
|
15
|
-
item.type = 'Type: '+item.type;
|
|
16
|
-
item.size = item.size ? 'Size: '+formatBytes(item.size)+'B' : '';
|
|
17
|
-
};
|
package/todo.txt
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
=== DOING
|
|
2
|
-
bug: backend: when a dynamic item is deleted, then re-added, it should be treated properly
|
|
3
|
-
debugging console via telnet (still working very bad)
|
|
4
|
-
improve in-source documentation
|
|
5
|
-
http://en.wikipedia.org/wiki/JSDoc
|
|
6
|
-
|
|
7
|
-
=== NEXT
|
|
8
|
-
backend: vfs: specific icon for the "deleted" folder
|
|
9
|
-
backend: vfs: overlay icon to signalise temp nodes (based on nodeKind)
|
|
10
|
-
|
|
11
|
-
=== AFTER
|
|
12
|
-
?comply with standard callback(err,data)
|
|
13
|
-
make the .expansion-button a fixed size
|
|
14
|
-
? folder multi-bind
|
|
15
|
-
? if 2 binds have 2 subfolders with same name, should merge them too?
|
|
16
|
-
vfs permissions
|
|
17
|
-
backend: vfs: drag&drop
|
|
18
|
-
handle non-working IO connection for both frontend and backend
|
|
19
|
-
? coffee-script
|
|
20
|
-
what wiki to use for development, github or rejetto.com?
|
|
21
|
-
modules that could be useful
|
|
22
|
-
for better performance on socket.io exchanges https://github.com/pgriess/node-msgpack
|
|
23
|
-
mime https://github.com/bentomas/node-mime
|
|
24
|
-
most used reloader https://github.com/remy/nodemon
|
|
25
|
-
browse the whole list at https://github.com/joyent/node/wiki/modules
|