|
287 | 287 | Below is the configuration file for your daemon on this node. We recommend <strong>not</strong> simply copy and pasting the code below unless you know what you are doing. You should run the <code>auto-installer</code> or <code>auto-updater</code> to setup the daemon. |
288 | 288 | </div> |
289 | 289 | <div class="col-md-12"> |
290 | | - <pre><code>{ |
291 | | - "web": { |
292 | | - "host": "0.0.0.0", |
293 | | - "listen": {{ $node->daemonListen }}, |
294 | | - "ssl": { |
295 | | - "enabled": {{ $node->scheme === 'https' ? 'true' : 'false' }}, |
296 | | - "certificate": "/etc/letsencrypt/live/{{ $node->fqdn }}/fullchain.pem", |
297 | | - "key": "/etc/letsencrypt/live/{{ $node->fqdn }}/privkey.pem" |
298 | | - } |
299 | | - }, |
300 | | - "docker": { |
301 | | - "socket": "/var/run/docker.sock", |
302 | | - "autoupdate_images": true |
303 | | - }, |
304 | | - "sftp": { |
305 | | - "path": "{{ $node->daemonBase }}", |
306 | | - "port": {{ $node->daemonSFTP }}, |
307 | | - "container": "ptdl-sftp" |
308 | | - }, |
309 | | - "query": { |
310 | | - "kill_on_fail": true, |
311 | | - "fail_limit": 5 |
312 | | - }, |
313 | | - "logger": { |
314 | | - "path": "logs/", |
315 | | - "src": false, |
316 | | - "level": "info", |
317 | | - "period": "1d", |
318 | | - "count": 3 |
319 | | - }, |
320 | | - "remote": { |
321 | | - "base": "{{ config('app.url') }}", |
322 | | - "download": "{{ route('remote.download') }}", |
323 | | - "installed": "{{ route('remote.install') }}" |
324 | | - }, |
325 | | - "uploads": { |
326 | | - "size_limit": {{ $node->upload_size }} |
327 | | - }, |
328 | | - "keys": [ |
329 | | - "{{ $node->daemonSecret }}" |
330 | | - ] |
331 | | -}</code></pre> |
| 290 | + <p>To simplify the configuration of nodes it is possible to fetch the config from the panel. A token is required for this process. The button below will generate a token and provide you with the commands necessary for automatic configuration of the node. Be aware that these tokens are only valid for 5 minutes.</p> |
| 291 | + <p class="text-center"> |
| 292 | + <button type="button" id="configTokenBtn" class="btn btn-primary">Generate token</button> |
| 293 | + </p> |
| 294 | + </div> |
| 295 | + <div class="col-md-12"> |
| 296 | + <pre><code>{{ $node->getConfigurationAsJson(true) }}</code></pre> |
332 | 297 | </div> |
333 | 298 | </div> |
334 | 299 | </div> |
|
536 | 501 | }); |
537 | 502 | }); |
538 | 503 |
|
| 504 | + $('#configTokenBtn').on('click', function (event) { |
| 505 | + $.getJSON('{{ route('admin.nodes.configuration-token', $node->id) }}') |
| 506 | + .done(function (data) { |
| 507 | + swal({ |
| 508 | + type: 'success', |
| 509 | + title: 'Token created.', |
| 510 | + text: 'Here is your token: <code>'+data.token+'</code><br />' + |
| 511 | + 'It will expire at <i>' + data.expires_at + '</i><br /><br />' + |
| 512 | + '<p>To auto-configure your node run<br /><small><code>npm run configure -- --panel-url '+window.location.protocol+'//{{ config('app.url') }} --token '+data.token+'</code></small></p>', |
| 513 | + html: true |
| 514 | + }) |
| 515 | + }) |
| 516 | + .fail(function () { |
| 517 | + swal({ |
| 518 | + title: 'Error', |
| 519 | + text: 'Something went wrong creating your token.', |
| 520 | + type: 'error' |
| 521 | + }); |
| 522 | + }) |
| 523 | + }) |
| 524 | +
|
539 | 525 | $('.cloneElement').on('click', function (event) { |
540 | 526 | event.preventDefault(); |
541 | 527 | var rnd = randomKey(10); |
|
0 commit comments