throw the tiny random site scripts in with the rest of app.js
and add JS-disabled and timeout messages... DOS style, of course.
This commit is contained in:
@@ -153,3 +153,23 @@ function TINF(){this.OK=0;this.DATA_ERROR=-3;this.WINDOW_SIZE=32768;this.TREE=fu
|
||||
* Licensed under MPL 2.0 (see https://github.com/novnc/noVNC/blob/master/LICENSE.txt)
|
||||
*/
|
||||
window.Websock_native=!0;window.MozWebSocket&&(window.WebSocket=window.MozWebSocket);function Websock(){var api={},websocket=null,mode="base64",rQ=[],rQi=0,sQ=[],eventHandlers={message:function(){},open:function(){},close:function(){},error:function(){}},test_mode=!1;function get_sQ(){return sQ}function get_rQ(){return rQ}function get_rQi(){return rQi}function set_rQi(val){rQi=val}function rQlen(){return rQ.length-rQi}function rQpeek8(){return rQ[rQi]}function rQshift8(){return rQ[rQi++]}function rQunshift8(num){0===rQi?rQ.unshift(num):rQ[rQi-=1]=num}function rQshift16(){return(rQ[rQi++]<<8)+rQ[rQi++]}function rQshift32(){return(rQ[rQi++]<<24)+(rQ[rQi++]<<16)+(rQ[rQi++]<<8)+rQ[rQi++]}function rQshiftStr(len){void 0===len&&(len=rQlen());var arr=rQ.slice(rQi,rQi+len);rQi+=len;return String.fromCharCode.apply(null,arr)}function rQshiftBytes(len){void 0===len&&(len=rQlen());rQi+=len;return rQ.slice(rQi-len,rQi)}function rQslice(start,end){return end?rQ.slice(rQi+start,rQi+end):rQ.slice(rQi+start)}function rQwait(msg,num,goback){if(rQ.length-rQi<num){if(goback){if(rQi<goback)throw"rQwait cannot backup "+goback+" bytes";rQi-=goback}return!0}return!1}function flush(){websocket.bufferedAmount;if(websocket.bufferedAmount<api.maxBufferedAmount){if(sQ.length>0){websocket.send("binary"===mode?new Uint8Array(sQ).buffer:Base64.encode(sQ));sQ=[]}return!0}Util.Info("Delaying send, bufferedAmount: "+websocket.bufferedAmount);return!1}function send(arr){sQ=sQ.concat(arr);return flush()}function send_string(str){api.send(str.split("").map((function(chr){return chr.charCodeAt(0)})))}function recv_message(e){try{(function(data){if("binary"===mode)for(var u8=new Uint8Array(data),i=0;i<u8.length;i++)rQ.push(u8[i]);else rQ=rQ.concat(Base64.decode(data,0))})(e.data);if(rQlen()>0){eventHandlers.message();if(rQ.length>1e4){rQ=rQ.slice(rQi);rQi=0}}}catch(exc){void 0!==exc.stack?Util.Warn("recv_message, caught exception: "+exc.stack):void 0!==exc.description?Util.Warn("recv_message, caught exception: "+exc.description):Util.Warn("recv_message, caught exception:"+exc);void 0!==exc.name?eventHandlers.error(exc.name+": "+exc.message):eventHandlers.error(exc)}}function on(evt,handler){eventHandlers[evt]=handler}function init(protocols){rQ=[];rQi=0;sQ=[];websocket=null;"Uint8Array"in window&&Uint8Array.prototype;void 0===protocols&&(protocols=["binary","base64"]);return protocols}function open(uri,protocols){protocols=init(protocols);if(test_mode)websocket={};else{websocket=new WebSocket(uri,protocols);protocols.indexOf("binary")>=0&&(websocket.binaryType="arraybuffer")}websocket.onmessage=recv_message;websocket.onopen=function(){if(websocket.protocol){mode=websocket.protocol;Util.Info("Server chose sub-protocol: "+websocket.protocol)}else{mode="base64";Util.Error("Server select no sub-protocol!: "+websocket.protocol)}eventHandlers.open()};websocket.onclose=function(e){eventHandlers.close(e)};websocket.onerror=function(e){eventHandlers.error(e)}}function close(){if(websocket){if(websocket.readyState===WebSocket.OPEN||websocket.readyState===WebSocket.CONNECTING){Util.Info("Closing WebSocket connection");websocket.close()}websocket.onmessage=function(){}}}function testMode(override_send,data_mode){test_mode=!0;mode=data_mode;api.send=override_send;api.close=function(){};return recv_message}return function(){api.maxBufferedAmount=200;api.get_sQ=get_sQ;api.get_rQ=get_rQ;api.get_rQi=get_rQi;api.set_rQi=set_rQi;api.rQlen=rQlen;api.rQpeek8=rQpeek8;api.rQshift8=rQshift8;api.rQunshift8=rQunshift8;api.rQshift16=rQshift16;api.rQshift32=rQshift32;api.rQshiftStr=rQshiftStr;api.rQshiftBytes=rQshiftBytes;api.rQslice=rQslice;api.rQwait=rQwait;api.flush=flush;api.send=send;api.send_string=send_string;api.on=on;api.init=init;api.open=open;api.close=close;api.testMode=testMode;return api}()}var $D,WebUtil={};window.$D||(window.$D=function(id){return document.getElementById?document.getElementById(id):document.all?document.all[id]:document.layers?document.layers[id]:void 0});WebUtil.init_logging=function(level){Util._log_level=void 0!==level?level:(document.location.href.match(/logging=([A-Za-z0-9\._\-]*)/)||["",Util._log_level])[1];Util.init_logging()};
|
||||
/*!
|
||||
* Custom code for y2k.land, licensed under MIT:
|
||||
* https://github.com/jakejarvis/y2k
|
||||
*
|
||||
* Keeping it somewhat readable until I automate minification.
|
||||
*/
|
||||
(function () {
|
||||
var t = Math.floor(Math.random() * 20);
|
||||
var s = document.getElementById("status");
|
||||
document.body.style.backgroundImage = "url('tiles/tile_" + t + ".png')";
|
||||
if (window.WebSocket) {
|
||||
var display = document.getElementById("display");
|
||||
var rfb = new RFB({ target: display, encrypt: true });
|
||||
rfb.connect("sandbox.y2k.land", 443);
|
||||
s.innerHTML = "Spinning up your very own personal computer, please wait!";
|
||||
setTimeout(function () { s.innerHTML = "Oh dear, it looks like we're a little busy right now. :(<br><br>Please try again in a bit!"; }, 35000);
|
||||
} else {
|
||||
s.innerHTML = "WebSockets must be enabled to enter Y2K Land!!!<br><br>Press the Any key to continue.";
|
||||
}
|
||||
})();
|
||||
|
||||
Reference in New Issue
Block a user