diff --git a/DApps/TestGame2/b.client.js b/DApps/TestGame2/b.client.js
new file mode 100644
index 0000000..797ef21
--- /dev/null
+++ b/DApps/TestGame2/b.client.js
@@ -0,0 +1,5 @@
+
+console.log('my test dapp client')
+setInterval(function(){
+ console.log('work - my test dapp client')
+}, 5000)
\ No newline at end of file
diff --git a/DApps/TestGame2/b.server.js b/DApps/TestGame2/b.server.js
new file mode 100644
index 0000000..74482fd
--- /dev/null
+++ b/DApps/TestGame2/b.server.js
@@ -0,0 +1,7 @@
+
+
+console.log('my test dapp server')
+
+setInterval(function(){
+ console.log('ok')
+}, 2500)
\ No newline at end of file
diff --git a/DApps/TestGame2/dapp.manifest b/DApps/TestGame2/dapp.manifest
new file mode 100644
index 0000000..b5981a3
--- /dev/null
+++ b/DApps/TestGame2/dapp.manifest
@@ -0,0 +1,8 @@
+{
+ "name" : "TestGame1",
+
+ "run" : {
+ "client" : "b.client.js",
+ "server" : "b.server.js"
+ }
+}
\ No newline at end of file
diff --git a/public/server.electron.js b/public/server.electron.js
index 060effd..3524750 100644
--- a/public/server.electron.js
+++ b/public/server.electron.js
@@ -63,7 +63,7 @@ const DApps = {
callback(dapp_data)
}
// tempory disable server part
- return;
+ return
// if (!dapp_config.run.server) {
// return
// }
@@ -72,6 +72,29 @@ const DApps = {
// console.log('module_path', module_path)
// require(module_path)
})
+
+ setInterval(()=>{
+ this.readDirs()
+ }, 5000)
+ },
+
+ readDirs(){
+ this.list = {}
+ fse.readdirSync(dapps_path).forEach(dir=>{
+ const full_path = dapps_path+dir+'/'
+ const dapp_config = this.readManifest( full_path+'dapp.manifest' )
+ if (!dapp_config) {
+ console.log('Cant find manifest for ', dir)
+ return
+ }
+
+ const dapp_data = {
+ config : dapp_config,
+ path : full_path,
+ }
+
+ this.list[dir] = dapp_data
+ })
},
readManifest: function(path){
@@ -112,7 +135,7 @@ const DApps = {
return
}
- const full_path = dapps_path+dir+'/'
+ const full_path = dapps_path+key+'/'
console.log('Remove folder ', full_path)
fse.removeSync(full_path)
delete(this.list[key])
@@ -155,7 +178,8 @@ const DApps = {
// remove game
if (request.url.indexOf('DApps/remove')>-1) {
- let folder = request.url.split('/').slice(-1)
+ let folder = request.url.split('/').slice(-1)[0]
+ console.log('Remove folder', folder)
this.remove( folder )
response.end(JSON.stringify({removed:true}), 'utf-8')
return true
diff --git a/src/model/DApps.js b/src/model/DApps.js
index 2d2be73..548badf 100644
--- a/src/model/DApps.js
+++ b/src/model/DApps.js
@@ -37,6 +37,14 @@ export default new class DApps {
this.loadAll()
}
+
+ remove(key, callback){
+ fetch(_config.server+'/DApps/remove/'+key).then( r => {
+ delete(this.List[key])
+ callback()
+ })
+ }
+
loadAll(){
fetch(_config.server+'/DApps/list/').then( r => { return r.json() }).then( list => {
this.List = Object.assign({},list)
diff --git a/src/server.electron.js b/src/server.electron.js
index 060effd..3524750 100644
--- a/src/server.electron.js
+++ b/src/server.electron.js
@@ -63,7 +63,7 @@ const DApps = {
callback(dapp_data)
}
// tempory disable server part
- return;
+ return
// if (!dapp_config.run.server) {
// return
// }
@@ -72,6 +72,29 @@ const DApps = {
// console.log('module_path', module_path)
// require(module_path)
})
+
+ setInterval(()=>{
+ this.readDirs()
+ }, 5000)
+ },
+
+ readDirs(){
+ this.list = {}
+ fse.readdirSync(dapps_path).forEach(dir=>{
+ const full_path = dapps_path+dir+'/'
+ const dapp_config = this.readManifest( full_path+'dapp.manifest' )
+ if (!dapp_config) {
+ console.log('Cant find manifest for ', dir)
+ return
+ }
+
+ const dapp_data = {
+ config : dapp_config,
+ path : full_path,
+ }
+
+ this.list[dir] = dapp_data
+ })
},
readManifest: function(path){
@@ -112,7 +135,7 @@ const DApps = {
return
}
- const full_path = dapps_path+dir+'/'
+ const full_path = dapps_path+key+'/'
console.log('Remove folder ', full_path)
fse.removeSync(full_path)
delete(this.list[key])
@@ -155,7 +178,8 @@ const DApps = {
// remove game
if (request.url.indexOf('DApps/remove')>-1) {
- let folder = request.url.split('/').slice(-1)
+ let folder = request.url.split('/').slice(-1)[0]
+ console.log('Remove folder', folder)
this.remove( folder )
response.end(JSON.stringify({removed:true}), 'utf-8')
return true
diff --git a/src/view/components/screens/dev/dapps_list.less b/src/view/components/screens/dev/dapps_list.less
index 2472f7e..2f196f2 100644
--- a/src/view/components/screens/dev/dapps_list.less
+++ b/src/view/components/screens/dev/dapps_list.less
@@ -1,24 +1,25 @@
+dapps_list {
+ caption, h3 {
+ text-transform:uppercase; font-size:18px; letter-spacing:2px;
+ padding:10px 25px 10px 10px; text-align:right;
+ cursor: default;
+ text-shadow: -1px -1px #111, 0 1px 0 #2a2a2a;
+ color: #222;
+
+
+ text-shadow:none;
+ color:#ccc; opacity:0.2; font-weight:200;
+}
+}
+
table#dapps_list {
width:100%;
margin:10px 0 20px 0;
- caption {
- text-transform:uppercase; font-size:18px; letter-spacing:2px;
- padding:10px 10px 5px 10px; text-align:right;
- cursor: default;
- text-shadow: -1px -1px #111, 0 1px 0 #2a2a2a;
- color: #222;
- }
-
- caption {
- text-shadow:none;
- color:#ccc; opacity:0.2; font-weight:200;
- }
-
th, td { padding:7px 5px 7px 15px; font-size:13px;
white-space:nowrap;
- span, a {
+ a {
overflow:hidden; text-overflow: ellipsis;
white-space:nowrap;
display:inline-block;
@@ -26,6 +27,7 @@ table#dapps_list {
}
}
+ th.actions { text-align: right; }
th {
background:rgba(100,100,100,0.1);
font-weight:normal; text-transform:uppercase; letter-spacing:1px;
@@ -33,10 +35,10 @@ table#dapps_list {
font-weight:300;
}
- td pre {
- word-break: break-all;
- white-space: pre-wrap;
- max-width: 85%;
+
+ .actions {
+ text-align: right;
+ padding-right: 25px;
}
a {
@@ -89,7 +91,7 @@ table#dapps_list {
.box__icon
{
display: none;
- path { fill: #444; }
+ path { fill: #333; }
}
.box.has-advanced-upload .box__dragndrop
{
@@ -212,3 +214,23 @@ table#dapps_list {
{
background-color: #000;
}
+
+
+
+
+pre {
+
+ &, * { word-break: break-all;
+ white-space: pre-wrap;
+ max-width: 85%;
+ }
+.json-key {
+ color: brown;
+ }
+.json-value {
+ color: navy;
+ }
+.json-string {
+ color: olive;
+ }
+}
diff --git a/src/view/components/screens/dev/upload_game.tag b/src/view/components/screens/dev/dapps_list.tag
similarity index 66%
rename from src/view/components/screens/dev/upload_game.tag
rename to src/view/components/screens/dev/dapps_list.tag
index cde4964..7efff54 100644
--- a/src/view/components/screens/dev/upload_game.tag
+++ b/src/view/components/screens/dev/dapps_list.tag
@@ -1,12 +1,34 @@
import DApps from 'DApps'
import './dapps_list.less'
-
@@ -57,33 +93,29 @@ import './dapps_list.less'
+
Code
-
- Actions
+ Config
+ Actions
{dapp.config.name}
-
- {JSON.stringify(dapp)}
- remove
+
+
+ remove
Upload new game