index-app.js 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620
  1. /*
  2. The MIT License (MIT)
  3. Copyright (c) 2014-2018 Nikolai Suslov and the Krestianstvo.org project contributors. (https://github.com/NikolaySuslov/livecodingspace/blob/master/LICENSE.md)
  4. */
  5. //import page from '/lib/page.mjs';
  6. //import { Header } from '/web/header.js';
  7. class IndexApp {
  8. constructor(entry) {
  9. console.log("index app constructor");
  10. this.entry = entry;
  11. this.worlds = {};
  12. this.instances = {};
  13. if (!_app.isLuminary) {
  14. this.initReflectorConnection();
  15. }
  16. this.initHTML();
  17. }
  18. initReflectorConnection() {
  19. this.options = {
  20. query: 'pathname=' + window.location.pathname.slice(1,
  21. window.location.pathname.lastIndexOf("/")),
  22. secure: window.location.protocol === "https:",
  23. reconnection: false,
  24. path: '',
  25. transports: ['websocket']
  26. }
  27. //window.location.host
  28. var socket = io.connect(window._app.reflectorHost, this.options);
  29. const parse = (msg) => {
  30. this.parseOnlineData(msg)
  31. }
  32. socket.on('getWebAppUpdate', msg => parse.call(this, msg));
  33. socket.on("connect", function () {
  34. let noty = new Noty({
  35. text: 'Connected to Reflector!',
  36. timeout: 2000,
  37. theme: 'mint',
  38. layout: 'bottomRight',
  39. type: 'success'
  40. });
  41. noty.show();
  42. })
  43. socket.on('connect_error', function (err) {
  44. console.log(err);
  45. var errDiv = document.createElement("div");
  46. errDiv.innerHTML = "<div class='vwf-err' style='z-index: 10; position: absolute; top: 80px; right: 50px'>Connection error to Reflector!" + err + "</div>";
  47. document.querySelector('body').appendChild(errDiv);
  48. let noty = new Noty({
  49. text: 'Connection error to Reflector! ' + err,
  50. theme: 'mint',
  51. layout: 'bottomRight',
  52. type: 'error'
  53. });
  54. noty.show();
  55. });
  56. }
  57. initHTML() {
  58. let self = this;
  59. //first init from _app
  60. document.querySelector('head').innerHTML += '<link rel="stylesheet" href="/web/index-app.css">';
  61. if(this.entry !== 'index'){
  62. import('/web/header.js').then(res => {
  63. let headerGUI = new res.Header();
  64. headerGUI.init();
  65. })
  66. }
  67. //add HTML
  68. let entry = document.createElement("div");
  69. entry.setAttribute("id", 'app');
  70. document.body.appendChild(entry);
  71. let divs = ['appGUI', 'userLobby', 'main', 'worldsGUI', 'lab'];
  72. divs.forEach(el => {
  73. let appEl = document.createElement("div");
  74. appEl.setAttribute("id", el);
  75. entry.appendChild(appEl);
  76. })
  77. document.querySelector("#worldsGUI").$cell({
  78. id: "worldsGUI",
  79. $cell: true,
  80. $type: "div",
  81. _comps: [],
  82. _wcards: {},
  83. $components: [],
  84. _refresh: function (comps) {
  85. //do update;
  86. //this._userAlias = user;
  87. this._comps = comps;
  88. this.$components = this._comps;
  89. },
  90. $init: function () {
  91. console.log('init comp...');
  92. },
  93. $update: function () {
  94. //do update;
  95. console.log('update me');
  96. }
  97. });
  98. //init CELL
  99. let userGUI = {
  100. $type: "div",
  101. id: "userGUI",
  102. // style:"background-color: #ffeb3b",
  103. class: "mdc-layout-grid mdc-layout-grid--align-left",
  104. _status: "Welcome!",
  105. $init: function () {
  106. //this._status = "Welcome!"
  107. //this._status = 'Welcome!';
  108. //userEl.style.backgroundColor = '#e6e6e6';
  109. self.initUser();
  110. this._refresh(); //$update();
  111. },
  112. $update: function () {},
  113. _refresh: function () {
  114. var gui = {};
  115. if (_LCSDB.user().is) {
  116. gui = [
  117. window._app.widgets.buttonRaised(
  118. {
  119. "label": 'Sign OUT',
  120. "onclick": function (e) {
  121. _LCSDB.user().leave();
  122. setTimeout(() => {
  123. //window.sessionStorage.removeItem('alias');
  124. //window.sessionStorage.removeItem('tmp');
  125. window.location.reload(true);
  126. }, 1);
  127. }
  128. }),
  129. {
  130. $type: "p"
  131. },
  132. window._app.widgets.buttonStroked(
  133. {
  134. "label": 'PROFILE',
  135. "onclick": function (e) {
  136. e.preventDefault();
  137. //page("/profile")
  138. window.location.pathname = "/profile"
  139. }
  140. }),
  141. {
  142. $type: "p"
  143. },
  144. window._app.widgets.buttonStroked(
  145. {
  146. "label": 'My World protos',
  147. "onclick": function (e) {
  148. e.preventDefault();
  149. let alias = _LCSDB.user().is.alias;
  150. window.location.pathname = '/' + alias + '/worlds/protos'
  151. //page('/' + alias + '/worlds/protos');
  152. //_app.indexApp.getWorldsProtosFromUserDB(alias);
  153. }
  154. }),
  155. window._app.widgets.buttonStroked(
  156. {
  157. "label": 'My World states',
  158. "onclick": function (e) {
  159. e.preventDefault();
  160. let alias = _LCSDB.user().is.alias;
  161. window.location.pathname = '/' + alias + '/worlds/states'
  162. //page('/' + alias + '/worlds/states');
  163. // page.redirect('/' + alias + '/worlds/states');
  164. //_app.indexApp.getWorldsFromUserDB(alias);
  165. }
  166. })
  167. ]
  168. }
  169. this.$components = [
  170. {
  171. $type: "h1",
  172. class: "mdc-typography--headline3",
  173. $text: this._status
  174. }
  175. ].concat(gui)
  176. }
  177. }
  178. document.querySelector("#userLobby").$cell({
  179. id: "userLobby",
  180. $cell: true,
  181. $type: "div",
  182. $components: [],
  183. _comps: [],
  184. _refresh: function(){
  185. this.$components = this._comps.concat([userGUI, self.getLoginGUI(), _app.widgets.divider, self.getLookWorlds()]);
  186. },
  187. $init: function () {
  188. this._comps = self.initUserGUI()
  189. this._refresh();
  190. },
  191. $update: function () {
  192. }
  193. });
  194. }
  195. async allWorldsProtosForUser(userAlias) {
  196. let userPub = await _app.helpers.getUserPub(userAlias);
  197. //let db = _LCSDB.user(userPub);
  198. let doc = document.querySelector("#worldsGUI");
  199. var worlds = {};
  200. if(userPub) {
  201. worlds = this.createWorldsGUI('proto', userAlias, userPub)
  202. } else {
  203. worlds = {
  204. $type: 'div',
  205. $text: 'Could not find user with name: ' + userAlias,
  206. class: "mdc-typography--headline4"
  207. }
  208. }
  209. let components = [
  210. {
  211. $type: "div",
  212. class: "mdc-layout-grid",
  213. $components: [
  214. {
  215. $type: "div",
  216. class: "mdc-layout-grid__inner",
  217. $components: [
  218. {
  219. $type: "div",
  220. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  221. $components: [
  222. {
  223. $type: "h1",
  224. class: "mdc-typography--headline4",
  225. $text: 'Worlds for user: ' + userAlias
  226. }
  227. ]
  228. },
  229. {
  230. $type: "div",
  231. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  232. $components: [worlds]
  233. }
  234. ]
  235. }
  236. ]
  237. }
  238. ];
  239. doc._refresh(components);
  240. }
  241. async allWorldsStatesForUser(userAlias, worldName, elID) {
  242. let userPub = await _app.helpers.getUserPub(userAlias);
  243. //let db = _LCSDB.user(userPub);
  244. let doc = elID ? document.querySelector("#" + elID): document.querySelector("#worldsGUI");
  245. var worlds = {};
  246. if(userPub) {
  247. if(!worldName){
  248. worlds = this.createWorldsGUI('state', userAlias, userPub)
  249. } else {
  250. worlds = this.createWorldsGUI('state', userAlias, userPub, worldName)
  251. }
  252. } else {
  253. worlds = {
  254. $type: 'div',
  255. $text: 'Could not find user with name: ' + userAlias,
  256. class: "mdc-typography--headline4"
  257. }
  258. }
  259. let components = [
  260. {
  261. $type: "div",
  262. class: "mdc-layout-grid",
  263. $components: [
  264. {
  265. $type: "div",
  266. class: "mdc-layout-grid__inner",
  267. $components: [
  268. {
  269. $type: "div",
  270. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  271. $components: [
  272. {
  273. $type: "h1",
  274. class: "mdc-typography--headline4",
  275. $text: 'States for ' + userAlias
  276. }
  277. ]
  278. },
  279. {
  280. $type: "div",
  281. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  282. $components: [].concat(worlds)
  283. }
  284. ]
  285. }
  286. ]
  287. }
  288. ]
  289. doc._refresh(components);
  290. }
  291. authGUI(){
  292. let alias = _LCSDB.user().is.alias;
  293. let userEl = document.querySelector('#userGUI');
  294. userEl._status = 'Welcome ' + alias + '!';
  295. //userEl.style.backgroundColor = '#e6e6e6';
  296. userEl._refresh(); //$update();
  297. //_LCSDB.user().get('profile').once(function (data) { console.log(data) })
  298. let el = document.getElementById("loginGUI");
  299. if (el) {
  300. el.remove();
  301. }
  302. _LCSDB.user().get('profile').not(function (key) {
  303. let profile = { 'alias': alias };
  304. _LCSDB.user().get('profile').put(profile);
  305. })
  306. // not load proxy by default
  307. // _LCSDB.user().get('proxy').not(res=>{
  308. // console.log('user has no proxy');
  309. // window._app.loadProxyDefaults();
  310. // });
  311. let actionsGUI = document.querySelector('#worldActionsGUI');
  312. if (actionsGUI)
  313. actionsGUI._refresh();
  314. new Noty({
  315. text: alias + ' is succesfully authenticated!',
  316. timeout: 2000,
  317. theme: 'mint',
  318. layout: 'bottomRight',
  319. type: 'success'
  320. }).show();
  321. if(this.entry == 'index'){
  322. //change for LiveCoding.space to 'app'
  323. //this.initWorldsProtosListForUserNew(alias);
  324. this.allWorldsProtosForUser(alias)
  325. }
  326. }
  327. initUser() {
  328. let self = this;
  329. if(_LCSDB.user().is) {
  330. self.authGUI()
  331. } else {
  332. _LCSDB.on('auth', function (ack) {
  333. if (ack.sea.pub) {
  334. self.authGUI();
  335. }
  336. console.log(_LCSDB.user().is);
  337. });
  338. }
  339. }
  340. getLookWorlds(){
  341. let self = this;
  342. let lookWorlds =
  343. {
  344. $type: "div",
  345. id: "lookWorlds",
  346. class: "mdc-layout-grid mdc-layout-grid--align-left",
  347. _status: '',
  348. $init: function () {
  349. this._status = "init";
  350. },
  351. $update: function () {
  352. //change for LiveCoding.space site 'app'
  353. let defaultName = '';
  354. let guiForAll = [
  355. {
  356. $type: "div",
  357. style: "margin-top: 20px;",
  358. _userName: null,
  359. _userNameField: null,
  360. $components:
  361. [
  362. _app.widgets.inputTextFieldOutlined({
  363. "id": 'worldsUserName',
  364. "label": 'Enter user name',
  365. "value": defaultName,
  366. "type": "text",
  367. "init": function () {
  368. this._userNameField = new mdc.textField.MDCTextField(this);
  369. }
  370. }),
  371. _app.widgets.p,
  372. // {
  373. // $type: "a",
  374. // class: "mdc-button mdc-button--raised mdc-card__action actionButton",
  375. // $text: 'World Protos', //self.language.t('set proxy'),//"clone",
  376. // onclick: function (e) {
  377. // //console.log('clone');
  378. // let searchName = this._userNameField.value;
  379. // self.initWorldsProtosListForUser(searchName);
  380. // }
  381. // },
  382. // {
  383. // $type: "a",
  384. // class: "mdc-button mdc-button--raised mdc-card__action actionButton",
  385. // $text: 'World States', //self.language.t('set proxy'),//"clone",
  386. // onclick: function (e) {
  387. // //console.log('clone');
  388. // let searchName = this._userNameField.value;
  389. // self.initWorldsStatesListForUser(searchName);
  390. // }
  391. // }
  392. _app.widgets.buttonRaised(
  393. {
  394. "label": 'World Protos',
  395. "onclick": function (e) {
  396. e.preventDefault();
  397. //page("/app/worlds/protos")
  398. let searchName = this._userNameField.value;
  399. if(searchName !== "")
  400. window.location.pathname = "/"+searchName+"/worlds/protos"
  401. //_app.indexApp.getAppDetailsFromDefaultDB('protos');
  402. }
  403. }),
  404. _app.widgets.space,
  405. _app.widgets.buttonRaised(
  406. {
  407. "label": 'World States',
  408. "onclick": function (e) {
  409. e.preventDefault();
  410. //page("/app/worlds/states")
  411. let searchName = this._userNameField.value;
  412. if(searchName !== "")
  413. window.location.pathname = "/"+searchName+"/worlds/states"
  414. //_app.indexApp.getAppDetailsFromDefaultDB('states');
  415. }
  416. })
  417. ]
  418. },
  419. // window._app.widgets.buttonStroked(
  420. // {
  421. // "label": 'Default World Protos',
  422. // "onclick": function (e) {
  423. // e.preventDefault();
  424. // //page("/app/worlds/protos")
  425. // window.location.pathname = "/app/worlds/protos"
  426. // //_app.indexApp.getAppDetailsFromDefaultDB('protos');
  427. // }
  428. // }),
  429. // window._app.widgets.buttonStroked(
  430. // {
  431. // "label": 'Default World States',
  432. // "onclick": function (e) {
  433. // e.preventDefault();
  434. // //page("/app/worlds/states")
  435. // window.location.pathname = "/app/worlds/states"
  436. // //_app.indexApp.getAppDetailsFromDefaultDB('states');
  437. // }
  438. // })
  439. ];
  440. this.$components = [
  441. {
  442. $type: "h1",
  443. class: "mdc-typography--headline4",
  444. $text: "Looking for Worlds made by other Users!"
  445. }
  446. ].concat(guiForAll, _app.widgets.p, _app.widgets.divider)
  447. }
  448. }
  449. return lookWorlds
  450. }
  451. getLoginGUI(){
  452. let self = this;
  453. let loginGUI =
  454. {
  455. $type: "div",
  456. id: "loginGUI",
  457. //style:"background-color: #efefef",
  458. class: "mdc-layout-grid mdc-layout-grid--align-left",
  459. _alias: null,
  460. _pass: null,
  461. _passField: null,
  462. _aliasField: null,
  463. _initData: function () {
  464. this._alias = '';
  465. this._pass = '';
  466. // if (window.sessionStorage.getItem('alias')) {
  467. // this._alias = window.sessionStorage.getItem('alias')
  468. // }
  469. // if (window.sessionStorage.getItem('tmp')) {
  470. // this._pass = window.sessionStorage.getItem('tmp')
  471. // }
  472. },
  473. $init: function () {
  474. this._initData();
  475. },
  476. $update: function () {
  477. this.$components = [
  478. {
  479. $type: "div",
  480. class: "mdc-layout-grid__inner",
  481. $components: [
  482. {
  483. $type: "div",
  484. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  485. $components: [
  486. {
  487. $type: "span",
  488. class: "mdc-typography--headline5",
  489. $text: "Login: "
  490. },
  491. window._app.widgets.inputTextFieldOutlined({
  492. "id": 'aliasInput',
  493. "label": "Login",
  494. "value": this._alias,
  495. "type": "text",
  496. "init": function () {
  497. this._aliasField = new mdc.textField.MDCTextField(this);
  498. }
  499. }),
  500. ]
  501. },
  502. {
  503. $type: "div",
  504. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  505. $components: [
  506. {
  507. $type: "span",
  508. class: "mdc-typography--headline5",
  509. $text: "Password: "
  510. },
  511. window._app.widgets.inputTextFieldOutlined({
  512. "id": 'passwordInput',
  513. "label": "Password",
  514. "value": this._pass,
  515. "type": "password",
  516. "init": function () {
  517. this._passField = new mdc.textField.MDCTextField(this);
  518. }
  519. }),
  520. ]
  521. },
  522. {
  523. $type: "div",
  524. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  525. $components: [
  526. window._app.widgets.buttonRaised(
  527. {
  528. "label": 'Sign UP',
  529. "onclick": function (e) {
  530. e.preventDefault();
  531. let alias = this._aliasField.value;
  532. let pass = this._passField.value
  533. if (pass.length < 7) {
  534. new Noty({
  535. text: "Your passphrase needs to be longer than 7 letters",
  536. timeout: 2000,
  537. theme: 'mint',
  538. layout: 'bottomRight',
  539. type: 'error'
  540. }).show();
  541. } else {
  542. //
  543. _LCSDB.user().create(alias, pass,
  544. function (ack) {
  545. if (!ack.wait) { }
  546. if (ack.err) {
  547. console.log(ack.err)
  548. return ack.err
  549. };
  550. if (ack.pub) {
  551. let userObj = {
  552. 'alias': alias,
  553. 'pub': ack.pub
  554. };
  555. _LCSDB.get('users').get(alias).put(userObj);
  556. }
  557. _LCSDB.user().auth(alias, pass);
  558. });
  559. }
  560. }
  561. }),
  562. _app.widgets.space,
  563. window._app.widgets.buttonRaised(
  564. {
  565. "label": 'Sign IN',
  566. "onclick": function (e) {
  567. e.preventDefault();
  568. let alias = this._aliasField.value;
  569. let pass = this._passField.value
  570. _app.helpers.authUser(alias, pass);
  571. // _LCSDB.user().auth.call(_LCSDB, alias, pass
  572. // // , function(ack) {
  573. // // if (ack.err) {
  574. // // new Noty({
  575. // // text: ack.err,
  576. // // timeout: 2000,
  577. // // theme: 'mint',
  578. // // layout: 'bottomRight',
  579. // // type: 'error'
  580. // // }).show();
  581. // // }
  582. // //}
  583. // );
  584. }
  585. })
  586. ]
  587. }
  588. ]
  589. }
  590. ]
  591. }
  592. }
  593. return loginGUI
  594. }
  595. initUserGUI() {
  596. let self = this;
  597. let lookWorlds =
  598. {
  599. $type: "div",
  600. id: "lookWorlds",
  601. class: "mdc-layout-grid mdc-layout-grid--align-left",
  602. _status: '',
  603. $init: function () {
  604. this._status = "init";
  605. },
  606. $update: function () {
  607. //change for LiveCoding.space site 'app'
  608. let defaultName = '';
  609. let guiForAll = [
  610. {
  611. $type: "div",
  612. style: "margin-top: 20px;",
  613. _userName: null,
  614. _userNameField: null,
  615. $components:
  616. [
  617. _app.widgets.inputTextFieldOutlined({
  618. "id": 'worldsUserName',
  619. "label": 'Enter user name',
  620. "value": defaultName,
  621. "type": "text",
  622. "init": function () {
  623. this._userNameField = new mdc.textField.MDCTextField(this);
  624. }
  625. }),
  626. _app.widgets.p,
  627. // {
  628. // $type: "a",
  629. // class: "mdc-button mdc-button--raised mdc-card__action actionButton",
  630. // $text: 'World Protos', //self.language.t('set proxy'),//"clone",
  631. // onclick: function (e) {
  632. // //console.log('clone');
  633. // let searchName = this._userNameField.value;
  634. // self.initWorldsProtosListForUser(searchName);
  635. // }
  636. // },
  637. // {
  638. // $type: "a",
  639. // class: "mdc-button mdc-button--raised mdc-card__action actionButton",
  640. // $text: 'World States', //self.language.t('set proxy'),//"clone",
  641. // onclick: function (e) {
  642. // //console.log('clone');
  643. // let searchName = this._userNameField.value;
  644. // self.initWorldsStatesListForUser(searchName);
  645. // }
  646. // }
  647. _app.widgets.buttonRaised(
  648. {
  649. "label": 'World Protos',
  650. "onclick": function (e) {
  651. e.preventDefault();
  652. //page("/app/worlds/protos")
  653. let searchName = this._userNameField.value;
  654. if(searchName !== "")
  655. window.location.pathname = "/"+searchName+"/worlds/protos"
  656. //_app.indexApp.getAppDetailsFromDefaultDB('protos');
  657. }
  658. }),
  659. _app.widgets.space,
  660. _app.widgets.buttonRaised(
  661. {
  662. "label": 'World States',
  663. "onclick": function (e) {
  664. e.preventDefault();
  665. //page("/app/worlds/states")
  666. let searchName = this._userNameField.value;
  667. if(searchName !== "")
  668. window.location.pathname = "/"+searchName+"/worlds/states"
  669. //_app.indexApp.getAppDetailsFromDefaultDB('states');
  670. }
  671. })
  672. ]
  673. },
  674. // window._app.widgets.buttonStroked(
  675. // {
  676. // "label": 'Default World Protos',
  677. // "onclick": function (e) {
  678. // e.preventDefault();
  679. // //page("/app/worlds/protos")
  680. // window.location.pathname = "/app/worlds/protos"
  681. // //_app.indexApp.getAppDetailsFromDefaultDB('protos');
  682. // }
  683. // }),
  684. // window._app.widgets.buttonStroked(
  685. // {
  686. // "label": 'Default World States',
  687. // "onclick": function (e) {
  688. // e.preventDefault();
  689. // //page("/app/worlds/states")
  690. // window.location.pathname = "/app/worlds/states"
  691. // //_app.indexApp.getAppDetailsFromDefaultDB('states');
  692. // }
  693. // })
  694. ];
  695. this.$components = [
  696. {
  697. $type: "h1",
  698. class: "mdc-typography--headline4",
  699. $text: "Looking for Worlds made by other Users!"
  700. }
  701. ].concat(guiForAll, _app.widgets.p, _app.widgets.divider)
  702. }
  703. }
  704. let connectionSettings = {
  705. id: 'connectionSettings',
  706. $type: 'div',
  707. class: "mdc-layout-grid mdc-layout-grid--align-left",
  708. $components: [
  709. _app.widgets.emptyDiv,
  710. window._app.widgets.buttonRaised(
  711. {
  712. "label": 'Connection settings',
  713. "onclick": function (e) {
  714. e.preventDefault();
  715. window.location.pathname = '/settings';
  716. }
  717. }), _app.widgets.emptyDiv
  718. ]
  719. }
  720. return [connectionSettings, _app.widgets.divider]
  721. }
  722. refresh() {
  723. // socket.emit('getWebAppUpdate', "");
  724. }
  725. parseOnlineData(data) {
  726. let parcedData = _app.parseAppInstancesData(data);
  727. //if (Object.entries(parcedData).length !== 0)
  728. let onlineGUIs = document.querySelectorAll('.online');
  729. onlineGUIs.forEach(function (item) {
  730. item._refresh(parcedData)
  731. });
  732. }
  733. createWorldCard(worldType, userAlias, userPub, worldName, id, type, cb) {
  734. let self = this;
  735. let db = _LCSDB.user(userPub);
  736. let onlineGUI = {
  737. $cell: true,
  738. id: "onlineGUI_" + id,
  739. class: "online",
  740. $type: "div",
  741. _instances: {},
  742. _worldListItem: function (m) {
  743. return {
  744. $type: "li",
  745. class: "mdc-list-item",
  746. $components: [
  747. {
  748. $type: "span",
  749. class: "world-link mdc-list-item__text",
  750. $components: [
  751. {
  752. $type: "span",
  753. class: "mdc-list-item__primary-text",
  754. $components: [
  755. {
  756. $type: "a",
  757. $text: m[0],
  758. //target: "_blank",
  759. // href: window.location.protocol + "//" + window.location.host + "/" + m[1].user + m[0],
  760. onclick: function (e) {
  761. self.checkForManualSettings();
  762. window.location.pathname = "/" + m[1].user + m[0];
  763. //self.refresh();
  764. }
  765. },
  766. ]
  767. },
  768. {
  769. $type: "span",
  770. class: "mdc-list-item__secondary-text",
  771. $text: _app.isLuminary ? _LangManager.language.t('users') + Object.keys(m[1].clients).length : _LangManager.language.t('users') + m[1].clients
  772. }
  773. ]
  774. }
  775. ]
  776. }
  777. },
  778. $components: [],
  779. _refresh: function (data) {
  780. if (data) {
  781. if (Object.entries(data).length !== 0) {
  782. if (this._worldInfo) {
  783. let insts = Object.entries(data).filter(el => el[0] == this._worldInfo.worldName);
  784. if (insts.length !== 0)
  785. this._instances = insts[0][1];
  786. }
  787. } else {
  788. this._instances = {}
  789. }
  790. }
  791. },
  792. $init: function () {
  793. if (_app.isLuminary) {
  794. let luminaryPath = _app.luminaryPath;
  795. let ref = _LCSDB.get(luminaryPath);
  796. setInterval(function () {
  797. ref.get('allclients').once().map().once(res => {
  798. if (res) {
  799. if (res.id) {
  800. let clientTime = Gun.state.is(res, 'live');
  801. let now = Gun.time.is();
  802. if (now - clientTime < 10000) {
  803. let instance = res.user + res.instance;
  804. //let data = JSON.stringify({[res.instance]: {instance: instance, clients: {}, user: res.user, loadInfo: {}}});
  805. //console.log(data);
  806. if (!self.instances[res.instance]) {
  807. self.instances[res.instance] = { id: res.instance, instance: instance, clients: { [res.id]: res }, user: res.user, loadInfo: {} }
  808. } else {
  809. self.instances[res.instance].clients[res.id] = res
  810. }
  811. let data = JSON.stringify(self.instances);
  812. self.parseOnlineData(data);
  813. } else {
  814. if (self.instances[res.instance]) {
  815. delete self.instances[res.instance].clients[res.id];
  816. if (Object.keys(self.instances[res.instance].clients).length == 0) {
  817. delete self.instances[res.instance];
  818. self.parseOnlineData(JSON.stringify({}));
  819. }
  820. }
  821. //ref.get('instances').get(res.instance).get(res.id).put(null);
  822. }
  823. }
  824. }
  825. }
  826. )
  827. }, 5000);
  828. }
  829. this._refresh();
  830. },
  831. $update: function () {
  832. if (this._instances) {
  833. let cardListData = Object.entries(this._instances).filter(el => el[1].user == this._worldInfo.userAlias);
  834. this.$components = [
  835. {
  836. $type: "hr",
  837. class: "mdc-list-divider"
  838. }
  839. ].concat(cardListData.map(this._worldListItem))
  840. }
  841. }
  842. }
  843. return {
  844. $cell: true,
  845. id: 'worldCard_' + id,
  846. $type: "div",
  847. _worldName: "",
  848. _worldInfo: {},
  849. _refresh: function (data) {
  850. this._worldInfo = data;
  851. this.$components = [this._updateCard()]
  852. },
  853. $init: function () {
  854. this._worldName = worldName;
  855. if(type == 'min') {
  856. if(worldType == 'proto') {
  857. db.get('worlds').get(this._worldName).path('info_json').on((res)=>{
  858. console.log(res);
  859. let worldDesc = JSON.parse(res);
  860. let root = Object.keys(worldDesc)[0];
  861. var appInfo = worldDesc[root]['en'];
  862. let langID = localStorage.getItem('krestianstvo_locale');
  863. if (langID) {
  864. appInfo = worldDesc[root][langID]
  865. }
  866. let doc = {
  867. 'worldName': this._worldName,
  868. 'created': undefined,
  869. 'modified': undefined,
  870. 'type': 'proto',
  871. 'userAlias': userAlias,
  872. 'info': appInfo
  873. }
  874. this._refresh(doc);
  875. //callback
  876. if(cb)
  877. cb(doc);
  878. })
  879. } else if (worldType == 'state'){
  880. let pathName = 'savestate_/' + this._worldName.protoName+ '/' + this._worldName.stateName + '_info_vwf_json';
  881. db.get('documents').get(this._worldName.protoName).path(pathName).on((res)=>{
  882. console.log(res);
  883. let worldDesc = JSON.parse(res);
  884. let root = Object.keys(worldDesc)[0];
  885. var appInfo = worldDesc[root]['en'];
  886. let langID = localStorage.getItem('krestianstvo_locale');
  887. if (langID) {
  888. appInfo = worldDesc[root][langID]
  889. }
  890. let doc = {
  891. 'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
  892. 'created': undefined,
  893. 'modified': undefined,
  894. 'type': 'saveState',
  895. 'userAlias': userAlias,
  896. 'info': appInfo
  897. }
  898. this._refresh(doc);
  899. //callback
  900. if(cb)
  901. cb(doc);
  902. })
  903. }
  904. } else if (type == 'full'){
  905. if(worldType == 'proto') {
  906. db.get('worlds').get(this._worldName).on((res)=>{
  907. console.log(res);
  908. let worldDesc = JSON.parse(res['info_json']);
  909. let root = Object.keys(worldDesc)[0];
  910. var appInfo = worldDesc[root]['en'];
  911. let langID = localStorage.getItem('krestianstvo_locale');
  912. if (langID) {
  913. appInfo = worldDesc[root][langID]
  914. }
  915. let settings = worldDesc[root]['settings'];
  916. let doc = {
  917. 'worldName': this._worldName,
  918. 'created': res.created ? res.created : "",
  919. 'modified': res.modified ? res.modified : "",
  920. 'proxy': res.proxy,
  921. 'type': 'proto',
  922. 'userAlias': userAlias,
  923. 'info': appInfo,
  924. 'settings': settings
  925. }
  926. this._refresh(doc);
  927. //callback
  928. if(cb)
  929. cb(doc);
  930. })
  931. } else if (worldType == 'state') {
  932. let pathNameInfo = 'savestate_/' + this._worldName.protoName+ '/' + this._worldName.stateName + '_info_vwf_json';
  933. db.get('documents').get(this._worldName.protoName).path(pathNameInfo).on((res)=>{
  934. console.log(res);
  935. let worldDesc = JSON.parse(res);
  936. let root = Object.keys(worldDesc)[0];
  937. var appInfo = worldDesc[root]['en'];
  938. let langID = localStorage.getItem('krestianstvo_locale');
  939. if (langID) {
  940. appInfo = worldDesc[root][langID]
  941. }
  942. let settings = worldDesc[root]['settings'];
  943. let doc = {
  944. 'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
  945. 'created': undefined,
  946. 'modified': undefined,
  947. 'type': 'saveState',
  948. 'userAlias': userAlias,
  949. 'info': appInfo,
  950. 'settings': settings
  951. }
  952. this._refresh(doc);
  953. //callback
  954. if(cb)
  955. cb(doc);
  956. })
  957. // let pathNameState = 'savestate_/' + this._worldName.protoName+ '/' + this._worldName.stateName + '_vwf_json';
  958. // db.get('documents').get(this._worldName.protoName).path(pathNameState).on((res)=>{
  959. // console.log(res);
  960. // // let worldDesc = JSON.parse(res);
  961. // // let root = Object.keys(worldDesc)[0];
  962. // // var appInfo = worldDesc[root]['en'];
  963. // // let langID = localStorage.getItem('krestianstvo_locale');
  964. // // if (langID) {
  965. // // appInfo = worldDesc[root][langID]
  966. // // }
  967. // let settings = worldDesc[root]['settings'];
  968. // let doc = {
  969. // 'worldName': this._worldName.protoName + '/load/' + this._worldName.stateName,
  970. // 'created': res.created,
  971. // 'modified': res.modified,
  972. // 'type': 'saveState',
  973. // 'userAlias': userAlias,
  974. // 'info': appInfo,
  975. // 'settings': settings
  976. // }
  977. // this._refresh(doc);
  978. // //callback
  979. // if(cb)
  980. // cb(doc);
  981. // })
  982. }
  983. }
  984. },
  985. $update: function () {
  986. //this.$components = [this._updateCard()]
  987. },
  988. _updateComps: function () {
  989. //console.log(this._worldInfo);
  990. },
  991. _updateCard: function () {
  992. let desc = this._worldInfo;
  993. if (!desc || Object.keys(desc).length == 0) {
  994. return {
  995. $type: "h1",
  996. class: "mdc-typography--headline4",
  997. $text: "ERROR: NO WORLD!"
  998. }
  999. }
  1000. let userGUI = [];
  1001. let online = [];
  1002. let cardInfo = {
  1003. "title": ""
  1004. };
  1005. if (type == "full") {
  1006. } else {
  1007. userGUI.push({
  1008. $type: "a",
  1009. class: "mdc-button mdc-button--compact mdc-card__action mdc-button--outlined",
  1010. $text: "Details",
  1011. onclick: function (e) {
  1012. e.preventDefault();
  1013. window.location.pathname = "/" + desc.userAlias + '/' + desc.worldName + '/about'
  1014. }
  1015. });
  1016. }
  1017. userGUI.push({
  1018. $type: "a",
  1019. class: "mdc-button mdc-button--raised mdc-card__action ",
  1020. $text: _LangManager.language.t('start'),//"Start new",
  1021. //target: "_blank",
  1022. //href: "/" + desc.userAlias + '/' + desc.worldName,
  1023. onclick: function (e) {
  1024. self.checkForManualSettings();
  1025. window.location.pathname = "/" + desc.userAlias + '/' + desc.worldName
  1026. //self.refresh();
  1027. }
  1028. });
  1029. let protoID = {}
  1030. if (desc.type == 'saveState') {
  1031. cardInfo.title = desc.worldName.split('/')[2];
  1032. let protoIDComp = {
  1033. $type: 'div',
  1034. $components: [
  1035. {
  1036. $type: "span",
  1037. class: "mdc-card__subtitle mdc-theme--text-secondary-on-background",
  1038. $text: 'proto: '
  1039. },
  1040. {
  1041. $type: "input",
  1042. type: "text",
  1043. disabled: "",
  1044. style: "font-size:18px",
  1045. value: desc.worldName.split('/')[0]
  1046. }
  1047. ]
  1048. }
  1049. Object.assign(protoID, protoIDComp)
  1050. }
  1051. if (desc.type == 'proto') {
  1052. cardInfo.title = desc.worldName;
  1053. // userGUI.push(
  1054. // {
  1055. // $type: "a",
  1056. // class: "mdc-button mdc-button--compact mdc-card__action",
  1057. // $text: "States",
  1058. // onclick: async function (e) {
  1059. // e.preventDefault();
  1060. // window.location.pathname = "/" + desc.userAlias + '/' + desc.worldName +'/about'
  1061. // //console.log('clone');
  1062. // // document.querySelector('#worldStatesGUI')._refresh({});
  1063. // // let data = await _app.getSaveStates(desc.userAlias, desc.worldName);
  1064. // // document.querySelector('#worldStatesGUI')._refresh(data);
  1065. // }
  1066. // }
  1067. // )
  1068. }
  1069. online.push(onlineGUI);
  1070. if(!desc.info){
  1071. desc.info = {
  1072. imgUrl: "/defaults/worlds/webrtc/webimg.jpg",
  1073. text: "..no text",
  1074. title: "..no title"
  1075. }
  1076. }
  1077. return {
  1078. $type: "div",
  1079. class: "mdc-card world-card",
  1080. $components: [
  1081. {
  1082. $type: "section",
  1083. class: "mdc-card__media world-card__16-9-media",
  1084. $init: function () {
  1085. if (desc.info.imgUrl !== "") {
  1086. this.style.backgroundImage = 'linear-gradient(0deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.3) ), url(' + desc.info.imgUrl + ')';
  1087. }
  1088. }
  1089. },
  1090. {
  1091. $type: "section",
  1092. class: "mdc-card__primary",
  1093. $components: [
  1094. {
  1095. $type: "h1",
  1096. class: "mdc-card__title mdc-card__title--large",
  1097. $text: desc.info.title
  1098. },
  1099. {
  1100. $type: "h2",
  1101. class: "mdc-card__subtitle mdc-theme--text-secondary-on-background",
  1102. $text: desc.info.text
  1103. },
  1104. {
  1105. $type: "span",
  1106. class: "mdc-card__subtitle mdc-theme--text-secondary-on-background",
  1107. $text: 'id: '
  1108. },
  1109. {
  1110. $type: "input",
  1111. type: "text",
  1112. disabled: "",
  1113. style: "font-size:18px",
  1114. value: cardInfo.title
  1115. },
  1116. {
  1117. $type: "p",
  1118. },
  1119. protoID,
  1120. {
  1121. $type: "p",
  1122. },
  1123. {
  1124. $type: "span",
  1125. class: "mdc-card__subtitle mdc-theme--text-secondary-on-background",
  1126. $text: desc.created ? 'created: ' + (new Date(desc.created)).toUTCString() : ""
  1127. },
  1128. {
  1129. $type: "p",
  1130. }
  1131. // ,{
  1132. // $type: "span",
  1133. // class: "mdc-card__subtitle mdc-theme--text-secondary-on-background",
  1134. // $text: 'modified: ' + (new Date(desc[5])).toUTCString()
  1135. // }
  1136. ]
  1137. },
  1138. {
  1139. $type: "section",
  1140. class: "mdc-card__actions",
  1141. $components: [
  1142. ].concat(userGUI)
  1143. },
  1144. {
  1145. $type: "section",
  1146. class: "mdc-card__actions",
  1147. $components: [
  1148. {
  1149. $type: 'div',
  1150. $text: 'online now: '
  1151. }
  1152. ].concat(online)
  1153. }
  1154. ]
  1155. }
  1156. }
  1157. }
  1158. }
  1159. createWorldsGUI(worldType, userAlias, userPub, worldName) {
  1160. let self = this;
  1161. let db = _LCSDB.user(userPub);
  1162. var headerText = 'Worlds';
  1163. if(worldType == 'state' && !worldName){
  1164. headerText = 'All World States for ' + userAlias;
  1165. } else {
  1166. headerText = worldName ? 'States for ' + worldName : 'All Worlds Protos'
  1167. }
  1168. let id = worldName ? worldName + '_' + userAlias : "allWorlds_" + userAlias
  1169. //let headerText = worldName ? 'States for ' + worldName : 'All Worlds Protos'
  1170. let worldCards = {
  1171. $cell: true,
  1172. id: id,
  1173. $type: "div",
  1174. $components: [],
  1175. _cards: [],
  1176. // _states: {},
  1177. // _refresh: function (data) {
  1178. // this._states = data;
  1179. // },
  1180. $init: function () {
  1181. console.log('init lab...');
  1182. if(worldType == 'proto'){
  1183. db.get('worlds')
  1184. .map()
  1185. .on((res,k)=>{
  1186. console.log('From world: ', k);
  1187. //let doc = document.querySelector('#'+ k);
  1188. let cardID = userAlias + '_' + k;
  1189. let doc = this._cards.filter(el=> el.$components[0].id == 'worldCard_'+ cardID)[0];
  1190. if(!doc) {
  1191. doc = this._makeWorldCard(k, cardID);
  1192. this._cards.push(doc);
  1193. }
  1194. })
  1195. } else if(worldType == 'state') {
  1196. //get states
  1197. if(!worldName) {
  1198. console.log('get states');
  1199. db.get('documents')
  1200. .map()
  1201. .on((res,k)=>{
  1202. if( k !== 'id'){
  1203. console.log('From world: ', k);
  1204. let worldStatesInfo = Object.entries(res).filter(el=>el[0].includes('_info_vwf_json'));
  1205. worldStatesInfo.map(el=>{
  1206. let saveName = el[0].split('/')[2].replace('_info_vwf_json', "");
  1207. let cardID = userAlias + '_' + saveName + '_' + k;
  1208. console.log(cardID, ' - ', el);
  1209. let doc = this._cards.filter(el=> el.$components[0].id == 'worldCard_'+ cardID)[0];
  1210. if(!doc) {
  1211. doc = this._makeWorldCard({protoName: k, stateName: saveName}, cardID);
  1212. this._cards.push(doc);
  1213. }
  1214. })
  1215. //let saveName = el.stateName.split('/')[2].replace('_info_vwf_json', "");
  1216. }
  1217. //let doc = document.querySelector('#'+ k);
  1218. // let doc = this._cards.filter(el=> el.$components[0].id == 'worldCard_'+ userAlias + '_' + k)[0];
  1219. // if(!doc) {
  1220. // doc = this._makeWorldCard(k);
  1221. // this._cards.push(doc);
  1222. // }
  1223. })
  1224. } else {
  1225. console.log('get states for ' + worldName);
  1226. db.get('documents')
  1227. .map((res, k) => {if (k == worldName) return res})
  1228. .on((res,k)=>{
  1229. if( k !== 'id'){
  1230. console.log('From world: ', k);
  1231. let worldStatesInfo = Object.entries(res).filter(el=>el[0].includes('_info_vwf_json'));
  1232. worldStatesInfo.map(el=>{
  1233. let saveName = el[0].split('/')[2].replace('_info_vwf_json', "");
  1234. let cardID = userAlias + '_' + saveName + '_' + k;
  1235. console.log(cardID, ' - ', el);
  1236. let doc = this._cards.filter(el=> el.$components[0].id == 'worldCard_'+ cardID)[0];
  1237. if(!doc) {
  1238. doc = this._makeWorldCard({protoName: k, stateName: saveName}, cardID);
  1239. this._cards.push(doc);
  1240. }
  1241. })
  1242. //let saveName = el.stateName.split('/')[2].replace('_info_vwf_json', "");
  1243. }
  1244. //let doc = document.querySelector('#'+ k);
  1245. // let doc = this._cards.filter(el=> el.$components[0].id == 'worldCard_'+ userAlias + '_' + k)[0];
  1246. // if(!doc) {
  1247. // doc = this._makeWorldCard(k);
  1248. // this._cards.push(doc);
  1249. // }
  1250. })
  1251. }
  1252. }
  1253. //this._refresh();
  1254. },
  1255. _makeWorldCard: function (worldID, cardID) {
  1256. //let cardID = userAlias + '_' + worldID//data[1].userAlias + '_' + data[1].worldName + '_' + data[0];
  1257. let card = self.createWorldCard(worldType, userAlias, userPub, worldID, cardID, 'min');
  1258. //card._refresh(data[1]);
  1259. //card._worldInfo = data[1];
  1260. //card._updateComps();
  1261. return {
  1262. $cell: true,
  1263. $type: "div",
  1264. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-4",
  1265. $components: [card]
  1266. }
  1267. },
  1268. $update: function () {
  1269. // let cards = Object.entries(this._states)
  1270. // .filter(el => Object.keys(el[1]).length !== 0)
  1271. // .sort(function (el1, el2) {
  1272. // return parseInt(el2[1].created) - parseInt(el1[1].created)
  1273. // })
  1274. // .map(this._makeWorldCard);
  1275. this.$components = [
  1276. {
  1277. $type: "div",
  1278. class: "mdc-layout-grid",
  1279. $components: [
  1280. {
  1281. $type: "div",
  1282. class: "mdc-layout-grid__inner",
  1283. $components: [
  1284. {
  1285. $type: "div",
  1286. class: "mdc-layout-grid__cell mdc-layout-grid__cell--span-12",
  1287. $components: [
  1288. {
  1289. $type: "H3",
  1290. $text: headerText
  1291. }
  1292. ]
  1293. }
  1294. ]
  1295. },
  1296. {
  1297. $type: "div",
  1298. class: "mdc-layout-grid__inner",
  1299. $components: this._cards
  1300. }
  1301. ]
  1302. }
  1303. ]
  1304. }
  1305. }
  1306. return worldCards
  1307. }
  1308. checkForManualSettings() {
  1309. console.log("check for manual settings");
  1310. let manualSettings = localStorage.getItem('lcs_app_manual_settings');
  1311. if (manualSettings) {
  1312. localStorage.removeItem('lcs_app_manual_settings');
  1313. }
  1314. let el = document.querySelector('#runWorldGUI');
  1315. if (el) {
  1316. if (el._arSwitch.checked) {
  1317. let arSettings = {
  1318. model: {
  1319. 'vwf/model/aframe': null
  1320. },
  1321. view: {
  1322. 'vwf/view/aframe': null,
  1323. 'vwf/view/editor-new': null
  1324. }
  1325. }
  1326. localStorage.setItem('lcs_app_manual_settings', JSON.stringify(arSettings));
  1327. }
  1328. if (el._turnArOnSwitch.checked) {
  1329. let arSettings = {
  1330. model: {
  1331. 'vwf/model/aframe': null
  1332. },
  1333. view: {
  1334. 'vwf/view/aframe': null,
  1335. 'vwf/view/aframe-ar-driver': null
  1336. }
  1337. }
  1338. localStorage.setItem('lcs_app_manual_settings', JSON.stringify(arSettings));
  1339. }
  1340. }
  1341. }
  1342. }
  1343. export { IndexApp as default }
  1344. //export {getAppDetails, generateFrontPage, setLanguage, initLocale};