diff --git a/app/Http/Controllers/Admin/NodesController.php b/app/Http/Controllers/Admin/NodesController.php index 0fad31d3..ad9a1b31 100644 --- a/app/Http/Controllers/Admin/NodesController.php +++ b/app/Http/Controllers/Admin/NodesController.php @@ -83,6 +83,7 @@ class NodesController extends Controller '_token', ])); Alert::success('Successfully created new node. Before you can add any servers you need to first assign some IP addresses and ports.')->flash(); + Alert::info('To simplify the node setup you can generate a token on the configuration tab.')->flash(); return redirect()->route('admin.nodes.view', [ 'id' => $new, diff --git a/resources/views/admin/nodes/view.blade.php b/resources/views/admin/nodes/view.blade.php index bc752321..3ecb859e 100644 --- a/resources/views/admin/nodes/view.blade.php +++ b/resources/views/admin/nodes/view.blade.php @@ -286,6 +286,12 @@
Below is the configuration file for your daemon on this node. We recommend not simply copy and pasting the code below unless you know what you are doing. You should run the auto-installer or auto-updater to setup the daemon.
+
+

You can generate a token for automatic setups. Pressing the button below will generate a token. It can only be used once and is valid for 5 minutes. It will also provide the necessary commands to auto-configure the node.

+

+ +

+
{{ $node->getConfigurationAsJson(true) }}
@@ -495,6 +501,27 @@ $(document).ready(function () { }); }); + $('#configTokenBtn').on('click', function (event) { + $.getJSON('{{ route('admin.nodes.configurationtoken', $node->id) }}') + .done(function (data) { + swal({ + type: 'success', + title: 'Token created.', + text: 'Here is your token: '+data.token+'
' + + 'It will expire at ' + data.expires_at + '

' + + '

To auto-configure your node run
npm run configure -- --panel-url {{ config('app.url') }} --token '+data.token+'

', + html: true + }) + }) + .fail(function () { + swal({ + title: 'Error', + text: 'Something went wrong creating your token.', + type: 'error' + }); + }) + }) + $('.cloneElement').on('click', function (event) { event.preventDefault(); var rnd = randomKey(10);