diff --git a/.gitignore b/.gitignore index d728e23..2230359 100755 --- a/.gitignore +++ b/.gitignore @@ -1,14 +1,5 @@ /node_modules -/tmp -/nginx -/cleaning -/nationchains/blocks -/nationchains/deals -/nationchains/logs -/nationchains/nations -/nationchains/pagans -/nationchains/towns -/nationchains/tribes -/nationchains/www/nginx_adminapx.conf -/nationchainssave +/nationchains +/adminapi/www/nginx_adminapx.conf +/adminapi/www/adminapx/conf/setup_xx.json /yarn* diff --git a/electedtown.json b/adminapi/www/adminapx/conf/electedtowns.json similarity index 100% rename from electedtown.json rename to adminapi/www/adminapx/conf/electedtowns.json diff --git a/nationchains/www/adminapx/static/tpldata/initconf.json b/adminapi/www/adminapx/conf/initconf.json similarity index 81% rename from nationchains/www/adminapx/static/tpldata/initconf.json rename to adminapi/www/adminapx/conf/initconf.json index 055258d..24553b3 100644 --- a/nationchains/www/adminapx/static/tpldata/initconf.json +++ b/adminapi/www/adminapx/conf/initconf.json @@ -1,5 +1,9 @@ { "dns": ["adminapx"], + "towns": [ + { "townId": "wall", "nationId": "ants", "url": "wall-ants.ndda.fr" }, + { "townId": "hill", "nationId": "ants", "url": "hill-ants.ndda.fr" } + ], "api": { "port": 3020, "languages": ["en", "fr"], diff --git a/nationchains/www/adminapx/ASUPnginx/nginx.conf.mustache b/adminapi/www/adminapx/conf/nginx.conf.mustache similarity index 100% rename from nationchains/www/adminapx/ASUPnginx/nginx.conf.mustache rename to adminapi/www/adminapx/conf/nginx.conf.mustache diff --git a/nationchains/www/adminapx/static/tpl/nginxmodelwebsite.conf.mustache b/adminapi/www/adminapx/conf/nginxmodelwebsite.conf.mustache similarity index 71% rename from nationchains/www/adminapx/static/tpl/nginxmodelwebsite.conf.mustache rename to adminapi/www/adminapx/conf/nginxmodelwebsite.conf.mustache index a3e6d01..58698b7 100755 --- a/nationchains/www/adminapx/static/tpl/nginxmodelwebsite.conf.mustache +++ b/adminapi/www/adminapx/conf/nginxmodelwebsite.conf.mustache @@ -1,18 +1,18 @@ server { server_name {{#dns}} {{.}} {{/dns}}; - access_log {{{dirname}}}/{{{nginx.fswww}}}logs/nginx/{{{nginx.website}}}.{{{nginx.tribeid}}}.access.log main; + access_log {{{nginx.logs}}}.access.log main; location ~* /nationchains/(schema|blocks|pagans|towns|nations)/ { # Warning: never add tribes for keeping it private - root {{{dirname}}}/; + root {{{dirapi}}}/; } # /plugins/pluginame/components/xxx?plugin=pluginname&pluginkey=key # acess if exist pluginkey location /plugins/ { add_header X-debug "plugins local $arg_plugin/keys/$arg_pluginkey sent"; - root {{{dirname}}}/{{{nginx.fswww}}}/plugins/; - if (-f {{{dirname}}}/{{{nginx.fswww}}}/plugins/$arg_plugin/keys/$arg_pluginkey) { + root {{{nginx.fswww}}}/plugins/; + if (-f {{{nginx.fswww}}}/plugins/$arg_plugin/keys/$arg_pluginkey) { rewrite /plugins/([^/]+)/components/([^\?]+) /$1/components/$2 break; } return 403 "No valid token access for plugin:$arg_plugin with token:$arg_pluginkey please ask your admin"; @@ -20,12 +20,12 @@ server { location /cdn/ { rewrite /cdn/(.*$) /$1 break; - root {{{dirname}}}/{{{nginx.fswww}}}www/cdn/; + root {{{nginx.fswww}}}www/cdn/; } location /spacedev/ { rewrite /spacedev/(.*$) /$1 break; - root {{{dirname}}}/{{{nginx.fswww}}}spacedev/{{{nginx.website}}}/dist/; + root {{{nginx.fswww}}}spacedev/{{{nginx.website}}}/dist/; } location /api/ { @@ -36,7 +36,7 @@ server { } location / { - root {{{dirname}}}/{{{nginx.fswww}}}www/{{{nginx.website}}}; + root {{{nginx.fswww}}}/{{{nginx.website}}}; index index.html {{{nginx.pageindex}}}; } error_page 404 /404.html; diff --git a/nationchains/www/adminapx/static/tpl/nginxproxyparams.mustache b/adminapi/www/adminapx/conf/nginxproxyparams.mustache similarity index 100% rename from nationchains/www/adminapx/static/tpl/nginxproxyparams.mustache rename to adminapi/www/adminapx/conf/nginxproxyparams.mustache diff --git a/nationchains/www/adminapx/index_en.html b/adminapi/www/adminapx/index_en.html similarity index 98% rename from nationchains/www/adminapx/index_en.html rename to adminapi/www/adminapx/index_en.html index 26b3456..9967182 100644 --- a/nationchains/www/adminapx/index_en.html +++ b/adminapi/www/adminapx/index_en.html @@ -47,7 +47,7 @@
Manage and understand apXtrib back-end
- Mandatory: apixtrib header have to set with:
- * {xalias,xhash,xdays,xtribe,xlang,xapp}
- * xhash is a detached signature done with public and private key of message: 'alias_xdays' where xdays is a time
- stamp
- a xhash has an elapse of 24hours after it has to be recreate.
+ Mandatory: any apixtrib request header have to set with:
+ {xalias,xhash,xdays,xtribe,xlang,xapp}
- We need in local storage auth for this example {alias,passphrase,privatekey, publickey} to be able to create a
- detached signature
- On the server side we check that signature xhash of alias_timestamp is valid with the public key
+ This webapp use :
+
+ In few words:
+ A Pagan is identify by an Alias (for human) known by api as a publicKey (for machine).
+ The owner of this Alias (stored in header xalias) have a privateKey generate when a Pagan is created.
+ This private key is used to sign (with openpgp.js detachedsignature) the message "xalias_xdays" where xdays is a
+ timestamp this signature is store into xhash (header)
+ It is possible to trust a tribe to store this privateKey (and passphrase that encrypt this privatekey, that can be
+ empty, if not the passphrase is needed to uncipher the stored privateKey).
+ api accept only xhash with a timestamp less than 24hours. Means app needs to store privatekey.
+
When authenticated, a Pagan can be identify as a Person into a tribe (xtribe) and then has an
+ object
+ instance of Person named "alias" into the tribe space (means /nationchains/tribe/xtribe/Person/alias.json).
+ In this file we get a key call accessright based onto the schema accessright to the ressource of the xtribe
+ only.
+
+ accessright is based on a CRUDOwner rules per object. Owner of an instance can do any things on his data
+ (until it respects schema). An object can have multiple Owners.
+ Other user needs to have specifics right to act on object instance {objectname:'CRUD', ..}.
+ Person can have key "profil" user of an app to manage webapp but action has to be on line with accessright to
+ work.
Alias is a unique string that humainly help to find a PublicKey that is the real identity. - To get the list of existing alias
+ onclick="app.runapirequest('modalinfo',{method:'GET',url:'nationchains/pagans/idx/alias_all.json'},{title:'Alias list',body:'',actions:[], classmodaldialog:'modal-xl'})">Show + list of alias
GET nationchains/pagans/idx/alias_all.json -> data:{alias:{alias:publicKey}}
- To allow trustable Tribe to store the Private and Passphrase Key, you get from the townId_all.json key:tribes
+To allow trustable Tribe to store the Private and Passphrase Key, you get from the townId_all.json key:tribes +
+ onclick="app.runapirequest('modalinfo',{method:'GET',url:'nationchains/towns/idx/townId_all.json'},{title:'Tribes list',body:'',actions:[], classmodaldialog:'modal-xl'})">Show + list of tribe
GET /nationchains/towns/idx/townId_all.json -> data:{townId:{tribes:[list of tribeId inside a town]}}
+ Download your keys at least PrivateKey this have to save in a secret place
+ onclick="app.downloadlink('tmp.privateKey',apx.data,apx.data.headers.xapp);">Download + PrivateKey