瀏覽代碼

Merge remote-tracking branch 'upstream/lcs-2020.1-5'

Nikolay Suslov 4 年之前
父節點
當前提交
0af43bf380

+ 40 - 23
package-lock.json

@@ -5,12 +5,14 @@
   "requires": true,
   "dependencies": {
     "@peculiar/asn1-schema": {
-      "version": "1.1.2",
-      "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-1.1.2.tgz",
-      "integrity": "sha512-ntQ4UnUFgdjs0tfWR6YmEQm/x0glV4OFus/RjxLkaJUKfu/R7VilefBntyUO3MoKWdlCgib30KN+JpCY1HqU2A==",
+      "version": "2.0.3",
+      "resolved": "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.0.3.tgz",
+      "integrity": "sha512-STqC+Tfx2dTiIGRmokjsKOeqsfhoV6WaBwFr7BVicSfHLAVSPrZXiugyD8AELrjQdJ9INWpL3N7YSJyU5a1ZwA==",
       "optional": true,
       "requires": {
+        "@types/asn1js": "^0.0.1",
         "asn1js": "^2.0.26",
+        "pvtsutils": "^1.0.10",
         "tslib": "^1.11.1"
       }
     },
@@ -24,16 +26,25 @@
       }
     },
     "@peculiar/webcrypto": {
-      "version": "1.0.29",
-      "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.0.29.tgz",
-      "integrity": "sha512-3e6CIpjZuj5WxPymGm0kCZA05XA9BSXwBEb/mU9KjBHAmEwMokT0yVIhxqwspCHSynlrTfUB+9KTNpseyB077A==",
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/@peculiar/webcrypto/-/webcrypto-1.1.1.tgz",
+      "integrity": "sha512-Bu2XgOvzirnLcojZYs4KQ8hOLf2ETpa0NL6btQt5NgsAwctI6yVkzgYP+EcG7Mm579RBP+V0LM5rXyMlTVx23A==",
       "optional": true,
       "requires": {
-        "@peculiar/asn1-schema": "^1.1.2",
+        "@peculiar/asn1-schema": "^2.0.3",
         "@peculiar/json-schema": "^1.1.10",
         "pvtsutils": "^1.0.10",
-        "tslib": "^1.11.1",
-        "webcrypto-core": "^1.0.20"
+        "tslib": "^1.11.2",
+        "webcrypto-core": "^1.1.0"
+      }
+    },
+    "@types/asn1js": {
+      "version": "0.0.1",
+      "resolved": "https://registry.npmjs.org/@types/asn1js/-/asn1js-0.0.1.tgz",
+      "integrity": "sha1-74uflwjLFjKhw6nNJ3F8qr55O8I=",
+      "optional": true,
+      "requires": {
+        "@types/pvutils": "*"
       }
     },
     "@types/color-name": {
@@ -41,6 +52,12 @@
       "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
       "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ=="
     },
