DataHoarder
55661a12da
All checks were successful
continuous-integration/drone/push Build is passing
187 lines
8.8 KiB
Plaintext
187 lines
8.8 KiB
Plaintext
{% import "git.gammaspectra.live/P2Pool/p2pool-observer/cmd/index" %}
|
|
{% import cmdutils "git.gammaspectra.live/P2Pool/p2pool-observer/cmd/utils" %}
|
|
|
|
{% code
|
|
type MinerOptionsPage struct {
|
|
// inherit from base page, so its' title is used in error page.
|
|
BasePage
|
|
Miner *cmdutils.MinerInfoResult
|
|
SignedAction *cmdutils.SignedAction
|
|
WebHooks []*index.MinerWebHook
|
|
}
|
|
|
|
func (p *MinerOptionsPage) Name() string {
|
|
return "miner-options"
|
|
}
|
|
%}
|
|
|
|
{% func (p *MinerOptionsPage) Title() %}
|
|
{%= p.BasePage.Title() %} - Miner Options {%z= p.Miner.Address.ToBase58() %}
|
|
{% endfunc %}
|
|
|
|
{% func (p *MinerOptionsPage) Content() %}
|
|
|
|
<div style="text-align: center">
|
|
<h2 class="mono">Miner Options</h2>
|
|
<p><strong>Payout Address:</strong> <span class="mono small">{%z= p.Miner.Address.ToBase58() %}</span></p>
|
|
|
|
{% if p.Miner.Alias != "" %}
|
|
<p><strong>Miner Alias:</strong> <span class="mono">{%s p.Miner.Alias %}</span></p>
|
|
<p><small>Miner Alias is user content and not verified. This value should only be used for vanity purposes.</small></p>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if p.SignedAction != nil %}
|
|
|
|
<div style="text-align: center;">
|
|
|
|
<form action="/miner-options/{%z= p.Miner.Address.ToBase58() %}/signed_action" method="get" target="_blank">
|
|
<h2>Sign and submit changes</h2>
|
|
<p>To submit any changes you will need to sign a message using your wallet to prove ownership.</p>
|
|
<p>On the Monero GUI, go to Advanced -> Sign/verify -> Select Mode "Message".</p>
|
|
<p>Enter the Message listed below in the "Message" field, then press Sign Message. Copy the Signature and paste it on the field below.</p>
|
|
<p>Do not modify the message, add spaces or add any new lines.</p>
|
|
<p><small>Signatures generated by a View-Only wallet are not supported. Monero GUI does not generate valid signatures for hardware wallets.</small></p>
|
|
<div>
|
|
<label for="message">Message</label><br/>
|
|
<input type="text" name="message" id="message" size="96" class="mono" value="{%s p.SignedAction.String() %}" style="user-select: all; -webkit-user-select: all;" readonly autofocus/>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<label for="signature">Signature</label><br/>
|
|
<input type="text" name="signature" id="signature" size="96" class="mono" placeholder="SigV2..." pattern="^SigV[12][123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz]+$" required/>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<input type="submit" value="Submit changes" style="width: 20em;"/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
{% else %}
|
|
|
|
<div style="text-align: center;">
|
|
<h2 id="mineralias">Miner Alias</h2>
|
|
|
|
<div>
|
|
<form action="/miner-options/{%z= p.Miner.Address.ToBase58() %}/set_miner_alias" method="get" target="_blank">
|
|
<h3>Set Miner Alias</h3>
|
|
<p><small>
|
|
Miner Alias must be 4 to 20 characters long, and only 0-9, a-z, A-Z, and _-. are allowed, and cannot start with a number or symbol. No spaces are allowed either.
|
|
</br>
|
|
Alias are unique for the observer instance, and can be removed or changed after adding one.
|
|
</small></p>
|
|
<div>
|
|
<label for="miner-alias">Miner Alias</label><br/>
|
|
<input type="text" name="alias" id="miner-alias" minlength="4" maxlength="20" size="20" class="mono" value="{%s p.Miner.Alias %}" pattern="^[a-zA-Z][0-9a-zA-Z_.\-]+$" required/>
|
|
</div>
|
|
<div style="margin-top: 10px">
|
|
<input type="submit" value="Set Alias" style="width: 20em;"/>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div>
|
|
{% if p.Miner.Alias != "" %}
|
|
<form action="/miner-options/{%z= p.Miner.Address.ToBase58() %}/unset_miner_alias" method="get" target="_blank">
|
|
<h3>Unset Miner Alias</h3>
|
|
<p><small>You can remove your miner alias below if you don't want one set.</small></p>
|
|
<div style="margin-top: 10px">
|
|
<input type="submit" value="Unset Alias" style="width: 20em;"/>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div style="text-align: center;">
|
|
<h2 id="webhooks">Notification WebHooks</h2>
|
|
|
|
<div>
|
|
<form action="/miner-options/{%z= p.Miner.Address.ToBase58() %}/add_webhook" method="get" target="_blank">
|
|
<h3>Add WebHook</h3>
|
|
<p><small>
|
|
Configure notification URLs that can be used to post messages or other actions in other platforms or services.
|
|
</br>
|
|
Only one URL of each type is allowed. To adjust an existing hook settings you will need to add it with the new preference.
|
|
</small></p>
|
|
<div>
|
|
<label for="webhook-type">WebHook Type</label><br/>
|
|
<select type="text" name="type" id="webhook-type" required>
|
|
<option value=""></option>
|
|
<optgroup label="Chat Services">
|
|
<option value="{%s string(index.WebHookDiscord) %}">Discord</option>
|
|
<option value="{%s string(index.WebHookSlack) %}" disabled>Slack (coming soon)</option>
|
|
<option value="{%s string(index.WebHookTelegram) %}" disabled>Telegram (coming soon)</option>
|
|
<option value="{%s string(index.WebHookMatrixHookshot) %}" disabled>Matrix Hookshot (coming soon)</option>
|
|
</optgroup>
|
|
<optgroup label="Other">
|
|
<option value="{%s string(index.WebHookCustom) %}">Custom</option>
|
|
</optgroup>
|
|
</select>
|
|
</div>
|
|
</br>
|
|
<div>
|
|
<label for="webhook-url">WebHook URL</label><br/>
|
|
<input type="url" name="url" id="webhook-url" size="60" class="mono" value="" required/>
|
|
</div>
|
|
</br>
|
|
<fieldset>
|
|
<legend>WebHook Events</legend>
|
|
<div>
|
|
<input type="checkbox" id="webhook-side_blocks" name="side_blocks" checked />
|
|
<label for="webhook-side_blocks">Miner Side blocks</label>
|
|
</div>
|
|
<div>
|
|
<input type="checkbox" id="webhook-payouts" name="payouts" checked />
|
|
<label for="webhook-payouts">Miner Payouts</label>
|
|
</div>
|
|
<div>
|
|
<input type="checkbox" id="webhook-found_blocks" name="found_blocks" />
|
|
<label for="webhook-found_blocks">Found Monero blocks</label>
|
|
</div>
|
|
<div>
|
|
<input type="checkbox" id="webhook-orphaned_blocks" name="orphaned_blocks" />
|
|
<label for="webhook-orphaned_blocks">Orphaned Monero blocks</label>
|
|
</div>
|
|
<div>
|
|
<input type="checkbox" id="webhook-other" name="other" checked />
|
|
<label for="webhook-other">Other (notices, updates, events)</label>
|
|
</div>
|
|
</fieldset>
|
|
|
|
<div style="margin-top: 10px">
|
|
<input type="submit" value="Add WebHook" style="width: 20em;"/>
|
|
</div>
|
|
</form>
|
|
{% if len(p.WebHooks) > 0 %}
|
|
|
|
<h3>Current WebHooks</h3>
|
|
|
|
<table class="center datatable" style="max-width: calc(8em + 28em + 8em + 8em + 8em + 8em + 8em + 8em)">
|
|
<tr>
|
|
<th style="width: 8em;">Type</th>
|
|
<th style="width: 28em;" title="URL SHA-256 Hash">URL Hash</th>
|
|
<th style="width: 8em;">Shares</th>
|
|
<th style="width: 8em;">Payouts</th>
|
|
<th style="width: 8em;">Found Blocks</th>
|
|
<th style="width: 8em;">Orphaned Blocks</th>
|
|
<th style="width: 8em;">Other</th>
|
|
<th style="width: 8em;"></th>
|
|
</tr>
|
|
{% for _, w := range p.WebHooks %}
|
|
<tr>
|
|
<th>{%s string(w.Type) %}</th>
|
|
<td class="mono small">{%s w.Url %}</td>
|
|
<td>{% if cmdutils.CanSendToHook(w, "side_blocks") %}Yes{% else %}No{% endif %}</td>
|
|
<td>{% if cmdutils.CanSendToHook(w, "payouts") %}Yes{% else %}No{% endif %}</td>
|
|
<td>{% if cmdutils.CanSendToHook(w, "found_blocks") %}Yes{% else %}No{% endif %}</td>
|
|
<td>{% if cmdutils.CanSendToHook(w, "orphaned_blocks") %}Yes{% else %}No{% endif %}</td>
|
|
<td>{% if cmdutils.CanSendToHook(w, "other") %}Yes{% else %}No{% endif %}</td>
|
|
<td><a href="/miner-options/{%z= p.Miner.Address.ToBase58() %}/remove_webhook?type={%s string(w.Type) %}&url_hash={%s w.Url %}">[Remove]</a></td>
|
|
</tr>
|
|
{% endfor %}
|
|
</table>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% endfunc %} |