maj setup
This commit is contained in:
@@ -4,6 +4,19 @@
|
||||
"use strict";
|
||||
var towns = towns || {};
|
||||
|
||||
towns.lauch =()=>{
|
||||
|
||||
}
|
||||
towns.loadtpldata = () => {
|
||||
// adapte tpldata to template tpl
|
||||
const dataowner = apx.data.tpldata.setup;
|
||||
dataowner.alias=apx.data.headers.xalias;
|
||||
dataowner.auth = dataowner.alias=="anonymous";
|
||||
dataowner.devtown = dataowner.townId == "devfarm";
|
||||
if (dataowner.mayorid) dataowner.owner = dataowner.mayorid == dataowner.alias;
|
||||
console.log('Data return to template',dataowner)
|
||||
return dataowner;
|
||||
};
|
||||
towns.owntown = () => {
|
||||
|
||||
|
||||
// only the owner can give ownership to someone else
|
||||
|
||||
};
|
||||
|
@@ -0,0 +1,19 @@
|
||||
/*eslint no-undef:0*/
|
||||
/*eslint-env browser*/
|
||||
|
||||
"use strict";
|
||||
var tribes = tribes || {};
|
||||
|
||||
tribes.loadtpldata = () => {
|
||||
// adapte tpldata to template tpl
|
||||
const datahost = apx.data.tpldata.setup;
|
||||
datahost.offers=[{offerid:"Z",title:" Offre gratuite Max space 1Mo public"},{offerid:"A",title:" Max space 5Mo public"},{offerid:"B",title:" Max space 5Mo private for less than 100 Persons"},{offerid:"C",title:" Max space 500 Mo private for less than 100 Persons"},{offerid:"D",title:" Max space 2 Go private for less than 1000 Persons"}],
|
||||
datahost.alias=apx.data.headers.xalias;
|
||||
datahost.auth = datahost.alias=="anonymous";
|
||||
console.log('Data return to template',datahost)
|
||||
return datahost;
|
||||
};
|
||||
tribes.addspaceweb = ( offer,domain, appname,msg) => {
|
||||
// Request to a druid to host space web accessible from a domain to share tribes data /persons / ...
|
||||
alert('Under construction to send notification to druid to get an access')
|
||||
};
|
||||
|
@@ -0,0 +1,57 @@
|
||||
<h4>Host a web app</h4>
|
||||
<p> A druid has to create a webapp space into his tribe/www/webappname. To do that he needs:</p>
|
||||
<ul>
|
||||
<li> a domain name that redirect to the IP of this town</li>
|
||||
<li> Define which method to push content, by simply using the upload browser or by creating a linux account to connect by sftp and mount it in distance machine.</li>
|
||||
</ul>
|
||||
<p>Option sftp: as sudo</p>
|
||||
<code>
|
||||
$ sudo useradd -s /bin/bash -m -d /home/sagark -c "sagark" sagark
|
||||
$ sudo paswd sagark to set a robust password
|
||||
$ chmod o+rwx folderappname # workspace/townId-nationId/tribes/tribeId/www/appname
|
||||
# su sagark
|
||||
$ mkdir -p --mode 700 ~/tribes/smatchit/www
|
||||
$ ln -s /home/phil/workspace/wall-ants/tribes/smatchit/www/smatchapp ~/tribes/smatchit/www/smatchapp
|
||||
# su sudoer to add file to jail user in his home
|
||||
$ sudo mkdir -p /home/sagark/dev
|
||||
$ cd /home/sagark/dev
|
||||
$ sudo mknod -m 666 null c 1 3
|
||||
$ sudo mknod -m 666 tty c 5 0
|
||||
$ sudo mknod -m 666 zero c 1 5
|
||||
$ sudo mknod -m 666 random c 1 8
|
||||
# change access right
|
||||
|
||||
$ userdel -r sagark
|
||||
</code>
|
||||
{{^auth}}
|
||||
<p><b>You have to be authenticate on this town with accessright on tribe to request a new web space for this tribe.</b></p>
|
||||
{{/auth}}
|
||||
{{#auth}}
|
||||
<p> Send him a request to create as alias:{{alias}}</p>
|
||||
<div class="col-md-6">
|
||||
<label for="inputdomain" class="form-label">A domain</label>
|
||||
<input type="text" class="form-control" id="inputdomain" placeholder="A register domain that redirect to the town IP">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<label for="inputappname" class="form-label">Name of your app</label>
|
||||
<input type="text" class="form-control" id="inputappname" placeholder="folder name in www/ and name of xapp in header">
|
||||
</div>
|
||||
<div id="selectoffer" class="">
|
||||
<label for="selectoffer" class="col-12 col-form-label">Choose your offer</label>
|
||||
<div class="col-12">
|
||||
<select class="form-select" id="chooseoffer" aria-label="" placeholder="To get a hosting web place">
|
||||
{{#offers}}
|
||||
<option {{#selected}}selected{{/selected}} value="{{offerid}}">{{title}}</option>
|
||||
{{/offers}}
|
||||
</select>
|
||||
<input class="d-none" id="inputofferid" value="{{offerid}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<label for="msgtodruid" class="form-label">Message</label>
|
||||
<textarea rows="5" id="msgtodruid" class="form-control" placeholder="A message to tribe's druid about hosting"></textarea>
|
||||
</div>
|
||||
<button class="btn btn-primary"
|
||||
onclick="tribes.addspaceweb(document.getElementById('inputofferid').value,document.getElementById('inputdomain').value,document.getElementById('inputappname').value,document.getElementById('msgtodruid').value);">
|
||||
Request a space web</button>
|
||||
{{/auth}}
|
@@ -77,7 +77,7 @@
|
||||
onclick="delete apx.data.auth;apx.data.headers=apxlocal.headers;apx.save();alert('delete apx.data.auth and reinit apx.data.header')">
|
||||
Remove headers</button>
|
||||
<hr>
|
||||
<h3>I proove that i own this alias</h3>
|
||||
<h3>I prove that i own this alias</h3>
|
||||
<div class="col-md-6">
|
||||
<label for="inputaliasauth" class="form-label">Your alias</label>
|
||||
<input type="text" class="form-control" id="inputaliasauth" placeholder="A public alias that any one see">
|
||||
|
46
adminapi/www/adminapx/static/tpl/townowner_en.mustache
Normal file
46
adminapi/www/adminapx/static/tpl/townowner_en.mustache
Normal file
@@ -0,0 +1,46 @@
|
||||
<div class="container">
|
||||
{{^auth}}
|
||||
<p> Sorry you need to have a valid authentification that prove that you are the major of this town to go ahead</p>
|
||||
{{/auth}}
|
||||
{{#auth}}
|
||||
<div class="row">
|
||||
<h4>Current setup</h4>
|
||||
<p>Your current town name: <b>{{townId}}</b> is link to nation: <b>{{nationId}}</b> and accessible with domain <b>{{#dns}}{{.}}{{/dns}}</b>.</p>
|
||||
{{#devtown}}
|
||||
<p> <b>devfarm</b> is a dev town that cannot be chain, to start dev means:</p>
|
||||
<ul>
|
||||
<li> install process made http://devfarm-ants available on your machine the /adminapi/www/adminapx/index_en.html to manage this dev town</li>
|
||||
<li>if not working, check that your /etc/hosts contain 127.0.0.1 devfarm-ants</li>
|
||||
<li>start the api in apxtrib folder $ yarn dev to allow manager adminapx to act on this trib</li>
|
||||
</ul>
|
||||
<p>Then you can dev in apxtrib to send your release to the project leader.</p>
|
||||
<p>You can dev some app as a tribe level into /devfarm-ants see menu Mayor's Town/Manage Tribes to create a dev tribe. You can unzip a tribe into a folder for debuging or dev with real backup data.</p>
|
||||
{{/devtown}}
|
||||
{{^mayorId}}
|
||||
<p>
|
||||
This town is not own by a mayor, anyone can use a pagan account to tell that he is owning this, so please,
|
||||
{{#auth}} you are authenticate under alias: {{alias}} <button class="btn btn-primary" onclick="towns.owntown();">Own this town</button>
|
||||
{{/auth}}
|
||||
{{^auth}} you have to be authenticat with an alias to own this town. go to Pagan / create login logout and authentify yourself and come back here.
|
||||
{{/auth}}
|
||||
{{/mayorId}}
|
||||
{{#owner}}
|
||||
<h4> Own & chain a town</h4>
|
||||
{{#devtown}}
|
||||
<p>You need to change town name (by default it is for dev "devfarm") by running on serveur as sudoer user: </p>
|
||||
<code>node apxtrib.js nationId:nationRequested townId:nameNotalreadyUse dns:domainToAccessTown </code>
|
||||
<p>Come back here.</p>
|
||||
{{/devtown}}
|
||||
{{^devtown}}
|
||||
<p> As owner you({{alias}}) can give the ownership of this town to an other alias. Be carefull when you click on this button you lose all your accessright on this town.</p>
|
||||
<div class="input-group mb-3">
|
||||
<input type="text" class="form-control" placeholder="Give alias to take the ownership" aria-label="New owner alias" aria-describedby="button-chgown">
|
||||
<button class="btn btn-outline-secondary" type="button" id="button-chgown">Give him the role on this town</button>
|
||||
</div>
|
||||
|
||||
|
||||
{{/devtown}}
|
||||
{{/owner}}
|
||||
</div>
|
||||
{{/auth}}
|
||||
</div>
|
@@ -1,50 +0,0 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<h4> Setup a new town</h4>
|
||||
<p>This form let you start joining a nation.</p>
|
||||
<p>For dev you can stay like this and use http instead of https. To join a nation you need:</p>
|
||||
<ul>
|
||||
<li> Get a domain name register to a publicIP that route web traffic from 80 and 443 to this machine</li>
|
||||
<li> Get a pagan identity and be authenticated <a onclick="app.load('apxmain','pagancreate',{})"> click here to create or authentify yoursefl</a>
|
||||
<li> Synchronize the nations, to update your nationchains (carefful all your local stuff will be deleted)</li>
|
||||
<li> Ready to your new mayor role of this town</li>
|
||||
<li> Start saling your hosting</li>
|
||||
</ul>
|
||||
<div class="col-sm-2">
|
||||
</div>
|
||||
<div class="col-sm-10">
|
||||
<div class="mb-3 row">
|
||||
<label for="selectnationid" class="col-sm-6 col-form-label">Select the nation to join</label>
|
||||
<div class="col-sm-6">
|
||||
<select class="form-select" data-nationId="{{nationId}}" aria-label="" placeholder="A nation">
|
||||
{{#nations}}
|
||||
<option {{#selected}}selected{{/selected}} value="{{nationId}}">{{nationId}}</option>
|
||||
{{/nations}}
|
||||
</select>
|
||||
<input class="d-none" id="inputnationId" value="{{nationId}}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="inputtownid" class="col-sm-6 col-form-label">Your Town</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" value="{{townId}}" class="form-control" id="inputtownid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="inputtribeid" class="col-sm-6 col-form-label">Your Tribes</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" value="{{tribeId}}" class="form-control" id="inputreibeid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="mb-3 row">
|
||||
<label for="inputdnstown" class="col-sm-6 col-form-label">Domain name of your town (to access this app from the web)</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" value="{{dns}}" class="form-control" id="inputdnstown">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<button onclick="setup.lauchtown(document.getElementById('inputnationId').value, document.getElementById('inputtownId').value,document.getElementById('inputdns').value)" class="btn btn-primary mb-3">Launch this town</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
Reference in New Issue
Block a user