+    "@types/pvutils": {
+      "version": "0.0.2",
+      "resolved": "https://registry.npmjs.org/@types/pvutils/-/pvutils-0.0.2.tgz",
+      "integrity": "sha512-CgQAm7pjyeF3Gnv78ty4RBVIfluB+Td+2DR8iPaU0prF18pkzptHHP+DoKPfpsJYknKsVZyVsJEu5AuGgAqQ5w==",
+      "optional": true
+    },
     "@unimodules/core": {
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/@unimodules/core/-/core-5.1.2.tgz",
@@ -685,9 +702,9 @@
       "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
     },
     "gun": {
-      "version": "0.2020.430",
-      "resolved": "https://registry.npmjs.org/gun/-/gun-0.2020.430.tgz",
-      "integrity": "sha512-mCRrz/VUflCGaRVOA4pTnRo5YSP5pa0lpSszqQ6offJQC9PzClvl2aofpaaHOXx5rFzw34HP/EjWZP3cxen3gQ==",
+      "version": "0.2020.514",
+      "resolved": "https://registry.npmjs.org/gun/-/gun-0.2020.514.tgz",
+      "integrity": "sha512-gKOUJUenNhVFmWOij7RjuXsluY8dSsFjX2mOA5MXrfvZP4Lqv6pEpSntnQmDmo3PHfECOaPF955JLLpiLVuLbw==",
       "requires": {
         "buffer": "^5.4.3",
         "bufferutil": "^4.0.1",
@@ -1434,9 +1451,9 @@
       "integrity": "sha512-yaOH/Pk/VEhBWWTlhI+qXxDFXlejDGcQipMlyxda9nthulaxLZUNcUqFxokp0vcYnvteJln5FNQDRrxj3YcbVw=="
     },
     "tslib": {
-      "version": "1.11.1",
-      "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.11.1.tgz",
-      "integrity": "sha512-aZW88SY8kQbU7gpV19lN24LtXh/yD4ZZg6qieAJDDg+YBsJcSmLGK9QpnUjAKVG/xefmvJGd1WUmfpT/g6AJGA==",
+      "version": "1.13.0",
+      "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.13.0.tgz",
+      "integrity": "sha512-i/6DQjL8Xf3be4K/E6Wgpekn5Qasl1usyw++dAA35Ue5orEn65VIxOA+YvNNl9HV3qv70T7CNwjODHZrLwvd1Q==",
       "optional": true
     },
     "type-is": {
@@ -1488,16 +1505,16 @@
       "integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
     },
     "webcrypto-core": {
-      "version": "1.0.21",
-      "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.0.21.tgz",
-      "integrity": "sha512-PcSD8Ga3u344LXEcI/1UbGv3dv5rZ8pzkeJIrMf/JOnEq8H5hSMmdTrRIp2WFYYnMNdKQbP564v560ZmERT2HQ==",
+      "version": "1.1.1",
+      "resolved": "https://registry.npmjs.org/webcrypto-core/-/webcrypto-core-1.1.1.tgz",
+      "integrity": "sha512-xK61sFRUyZdSAJG7+bJox36+Tnhxw1PaMbmrLLp30HNTJ4mffqsY2jUMlmGq6OOoej3WO/SsH5serzlzBMZ+jg==",
       "optional": true,
       "requires": {
-        "@peculiar/asn1-schema": "^1.1.2",
+        "@peculiar/asn1-schema": "^2.0.1",
         "@peculiar/json-schema": "^1.1.10",
         "asn1js": "^2.0.26",
         "pvtsutils": "^1.0.10",
-        "tslib": "^1.11.1"
+        "tslib": "^1.11.2"
       }
     },
     "webcrypto-shim": {
@@ -1522,9 +1539,9 @@
       }
     },
     "ws": {
-      "version": "7.2.5",
-      "resolved": "https://registry.npmjs.org/ws/-/ws-7.2.5.tgz",
-      "integrity": "sha512-C34cIU4+DB2vMyAbmEKossWq2ZQDr6QEyuuCzWrM9zfw1sGc0mYiJ0UnG9zzNykt49C2Fi34hvr2vssFQRS6EA=="
+      "version": "7.3.0",
+      "resolved": "https://registry.npmjs.org/ws/-/ws-7.3.0.tgz",
+      "integrity": "sha512-iFtXzngZVXPGgpTlP1rBqsUK82p9tKqsWRPg5L56egiljujJT3vGAYnHANvFxBieXrTFavhzhxW52jnaWV+w2w=="
     },
     "xmlhttprequest-ssl": {
       "version": "1.5.5",

+ 1 - 1
package.json

@@ -20,7 +20,7 @@
     "yargs": "15.3.1",
     "socket.io": "2.2.0",
     "lcs-reflector": "0.3",
-    "gun": "0.2020.430"
+    "gun": "0.2020.514"
   },
   "scripts": {
     "start": "node index.js",

File diff suppressed because it is too large
+ 333 - 382
public/app.js


+ 45 - 12
public/helpers.js

@@ -372,19 +372,19 @@ class Helpers {
     authUser(alias, pass){
 
         _LCSDB.user().auth(alias, pass
-            //     , function(ack) {
+                , function(ack) {
     
-            //     if (ack.err) {
-            //         new Noty({
-            //             text: ack.err,
-            //             timeout: 2000,
-            //             theme: 'mint',
-            //             layout: 'bottomRight',
-            //             type: 'error'
-            //         }).show();
+                if (ack.err) {
+                    new Noty({
+                        text: ack.err,
+                        timeout: 2000,
+                        theme: 'mint',
+                        layout: 'bottomRight',
+                        type: 'error'
+                    }).show();
     
-            //     }
-             //}
+                }
+             }
              );
 
     }
@@ -404,11 +404,44 @@ class Helpers {
 
     async getUserPub(userName) {
 
+        //TODO: Fix for using hashids instead users aliases with pubs sorted by time of registration
         let alias = '~@' + userName;
         let user = await (new Promise(res=>_LCSDB.get(alias).once(res)));
        
-        if(user)
+        if(user) {
+
+        if(Object.keys(user).length > 1){
+            let pubs = await Promise.all(Object.keys(user).filter(el=>el !== '_').map(el => _LCSDB.user(el.slice(1)).then(res=>{
+                let ts = Gun.state.is(res, 'pub')
+                return {pub: res.pub, time: ts}
+            })))
+            //console.log(pubs);
+            pubs.sort(function(a,b){
+                return new Date(b.time) - new Date(a.time);
+              });
+            
+            return pubs[0].pub
+
+        } else {
             return Object.keys(user)[1].slice(1)
+        }
+
+    }
+
+    }
+
+   checkUserCollision(){
+
+     //TODO: Fix for using hashids instead users aliases with pubs sorted by time of registration
+
+        _app.helpers.getUserPub(_LCSDB.user().is.alias).then(res=>{
+            if(_LCSDB.user().is.pub !== res){
+              if(window.confirm("ERROR: User name collision. Try to delete user collision?")) {
+                _LCSDB.user().delete();
+                window.reload();
+            }
+            }
+          })
 
     }
 

+ 1 - 1
public/index.html

@@ -20,7 +20,7 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
 
     <link href="/lib/noty/noty.css" rel="stylesheet">
     <link href="/lib/noty/themes/mint.css" rel="stylesheet">
-    <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet">
+   <!-- <link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" rel="stylesheet"> --> 
     <link rel="stylesheet" href="/lib/mdc/dist/material-components-web.min.css">
     <link rel="stylesheet" type="text/css" href="/vwf/model/aframe/addon/virtualgc/virtual-gamepad-controls.css" />
     <link rel="stylesheet" type="text/css" href="/lib/index.css" />

+ 24 - 15
public/lib/gundb/gun.js

@@ -735,10 +735,10 @@
 			}
 			function put(msg){
 				if(!msg){ return }
-				var ctx = msg._||'', root = ctx.root = ((msg.$||'')._||'').root;
+				var ctx = msg._||'', root = ctx.root = ((ctx.$ = msg.$||'')._||'').root;
 				var put = msg.put, id = msg['#'], err, tmp;
 				var DBG = ctx.DBG = msg.DBG;
-				if(put['#'] && put['.']){ root.on('put', msg); return }
+				if(put['#'] && put['.']){ root.on('put', msg); return } // TODO: BUG! This needs to call HAM instead.
 				/*root.on(id, function(m){
 					console.log('ack:', m);
 				});*/
@@ -777,10 +777,11 @@
 						setTimeout(function(){
 							ham(val, key, soul, state, msg);
 						}, to > MD? MD : to); // setTimeout Max Defer 32bit :(
-						if(!ctx.to){ root.on('in', {'@': msg['#'], err: to}) } ctx.to = 1;
+						if(!ctx.to){ root.on('in', {'@': msg['#'], err: to}) } ctx.to = 1; // TODO: This causes too many problems unless sending peers auto-retry.
 						return to;
 					}
-					return;
+					//return; // it should be this
+					if(!ctx.miss){ return } // but some chains have a cache miss that need to re-fire. // TODO: Improve in future.
 				}
 				(lot = ctx.lot||'').s++; lot.more++;
 				(ctx.stun || (ctx.stun = {}))[soul+key] = 1;
@@ -808,7 +809,7 @@
 			function fire(ctx){
 				if(ctx.err){ return }
 				var stop = {};
-				var root = ctx.root, next = root.next||'', put = ctx.put, tmp;
+				var root = ((ctx.$||'')._||'').root, next = (root||'').next||'', put = ctx.put, tmp;
 				var S = +new Date;
 				//Gun.graph.is(put, function(node, soul){
 				for(var soul in put){ var node = put[soul]; // Gun.obj.native() makes this safe.
@@ -931,6 +932,7 @@
 				node = Gun.graph.node(node);
 				tmp = (at||empty).ack;
 				var faith = function(){}; faith.ram = faith.faith = true; // HNPERF: We're testing performance improvement by skipping going through security again, but this should be audited.
+				faith.$ = msg.$;
 				DBG && (DBG.ga = +new Date);
 				root.on('in', {
 					'@': msg['#'],
@@ -1331,6 +1333,9 @@
 				at.on('in', {get: at.get, put: Gun.val.link.ify(get['#']), $: at.$, '@': msg['@']});
 				return;
 			}
+			if(at.$ === (msg._||'').$){ // replying to self, for perf, skip ham/security tho needs audit.
+				(msg._).miss = (at.put === u);
+			}
 			Gun.on.put(msg);
 		}
 		var empty = {}, u;
@@ -1413,7 +1418,7 @@
 			if(cat.jam){ return cat.jam.push([cb, as]) }
 			cat.jam = [[cb,as]];
 			gun.get(function go(msg, eve){
-				if(u === msg.put && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks <= tmp){
+				if(u === msg.put && !cat.root.opt.super && (tmp = Object.keys(cat.root.opt.peers).length) && ++acks <= tmp){ // TODO: super should not be in core code, bring AXE up into core instead to fix?
 					return;
 				}
 				eve.rid(msg);
@@ -1631,9 +1636,12 @@
 		}
 		var G = String.fromCharCode(31);
 		function soul(id, as, msg, eve){
-			var as = as.as, path = as.p, ref = as.ref, cat = as.at; as = as.as;
-			var sat = ref.back(function(at){ return sat = at.soul || at.link || at.dub });
-			var pat = [sat || as.soul].concat(ref._.has || ref._.get || path)
+			var as = as.as, path = as.p, ref = as.ref, cat = as.at, pat = []; as = as.as;
+			ref.back(function(at){
+				if(sat = at.soul || at.link || at.dub){ return sat }
+				pat.push(at.has || at.get);
+			});
+			pat = [sat || as.soul].concat(pat.reverse());
 			var at = ((msg || {}).$ || {})._ || {};
 			id = at.dub = at.dub || id || Gun.node.soul(cat.obj) || Gun.node.soul(msg.put || at.put) || Gun.val.link.is(msg.put || at.put) || pat.join('/') /* || (function(){
 				return (as.soul+'.')+Gun.text.hash(path.join(G)).toString(32);
@@ -1811,9 +1819,10 @@
 			}
 			if((tmp = eve.wait) && (tmp = tmp[at.id])){ clearTimeout(tmp) }
 			eve.ack = (eve.ack||0)+1;
-			if(!to && u === data && eve.ack <= (opt.acks || Object.keys(at.root.opt.peers).length)){ return }
+			// TODO: super should not be in core code, bring AXE up into core instead to fix?
+			if(!to && u === data && !at.root.opt.super && eve.ack <= (opt.acks || Object.keys(at.root.opt.peers).length)){ return }
 			if((!to && (u === data || at.soul || at.link || (link && !(0 < link.ack))))
-			|| (u === data && (tmp = Object.keys(at.root.opt.peers).length) && (!to && (link||at).ack < tmp))){
+			|| (u === data && !at.root.opt.super && (tmp = Object.keys(at.root.opt.peers).length) && (!to && (link||at).ack < tmp))){
 				tmp = (eve.wait = {})[at.id] = setTimeout(function(){
 					val.call({as:opt}, msg, eve, tmp || 1);
 				}, opt.wait || 99);
@@ -2157,10 +2166,10 @@
 				var SMIA = 0;
 				var message, loop;
 				function each(peer){ mesh.say(message, peer) }
-				var say = mesh.say = function(msg, peer){
-					if(this && this.to){ this.to.next(msg) } // compatible with middleware adapters.
+				var say = mesh.say = function(msg, peer){ var tmp;
+					if((tmp = this) && (tmp = tmp.to) && tmp.next){ tmp.next(msg) } // compatible with middleware adapters.
 					if(!msg){ return false }
-					var id, hash, tmp, raw;
+					var id, hash, raw;
 					var DBG = msg.DBG, S; if(!peer){ S = +new Date ; DBG && (DBG.y = S) }
 					var meta = msg._||(msg._=function(){});
 					if(!(id = msg['#'])){ id = msg['#'] = Type.text.random(9) }
@@ -2404,7 +2413,7 @@
 			mesh.wire = opt.wire = open;
 			function open(peer){ try{
 				if(!peer || !peer.url){ return wire && wire(peer) }
-				var url = peer.url.replace('http', 'ws');
+				var url = peer.url.replace(/^http/, 'ws');
 				var wire = peer.wire = new opt.WebSocket(url);
 				wire.onclose = function(){
 					opt.mesh.bye(peer);

+ 1 - 1
public/lib/gundb/lib/stats.js

@@ -72,6 +72,6 @@ Gun.log = console.STAT = function(a,b,c,d){
 		if(max < tmp.push([a,b])){ all[c] = [] } // reset
 		//return;
 	}
-	if(!console.LOG || log.off){ return }
+	if(!console.LOG || log.off){ return a }
 	return log.apply(Gun, arguments);
 }

+ 1 - 1
public/lib/gundb/lib/store.js

@@ -8,7 +8,7 @@ Gun.on('create', function(root){
     var Radisk = (Gun.window && Gun.window.Radisk) || require('./radisk');
     var Radix = Radisk.Radix;
     var ST = 0;
- 
+    // TODO: BUG! For RN storage, RN does not like the following require:
     opt.store = opt.store || (!Gun.window && require('./rfs')(opt));
     var dare = Radisk(opt), esc = String.fromCharCode(27);
  

+ 4 - 1
public/lib/gundb/lib/wire.js

@@ -62,7 +62,10 @@ Gun.on('opt', function(root){
 	var ws = opt.ws = opt.ws || {};
 	ws.path = ws.path || '/gun';
 	// if we DO need an HTTP server, then choose ws specific one or GUN default one.
-	if(!ws.noServer){ ws.server = ws.server || opt.web }
+	if(!ws.noServer){
+		ws.server = ws.server || opt.web;
+		if(!ws.server){ return }
+	}
 	ws.web = ws.web || new opt.WebSocket.Server(ws); // we still need a WS server.
 	ws.web.on('connection', function(wire){ var peer;
 		wire.upgradeReq = wire.upgradeReq || {};

+ 439 - 0
public/lib/hashids/hashids.js

@@ -0,0 +1,439 @@
+(function (global, factory) {
+  if (typeof define === "function" && define.amd) {
+    define("Hashids", ["exports"], factory);
+  } else if (typeof exports !== "undefined") {
+    factory(exports);
+  } else {
+    var mod = {
+      exports: {}
+    };
+    factory(mod.exports);
+    global.Hashids = mod.exports;
+  }
+})(typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : this, function (_exports) {
+  "use strict";
+
+  _exports.__esModule = true;
+  _exports.onlyChars = _exports.withoutChars = _exports.keepUnique = _exports.default = void 0;
+
+  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
+
+  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
+
+  function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
+
+  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
+
+  var Hashids =
+  /*#__PURE__*/
+  function () {
+    function Hashids(salt, minLength, alphabet, seps) {
+      if (salt === void 0) {
+        salt = '';
+      }
+
+      if (minLength === void 0) {
+        minLength = 0;
+      }
+
+      if (alphabet === void 0) {
+        alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
+      }
+
+      if (seps === void 0) {
+        seps = 'cfhistuCFHISTU';
+      }
+
+      this.minLength = minLength;
+
+      if (typeof minLength !== 'number') {
+        throw new TypeError("Hashids: Provided 'minLength' has to be a number (is " + typeof minLength + ")");
+      }
+
+      if (typeof salt !== 'string') {
+        throw new TypeError("Hashids: Provided 'salt' has to be a string (is " + typeof salt + ")");
+      }
+
+      if (typeof alphabet !== 'string') {
+        throw new TypeError("Hashids: Provided alphabet has to be a string (is " + typeof alphabet + ")");
+      }
+
+      var saltChars = Array.from(salt);
+      var alphabetChars = Array.from(alphabet);
+      var sepsChars = Array.from(seps);
+      this.salt = saltChars;
+      var uniqueAlphabet = keepUnique(alphabetChars);
+
+      if (uniqueAlphabet.length < minAlphabetLength) {
+        throw new Error("Hashids: alphabet must contain at least " + minAlphabetLength + " unique characters, provided: " + uniqueAlphabet);
+      }
+      /** `alphabet` should not contains `seps` */
+
+
+      this.alphabet = withoutChars(uniqueAlphabet, sepsChars);
+      /** `seps` should contain only characters present in `alphabet` */
+
+      var filteredSeps = onlyChars(sepsChars, uniqueAlphabet);
+      this.seps = shuffle(filteredSeps, saltChars);
+      var sepsLength;
+      var diff;
+
+      if (this.seps.length === 0 || this.alphabet.length / this.seps.length > sepDiv) {
+        sepsLength = Math.ceil(this.alphabet.length / sepDiv);
+
+        if (sepsLength > this.seps.length) {
+          var _this$seps;
+
+          diff = sepsLength - this.seps.length;
+
+          (_this$seps = this.seps).push.apply(_this$seps, _toConsumableArray(this.alphabet.slice(0, diff)));
+
+          this.alphabet = this.alphabet.slice(diff);
+        }
+      }
+
+      this.alphabet = shuffle(this.alphabet, saltChars);
+      var guardCount = Math.ceil(this.alphabet.length / guardDiv);
+
+      if (this.alphabet.length < 3) {
+        this.guards = this.seps.slice(0, guardCount);
+        this.seps = this.seps.slice(guardCount);
+      } else {
+        this.guards = this.alphabet.slice(0, guardCount);
+        this.alphabet = this.alphabet.slice(guardCount);
+      }
+
+      this.guardsRegExp = makeAnyOfCharsRegExp(this.guards);
+      this.sepsRegExp = makeAnyOfCharsRegExp(this.seps);
+      this.allowedCharsRegExp = makeAtLeastSomeCharRegExp([].concat(_toConsumableArray(this.alphabet), _toConsumableArray(this.guards), _toConsumableArray(this.seps)));
+    }
+
+    var _proto = Hashids.prototype;
+
+    _proto.encode = function encode(first) {
+      for (var _len = arguments.length, numbers = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
+        numbers[_key - 1] = arguments[_key];
+      }
+
+      var ret = '';
+
+      if (Array.isArray(first)) {
+        numbers = first;
+      } else {
+        // eslint-disable-next-line eqeqeq
+        numbers = [].concat(_toConsumableArray(first != null ? [first] : []), _toConsumableArray(numbers));
+      }
+
+      if (!numbers.length) {
+        return ret;
+      }
+
+      if (!numbers.every(isIntegerNumber)) {
+        numbers = numbers.map(function (n) {
+          return typeof n === 'bigint' || typeof n === 'number' ? n : safeParseInt10(String(n));
+        });
+      }
+
+      if (!numbers.every(isPositiveAndFinite)) {
+        return ret;
+      }
+
+      return this._encode(numbers).join('');
+    };
+
+    _proto.decode = function decode(id) {
+      if (!id || typeof id !== 'string' || id.length === 0) return [];
+      return this._decode(id);
+    }
+    /**
+     * @description Splits a hex string into groups of 12-digit hexadecimal numbers,
+     * then prefixes each with '1' and encodes the resulting array of numbers
+     *
+     * Encoding '00000000000f00000000000f000f' would be the equivalent of:
+     * Hashids.encode([0x100000000000f, 0x100000000000f, 0x1000f])
+     *
+     * This means that if your environment supports BigInts,
+     * you will get different (shorter) results if you provide
+     * a BigInt representation of your hex and use `encode` directly, e.g.:
+     * Hashids.encode(BigInt(`0x${hex}`))
+     *
+     * To decode such a representation back to a hex string, use the following snippet:
+     * Hashids.decode(id)[0].toString(16)
+     */
+    ;
+
+    _proto.encodeHex = function encodeHex(hex) {
+      switch (typeof hex) {
+        case 'bigint':
+          hex = hex.toString(16);
+          break;
+
+        case 'string':
+          if (!/^[0-9a-fA-F]+$/.test(hex)) return '';
+          break;
+
+        default:
+          throw new Error("Hashids: The provided value is neither a string, nor a BigInt (got: " + typeof hex + ")");
+      }
+
+      var numbers = splitAtIntervalAndMap(hex, 12, function (part) {
+        return parseInt("1" + part, 16);
+      });
+      return this.encode(numbers);
+    };
+
+    _proto.decodeHex = function decodeHex(id) {
+      return this.decode(id).map(function (number) {
+        return number.toString(16).slice(1);
+      }).join('');
+    };
+
+    _proto._encode = function _encode(numbers) {
+      var _this = this;
+
+      var alphabet = this.alphabet;
+      var numbersIdInt = numbers.reduce(function (last, number, i) {
+        return last + (typeof number === 'bigint' ? Number(number % BigInt(i + 100)) : number % (i + 100));
+      }, 0);
+      var ret = [alphabet[numbersIdInt % alphabet.length]];
+      var lottery = ret.slice();
+      var seps = this.seps;
+      var guards = this.guards;
+      numbers.forEach(function (number, i) {
+        var _ret;
+
+        var buffer = lottery.concat(_this.salt, alphabet);
+        alphabet = shuffle(alphabet, buffer);
+        var last = toAlphabet(number, alphabet);
+
+        (_ret = ret).push.apply(_ret, _toConsumableArray(last));
+
+        if (i + 1 < numbers.length) {
+          var charCode = last[0].codePointAt(0) + i;
+          var extraNumber = typeof number === 'bigint' ? Number(number % BigInt(charCode)) : number % charCode;
+          ret.push(seps[extraNumber % seps.length]);
+        }
+      });
+
+      if (ret.length < this.minLength) {
+        var prefixGuardIndex = (numbersIdInt + ret[0].codePointAt(0)) % guards.length;
+        ret.unshift(guards[prefixGuardIndex]);
+
+        if (ret.length < this.minLength) {
+          var suffixGuardIndex = (numbersIdInt + ret[2].codePointAt(0)) % guards.length;
+          ret.push(guards[suffixGuardIndex]);
+        }
+      }
+
+      var halfLength = Math.floor(alphabet.length / 2);
+
+      while (ret.length < this.minLength) {
+        var _ret2, _ret3;
+
+        alphabet = shuffle(alphabet, alphabet);
+
+        (_ret2 = ret).unshift.apply(_ret2, _toConsumableArray(alphabet.slice(halfLength)));
+
+        (_ret3 = ret).push.apply(_ret3, _toConsumableArray(alphabet.slice(0, halfLength)));
+
+        var excess = ret.length - this.minLength;
+
+        if (excess > 0) {
+          var halfOfExcess = excess / 2;
+          ret = ret.slice(halfOfExcess, halfOfExcess + this.minLength);
+        }
+      }
+
+      return ret;
+    };
+
+    _proto.isValidId = function isValidId(id) {
+      return this.allowedCharsRegExp.test(id);
+    };
+
+    _proto._decode = function _decode(id) {
+      if (!this.isValidId(id)) {
+        throw new Error("The provided ID (" + id + ") is invalid, as it contains characters that do not exist in the alphabet (" + this.guards.join('') + this.seps.join('') + this.alphabet.join('') + ")");
+      }
+
+      var idGuardsArray = id.split(this.guardsRegExp);
+      var splitIndex = idGuardsArray.length === 3 || idGuardsArray.length === 2 ? 1 : 0;
+      var idBreakdown = idGuardsArray[splitIndex];
+      if (idBreakdown.length === 0) return [];
+      var lotteryChar = idBreakdown[Symbol.iterator]().next().value;
+      var idArray = idBreakdown.slice(lotteryChar.length).split(this.sepsRegExp);
+      var lastAlphabet = this.alphabet;
+      var result = [];
+
+      for (var _iterator = idArray, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
+        var _ref;
+
+        if (_isArray) {
+          if (_i >= _iterator.length) break;
+          _ref = _iterator[_i++];
+        } else {
+          _i = _iterator.next();
+          if (_i.done) break;
+          _ref = _i.value;
+        }
+
+        var subId = _ref;
+        var buffer = [lotteryChar].concat(_toConsumableArray(this.salt), _toConsumableArray(lastAlphabet));
+        var nextAlphabet = shuffle(lastAlphabet, buffer.slice(0, lastAlphabet.length));
+        result.push(fromAlphabet(Array.from(subId), nextAlphabet));
+        lastAlphabet = nextAlphabet;
+      } // if the result is different from what we'd expect, we return an empty result (malformed input):
+
+
+      if (this._encode(result).join('') !== id) return [];
+      return result;
+    };
+
+    return Hashids;
+  }();
+
+  _exports.default = Hashids;
+  var minAlphabetLength = 16;
+  var sepDiv = 3.5;
+  var guardDiv = 12;
+
+  var keepUnique = function keepUnique(content) {
+    return Array.from(new Set(content));
+  };
+
+  _exports.keepUnique = keepUnique;
+
+  var withoutChars = function withoutChars(chars, _withoutChars) {
+    return chars.filter(function (char) {
+      return !_withoutChars.includes(char);
+    });
+  };
+
+  _exports.withoutChars = withoutChars;
+
+  var onlyChars = function onlyChars(chars, keepChars) {
+    return chars.filter(function (char) {
+      return keepChars.includes(char);
+    });
+  };
+
+  _exports.onlyChars = onlyChars;
+
+  var isIntegerNumber = function isIntegerNumber(n) {
+    return typeof n === 'bigint' || !Number.isNaN(Number(n)) && Math.floor(Number(n)) === n;
+  };
+
+  var isPositiveAndFinite = function isPositiveAndFinite(n) {
+    return typeof n === 'bigint' || n >= 0 && Number.isSafeInteger(n);
+  };
+
+  function shuffle(alphabetChars, saltChars) {
+    if (saltChars.length === 0) {
+      return alphabetChars;
+    }
+
+    var integer;
+    var transformed = alphabetChars.slice();
+
+    for (var i = transformed.length - 1, v = 0, p = 0; i > 0; i--, v++) {
+      v %= saltChars.length;
+      p += integer = saltChars[v].codePointAt(0);
+      var j = (integer + v + p) % i; // swap characters at positions i and j
+
+      var a = transformed[i];
+      var b = transformed[j];
+      transformed[j] = a;
+      transformed[i] = b;
+    }
+
+    return transformed;
+  }
+
+  var toAlphabet = function toAlphabet(input, alphabetChars) {
+    var id = [];
+
+    if (typeof input === 'bigint') {
+      var alphabetLength = BigInt(alphabetChars.length);
+
+      do {
+        id.unshift(alphabetChars[Number(input % alphabetLength)]);
+        input = input / alphabetLength;
+      } while (input > BigInt(0));
+    } else {
+      do {
+        id.unshift(alphabetChars[input % alphabetChars.length]);
+        input = Math.floor(input / alphabetChars.length);
+      } while (input > 0);
+    }
+
+    return id;
+  };
+
+  var fromAlphabet = function fromAlphabet(inputChars, alphabetChars) {
+    return inputChars.reduce(function (carry, item) {
+      var index = alphabetChars.indexOf(item);
+
+      if (index === -1) {
+        throw new Error("The provided ID (" + inputChars.join('') + ") is invalid, as it contains characters that do not exist in the alphabet (" + alphabetChars.join('') + ")");
+      }
+
+      if (typeof carry === 'bigint') {
+        return carry * BigInt(alphabetChars.length) + BigInt(index);
+      }
+
+      var value = carry * alphabetChars.length + index;
+      var isSafeValue = Number.isSafeInteger(value);
+
+      if (isSafeValue) {
+        return value;
+      } else {
+        if (typeof BigInt === 'function') {
+          return BigInt(carry) * BigInt(alphabetChars.length) + BigInt(index);
+        } else {
+          // we do not have support for BigInt:
+          throw new Error("Unable to decode the provided string, due to lack of support for BigInt numbers in the current environment");
+        }
+      }
+    }, 0);
+  };
+
+  var safeToParseNumberRegExp = /^\+?[0-9]+$/;
+
+  var safeParseInt10 = function safeParseInt10(str) {
+    return safeToParseNumberRegExp.test(str) ? parseInt(str, 10) : NaN;
+  };
+
+  var splitAtIntervalAndMap = function splitAtIntervalAndMap(str, nth, map) {
+    return Array.from({
+      length: Math.ceil(str.length / nth)
+    }, function (_, index) {
+      return map(str.slice(index * nth, (index + 1) * nth));
+    });
+  };
+
+  var makeAnyOfCharsRegExp = function makeAnyOfCharsRegExp(chars) {
+    return new RegExp(chars.map(function (char) {
+      return escapeRegExp(char);
+    }) // we need to sort these from longest to shortest,
+    // as they may contain multibyte unicode characters (these should come first)
+    .sort(function (a, b) {
+      return b.length - a.length;
+    }).join('|'));
+  };
+
+  var makeAtLeastSomeCharRegExp = function makeAtLeastSomeCharRegExp(chars) {
+    return new RegExp("^[" + chars.map(function (char) {
+      return escapeRegExp(char);
+    }) // we need to sort these from longest to shortest,
+    // as they may contain multibyte unicode characters (these should come first)
+    .sort(function (a, b) {
+      return b.length - a.length;
+    }).join('') + "]+$");
+  };
+
+  var escapeRegExp = function escapeRegExp(text) {
+    return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
+  };
+});
+
+//# sourceMappingURL=hashids.js.map

File diff suppressed because it is too large
+ 0 - 0
public/lib/hashids/hashids.js.map


File diff suppressed because it is too large
+ 0 - 0
public/lib/hashids/hashids.min.js


File diff suppressed because it is too large
+ 0 - 0
public/lib/hashids/hashids.min.js.map


+ 45 - 241
public/lib/index.css

@@ -97,187 +97,19 @@ input {
 }
 */
 
-.vwf-properties {
-  background-color: #DCC;
-}
-
-.vwf-methods {
-  background-color: #CDC;
-}
-
-.vwf-events {
-  background-color: #CCD;
-}
-
-.vwf-root {
-  background-color: #CCC;
-}
-
-.vwf-root .vwf-node:nth-child(odd) {
-  background-color: #BCC;
-}
-
-.vwf-root .vwf-node:nth-child(even) {
-  background-color: #CBC;
-}
-
-.vwf-orphanage {
-  background-color: #CCC;
-}
-
-.vwf-orphanage .vwf-node:nth-child(odd) {
-  background-color: #BCC;
-}
-
-.vwf-orphanage .vwf-node:nth-child(even) {
-  background-color: #CBC;
-}
-
-.vwf-children {
-  background-color: #CCC;
-}
-
-.vwf-children .vwf-node:nth-child(odd) {
-  background-color: #BCC;
-}
-
-.vwf-children .vwf-node:nth-child(even) {
-  background-color: #CBC;
-}
-
-.vwf-children .vwf-children {
-  background-color: #AAA;
-}
-
-.vwf-children .vwf-children .vwf-node:nth-child(odd) {
-  background-color: #9AA;
-}
-
-.vwf-children .vwf-children .vwf-node:nth-child(even) {
-  background-color: #A9A;
-}
-
-.vwf-children .vwf-children .vwf-children {
-  background-color: #888;
-}
-
-.vwf-children .vwf-children .vwf-children .vwf-node:nth-child(odd) {
-  background-color: #788;
-}
-
-.vwf-children .vwf-children .vwf-children .vwf-node:nth-child(even) {
-  background-color: #878;
-}
-
-.vwf-children .vwf-children .vwf-children .vwf-children {
-  background-color: #666;
-}
-
-.vwf-children .vwf-children .vwf-children .vwf-children .vwf-node:nth-child(odd) {
-  background-color: #566;
-}
-
-.vwf-children .vwf-children .vwf-children .vwf-children .vwf-node:nth-child(even) {
-  background-color: #656;
-}
-
-.vwf-scripts {
-  background-color: #CDD;
-}
-
-/*
-.vwf-properties, .vwf-methods, .vwf-events, .vwf-children, .vwf-scripts {
-  padding: 0;
-}
-*/
-
-/*
-.vwf-properties > .vwf-label, .vwf-methods > .vwf-label, .vwf-events > .vwf-label, .vwf-children > .vwf-label, .vwf-scripts> .vwf-label {
-  margin: 0;
-  padding: 8px 5px 5px 5px;
-  font-size: 12px;
-  font-weight: bold;
-}
-
-*/
-
-.vwf-properties > .vwf-label {
-  background-color: #CBB;
-}
-
-.vwf-methods > .vwf-label {
-  background-color: #BCB;
-}
-
-.vwf-events > .vwf-label {
-  background-color: #BBC;
-}
-
-.vwf-children > .vwf-label {
-  background-color: #BBB;
-}
-
-.vwf-scripts > .vwf-label {
-  background-color: #BCC;
-}
 
-.vwf-node > .vwf-label {
-  padding-left: 3px;
-  padding-bottom: 5px;
-}
-
-.vwf-label {
-  margin: 0;
-  padding: 2px 5px 2px 5px;
-  font-size: 18px;
-  font-family: Verdana, Arial, Helvetica, sans-serif;
-}
-
-.vwf-attribute {
-  font-size: 14px;
-}
 
 #vwf-root {
   position:absolute;
   z-index:-1;
 }
 
-#vwf-root > .vwf-label > .vwf-attribute {
-  font-size: 18px;
-}
-
-.vwf-node {
-  padding: 10px;
-}
-
 #vwf-root>div, #vwf-root>canvas {
   margin-left: auto;
   margin-right: auto;
   display: block;
 }
 
-.vwf-control-slider, .vwf-control-roll-slider, .vwf-control-pitch-slider, .vwf-control-yaw-slider, .vwf-control-x-slider, .vwf-control-y-slider, .vwf-control-z-slider, .vwf-control-r-slider, .vwf-control-g-slider, .vwf-control-b-slider {
-    display: inline-block;
-    width: 15em;
-    margin-left: 1ex;
-}
-
-.vwf-activeCamera-dropdown {
-    display: inline-block;
-    width: 15em;
-    margin-left: 1ex;
-}
-
-.vwf-roll-value, .vwf-pitch-value, .vwf-yaw-value, .vwf-r-value, .vwf-g-value, .vwf-b-value, .vwf-a-value {
-    display: inline-block;
-    width: 2em;
-}
-
-.vwf-x-value, .vwf-y-value, .vwf-z-value {
-    display: inline-block;
-    width: 4em;
-}
-
 .vwf-err {
     border: 2px solid red;
     font: 14px Arial;
@@ -349,75 +181,6 @@ text-shadow: 0px 0px 0 rgba(0, 0, 0, 0.3);
 }
 */
 
-.pace {
-  -webkit-pointer-events: none;
-  pointer-events: none;
-  -webkit-user-select: none;
-  -moz-user-select: none;
-  user-select: none;
-}
-
-.pace .pace-activity {
-  display: block;
-  position: fixed;
-  z-index: 2000;
-  top: 0;
-  right: 0;
-  width: 300px;
-  height: 300px;
-  background: #6c96f7;
-  -webkit-transition: -webkit-transform 0.3s;
-  transition: transform 0.3s;
-  -webkit-transform: translateX(100%) translateY(-100%) rotate(45deg);
-  transform: translateX(100%) translateY(-100%) rotate(45deg);
-  pointer-events: none;
-}
-
-.pace.pace-active .pace-activity {
-  -webkit-transform: translateX(50%) translateY(-50%) rotate(45deg);
-  transform: translateX(50%) translateY(-50%) rotate(45deg);
-}
-
-.pace .pace-activity::before,
-.pace .pace-activity::after {
-    position: absolute;
-    bottom: 30px;
-    left: 50%;
-    display: block;
-    border: 5px solid #fff;
-    border-radius: 50%;
-    content: '';
-}
-
-.pace .pace-activity::before {
-    margin-left: -40px;
-    width: 80px;
-    height: 80px;
-    border-right-color: rgba(0, 0, 0, .2);
-    border-left-color: rgba(0, 0, 0, .2);
-    -webkit-animation: pace-rotation 3s linear infinite;
-    animation: pace-rotation 3s linear infinite;
-}
-
-.pace .pace-activity::after {
-    bottom: 50px;
-    margin-left: -20px;
-    width: 40px;
-    height: 40px;
-    border-top-color: rgba(0, 0, 0, .2);
-    border-bottom-color: rgba(0, 0, 0, .2);
-    -webkit-animation: pace-rotation 1s linear infinite;
-    animation: pace-rotation 1s linear infinite;
-}
-
-@-webkit-keyframes pace-rotation {
-  0% { -webkit-transform: rotate(0deg); }
-  100% { -webkit-transform: rotate(359deg); }
-}
-@keyframes pace-rotation {
-  0% { transform: rotate(0deg); }
-  100% { transform: rotate(359deg); }
-}
 
 #incompatibleBrowser {
     visibility: hidden;
@@ -434,12 +197,12 @@ text-shadow: 0px 0px 0 rgba(0, 0, 0, 0.3);
 
   position: absolute;
   border: 0;
-  right: 40px;
-  bottom: 20px;
+  right: 0px;
+  bottom: 70px;
   cursor: pointer;
   min-width: 50px;
   min-height: 30px;
-  padding-right: 5%;
+  padding-right: 2%;
   padding-top: 4%;
   position: absolute;
   transition: background-color .05s ease;
@@ -477,4 +240,45 @@ text-shadow: 0px 0px 0 rgba(0, 0, 0, 0.3);
 
 .drag {
   border: 5px solid rgba(195, 0, 0, 0.751);
-}
+}
+
+a.link-in-text {
+  outline: none;
+  text-decoration: none;
+  color: inherit;
+  border-bottom: 1px solid;
+}
+
+
+a.link-in-text:link {
+  border-bottom: 1px solid;
+}
+
+
+
+a.link-in-text:visited {
+  border-bottom: 1px solid;
+}
+
+
+a.link-in-text:focus {
+  border-bottom: 2px solid; 
+  
+}
+
+a.link-in-text:hover {   
+  border-bottom: 2px solid; 
+}
+
+a.link-in-text:active {
+  
+  border-bottom: 1px solid; 
+}
+
+.unselectable {
+  -moz-user-select: text;
+  -khtml-user-select: text;
+  -webkit-user-select: text;
+  -ms-user-select: text;
+  user-select: text;
+ }

