diff --git a/index.php b/index.php index ecd00a2..aa5acaa 100755 --- a/index.php +++ b/index.php @@ -37,8 +37,6 @@ if( defined( "SITE_NAME" ) && ! ( SITE_NAME === "" || SITE_NAME === null ) ) { <?php echo htmlentities( $site_name ); ?> - - =31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/))}function i(t){var n=this.useColors;if(t[0]=(n?"%c":"")+this.namespace+(n?" %c":" ")+t[0]+(n?"%c ":" ")+"+"+e.humanize(this.diff),n){var r="color: "+this.color;t.splice(1,0,r,"color: inherit");var o=0,i=0;t[0].replace(/%[a-zA-Z%]/g,function(t){"%%"!==t&&(o++,"%c"===t&&(i=o))}),t.splice(i,0,r)}}function s(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function a(t){try{null==t?e.storage.removeItem("debug"):e.storage.debug=t}catch(n){}}function c(){var t;try{t=e.storage.debug}catch(n){}return!t&&"undefined"!=typeof r&&"env"in r&&(t=r.env.DEBUG),t}function u(){try{return window.localStorage}catch(t){}}e=t.exports=n(5),e.log=s,e.formatArgs=i,e.save=a,e.load=c,e.useColors=o,e.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:u(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"],e.formatters.j=function(t){try{return JSON.stringify(t)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}},e.enable(c())}).call(e,n(4))},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function o(t){if(p===setTimeout)return setTimeout(t,0);if((p===n||!p)&&setTimeout)return p=setTimeout,setTimeout(t,0);try{return p(t,0)}catch(e){try{return p.call(null,t,0)}catch(e){return p.call(this,t,0)}}}function i(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function s(){y&&l&&(y=!1,l.length?d=l.concat(d):m=-1,d.length&&a())}function a(){if(!y){var t=o(s);y=!0;for(var e=d.length;e;){for(l=d,d=[];++m1)for(var n=1;n100)){var e=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(t);if(e){var n=parseFloat(e[1]),r=(e[2]||"ms").toLowerCase();switch(r){case"years":case"year":case"yrs":case"yr":case"y":return n*p;case"days":case"day":case"d":return n*u;case"hours":case"hour":case"hrs":case"hr":case"h":return n*c;case"minutes":case"minute":case"mins":case"min":case"m":return n*a;case"seconds":case"second":case"secs":case"sec":case"s":return n*s;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return n;default:return}}}}function r(t){return t>=u?Math.round(t/u)+"d":t>=c?Math.round(t/c)+"h":t>=a?Math.round(t/a)+"m":t>=s?Math.round(t/s)+"s":t+"ms"}function o(t){return i(t,u,"day")||i(t,c,"hour")||i(t,a,"minute")||i(t,s,"second")||t+" ms"}function i(t,e,n){if(!(t0)return n(t);if("number"===i&&isNaN(t)===!1)return e["long"]?o(t):r(t);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(t))}},function(t,e,n){function r(){}function o(t){var n=""+t.type;if(e.BINARY_EVENT!==t.type&&e.BINARY_ACK!==t.type||(n+=t.attachments+"-"),t.nsp&&"/"!==t.nsp&&(n+=t.nsp+","),null!=t.id&&(n+=t.id),null!=t.data){var r=i(t.data);if(r===!1)return g;n+=r}return f("encoded %j as %s",t,n),n}function i(t){try{return JSON.stringify(t)}catch(e){return!1}}function s(t,e){function n(t){var n=d.deconstructPacket(t),r=o(n.packet),i=n.buffers;i.unshift(r),e(i)}d.removeBlobs(t,n)}function a(){this.reconstructor=null}function c(t){var n=0,r={type:Number(t.charAt(0))};if(null==e.types[r.type])return h("unknown packet type "+r.type);if(e.BINARY_EVENT===r.type||e.BINARY_ACK===r.type){for(var o="";"-"!==t.charAt(++n)&&(o+=t.charAt(n),n!=t.length););if(o!=Number(o)||"-"!==t.charAt(n))throw new Error("Illegal attachments");r.attachments=Number(o)}if("/"===t.charAt(n+1))for(r.nsp="";++n;){var i=t.charAt(n);if(","===i)break;if(r.nsp+=i,n===t.length)break}else r.nsp="/";var s=t.charAt(n+1);if(""!==s&&Number(s)==s){for(r.id="";++n;){var i=t.charAt(n);if(null==i||Number(i)!=i){--n;break}if(r.id+=t.charAt(n),n===t.length)break}r.id=Number(r.id)}if(t.charAt(++n)){var a=u(t.substr(n)),c=a!==!1&&(r.type===e.ERROR||y(a));if(!c)return h("invalid payload");r.data=a}return f("decoded %s as %j",t,r),r}function u(t){try{return JSON.parse(t)}catch(e){return!1}}function p(t){this.reconPack=t,this.buffers=[]}function h(t){return{type:e.ERROR,data:"parser error: "+t}}var f=n(3)("socket.io-parser"),l=n(8),d=n(9),y=n(10),m=n(11);e.protocol=4,e.types=["CONNECT","DISCONNECT","EVENT","ACK","ERROR","BINARY_EVENT","BINARY_ACK"],e.CONNECT=0,e.DISCONNECT=1,e.EVENT=2,e.ACK=3,e.ERROR=4,e.BINARY_EVENT=5,e.BINARY_ACK=6,e.Encoder=r,e.Decoder=a;var g=e.ERROR+'"encode error"';r.prototype.encode=function(t,n){if(f("encoding packet %j",t),e.BINARY_EVENT===t.type||e.BINARY_ACK===t.type)s(t,n);else{var r=o(t);n([r])}},l(a.prototype),a.prototype.add=function(t){var n;if("string"==typeof t)n=c(t),e.BINARY_EVENT===n.type||e.BINARY_ACK===n.type?(this.reconstructor=new p(n),0===this.reconstructor.reconPack.attachments&&this.emit("decoded",n)):this.emit("decoded",n);else{if(!m(t)&&!t.base64)throw new Error("Unknown type: "+t);if(!this.reconstructor)throw new Error("got binary data when not reconstructing a packet");n=this.reconstructor.takeBinaryData(t),n&&(this.reconstructor=null,this.emit("decoded",n))}},a.prototype.destroy=function(){this.reconstructor&&this.reconstructor.finishedReconstruction()},p.prototype.takeBinaryData=function(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){var e=d.reconstructPacket(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null},p.prototype.finishedReconstruction=function(){this.reconPack=null,this.buffers=[]}},function(t,e,n){function r(t){if(t)return o(t)}function o(t){for(var e in r.prototype)t[e]=r.prototype[e];return t}t.exports=r,r.prototype.on=r.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this},r.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(1==arguments.length)return delete this._callbacks["$"+t],this;for(var r,o=0;o0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},r.prototype.cleanup=function(){h("cleanup");for(var t=this.subs.length,e=0;e=this._reconnectionAttempts)h("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();h("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(h("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(h("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(h("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},r.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},function(t,e,n){t.exports=n(14),t.exports.parser=n(21)},function(t,e,n){(function(e){function r(t,n){if(!(this instanceof r))return new r(t,n);n=n||{},t&&"object"==typeof t&&(n=t,t=null),t?(t=p(t),n.hostname=t.host,n.secure="https"===t.protocol||"wss"===t.protocol,n.port=t.port,t.query&&(n.query=t.query)):n.host&&(n.hostname=p(n.host).host),this.secure=null!=n.secure?n.secure:e.location&&"https:"===location.protocol,n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.agent=n.agent||!1,this.hostname=n.hostname||(e.location?location.hostname:"localhost"),this.port=n.port||(e.location&&location.port?location.port:this.secure?443:80),this.query=n.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==n.upgrade,this.path=(n.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!n.forceJSONP,this.jsonp=!1!==n.jsonp,this.forceBase64=!!n.forceBase64,this.enablesXDR=!!n.enablesXDR,this.timestampParam=n.timestampParam||"t",this.timestampRequests=n.timestampRequests,this.transports=n.transports||["polling","websocket"],this.transportOptions=n.transportOptions||{},this.readyState="",this.writeBuffer=[],this.prevBufferLen=0,this.policyPort=n.policyPort||843,this.rememberUpgrade=n.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=n.onlyBinaryUpgrades,this.perMessageDeflate=!1!==n.perMessageDeflate&&(n.perMessageDeflate||{}),!0===this.perMessageDeflate&&(this.perMessageDeflate={}),this.perMessageDeflate&&null==this.perMessageDeflate.threshold&&(this.perMessageDeflate.threshold=1024),this.pfx=n.pfx||null,this.key=n.key||null,this.passphrase=n.passphrase||null,this.cert=n.cert||null,this.ca=n.ca||null,this.ciphers=n.ciphers||null,this.rejectUnauthorized=void 0===n.rejectUnauthorized||n.rejectUnauthorized,this.forceNode=!!n.forceNode;var o="object"==typeof e&&e;o.global===o&&(n.extraHeaders&&Object.keys(n.extraHeaders).length>0&&(this.extraHeaders=n.extraHeaders),n.localAddress&&(this.localAddress=n.localAddress)),this.id=null,this.upgrades=null,this.pingInterval=null,this.pingTimeout=null,this.pingIntervalTimer=null,this.pingTimeoutTimer=null,this.open()}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var i=n(15),s=n(8),a=n(3)("engine.io-client:socket"),c=n(36),u=n(21),p=n(2),h=n(30);t.exports=r,r.priorWebsocketSuccess=!1,s(r.prototype),r.protocol=u.protocol,r.Socket=r,r.Transport=n(20),r.transports=n(15),r.parser=n(21),r.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=o(this.query);e.EIO=u.protocol,e.transport=t;var n=this.transportOptions[t]||{};this.id&&(e.sid=this.id);var r=new i[t]({query:e,socket:this,agent:n.agent||this.agent,hostname:n.hostname||this.hostname,port:n.port||this.port,secure:n.secure||this.secure,path:n.path||this.path,forceJSONP:n.forceJSONP||this.forceJSONP,jsonp:n.jsonp||this.jsonp,forceBase64:n.forceBase64||this.forceBase64,enablesXDR:n.enablesXDR||this.enablesXDR,timestampRequests:n.timestampRequests||this.timestampRequests,timestampParam:n.timestampParam||this.timestampParam,policyPort:n.policyPort||this.policyPort,pfx:n.pfx||this.pfx,key:n.key||this.key,passphrase:n.passphrase||this.passphrase,cert:n.cert||this.cert,ca:n.ca||this.ca,ciphers:n.ciphers||this.ciphers,rejectUnauthorized:n.rejectUnauthorized||this.rejectUnauthorized,perMessageDeflate:n.perMessageDeflate||this.perMessageDeflate,extraHeaders:n.extraHeaders||this.extraHeaders,forceNode:n.forceNode||this.forceNode,localAddress:n.localAddress||this.localAddress,requestTimeout:n.requestTimeout||this.requestTimeout,protocols:n.protocols||void 0});return r},r.prototype.open=function(){var t;if(this.rememberUpgrade&&r.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1)t="websocket";else{if(0===this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},r.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},r.prototype.probe=function(t){function e(){if(f.onlyBinaryUpgrades){var e=!this.supportsBinary&&f.transport.supportsBinary;h=h||e}h||(a('probe transport "%s" opened',t),p.send([{type:"ping",data:"probe"}]),p.once("packet",function(e){if(!h)if("pong"===e.type&&"probe"===e.data){if(a('probe transport "%s" pong',t),f.upgrading=!0,f.emit("upgrading",p),!p)return;r.priorWebsocketSuccess="websocket"===p.name,a('pausing current transport "%s"',f.transport.name),f.transport.pause(function(){h||"closed"!==f.readyState&&(a("changing transport and sending upgrade packet"),u(),f.setTransport(p),p.send([{type:"upgrade"}]),f.emit("upgrade",p),p=null,f.upgrading=!1,f.flush())})}else{a('probe transport "%s" failed',t);var n=new Error("probe error");n.transport=p.name,f.emit("upgradeError",n)}}))}function n(){h||(h=!0,u(),p.close(),p=null)}function o(e){var r=new Error("probe error: "+e);r.transport=p.name,n(),a('probe transport "%s" failed because of error: %s',t,e),f.emit("upgradeError",r)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){p&&t.name!==p.name&&(a('"%s" works - aborting "%s"',t.name,p.name),n())}function u(){p.removeListener("open",e),p.removeListener("error",o),p.removeListener("close",i),f.removeListener("close",s),f.removeListener("upgrading",c)}a('probing transport "%s"',t);var p=this.createTransport(t,{probe:1}),h=!1,f=this;r.priorWebsocketSuccess=!1,p.once("open",e),p.once("error",o),p.once("close",i),this.once("close",s),this.once("upgrading",c),p.open()},r.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",r.priorWebsocketSuccess="websocket"===this.transport.name,this.emit("open"),this.flush(),"open"===this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;t1?{type:b[o],data:t.substring(1)}:{type:b[o]}:w}var i=new Uint8Array(t),o=i[0],s=f(t,1);return k&&"blob"===n&&(s=new k([s])),{type:b[o],data:s}},e.decodeBase64Packet=function(t,e){var n=b[t.charAt(0)];if(!u)return{type:n,data:{base64:!0,data:t.substr(1)}};var r=u.decode(t.substr(1));return"blob"===e&&k&&(r=new k([r])),{type:n,data:r}},e.encodePayload=function(t,n,r){function o(t){return t.length+":"+t}function i(t,r){e.encodePacket(t,!!s&&n,!1,function(t){r(null,o(t))})}"function"==typeof n&&(r=n,n=null);var s=h(t);return n&&s?k&&!g?e.encodePayloadAsBlob(t,r):e.encodePayloadAsArrayBuffer(t,r):t.length?void c(t,i,function(t,e){return r(e.join(""))}):r("0:")},e.decodePayload=function(t,n,r){if("string"!=typeof t)return e.decodePayloadAsBinary(t,n,r);"function"==typeof n&&(r=n,n=null);var o;if(""===t)return r(w,0,1);for(var i,s,a="",c=0,u=t.length;c0;){for(var s=new Uint8Array(o),a=0===s[0],c="",u=1;255!==s[u];u++){if(c.length>310)return r(w,0,1);c+=s[u]}o=f(o,2+c.length),c=parseInt(c);var p=f(o,0,c);if(a)try{p=String.fromCharCode.apply(null,new Uint8Array(p))}catch(h){var l=new Uint8Array(p);p="";for(var u=0;ur&&(n=r),e>=r||e>=n||0===r)return new ArrayBuffer(0);for(var o=new Uint8Array(t),i=new Uint8Array(n-e),s=e,a=0;s=55296&&e<=56319&&o65535&&(e-=65536,o+=w(e>>>10&1023|55296),e=56320|1023&e),o+=w(e);return o}function c(t,e){if(t>=55296&&t<=57343){if(e)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value");return!1}return!0}function u(t,e){return w(t>>e&63|128)}function p(t,e){if(0==(4294967168&t))return w(t);var n="";return 0==(4294965248&t)?n=w(t>>6&31|192):0==(4294901760&t)?(c(t,e)||(t=65533),n=w(t>>12&15|224),n+=u(t,6)):0==(4292870144&t)&&(n=w(t>>18&7|240),n+=u(t,12),n+=u(t,6)),n+=w(63&t|128)}function h(t,e){e=e||{};for(var n,r=!1!==e.strict,o=s(t),i=o.length,a=-1,c="";++a=v)throw Error("Invalid byte index");var t=255&g[b];if(b++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(t){var e,n,r,o,i;if(b>v)throw Error("Invalid byte index");if(b==v)return!1;if(e=255&g[b],b++,0==(128&e))return e;if(192==(224&e)){if(n=f(),i=(31&e)<<6|n,i>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&e)){if(n=f(),r=f(),i=(15&e)<<12|n<<6|r,i>=2048)return c(i,t)?i:65533;throw Error("Invalid continuation byte")}if(240==(248&e)&&(n=f(),r=f(),o=f(),i=(7&e)<<18|n<<12|r<<6|o,i>=65536&&i<=1114111))return i;throw Error("Invalid UTF-8 detected")}function d(t,e){e=e||{};var n=!1!==e.strict;g=s(t),v=g.length,b=0;for(var r,o=[];(r=l(n))!==!1;)o.push(r);return a(o)}var y="object"==typeof e&&e,m=("object"==typeof t&&t&&t.exports==y&&t,"object"==typeof o&&o);m.global!==m&&m.window!==m||(i=m);var g,v,b,w=String.fromCharCode,k={version:"2.1.2",encode:h,decode:d};r=function(){return k}.call(e,n,e,t),!(void 0!==r&&(t.exports=r))}(this)}).call(e,n(27)(t),function(){return this}())},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e){!function(){"use strict";for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=new Uint8Array(256),r=0;r>2],i+=t[(3&r[n])<<4|r[n+1]>>4],i+=t[(15&r[n+1])<<2|r[n+2]>>6],i+=t[63&r[n+2]];return o%3===2?i=i.substring(0,i.length-1)+"=":o%3===1&&(i=i.substring(0,i.length-2)+"=="),i},e.decode=function(t){var e,r,o,i,s,a=.75*t.length,c=t.length,u=0;"="===t[t.length-1]&&(a--,"="===t[t.length-2]&&a--);var p=new ArrayBuffer(a),h=new Uint8Array(p);for(e=0;e>4,h[u++]=(15&o)<<4|i>>2,h[u++]=(3&i)<<6|63&s;return p}}()},function(t,e){(function(e){function n(t){for(var e=0;e0);return e}function r(t){var e=0;for(p=0;p';i=document.createElement(e)}catch(t){i=document.createElement("iframe"),i.name=o.iframeId,i.src="javascript:0"}i.id=o.iframeId,o.form.appendChild(i),o.iframe=i}var o=this;if(!this.form){var i,s=document.createElement("form"),a=document.createElement("textarea"),p=this.iframeId="eio_iframe_"+this.index;s.className="socketio",s.style.position="absolute",s.style.top="-1000px",s.style.left="-1000px",s.target=p,s.method="POST",s.setAttribute("accept-charset","utf-8"),a.name="d",s.appendChild(a),document.body.appendChild(s),this.form=s,this.area=a}this.form.action=this.uri(),r(),t=t.replace(u,"\\\n"),this.area.value=t.replace(c,"\\n");try{this.form.submit()}catch(h){}this.iframe.attachEvent?this.iframe.onreadystatechange=function(){"complete"===o.iframe.readyState&&n()}:this.iframe.onload=n}}).call(e,function(){return this}())},function(t,e,n){(function(e){function r(t){var e=t&&t.forceBase64;e&&(this.supportsBinary=!1),this.perMessageDeflate=t.perMessageDeflate,this.usingBrowserWebSocket=h&&!t.forceNode,this.protocols=t.protocols,this.usingBrowserWebSocket||(l=o),i.call(this,t)}var o,i=n(20),s=n(21),a=n(30),c=n(31),u=n(32),p=n(3)("engine.io-client:websocket"),h=e.WebSocket||e.MozWebSocket;if("undefined"==typeof window)try{o=n(35)}catch(f){}var l=h;l||"undefined"!=typeof window||(l=o),t.exports=r,c(r,i),r.prototype.name="websocket",r.prototype.supportsBinary=!0,r.prototype.doOpen=function(){if(this.check()){var t=this.uri(),e=this.protocols,n={agent:this.agent,perMessageDeflate:this.perMessageDeflate};n.pfx=this.pfx,n.key=this.key,n.passphrase=this.passphrase,n.cert=this.cert,n.ca=this.ca,n.ciphers=this.ciphers,n.rejectUnauthorized=this.rejectUnauthorized,this.extraHeaders&&(n.headers=this.extraHeaders),this.localAddress&&(n.localAddress=this.localAddress);try{this.ws=this.usingBrowserWebSocket?e?new l(t,e):new l(t):new l(t,e,n)}catch(r){return this.emit("error",r)}void 0===this.ws.binaryType&&(this.supportsBinary=!1),this.ws.supports&&this.ws.supports.binary?(this.supportsBinary=!0,this.ws.binaryType="nodebuffer"):this.ws.binaryType="arraybuffer",this.addEventListeners()}},r.prototype.addEventListeners=function(){var t=this;this.ws.onopen=function(){t.onOpen()},this.ws.onclose=function(){t.onClose()},this.ws.onmessage=function(e){t.onData(e.data)},this.ws.onerror=function(e){t.onError("websocket error",e)}},r.prototype.write=function(t){function n(){r.emit("flush"),setTimeout(function(){r.writable=!0,r.emit("drain")},0)}var r=this;this.writable=!1;for(var o=t.length,i=0,a=o;i0&&t.jitter<=1?t.jitter:0,this.attempts=0}t.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}}])}); -//# sourceMappingURL=socket.io.js.map \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/init_old.js b/plugins/Codiad-Collaborative-master/init_old.js deleted file mode 100755 index 1a808ee..0000000 --- a/plugins/Codiad-Collaborative-master/init_old.js +++ /dev/null @@ -1,297 +0,0 @@ -/* -* Copyright (c) Codiad (codiad.com) & Isaac Brown (telaaedifex.com), -* distributed as-is and without warranty under the MIT License. See -* [root]/license.txt for more. This information must remain intact. -*/ - -(function (global, $) { - - var codiad = global.codiad, - scripts = document.getElementsByTagName('script'), - path = scripts[scripts.length-1].src.split('?')[0], - curpath = path.split( '/' ).slice( 0, -1 ).join( '/ ') + '/'; - - var buffer_dumped = false; - var collaborator = null; - var current_editor = codiad.active.getPath(); - var cursor = null; - var editor = null; - var initial = false; - var just_cleared_buffer = null; - var just_opened = false; - var last_applied_change = null; - var loaded = false; - var loading = true; - var session_id = codiad.system.session_id; - var site_id = codiad.system.site_id; - - function Collaborator( file_path, session_id ) { - - - this.collaboration_socket = null - let file_id = btoa( current_editor ); - this.collaboration_socket = io.connect( "https://local.telaaedifex.com:1337", {'forceNew': true, query:'?session=' + session_id + "&file=" + site_id + current_editor} ); - - this.collaboration_socket.on( "change", function(delta) { - - if( current_editor !== codiad.active.getPath() || editor === null ) { - return; - } - - delta = JSON.parse( delta ) ; - last_applied_change = delta ; - editor.getSession().getDocument().applyDeltas( [delta] ) ; - }.bind() ); - - this.collaboration_socket.on( "clear_buffer", function() { - just_cleared_buffer = true ; - console.log( "setting editor contents" ) ; - editor.setValue( "" ) ; - }.bind() ); - - this.collaboration_socket.on( "recieve_init", function(delta) { - - delta = JSON.parse( delta ) ; - - console.log( 'Recieved dump buffer JSON', delta.message, delta.initial ); - initial = delta.initial; - - if ( delta.initial === true ) { - - console.log( 'Setting initial content...' ); - //codiad.editor.setContent( '' ); - codiad.editor.setContent( delta.content ) - inital = false; - } - - setTimeout(function(){ - if( cursor !== null ) { - console.log( 'Going to position: ' + cursor.row + ", " + cursor.column ); - editor.gotoLine( cursor.row, cursor.column, true ); - } - }, 256); - - }.bind() ); - - this.collaboration_socket.on( "recieve_content", function( ) { - - console.log( 'Someone is joining ...' ); - console.log( 'Cursor is at ' + cursor.row + ", " + cursor.column ); - - // Remove change callback - editor.removeEventListener( "change", handle_change ); - codiad.editor.disableEditing(); - codiad.editor.setContent( '' ); - collaborator.dump_buffer() - // registering change callback - editor.addEventListener( "change", handle_change ); - }.bind() ); - - this.collaboration_socket.on( "unlock", function( ) { - - console.log( 'Unlocking editors and going to ' + cursor.row + ", " + cursor.column ); - - codiad.editor.enableEditing(); - setTimeout(function(){ - if( cursor !== null ) { - console.log( 'Going to position: ' + cursor.row + ", " + cursor.column ); - editor.gotoLine( cursor.row, cursor.column, true ); - } - }, 256); - }.bind() ); - - window.collaboration_socket = this.collaboration_socket; - } - - Collaborator.prototype.change = function( delta ) { - - this.collaboration_socket.emit( "change", delta ); - } - - Collaborator.prototype.clear_buffer = function() { - this.collaboration_socket.emit( "clear_buffer" ); - } - - Collaborator.prototype.disconnect = function() { - this.collaboration_socket.emit( "disconnect" ); - } - - Collaborator.prototype.dump_buffer = function() { - this.collaboration_socket.emit( "dump_buffer" ); - } - - Collaborator.prototype.send_init = function( content ) { - this.collaboration_socket.emit( "send_init", content ); - } - - function handle_change( e ) { - - // TODO, we could make things more efficient and not likely to conflict by keeping track of change IDs - coords = editor.getCursorPosition(); - if( coords.row !== 0 && coords.column !== 0 ) { - cursor = editor.getCursorPosition(); - cursor.row = cursor.row + 1 - console.log( 'Cursor at: ' + cursor.row + ", " + cursor.column ); - } - - if( last_applied_change!=e && !just_cleared_buffer ) { - - collaborator.change( JSON.stringify(e) ); - } - - just_cleared_buffer = false; - } - - function close() { - - if( typeof window.collaboration_socket === 'undefined' ) { - - return; - } - - if( window.collaboration_socket !== null ) { - - window.collaboration_socket.disconnect(); - } - - if( editor !== null ) { - - editor.removeEventListener( "change", handle_change ); - } - - editor = null; - loaded = false; - //current_editor = null; - window.collaboration_socket = null; - console.log( 'Cleared buffer and closed editor.' ); - } - - function body_loaded() { - - if( collaborator !== null && editor !== null && initial === false ) { - - if( last_applied_change !== null ) { - - editor.setValue( "" ) - collaborator.dump_buffer() - } - //document.getElementsByTagName('textarea')[0].focus() ; - last_applied_change = null ; - just_cleared_buffer = false ; - return; - } - - current_editor = codiad.active.getPath(); - editor = ace.edit( codiad.editor.getActive() ); - - if( editor === null ) { - - return; - } - - let content = null; - - collaborator = new Collaborator( session_id ); - - //codiad.editor.disableEditing(); - //collaborator.open_file( ) - content = codiad.editor.getContent() - codiad.editor.setContent( '' ) - collaborator.send_init( content ) - - // registering change callback - editor.addEventListener( "change", handle_change ); - - //editor.setTheme( "ace/theme/monokai") ; - editor.$blockScrolling = Infinity; - - //collaborator.dump_buffer(); - let dumped_content = null; - - - dumped_content = codiad.editor.getContent() - collaborator.dump_buffer(); - loaded = true; - } - - collaborator = new Collaborator( session_id ); - collaborator.send_init() - - if( window.collaboration_socket !== null ) { - - window.collaboration_socket.disconnect(); - } - - /* Subscribe to know when a file is being closed. */ - amplify.subscribe('active.onClose', function (path) { - - close() - }); - - $(window).blur(function() { - - if( editor !== null ) { - coords = editor.getCursorPosition(); - if( coords.row !== 0 && coords.column !== 0 ) { - cursor = editor.getCursorPosition(); - cursor.row = cursor.row + 1 - console.log( 'Cursor at: ' + cursor.row + ", " + cursor.column ); - } - } - close(); - }); - - /* When the window is clicked get the cursor position. - $(window).click(function () { - - coords = editor.getCursorPosition(); - if( coords.row !== 0 && coords.column !== 0 ) { - //cursor = editor.getCursorPosition(); - //cursor.row = cursor.row + 1 - //console.log( 'Cursor at: ' + cursor.row + ", " + cursor.column ); - } - });*/ - - /* Subscribe to know when a file become active. */ - amplify.subscribe('active.onFocus', function (path) { - - just_opened = true; - - if( current_editor !== codiad.active.getPath() && current_editor !== null ) { - - cursor = null; - console.log( 'Closing Socket' ); - close(); - } - console.log( 'Last Editor: ' + current_editor ); - - if( loaded === false ) { - - console.log( 'Loading Body' ); - body_loaded(); - } - console.log( 'Focused Editor: ' + codiad.active.getPath() ); - - coords = editor.getCursorPosition(); - if( coords.row !== 0 && coords.column !== 0 ) { - cursor = editor.getCursorPosition(); - cursor.row = cursor.row + 1 - console.log( 'Cursor at: ' + cursor.row + ", " + cursor.column ); - } - }); - - ////////////////////////////////////////////////////////////////// - // - // Collaborative Component for Codiad - // --------------------------------- - // Displays in real time the selection position and - // the changes when concurrently editing files. - // - ////////////////////////////////////////////////////////////////// - - codiad.collaborative = { - - - }; - -})(this, jQuery); \ No newline at end of file diff --git a/plugins/Codiad-Collaborative-master/server_old.js b/plugins/Codiad-Collaborative-master/server_old.js deleted file mode 100755 index 973f19d..0000000 --- a/plugins/Codiad-Collaborative-master/server_old.js +++ /dev/null @@ -1,205 +0,0 @@ -// config variables -verbose = false ; -session_directory = "./sessions"; // it has to exist - -/* https specific */ -var https = require( 'https' ), -fs = require( 'fs' ); - -var options = { - key: fs.readFileSync( '/etc/letsencrypt/live/local.telaaedifex.com/privkey.pem' ), - cert: fs.readFileSync( '/etc/letsencrypt/live/local.telaaedifex.com/fullchain.pem' ), - ca: fs.readFileSync( '/etc/letsencrypt/live/local.telaaedifex.com/chain.pem' ) -}; -var app = https.createServer( options ); -io = require( 'socket.io' ).listen( app ); //socket.io server listens to https connections -app.listen( 1337, "0.0.0.0" ); - -// will use the following for file IO -var fs = require( "fs" ) ; - -//io = require('socket.io').listen(2015) ; -if( verbose ) { console.log( "> server launched" ); } - -var init = false; -collaborations = [] ; -socket_id_to_session_id = [] ; - -io.sockets.on('connection', function(socket) { - - init = false - var file = socket.handshake.query.file; - //var session_id = socket.handshake.query.session_id; - var session_id = socket.handshake.query.file; - socket_id_to_session_id[socket.id] = session_id ; - - if( verbose ) { console.log( session_id + "connected on socket" + socket.id ) ; } - - - if( !( session_id in collaborations ) ) { - // not in memory but is is on the filesystem? - if( file_exists(session_directory + "/" + session_id) ) { - if( verbose ) { console.log( "session terminated previously, pulling back from filesystem" ); } - - var data = read_file( session_directory + "/" + session_id ); - if( data !== false ) { - - init = false; - collaborations[session_id] = {'cached_instructions':JSON.parse(data), 'participants':[]}; - } else { - - // something went wrong, we start from scratch - init = true; - collaborations[session_id] = {'cached_instructions':[], 'participants':[]}; - } - } else { - if( verbose ) { console.log( " creating new session" ) ; } - init = true; - collaborations[session_id] = {'cached_instructions':[], 'participants':[]}; - } - } - - var i = 0; - - for( i=0 ; i-1 ) { - //collaborations[socket_id_to_session_id[socket.id]].participants.splice( index, 1 ) ; - collaborations[socket_id_to_session_id[socket.id]]['participants'].splice( index, 1 ) ; - found_and_removed = true ; - //if( collaborations[socket_id_to_session_id[socket.id]].participants.length==0 ) { - if( collaborations[socket_id_to_session_id[socket.id]]['participants'].length==0 ) { - if( verbose ) { console.log( "last participant in collaboration, committing to disk & removing from memory" ) ; } - // no one is left in this session, we commit it to disk & remove it from memory - write_file( session_directory + "/" + socket_id_to_session_id[socket.id], JSON.stringify(collaborations[socket_id_to_session_id[socket.id]]['cached_instructions']) ) ; - delete collaborations[socket_id_to_session_id[socket.id]] ; - } - } - } - if( !found_and_removed ) { - console.log( "WARNING: could not tie socket_id to any collaboration" ) ; - } - console.log( collaborations ) ; - }); - - socket.on('send_init', function ( delta ) { - - let response = { - "message": "setting initial", - "initial": init, - "content": `${delta}` - } - socket.emit('recieve_init', JSON.stringify( response ) ); - init = false - }); -}); - - -function write_file( path, data ) { - try { - fs.writeFileSync( path, data ) ; - return true ; - } catch( e ) { - return false ; - } -} - - -function read_file( path ) { - try { - var data = fs.readFileSync( path ) ; - return data ; - } catch( e ) { - return false - } -} - - -function file_exists( path ) { - try { - stats = fs.lstatSync( path ) ; - if (stats.isFile()) { - return true ; - } - } catch( e ) { - return false ; - } - // we should not reach that point - return false ; -} \ No newline at end of file