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.
Files changed (91) hide show
  1. package/LICENSE.txt +674 -0
  2. package/README.md +102 -8
  3. package/admin/assets/index.dcc78777.css +1 -0
  4. package/admin/assets/index.f056db34.js +282 -0
  5. package/admin/assets/sha512.3c0e384c.js +8 -0
  6. package/admin/index.html +17 -0
  7. package/admin/logo.svg +36 -0
  8. package/frontend/assets/index.55c710c2.js +85 -0
  9. package/frontend/assets/index.ee805a6c.css +1 -0
  10. package/frontend/assets/sha512.634b743e.js +8 -0
  11. package/frontend/fontello.css +77 -0
  12. package/frontend/fontello.woff2 +0 -0
  13. package/frontend/index.html +18 -0
  14. package/package.json +93 -28
  15. package/plugins/antibrute/plugin.js +38 -0
  16. package/plugins/download-counter/plugin.js +47 -0
  17. package/plugins/download-counter/public/hits.js +5 -0
  18. package/plugins/updater-disabled/plugin.js +44 -0
  19. package/plugins/vhosting/plugin.js +42 -0
  20. package/src/QuickZipStream.js +285 -0
  21. package/src/ThrottledStream.js +93 -0
  22. package/src/adminApis.js +169 -0
  23. package/src/api.accounts.js +59 -0
  24. package/src/api.auth.js +130 -0
  25. package/src/api.file_list.js +103 -0
  26. package/src/api.helpers.js +32 -0
  27. package/src/api.monitor.js +102 -0
  28. package/src/api.plugins.js +125 -0
  29. package/src/api.vfs.js +164 -0
  30. package/src/apiMiddleware.js +136 -0
  31. package/src/block.js +33 -0
  32. package/src/commands.js +105 -0
  33. package/src/config.js +172 -0
  34. package/src/connections.js +57 -0
  35. package/src/const.js +83 -0
  36. package/src/crypt.js +21 -0
  37. package/src/debounceAsync.js +48 -0
  38. package/src/events.js +9 -0
  39. package/src/frontEndApis.js +38 -0
  40. package/src/github.js +102 -0
  41. package/src/index.js +53 -0
  42. package/src/listen.js +226 -0
  43. package/src/log.js +137 -0
  44. package/src/middlewares.js +154 -0
  45. package/src/misc.js +160 -0
  46. package/src/pbkdf2.js +74 -0
  47. package/src/perm.js +176 -0
  48. package/src/plugins.js +338 -0
  49. package/src/serveFile.js +104 -0
  50. package/src/serveGuiFiles.js +113 -0
  51. package/src/sse.js +29 -0
  52. package/src/throttler.js +91 -0
  53. package/src/update.js +69 -0
  54. package/src/util-files.js +141 -0
  55. package/src/util-generators.js +30 -0
  56. package/src/util-http.js +30 -0
  57. package/src/vfs.js +227 -0
  58. package/src/watchLoad.js +73 -0
  59. package/src/zip.js +69 -0
  60. package/.npmignore +0 -19
  61. package/admin-server.js +0 -212
  62. package/cli.js +0 -33
  63. package/file-server.js +0 -100
  64. package/lib/common.js +0 -10
  65. package/lib/extending.js +0 -158
  66. package/lib/mime.js +0 -19
  67. package/lib/misc.js +0 -75
  68. package/lib/serving.js +0 -81
  69. package/lib/vfs.js +0 -403
  70. package/main.js +0 -24
  71. package/note.txt +0 -104
  72. package/speedtest.js +0 -21
  73. package/static/backend.css +0 -14
  74. package/static/backend.html +0 -32
  75. package/static/backend.js +0 -694
  76. package/static/extending.js +0 -187
  77. package/static/frontend.css +0 -29
  78. package/static/frontend.html +0 -23
  79. package/static/frontend.js +0 -230
  80. package/static/icons/files/archive.png +0 -0
  81. package/static/icons/files/audio.png +0 -0
  82. package/static/icons/files/file.png +0 -0
  83. package/static/icons/files/folder.png +0 -0
  84. package/static/icons/files/image.png +0 -0
  85. package/static/icons/files/link.png +0 -0
  86. package/static/icons/files/video.png +0 -0
  87. package/static/jquery.js +0 -4
  88. package/static/jquery.rule-1.0.2.js +0 -273
  89. package/static/misc.js +0 -194
  90. package/static/tpl.js +0 -17
  91. 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