+ 252 - 5
public/lib/widgets.js

@@ -692,6 +692,28 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
         }
 
 
+        connectionSettingsGUI() {
+
+            let connectionSettings = {
+                id: 'connectionSettings',
+                $type: 'div',
+                $components: [ 
+                _app.widgets.emptyDiv,
+                window._app.widgets.buttonRaised(
+                    {
+                        "label": 'Connection settings',
+                        "onclick": function (e) {
+                            e.preventDefault();
+                            window.location.pathname = '/settings';
+                        }
+                    }), _app.widgets.emptyDiv
+                ]
+            }
+
+            return connectionSettings
+            
+        }
+
         reflectorGUI() {
 
             let webrtcConnection = {
@@ -792,6 +814,59 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
               }
 
 
+              let luminaryFeature = {
+                $type: 'div',
+                _luminarySwitch: null,
+                $components: [
+                    {
+                        $type: "p",
+                        class: "mdc-typography--headline4",
+                        $text: "Use Krestianstvo Luminary (experimental)"
+                    },
+                    {
+                        $type: 'p'
+                    },
+                    _app.widgets.switch({
+                        'id': 'forceLuminary',
+                        'init': function () {
+                            this._switch = new mdc.switchControl.MDCSwitch(this);
+                            let config = localStorage.getItem('lcs_config');
+                            this._switch.checked = JSON.parse(config).luminary;
+    
+                            // this._replaceSwitch = this._switch;
+    
+                        },
+                        'onchange': function (e) {
+    
+                            if (this._switch) {
+                                let chkAttr = this._switch.checked;//this.getAttribute('checked');
+                                if (chkAttr) {
+                                    let config = JSON.parse(localStorage.getItem('lcs_config'));
+                                    config.luminary = true;
+                                    localStorage.setItem('lcs_config', JSON.stringify(config));
+                                    window.location.reload(true);
+                                    //this._switch.checked = false;
+                                } else {
+                                    let config = JSON.parse(localStorage.getItem('lcs_config'));
+                                    config.luminary = false;
+                                    localStorage.setItem('lcs_config', JSON.stringify(config));
+                                    window.location.reload(true);
+                                }
+                            }
+                        }
+                    }
+                    ),
+                    {
+                        $type: 'label',
+                        for: 'input-forceLuminary',
+                        $text: 'Off / On'
+                    },
+                    _app.widgets.p
+    
+                ]
+            }
+    
+
             let reflectorGUI =
             {
                 $type: "div",
@@ -905,17 +980,31 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
                                     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
                                     $components: [webrtcConnection ]
                                    },
+                                   { 
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [_app.widgets.divider]
+                                   },
+                                  
+                                // {
+                                //     $type: "div",
+                                //     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                //     $components: [
+                                //     {
+                                //         $type: "h4",
+                                //         class: "mdc-typography--headline4",
+                                //         $text: "Krestianstvo Luminary settings (experimental)"
+                                //     }
+                                // ]
+                                // },
                                 {
                                     $type: "div",
                                     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
                                     $components: [
-                                    {
-                                        $type: "h4",
-                                        class: "mdc-typography--headline4",
-                                        $text: "Krestianstvo Luminary settings (experimental)"
-                                    }
+                                        luminaryFeature
                                 ]
                                 },
+                               
                                 {
                                     $type: "div",
                                     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
@@ -1017,6 +1106,164 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
         }
 
 
+        getLoginGUI(){
+
+            let loginGUI =
+            {
+                $type: "div",
+                id: "loginGUI",
+                //style:"background-color: #efefef",
+                class: "mdc-layout-grid mdc-layout-grid--align-left",
+                _alias: null,
+                _pass: null,
+                _passField: null,
+                _aliasField: null,
+                _initData: function () {
+                    this._alias = '';
+                    this._pass = '';
+                    // if (window.sessionStorage.getItem('alias')) {
+                    //     this._alias = window.sessionStorage.getItem('alias')
+                    // }
+                    // if (window.sessionStorage.getItem('tmp')) {
+                    //     this._pass = window.sessionStorage.getItem('tmp')
+                    // }
+                },
+                $init: function () {
+                    this._initData();
+                },
+                $update: function () {
+    
+                    this.$components = [
+                        {
+                            $type: "div",
+                            class: "mdc-layout-grid__inner",
+                            $components: [
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        {
+                                            $type: "span",
+                                            class: "mdc-typography--headline5",
+                                            $text: "Login: "
+                                        },
+                                        window._app.widgets.inputTextFieldOutlined({
+                                            "id": 'aliasInput',
+                                            "label": "Login",
+                                            "value": this._alias,
+                                            "type": "text",
+                                            "init": function () {
+                                                this._aliasField = new mdc.textField.MDCTextField(this);
+                                            }
+                                        }),
+                                    ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        {
+                                            $type: "span",
+                                            class: "mdc-typography--headline5",
+                                            $text: "Password: "
+                                        },
+                                        window._app.widgets.inputTextFieldOutlined({
+                                            "id": 'passwordInput',
+                                            "label": "Password",
+                                            "value": this._pass,
+                                            "type": "password",
+                                            "init": function () {
+                                                this._passField = new mdc.textField.MDCTextField(this);
+                                            }
+                                        }),
+                                    ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        window._app.widgets.buttonRaised(
+                                            {
+                                                "label": 'Sign UP',
+                                                "onclick": function (e) {
+                                                    e.preventDefault();
+    
+                                                    let alias = this._aliasField.value;
+                                                    let pass = this._passField.value
+    
+                                                    if (pass.length < 7) {
+                                                        new Noty({
+                                                            text: "Your passphrase needs to be longer than 7 letters",
+                                                            timeout: 2000,
+                                                            theme: 'mint',
+                                                            layout: 'bottomRight',
+                                                            type: 'error'
+                                                        }).show();
+                                                    } else {
+                                                        //
+                                                        _LCSDB.user().create(alias, pass,
+                                                            function (ack) {
+                                                                if (!ack.wait) { }
+                                                                if (ack.err) {
+                                                                    console.log(ack.err)
+                                                                    return ack.err
+                                                                };
+                                                                if (ack.pub) {
+                                                                    let userObj = {
+                                                                        'alias': alias,
+                                                                        'pub': ack.pub
+                                                                    };
+                                                                    _LCSDB.get('users').get(alias).put(userObj);
+    
+                                                                }
+                                                                _LCSDB.user().auth(alias, pass);
+                                                            });
+    
+                                                    }
+                                                }
+                                            }),
+                                        _app.widgets.space,
+                                        window._app.widgets.buttonRaised(
+                                            {
+                                                "label": 'Sign IN',
+                                                "onclick": function (e) {
+                                                    e.preventDefault();
+                                                    let alias = this._aliasField.value;
+                                                    let pass = this._passField.value
+                                                    _app.helpers.authUser(alias, pass);
+                                                    // _LCSDB.user().auth.call(_LCSDB, alias, pass
+                                                    // //     , function(ack) {
+    
+                                                    // //     if (ack.err) {
+                                                    // //         new Noty({
+                                                    // //             text: ack.err,
+                                                    // //             timeout: 2000,
+                                                    // //             theme: 'mint',
+                                                    // //             layout: 'bottomRight',
+                                                    // //             type: 'error'
+                                                    // //         }).show();
+    
+                                                    // //     }
+                                                    //  //}
+                                                    //  );
+                                                }
+                                            })
+    
+    
+    
+                                    ]
+                                }
+    
+                            ]
+                        }
+                    ]
+                }
+    
+            }
+            return loginGUI
+        }
+
+
       }
 
    export { Widgets }

