peach-workspace/peach-web/templates/settings/scuttlebutt/configure_sbot.html.tera

86 lines
5.6 KiB
Plaintext

{%- extends "nav" -%}
{%- block card %}
{# ASSIGN VARIABLES #}
{# ---------------- #}
{%- if sbot_config.hops -%}
{% set hops = sbot_config.hops -%}
{%- else -%}
{% set hops = "X" -%}
{%- endif -%}
{%- if sbot_config.lis -%}
{%- set listen_addr = sbot_config.lis | split(pat=":") -%}
{%- else -%}
{%- set listen_addr = ["", ""] -%}
{%- endif -%}
<!-- SBOT CONFIGURATION FORM -->
<div class="card center">
<form id="sbotConfig" class="center" action="/settings/scuttlebutt/configure" method="post">
<div class="center" style="display: flex; flex-direction: column;" title="Number of hops to replicate">
<label for="hops" class="label-small">HOPS</label>
<div id="hops" style="display: flex; justify-content: space-evenly;">
<input type="radio" id="hops_0" name="hops" value="0"{% if hops == 0 %} checked{% endif %}>
<label for="hops_0">0</label>
<input type="radio" id="hops_1" name="hops" value="1"{% if hops == 1 %} checked{% endif %}>
<label for="hops_1">1</label>
<input type="radio" id="hops_2" name="hops" value="2"{% if hops == 2 %} checked{% endif %}>
<label for="hops_2">2</label>
<input type="radio" id="hops_3" name="hops" value="3"{% if hops == 3 %} checked{% endif %}>
<label for="hops_3">3</label>
<input type="radio" id="hops_4" name="hops" value="4"{% if hops == 4 %} checked{% endif %}>
<label for="hops_4">4</label><br>
</div>
</div>
<br>
<div class="center" style="display: flex; justify-content: space-between;">
<div style="display: flex; flex-direction: column; width: 60%;" title="IP address on which the sbot runs">
<label for="ip" class="label-small">IP ADDRESS</label>
<input type="text" id="ip" name="lis_ip" value="{{ listen_addr.0 }}">
</div>
<div style="display: flex; flex-direction: column; width: 20%;" title="Port on which the sbot runs">
<label for="port" class="label-small">PORT</label>
<input type="text" id="port" name="lis_port" value="{{ listen_addr.1 }}">
</div>
</div>
<br>
<div class="center" style="display: flex; flex-direction: column;" title="Network key (aka 'caps key') to define the Scuttleverse in which the sbot operates in">
<label for="network_key" class="label-small">NETWORK KEY</label>
<input type="text" id="network_key" name="shscap" value="{{ sbot_config.shscap }}">
</div>
<br>
<div class="center" style="display: flex; flex-direction: column;" title="Directory in which the sbot database is saved">
<label for="database_dir" class="label-small">DATABASE DIRECTORY</label>
<input type="text" id="database_dir" name="repo" value="{{ sbot_config.repo }}">
</div>
<br>
<div class="center">
<input type="checkbox" id="lanBroadcast" name="localadv"{% if sbot_config.localadv == true %} checked{% endif %}>
<label for="lanBroadcast" title="Broadcast the IP and port of this sbot instance so that local peers can discovery it and attempt to connect">Enable LAN Broadcasting</label><br>
<br>
<input type="checkbox" id="lanDiscovery" name="localdiscov"{% if sbot_config.localdiscov == true %} checked{% endif %}>
<label for="lanDiscovery" title="Listen for the presence of local peers and attempt to connect if found">Enable LAN Discovery</label><br>
<br>
<input type="checkbox" id="startup" name="startup"{% if run_on_startup == "enabled" %} checked{% endif %}>
<label for="startup" title="Run the pub automatically on system startup">Run pub on system startup</label><br>
<br>
<input type="checkbox" id="repair" name="repair"{% if sbot_config.repair == true %} checked{% endif %}>
<label for="repair" title="Attempt to repair the filesystem before starting the pub">Attempt filesystem repair when pub starts</label><br>
</div>
<br>
<!-- hidden input elements for all other config variables -->
<input type="hidden" id="debugdir" name="debugdir" value="{{ sbot_config.debugdir }}">
<input type="hidden" id="hmac" name="hmac" value="{{ sbot_config.hmac }}">
<input type="hidden" id="wslis" name="wslis" value="{{ sbot_config.wslis }}">
<input type="hidden" id="debuglis" name="debuglis" value="{{ sbot_config.debuglis }}">
<input type="hidden" id="enable_ebt" name="enable_ebt" value="{{ sbot_config.enable_ebt }}">
<input type="hidden" id="promisc" name="promisc" value="{{ sbot_config.promisc }}">
<input type="hidden" id="nounixsock" name="nounixsock" value="{{ sbot_config.nounixsock }}">
<!-- BUTTONS -->
<input id="saveConfig" class="button button-primary center" type="submit" title="Save configuration parameters to file" value="Save">
<input id="saveRestartConfig" class="button button-primary center" type="submit" title="Save configuration parameters to file and then (re)start the pub" value="Save & Restart" formaction="/settings/scuttlebutt/configure?restart=true">
<a id="restoreDefaults" class="button button-warning center" href="/settings/scuttlebutt/configure/default" title="Restore default configuration parameters and save them to file">Restore Defaults</a>
</form>
<!-- FLASH MESSAGE -->
{% include "snippets/flash_message" %}
</div>
{%- endblock card -%}