+ 2 - 1
public/loadLibs.js

@@ -12,7 +12,8 @@ loadjs([
     '/lib/ace/ace.js',
     '/lib/yamljs/dist/yaml.js',
     '/lib/wt/drag-drop.js',
-    '/lib/wt/buffer5.6.0.min.js'
+    '/lib/wt/buffer5.6.0.min.js',
+    '/lib/hashids/hashids.min.js'
 ],'forall', {
     async: false
 });

+ 5 - 4
public/vwf.js

@@ -46,6 +46,7 @@ Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contribu
         /// @private
 
         this.proxy = undefined;
+        this.conf = undefined;
 
         this.configuration = undefined; // require( "vwf/configuration" ).active; // "active" updates in place and changes don't invalidate the reference  // TODO: assign here after converting vwf.js to a RequireJS module and listing "vwf/configuration" as a dependency
 
@@ -4579,7 +4580,7 @@ if ( ! childComponent.source ) {
                 if(dbName.includes("vwf_example_com")){
                     //userDB = await window._LCS_SYS_USER.get('proxy').then();
                    fileName = dbName;
-                   let dbNode = proxyDB.get('proxy').get(fileName).get('file');
+                   let dbNode = proxyDB.get('proxy').get(fileName);
 
                    let nodeProm = new Promise(res => dbNode.once(res))
 
@@ -4597,7 +4598,7 @@ if ( ! childComponent.source ) {
                     let worldName = dbName.split('/')[0];
                     //userDB = await window._LCS_WORLD_USER.get('worlds').path(worldName).then();
                    fileName = dbName.replace(worldName + '/', "");
-                   let dbNode = _LCSDB.user(_LCS_WORLD_USER.pub).get('worlds').path(worldName).get(fileName).get('file');
+                   let dbNode = _LCSDB.user(_LCS_WORLD_USER.pub).get('worlds').path(worldName).get(fileName);
 
                    let nodeProm = new Promise(res => dbNode.once(res))
                    nodeProm.then(comp=>{
@@ -4673,7 +4674,7 @@ if ( ! childComponent.source ) {
                 if(dbName.includes("vwf_example_com")){
                     //userDB = window._LCS_SYS_USER.get('proxy');
                     fileName = dbName;
-                    let dbNode = proxyDB.get('proxy').get(fileName).get('file');
+                    let dbNode = proxyDB.get('proxy').get(fileName);
                     let nodeProm = new Promise(res => dbNode.once(res))
 
                     nodeProm.then(comp=>{
@@ -4687,7 +4688,7 @@ if ( ! childComponent.source ) {
                 } else {
                     fileName = dbName.replace(worldName + '/', "");
 
-                    let dbNode = _LCSDB.user(_LCS_WORLD_USER.pub).get('worlds').path(worldName).get(fileName).get('file');
+                    let dbNode = _LCSDB.user(_LCS_WORLD_USER.pub).get('worlds').path(worldName).get(fileName);
                     let nodeProm = new Promise(res => dbNode.once(res))
                     nodeProm.then(comp=>{
                         parseComp (comp);

+ 1 - 1
public/vwf/model/aframe.js

@@ -625,7 +625,7 @@ define(["module", "vwf/model", "vwf/utility"], function (module, model, utility)
                                 let dbPath = propertyValue.split(".").join("_");
 
                                 let userDB = _LCSDB.user(_LCS_WORLD_USER.pub);
-                                userDB.get('worlds').get(worldName).get(dbPath).get('file').once(function(response) {
+                                userDB.get('worlds').get(worldName).get(dbPath).once(function(response) {
                                     if (response) {
 
                                         if (Object.keys(response).length > 0) {

+ 4 - 4
public/vwf/view/aframe.js

@@ -936,9 +936,9 @@ define(["module", "vwf/view"], function (module, view) {
            if (!self.state.nodes[avatarName]) {
               
 
-               if (_LCSUSER.is) {
+               if (_LCSDB.user().is) {
 
-                   _LCSUSER.get('profile').get('alias').once(alias => {
+                _LCSDB.user().get('profile').get('alias').once(alias => {
                            if (alias){
 
                                newNode.properties.displayName = alias;
@@ -947,11 +947,11 @@ define(["module", "vwf/view"], function (module, view) {
                            vwf_view.kernel.createChild(nodeID, avatarName, newNode);
                            });
 
-                           _LCSUSER.get('profile').get('avatarNode').not(res=>{
+                           _LCSDB.user().get('profile').get('avatarNode').not(res=>{
                                //vwf_view.kernel.callMethod(avatarName, "createAvatarBody", []);
                            })
 
-                               _LCSUSER.get('profile').get('avatarNode').once(res => {
+                           _LCSDB.user().get('profile').get('avatarNode').once(res => {
                                    var myNode = null;
                                    if (res) {
                                        //myNode = JSON.parse(res.avatarNode);

+ 3 - 3
public/vwf/view/document.js

@@ -85,11 +85,11 @@ define( [ "module", "vwf/view", "vwf/utility"], function( module, view, utility)
                 if(all){
                     if(Object.keys(all).includes(dbPath)){
 
-                        userDB.get('worlds').get(worldName).get(dbPath).get('file').load(function(res) { 
+                        userDB.get('worlds').get(worldName).get(dbPath).load(function(res) { 
                         //let res = all[dbPath].file;
                         loadDoc(res);
                         callback( true );
-                       },{wait:300})
+                       }) //,{wait:300}
                     } else {
                         //NEED TO FIXED!!! Error: Callback was already called.
                         // userDB.get('worlds').get('empty').get(dbPath).get('file').once(function(res) { 
@@ -106,7 +106,7 @@ define( [ "module", "vwf/view", "vwf/utility"], function( module, view, utility)
                     }
                 }
                 
-              },{wait:300})
+              }) //,{wait:300}
 
 
               

+ 32 - 11
public/vwf/view/editor-new.js

@@ -60,6 +60,20 @@ define([
             }
             );
 
+            _LCSDB.on('auth', function (ack) {
+                if (ack.sea.pub) {
+                    _app.helpers.checkUserCollision();
+
+                    console.log(_LCSDB.user().is);
+                    let loadSave = document.querySelector('#loadSaveSettings');
+                    if(loadSave){
+                       
+                    }
+                    //self.authGUI();
+                }
+                
+            });
+
             this.avatarCardDef = function (src, desc, onclickfunc) {
 
                 return {
@@ -459,7 +473,7 @@ define([
 
             var saveAvatar = {};
             var loadAvatar = {};
-            if (_LCSUSER.is) {
+            if (_LCSDB.user().is) {
                 saveAvatar = self.widgets.floatActionButton({
                     label: "save",
                     styleClass: "mdc-fab--mini",
@@ -470,7 +484,7 @@ define([
                         let nodeDef = self.helpers.getNodeDef(nodeID).children.avatarNode;
                         console.log(nodeDef);
 
-                        _LCSUSER.get('profile').get('avatarNode').put(JSON.stringify(nodeDef), acc => {
+                        _LCSDB.user().get('profile').get('avatarNode').put(JSON.stringify(nodeDef), acc => {
                             console.log("saved: " + acc)
                         });
 
@@ -484,7 +498,7 @@ define([
                     styleClass: "mdc-fab--mini",
                     onclickfunc: function () {
                         let nodeID = 'avatar-' + self.kernel.moniker();
-                        _LCSUSER.get('profile').get('avatarNode').once(res => {
+                        _LCSDB.user().get('profile').get('avatarNode').once(res => {
                             if (res) {
                                 var myNode = res;
 
@@ -993,8 +1007,8 @@ define([
 
                     let worldOwner = self.helpers.getRoot(false).root.split('/')[0];
 
-                    if (_LCSUSER.is) {
-                        if (worldOwner == _LCSUSER.is.alias) {
+                    if (_LCSDB.user().is) {
+                        if (worldOwner == _LCSDB.user().is.alias) {
 
                             userGUI.push(
                                 {
@@ -1072,8 +1086,8 @@ define([
 
                                                 let worldOwner = self.helpers.getRoot(false).root.split('/')[0];
 
-                                                if (_LCSUSER.is) {
-                                                    if (worldOwner == _LCSUSER.is.alias) {
+                                                if (_LCSDB.user().is) {
+                                                    if (worldOwner == _LCSDB.user().is.alias) {
                                                         _app.saveStateAsFile(fileName.value);
                                                     } else {
                                                         console.log('clone world with prototype to: ' + fileName);
@@ -1095,11 +1109,18 @@ define([
 
                         )
 
-                        let saveGUI = document.querySelector('#saveGUI');
-                        saveGUI.$components = userGUI.concat(saveGUI.$components);
+                        // let saveGUI = document.querySelector('#saveGUI');
+                        // saveGUI.$components = userGUI.concat(saveGUI.$components);
                         //document.querySelector('#fileName').value = 'world' + _app.helpers.randId();
 
+                    } else {
+                        userGUI.push(
+                            self.widgets.getLoginGUI()
+                        );
                     }
+                    
+                    let saveGUI = document.querySelector('#saveGUI');
+                    saveGUI.$components = userGUI.concat(saveGUI.$components);
                 },
                 $update: function () {
                 },
@@ -1802,7 +1823,7 @@ define([
 
             var saveGUI = {};
 
-            if (_LCSUSER.is) {
+            if (_LCSDB.user().is) {
                 saveGUI = self.widgets.floatActionButton({
                     label: "save",
                     styleClass: "mdc-fab--mini",
@@ -3183,7 +3204,7 @@ define([
                     let worldName = self.helpers.getRoot(true).root;//url.split('/')[0];
                     let userDB = _LCSDB.user(_LCS_WORLD_USER.pub);
 
-                    userDB.get('worlds').get(worldName).get(fileName).get('file').once(res => {
+                    userDB.get('worlds').get(worldName).get(fileName).once(res => {
 
                         this._importScript(res);
                     })

+ 91 - 0
public/web/footer.js

@@ -0,0 +1,91 @@
+/*
+The MIT License (MIT)
+Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
+*/
+
+//import page from '/lib/page.mjs';
+
+class Footer {
+    constructor() {
+        console.log("footer constructor");
+        this.language = _LangManager.language;
+
+    }
+
+    init() {
+
+        // let rootDoc = _app.indexApp.entry == 'index' ? document.querySelector('#indexPage') : document.querySelector('#app');
+        let rootDoc = document.querySelector('#app');
+
+        let el = document.createElement("div");
+        el.setAttribute("id", "footer");
+        rootDoc.appendChild(el);
+
+        document.querySelector("#footer").$cell({
+            id: 'footer',
+            $cell: true,
+            $type: "div",
+            $components: [
+
+                {
+                    $type: "div",
+                    class: "mdc-layout-grid",
+                    $components: [
+                        {
+                            $type: "div",
+                            class: "mdc-layout-grid__inner",
+                            $components: [
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        _app.widgets.divider
+                                    ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+
+
+                                        {
+
+                                            $type: "a",
+                                            style: "cursor:pointer; margin-right: 10px",
+                                            class: "mdc-typography  link-in-text mdc-theme--text-hint-on-background",
+                                            $text: "Krestianstvo.org",
+                                            href: "https://www.krestianstvo.org"
+                                        },
+                                        {
+
+                                            $type: "span",
+                                            class: "mdc-typography  mdc-theme--text-hint-on-background",
+                                            $text: "| 2020 "
+                                        }
+
+
+
+                                    ]
+                                }
+                               
+                                
+
+
+                            ]
+                        }
+                    ]
+                }
+
+
+
+
+
+            ]
+        })
+
+    }
+
+
+}
+
+export { Footer }

+ 106 - 16
public/web/header.js

@@ -12,32 +12,122 @@ class Header {
 
     }
 
-    init(){
+    init() {
 
+        var rootDoc = document.body
+        if(_app.indexApp){
+            rootDoc = _app.indexApp.entry == 'index' ? document.querySelector('#indexPage') : document.querySelector('#app');
+        //let rootDoc = document.querySelector('#app');
+        } 
 
         let el = document.createElement("div");
         el.setAttribute("id", "header");
-        document.body.appendChild(el);
-
-        let headerGUI = {
-            
-                $type: "a",
-                class: "mdc-button mdc-button--compact mdc-card__action",
-                $text: "Back",
-                //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                onclick: function (e) {
-                    window.history.back();
-                }
-            
-        }
-
+        rootDoc.prepend(el);
 
         document.querySelector("#header").$cell({
             id: 'header',
             $cell: true,
             $type: "div",
             $components: [
-                //headerGUI
+
+                {
+                    $type: "div",
+                    class: "mdc-layout-grid",
+                    $components: [
+                        {
+                            $type: "div",
+                            class: "mdc-layout-grid__inner",
+                            $components: [
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+
+
+                                        {
+
+                                            $type: "a",
+                                            style: "cursor:pointer; margin-right: 10px",
+                                            class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
+                                            $text: "Home",
+                                            //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                            onclick: function (e) {
+                                                window.location.pathname = '/'
+                                                //window.history.back();
+                                            }
+
+                                        },
+                                        {
+                                            $type: "a",
+                                            style: "cursor:pointer; margin-right: 10px",
+                                            class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
+                                            $text: "Connection settings",
+                                            //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                            onclick: function (e) {
+                                                window.location.pathname = '/settings'
+                                                //window.history.back();
+                                            }
+
+                                        },
+                                        {
+
+                                            $type: "a",
+                                            style: "cursor:pointer; margin-right: 40px",
+                                            class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
+                                            $text: "Help",
+                                            //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                            href: 'https://www.krestianstvo.org/docs/sdk3'
+
+                                        },
+                                        {
+                                            $type: "a",
+                                            id: 'ruLang',
+                                            style: "cursor:pointer; margin-right: 10px",
+                                            class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
+                                            $text: "RU",
+                                            //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                            onclick: function (e) {
+                                                _LangManager.locale = 'ru';
+                                                window.location.reload(true);
+                                            }
+
+                                        },
+                                        {
+                                            $type: "a",
+                                            id: 'enLang',
+                                            style: "cursor:pointer; margin-right: 10px",
+                                            class: "mdc-typography link-in-text mdc-theme--text-hint-on-background",
+                                            $text: "EN",
+                                            //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                            onclick: function (e) {
+                                                _LangManager.locale = 'en';
+                                                window.location.reload(true);
+                                            }
+
+                                        }
+
+
+                                    ]
+                                },
+                                {
+                                    $type: "div",
+                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    $components: [
+                                        _app.widgets.divider
+                                    ]
+                                }
+                                
+
+
+                            ]
+                        }
+                    ]
+                }
+
+
+
+
+
             ]
         })
 

+ 1 - 40
public/web/index-app.css

@@ -31,39 +31,6 @@ background: linear-gradient(0deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5) ), url(
 }
 
 
-a.link-in-text {
-  outline: none;
-  text-decoration: none;
-  color: inherit;
-  border-bottom: 1px solid;
-}
-
-
-a.link-in-text:link {
-  border-bottom: 1px solid;
-}
-
-
-
-a.link-in-text:visited {
-  border-bottom: 1px solid;
-}
-
-
-a.link-in-text:focus {
-  border-bottom: 2px solid; 
-  
-}
-
-a.link-in-text:hover {   
-  border-bottom: 2px solid; 
-}
-
-a.link-in-text:active {
-  
-  border-bottom: 1px solid; 
-}
-
 /* 
 border-bottom: 1px solid; 
 background: rgb(237, 237, 237);
@@ -82,10 +49,4 @@ background: rgb(217, 217, 217);
   margin: 3px
 }
 
-.unselectable {
-  -moz-user-select: text;
-  -khtml-user-select: text;
-  -webkit-user-select: text;
-  -ms-user-select: text;
-  user-select: text;
- }
+

File diff suppressed because it is too large
+ 457 - 396
public/web/index-app.js


+ 0 - 10
public/web/locale/en/index.html

@@ -5,16 +5,6 @@
 
 <div id="headerGUI" class="mdc-layout-grid mdc-layout-grid--align-left">
   <div class="mdc-layout-grid__inner">
-    <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
-      <span class="mdc-typography--subtitle1 mdc-theme--text-secondary-on-background mdc-typography">
-        <a id="ruLang" class="mdc-typography link-in-text mdc-theme--text-hint-on-background" style="cursor:pointer">RU</a>
-        <!--<strong>LiveCoding</strong>.space -->
-      </span>
-      <span class="mdc-typography--subtitle1 mdc-theme--text-secondary-on-background mdc-typography">
-        <a id="enLang" class="mdc-typography link-in-text mdc-theme--text-hint-on-background" style="cursor:pointer">EN</a>
-        <!--<strong>LiveCoding</strong>.space -->
-      </span>
-    </div>
     <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
       <div id="titleText">
         <h1 class="mdc-typography--headline3 mdc-theme--text-secondary-on-background mdc-typography"><a class="mdc-typography link-in-text"

+ 0 - 10
public/web/locale/ru/index.html

@@ -5,16 +5,6 @@
 
 <div id="headerGUI" class="mdc-layout-grid mdc-layout-grid--align-left">
   <div class="mdc-layout-grid__inner">
-    <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
-      <span class="mdc-typography--subtitle1 mdc-theme--text-secondary-on-background mdc-typography">
-        <a id="ruLang" class="mdc-typography link-in-text mdc-theme--text-hint-on-background" style="cursor:pointer">RU</a>
-        <!--<strong>LiveCoding</strong>.space -->
-      </span>
-      <span class="mdc-typography--subtitle1 mdc-theme--text-secondary-on-background mdc-typography">
-        <a id="enLang" class="mdc-typography link-in-text mdc-theme--text-hint-on-background" style="cursor:pointer">EN</a>
-        <!--<strong>LiveCoding</strong>.space -->
-      </span>
-    </div>
     <div class="mdc-layout-grid__cell mdc-layout-grid__cell--span-12">
       <div id="titleText">
         <h1 class="mdc-typography--headline3 mdc-theme--text-secondary-on-background mdc-typography"><a class="mdc-typography link-in-text"

+ 363 - 356
public/web/world-app.js

@@ -18,13 +18,37 @@ class WorldApp {
         //this.worlds = {};
         this.language = _LangManager.language;
 
+        let rootDoc = document.querySelector('#app');
         let el = document.createElement("div");
         el.setAttribute("id", "aboutWorld");
-        document.body.appendChild(el);
+        rootDoc.appendChild(el);
 
         let el2 = document.createElement("div");
         el2.setAttribute("id", "worldStates");
-        document.body.appendChild(el2);
+        rootDoc.appendChild(el2);
+
+        document.querySelector("#worldStates").$cell({
+            id: "worldStates",
+            $cell: true,
+            $type: "div",
+            _comps: [],
+            _wcards: {},
+            $components: [],
+            _refresh: function (comps) {
+                //do update;
+                //this._userAlias = user;
+                this._comps = comps;
+                this.$components = this._comps;
+            },
+            $init: function () {
+                console.log('init comp...');
+            },
+
+            $update: function () {
+                //do update;
+                console.log('update me');
+            }
+        });
 
     }
 
@@ -52,7 +76,7 @@ class WorldApp {
                 }
                 //console.log(data);
             },
-            $update: function(){},
+            $update: function () { },
             _updateComps: function () {
                 this.$components = [
                     {
@@ -103,289 +127,361 @@ class WorldApp {
         let space = this.worldName;
         let saveName = this.saveName;
 
-       
+
 
         let cardID = user.user + '_' + space + '_' + (saveName ? saveName : "");
-        let worldCardGUI = _app.indexApp.createWorldCard(cardID, 'full');
+        let cardWorldType = saveName ? 'state' : 'proto';
+
+        let worldNameInfo = saveName ? { protoName: space, stateName: saveName } : space
+
+        let worldCardGUI = _app.indexApp.createWorldCard(cardWorldType, this.userAlias, userPub, worldNameInfo, cardID, "full", setWorldParameters); //createWorldCard(userAlias, userPub, worldName, id, type)
         let worldStatesGUI = [];
 
         //var runWorldGUI = {};
 
-     
 
-        let actionsGUI = {
-            $cell: true,
-            id: "worldActionsGUI",
-            $type: "div",
-            $components: [],
-            _worldInfo: {},
-            _refresh: function () {
+        function setWorldParameters(data) {
 
-                this._worldInfo = {
-                    'userAlias': self.userAlias,
-                    'worldName': self.saveName ? self.worldName + '/load/' + self.saveName : self.worldName,
-                    'type': self.saveName ? 'saveState' : 'proto'
-                }
+            console.log(data);
+            let actionsGUI = {
+                $cell: true,
+                id: "worldActionsGUI",
+                $type: "div",
+                $components: [],
+                _worldInfo: {},
+                _refresh: function () {
 
-                //    let worldCard = document.querySelector('#worldCard');
-                //    if(worldCard){
-                //        this._worldInfo = worldCard._worldInfo;
-                //    } 
-            },
-            $init: function () {
-                if (_LCSDB.user().is) {
-                    this._refresh();
-                }
-            },
-            $update: function () {
+                    this._worldInfo = {
+                        'userAlias': self.userAlias,
+                        'worldName': self.saveName ? self.worldName + '/load/' + self.saveName : self.worldName,
+                        'type': self.saveName ? 'saveState' : 'proto'
+                    }
 
-                let desc = this._worldInfo;
-                let userGUI = [];
+                    //    let worldCard = document.querySelector('#worldCard');
+                    //    if(worldCard){
+                    //        this._worldInfo = worldCard._worldInfo;
+                    //    } 
+                },
+                $init: function () {
+                    if (_LCSDB.user().is) {
+                        this._refresh();
+                    }
+                },
+                $update: function () {
 
-                // if(!desc){
-                //     this.$components = [];
-                //     return
-                // }
+                    let desc = this._worldInfo;
+                    let userGUI = [];
 
-                if (_LCSDB.user().is) {
-                    if (_LCSDB.user().is.alias == desc.userAlias) {
-                        userGUI.push(
-                            {
-                                $type: "a",
-                                class: "mdc-button ",
-                                $text: "Edit info",
-                                //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                onclick: function (e) {
-                                    //'/:user/:type/:name/edit/:file'
-                                    if (desc.type == 'proto') {
-                                        window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/info_json'
-                                    } else if (desc.type == 'saveState') {
-                                        let names = desc.worldName.split('/');
-                                        let filename = ('savestate_/' + names[0] + '/' + names[2] + '_info_vwf_json').split('/').join("~");
-                                        window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
-                                    }
-                                    //self.refresh();
-                                }
-                            },
-                            {
-                                $type: "a",
-                                class: "mdc-button ",
-                                $text: "Edit source",
-                                //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                onclick: function (e) {
-                                    //'/:user/:type/:name/edit/:file'
-                                    if (desc.type == 'proto') {
-                                        window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
-                                    } else if (desc.type == 'saveState') {
-                                        let names = desc.worldName.split('/');
-                                        let filename = ('savestate_/' + names[0] + '/' + names[2] + '_vwf_json').split('/').join("~");
-                                        window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
-                                    }
-                                    //self.refresh();
-                                }
-                            }
+                    // if(!desc){
+                    //     this.$components = [];
+                    //     return
+                    // }
 
-                        );
-
-                        if (desc.type == 'proto') {
-                          
+                    if (_LCSDB.user().is) {
+                        if (_LCSDB.user().is.alias == desc.userAlias) {
                             userGUI.push(
-                                // {
-                                //     $type: "a",
-                                //     class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                //     $text: "Edit proto",
-                                //     //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                //     onclick: function (e) {
-                                //         window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
-                                //     }
-                                // },
-                               
-                                   {
-                                    $type: "a",
-                                    class: "mdc-button ",
-                                    $text: "Edit config",
-                                    //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                    onclick: function (e) {
-                                        window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_config_yaml'
-                                    }
-                                },
-                                {$type: "br"},
-                                {
-                                    $type: "a",
-                                    class: "mdc-button",
-                                    $text: "Edit appui.js",
-                                    //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                    onclick: function (e) {
-                                        window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/appui_js'
-                                    }
-                                },
-                               
                                 {
                                     $type: "a",
-                                    class: "mdc-button",
-                                    $text: "Edit assets.json",
+                                    class: "mdc-button ",
+                                    $text: "Edit info",
                                     //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
                                     onclick: function (e) {
-                                        window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/assets_json'
+                                        //'/:user/:type/:name/edit/:file'
+                                        if (desc.type == 'proto') {
+                                            window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/info_json'
+                                        } else if (desc.type == 'saveState') {
+                                            let names = desc.worldName.split('/');
+                                            let filename = ('savestate_/' + names[0] + '/' + names[2] + '_info_vwf_json').split('/').join("~");
+                                            window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
+                                        }
+                                        //self.refresh();
                                     }
                                 },
                                 {
                                     $type: "a",
-                                    class: "mdc-button",
-                                    $text: "Edit index.vwf.html",
+                                    class: "mdc-button ",
+                                    $text: "Edit source",
                                     //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
                                     onclick: function (e) {
-                                        window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_html'
+                                        //'/:user/:type/:name/edit/:file'
+                                        if (desc.type == 'proto') {
+                                            window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
+                                        } else if (desc.type == 'saveState') {
+                                            let names = desc.worldName.split('/');
+                                            let filename = ('savestate_/' + names[0] + '/' + names[2] + '_vwf_json').split('/').join("~");
+                                            window.location.pathname = "/" + desc.userAlias + '/state/' + names[0] + '/edit/' + filename;
+                                        }
+                                        //self.refresh();
                                     }
                                 }
-                            
+
                             );
 
-                            userGUI.push(
-                                {$type: "br"},
-                                {
-                                    $type: "a",
-                                    class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                    $text: "Delete",
-                                    //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                    onclick: function (e) {
-                                        _app.deleteWorld(desc.worldName, 'proto');
+                            if (desc.type == 'proto') {
+
+                                userGUI.push(
+                                    // {
+                                    //     $type: "a",
+                                    //     class: "mdc-button mdc-button--raised mdc-card__action actionButton",
+                                    //     $text: "Edit proto",
+                                    //     //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                    //     onclick: function (e) {
+                                    //         window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_yaml'
+                                    //     }
+                                    // },
+
+                                    {
+                                        $type: "a",
+                                        class: "mdc-button ",
+                                        $text: "Edit config",
+                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                        onclick: function (e) {
+                                            window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_config_yaml'
+                                        }
+                                    },
+                                    { $type: "br" },
+                                    {
+                                        $type: "a",
+                                        class: "mdc-button",
+                                        $text: "Edit appui.js",
+                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                        onclick: function (e) {
+                                            window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/appui_js'
+                                        }
+                                    },
+
+                                    {
+                                        $type: "a",
+                                        class: "mdc-button",
+                                        $text: "Edit assets.json",
+                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                        onclick: function (e) {
+                                            window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/assets_json'
+                                        }
+                                    },
+                                    {
+                                        $type: "a",
+                                        class: "mdc-button",
+                                        $text: "Edit index.vwf.html",
+                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                        onclick: function (e) {
+                                            window.location.pathname = "/" + desc.userAlias + '/proto/' + desc.worldName + '/edit/index_vwf_html'
+                                        }
                                     }
-                                }
-                            );
+
+                                );
+
+                                userGUI.push(
+                                    { $type: "br" },
+                                    {
+                                        $type: "a",
+                                        class: "mdc-button mdc-button--raised mdc-card__action actionButton",
+                                        $text: "Delete",
+                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                        onclick: function (e) {
+                                            _app.deleteWorld(desc.worldName, 'proto');
+                                        }
+                                    }
+                                );
+
+
+                                let proxyID = data.proxy;
+
+                                userGUI.push(
+                                    {
+                                        $type: "div",
+                                        style: "margin-top: 20px;",
+                                        _proxyName: null,
+                                        _proxyNameField: null,
+                                        $components:
+                                            [
+
+                                                window._app.widgets.inputTextFieldOutlined({
+                                                    "id": 'proxyName',
+                                                    "label": proxyID,
+                                                    "value": this._proxyName,
+                                                    "type": "text",
+                                                    "init": function () {
+                                                        this._proxyNameField = new mdc.textField.MDCTextField(this);
+                                                        if (!proxyID) {
+                                                            //document.querySelector('#proxyName').value = res;
+                                                        } else {
+                                                            _app.helpers.getUserAlias(proxyID).then(res => {
+                                                                document.querySelector('#proxyName').value = res;
+                                                            })
+                                                        }
+                                                    }
+                                                }),
+                                                {
+                                                    $type: "a",
+                                                    class: "mdc-button mdc-button--raised mdc-card__action actionButton",
+                                                    $text: 'Set proxy', //self.language.t('set proxy'),//"clone",
+                                                    onclick: function (e) {
+                                                        //console.log('clone');
+                                                        let newProxyName = this._proxyNameField.value;
+                                                        _app.setNewProxyForWorld(desc.worldName, newProxyName);
+                                                        //_app.cloneWorldPrototype(desc.worldName, desc.userAlias, newProtoName);
+                                                        //self.refresh();
+                                                    }
+                                                }
+
+
+                                            ]
+                                    }
+                                )
+
+
+
+                            }
+
+
+                            if (desc.type == 'saveState') {
+                                userGUI.push(
+                                    { $type: "br" },
+                                    {
+                                        $type: "a",
+                                        class: "mdc-button mdc-button--raised mdc-card__action actionButton",
+                                        $text: "Delete",
+                                        //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
+                                        onclick: function (e) {
+                                            _app.deleteWorld(desc.worldName, 'state');
+                                        }
+                                    }
+                                );
+                            }
 
 
-                            let proxyID = worldCardGUI._worldInfo.proxy;
+                        }
 
+                        if (desc.type == 'proto') {
+                            let worldID = window._app.helpers.GenerateInstanceID().toString();
                             userGUI.push(
                                 {
                                     $type: "div",
                                     style: "margin-top: 20px;",
-                                    _proxyName: null,
-                                    _proxyNameField: null,
+                                    _protoName: null,
+                                    _protoNameField: null,
                                     $components:
                                         [
-  
                                             window._app.widgets.inputTextFieldOutlined({
-                                                "id": 'proxyName',
-                                                "label": proxyID,
-                                                "value": this._proxyName,
+                                                "id": 'protoName',
+                                                "label": worldID,
+                                                "value": this._protoName,
                                                 "type": "text",
                                                 "init": function () {
-                                                    this._proxyNameField = new mdc.textField.MDCTextField(this);
-                                                    if(!proxyID){
-                                                        //document.querySelector('#proxyName').value = res;
-                                                    } else {
-                                                        _app.helpers.getUserAlias(proxyID).then(res=>{
-                                                            document.querySelector('#proxyName').value = res;
-                                                        })
-                                                    }
+                                                    this._protoNameField = new mdc.textField.MDCTextField(this);
                                                 }
                                             }),
                                             {
                                                 $type: "a",
                                                 class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                                $text: 'Set proxy', //self.language.t('set proxy'),//"clone",
+                                                $text: self.language.t('clone proto'),//"clone",
                                                 onclick: function (e) {
                                                     //console.log('clone');
-                                                    let newProxyName = this._proxyNameField.value;
-                                                    _app.setNewProxyForWorld(desc.worldName, newProxyName);
-                                                    //_app.cloneWorldPrototype(desc.worldName, desc.userAlias, newProtoName);
+                                                    let newProtoName = this._protoNameField.value;
+                                                    _app.cloneWorldPrototype(desc.worldName, desc.userAlias, newProtoName);
                                                     //self.refresh();
                                                 }
                                             }
-                                            
-                                           
+
                                         ]
                                 }
                             )
+                        } else if (desc.type == 'saveState') {
+
 
+                            // userGUI.push(
+                            //     {
+                            //         $type: "a",
+                            //         class: "mdc-button mdc-button--compact mdc-card__action mdc-button--outlined",
+                            //         $text: "Clone",
+                            //         onclick: function (e) {
+                            //             //console.log('clone');
 
-                            
+                            //             //self.cloneWorldState(desc[0], desc[2]);
+
+                            //             //self.refresh();
+                            //         }
+                            //     })
                         }
 
+                    }
 
-                        if (desc.type == 'saveState') {
-                            userGUI.push(
-                                {$type: "br"},
-                                {
-                                    $type: "a",
-                                    class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                    $text: "Delete",
-                                    //href: "/" + desc[2] + '/worlds/' + desc[0] + '/edit', ///:user/worlds/:name/edit
-                                    onclick: function (e) {
-                                        _app.deleteWorld(desc.worldName, 'state');
-                                    }
-                                }
-                            );
+
+
+                    this.$components = [
+                        {
+                            $type: "div",
+                            $text: "World actions:"
                         }
+                    ].concat(userGUI)
+                }
+            }
 
 
-                    }
+            document.querySelector("#aboutWorld")._actionsGUI = actionsGUI;
+
+            ///settings
+
+            let settings = data.settings;
+            if (settings) {
+                if (settings.ar) {
 
-                    if (desc.type == 'proto') {
-                        let worldID = window._app.helpers.GenerateInstanceID().toString();
-                        userGUI.push(
+                    let runWorldGUI = {
+                        id: "runWorldGUI",
+                        $type: "div",
+                        $init: function () {
+                            console.log(worldCardGUI);
+                        },
+                        _arSwitch: null,
+                        _turnArOnSwitch: null,
+                        $components: [
                             {
                                 $type: "div",
-                                style: "margin-top: 20px;",
-                                _protoName: null,
-                                _protoNameField: null,
-                                $components:
-                                    [
-                                        window._app.widgets.inputTextFieldOutlined({
-                                            "id": 'protoName',
-                                            "label": worldID,
-                                            "value": this._protoName,
-                                            "type": "text",
-                                            "init": function () {
-                                                this._protoNameField = new mdc.textField.MDCTextField(this);
-                                            }
-                                        }),
-                                        {
-                                            $type: "a",
-                                            class: "mdc-button mdc-button--raised mdc-card__action actionButton",
-                                            $text: self.language.t('clone proto'),//"clone",
-                                            onclick: function (e) {
-                                                //console.log('clone');
-                                                let newProtoName = this._protoNameField.value;
-                                                _app.cloneWorldPrototype(desc.worldName, desc.userAlias, newProtoName);
-                                                //self.refresh();
-                                            }
-                                        }
-                                        
-                                    ]
+                                $text: "Settings for start:"
+                            },
+                            _cellWidgets.switch({
+                                'id': 'arjsView',
+                                'init': function () {
+                                    this._switch = new mdc.switchControl.MDCSwitch(this);
+                                    this._switch.checked = false;
+                                    this._arSwitch = this._switch;
+                                }
                             }
-                        )
-                    } else if (desc.type == 'saveState') {
-
-
-                        // userGUI.push(
-                        //     {
-                        //         $type: "a",
-                        //         class: "mdc-button mdc-button--compact mdc-card__action mdc-button--outlined",
-                        //         $text: "Clone",
-                        //         onclick: function (e) {
-                        //             //console.log('clone');
-
-                        //             //self.cloneWorldState(desc[0], desc[2]);
+                            ),
+                            {
+                                $type: 'label',
+                                for: 'input-forceReplace',
+                                $text: 'Edit mode'
+                            },
+                            { $type: "div", style: "margin-top: 20px" },
+                            _cellWidgets.switch({
+                                'id': 'arOnView',
+                                'init': function () {
+                                    this._turnArOn = new mdc.switchControl.MDCSwitch(this);
+                                    this._turnArOn.checked = false;
+                                    this._turnArOnSwitch = this._turnArOn;
+                                }
+                            }
+                            ),
+                            {
+                                $type: 'label',
+                                for: 'input-forceReplace',
+                                $text: 'Ar mode'
+                            }
+                        ]
 
-                        //             //self.refresh();
-                        //         }
-                        //     })
                     }
 
+                    document.querySelector("#aboutWorld")._runWorldGUI = runWorldGUI;
+                    //document.querySelector("#aboutWorld")._refresh(worldCardGUI);
                 }
+            }
+
+
 
 
 
-                this.$components = [
-                    {
-                        $type: "div",
-                        $text: "World actions:"
-                    }
-                ].concat(userGUI)
-            }
         }
 
 
@@ -393,167 +489,78 @@ class WorldApp {
             id: 'aboutWorld',
             $cell: true,
             $type: "div",
+            _actionsGUI: {},
             _runWorldGUI: {},
             _worldsComps: {},
-            _refresh: function(comps){
+            _refresh: function (comps) {
                 this._worldsComps = comps
             },
-            $init: function(){
+            $init: function () {
                 //this._worldsComps = worldCardGUI; 
             },
-            $update: function(){
+            $update: function () {
                 this.$components = [
-                {
-                    $type: "div",
-                    class: "mdc-layout-grid",
-                    $components: [
-                        {
-                            $type: "div",
-                            class: "mdc-layout-grid__inner",
-                            $components: [
-                                {
-                                    $type: "div",
-                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                    $components: [
-                                        {
-                                            $type: "h1",
-                                            class: "mdc-typography--headline4",
-                                            $text: self.worldName + ' by ' + self.userAlias
-                                        }
-                                    ]
-                                },
-                                {
-                                    $type: "div",
-                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-4",
-                                    $components: [
-                                        //worldCardGUI,
-                                        this._worldsComps,
-                                        { $type: 'p' },
-                                        this._runWorldGUI
-                                    ]
-                                },
-                                {
-                                    $type: "div",
-                                    class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                    $components: [
-                                        actionsGUI
-                                    ]
-                                },
-                                // {
-                                //     $type: "div",
-                                //     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
-                                //     $components: [
-                                //     ].concat(worldStatesGUI)
-                                // },
-                            ]
-                        }
-                    ]
-                }
-            ]
-        }
+                    {
+                        $type: "div",
+                        class: "mdc-layout-grid",
+                        $components: [
+                            {
+                                $type: "div",
+                                class: "mdc-layout-grid__inner",
+                                $components: [
+                                    {
+                                        $type: "div",
+                                        class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                        $components: [
+                                            {
+                                                $type: "h1",
+                                                class: "mdc-typography--headline4",
+                                                $text: self.worldName + ' by ' + self.userAlias
+                                            }
+                                        ]
+                                    },
+                                    {
+                                        $type: "div",
+                                        class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-4",
+                                        $components: [
+                                            //worldCardGUI,
+                                            this._worldsComps,
+                                            { $type: 'p' },
+                                            this._runWorldGUI
+                                        ]
+                                    },
+                                    {
+                                        $type: "div",
+                                        class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                        $components: [
+                                            this._actionsGUI
+                                        ]
+                                    },
+                                    // {
+                                    //     $type: "div",
+                                    //     class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
+                                    //     $components: [
+                                    //     ].concat(worldStatesGUI)
+                                    // },
+                                ]
+                            }
+                        ]
+                    }
+                ]
+            }
         })
 
-        let worldStatesComp = this.createWorldStatesGUI();
-
-        document.querySelector("#worldStates").$cell({
-            id: 'worldStates',
-            $cell: true,
-            $type: "div",
-            $components: [worldStatesComp]
-        //     $update: function(){
-        //         this.$components = [
-        //         {}
-            
-        //     ]
-        // }
-    })
-
-
-        var info = {};
-
-
-        if (!saveName) {
-            info = await _app.getAllProtoWorldsInfoForUser(user.user, space) //await _app.getWorldInfo(user, space);
-        } else {
-            let loadName = space + "/load/" + saveName;
-            info = await _app.getAllStateWorldsInfoForUser(user.user, space, loadName) //await _app.getStateInfo(user, space, saveName);
-        }
-        // worldCardGUI._worldInfo = info;
-        // worldCardGUI.$update();
-       
-        worldCardGUI._refresh(info);
-        worldCardGUI._updateComps();
         document.querySelector("#aboutWorld")._refresh(worldCardGUI);
-        //document.querySelector("#aboutWorld")._refreshWorldComps(info);
-
-        let settings = worldCardGUI._worldInfo.settings;
-        if (settings) {
-            if (settings.ar) {
 
-               let runWorldGUI = {
-                    id: "runWorldGUI",
-                    $type: "div",
-                    $init: function () {
-                        console.log(worldCardGUI);
-                    },
-                    _arSwitch: null,
-                    _turnArOnSwitch: null,
-                    $components: [
-                        {
-                            $type: "div",
-                            $text: "Settings for start:"
-                        },
-                        _cellWidgets.switch({
-                            'id': 'arjsView',
-                            'init': function () {
-                                this._switch = new mdc.switchControl.MDCSwitch(this);
-                                this._switch.checked = false;
-                                this._arSwitch = this._switch;
-                            }
-                        }
-                        ),
-                        {
-                            $type: 'label',
-                            for: 'input-forceReplace',
-                            $text: 'Edit mode'
-                        },
-                        {$type: "div", style: "margin-top: 20px"},
-                        _cellWidgets.switch({
-                            'id': 'arOnView',
-                            'init': function () {
-                                this._turnArOn = new mdc.switchControl.MDCSwitch(this);
-                                this._turnArOn.checked = false;
-                                this._turnArOnSwitch = this._turnArOn;
-                            }
-                        }
-                        ),
-                        {
-                            $type: 'label',
-                            for: 'input-forceReplace',
-                            $text: 'Ar mode'
-                        }
-                    ]
 
-                }
 
-            document.querySelector("#aboutWorld")._runWorldGUI = runWorldGUI;
-            //document.querySelector("#aboutWorld")._refresh(worldCardGUI);
-            }
-        }
+        var info = {};
 
         if (!saveName) {
-            let statesData = await _app.getAllStateWorldsInfoForUser(user.user, space) //await _app.getSaveStates(user, space);
-            //let worldStates = this.createWorldStatesGUI();
-            let worldStates = document.querySelector("#worldStatesGUI");
-            worldStates._states = statesData;
-            worldStates._updateComps();
-            worldStatesComp.$components.push(worldStates);
+            _app.indexApp.allWorldsStatesForUser(user.user, space, 'worldStates')
         }
 
     }
-
-
-
 }
 
 export { WorldApp }

Some files were not shown because too many files changed in this diff