Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 62 additions & 5 deletions desk/app/vitriol.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
state-6
state-7
state-8
state-9
==
+$ state-0
$: %0
Expand Down Expand Up @@ -109,6 +110,21 @@
in-flight=(map @t [proofs=(list cashu-proof) mint=@t expiry=@da])
pending-melts=(map @t pending-melt)
==
+$ state-9
$: %9
ecash-key=(unit [sec=@ pub=@])
banned=(set @p)
require-payment=?
sats-per-pr=(unit @ud)
public-verify=?
mint=(unit @t)
wallet=(map @t (list cashu-proof))
mint-keysets=(map @t (map @ud @t))
pending-mints=(map @t pending-mint-quote)
pending-verifies=(map @t pending-verify)
in-flight=(map @t [proofs=(list cashu-proof) mint=@t expiry=@da])
pending-melts=(map @t pending-melt)
==
::
++ ca cashu
::
Expand Down Expand Up @@ -338,7 +354,7 @@
$(to-remove t.to-remove)
--
^- agent:gall
=| state-8
=| state-9
=* state -
|_ =bowl:gall
+* this .
Expand All @@ -352,6 +368,7 @@
banned *(set @p)
require-payment %.n
sats-per-pr ~
public-verify %.n
mint ~
wallet *(map @t (list cashu-proof))
mint-keysets *(map @t (map @ud @t))
Expand All @@ -377,13 +394,30 @@
=/ empty-flights *(map @t [proofs=(list cashu-proof) mint=@t expiry=@da])
=/ empty-melts *(map @t pending-melt)
?- -.old
%8 [~[eyre-card] this(state old)]
%9 [~[eyre-card] this(state old)]
%8
:_ %= this
ecash-key ecash-key.old
banned banned.old
require-payment require-payment.old
sats-per-pr sats-per-pr.old
public-verify %.n
mint mint.old
wallet wallet.old
mint-keysets mint-keysets.old
pending-mints pending-mints.old
pending-verifies pending-verifies.old
in-flight in-flight.old
pending-melts pending-melts.old
==
~[eyre-card]
%7
:_ %= this
ecash-key ecash-key.old
banned banned.old
require-payment require-payment.old
sats-per-pr sats-per-pr.old
public-verify %.n
mint mint.old
wallet wallet.old
mint-keysets mint-keysets.old
Expand All @@ -399,6 +433,7 @@
banned banned.old
require-payment require-payment.old
sats-per-pr sats-per-pr.old
public-verify %.n
mint mint.old
wallet wallet.old
mint-keysets mint-keysets.old
Expand All @@ -414,6 +449,7 @@
banned banned.old
require-payment require-payment.old
sats-per-pr ~
public-verify %.n
mint mint.old
wallet wallet.old
mint-keysets mint-keysets.old
Expand All @@ -429,6 +465,7 @@
banned banned.old
require-payment require-payment.old
sats-per-pr ~
public-verify %.n
mint ~
wallet empty-wallet
mint-keysets empty-keysets
Expand All @@ -444,6 +481,7 @@
banned banned.old
require-payment %.n
sats-per-pr ~
public-verify %.n
mint ~
wallet empty-wallet
mint-keysets empty-keysets
Expand All @@ -459,6 +497,7 @@
banned *(set @p)
require-payment %.n
sats-per-pr ~
public-verify %.n
mint ~
wallet empty-wallet
mint-keysets empty-keysets
Expand All @@ -475,6 +514,7 @@
banned *(set @p)
require-payment %.n
sats-per-pr ~
public-verify %.n
mint ~
wallet empty-wallet
mint-keysets empty-keysets
Expand All @@ -491,6 +531,7 @@
banned *(set @p)
require-payment %.n
sats-per-pr ~
public-verify %.n
mint ~
wallet empty-wallet
mint-keysets empty-keysets
Expand All @@ -509,11 +550,20 @@
%handle-http-request
=/ [eyre-id=@ta req=inbound-request:eyre]
!<([@ta inbound-request:eyre] vase)
?. authenticated.req
:_ this
(give-simple-payload:app:server eyre-id [[403 ~] ~])
=/ rl (parse-request-line:server url.request.req)
=/ meth method.request.req
:: allow public access to verify endpoints when public-verify is on
=/ is-public-endpoint=?
?& public-verify
?| =([%vitriol %verify-commit ~] site.rl)
?=([%vitriol %verify-status *] site.rl)
=([%vitriol %sats-per-pr ~] site.rl)
=([%vitriol %ecash-pubkey ~] site.rl)
==
==
?. |(authenticated.req is-public-endpoint)
:_ this
(give-simple-payload:app:server eyre-id [[403 ~] ~])
?+ site.rl
:_ this
(give-simple-payload:app:server eyre-id not-found:gen:server)
Expand All @@ -536,6 +586,7 @@
banned
require-payment
sats-per-pr
public-verify
mint
wallet
pending-mints
Expand Down Expand Up @@ -594,6 +645,12 @@
:_ this(require-payment !require-payment)
(redirect-response:vitriol-ui eyre-id '/vitriol/admin')
::
:: POST /vitriol/admin/toggle-public-verify — toggle public verification
::
[%vitriol %admin %toggle-public-verify ~]
:_ this(public-verify !public-verify)
(redirect-response:vitriol-ui eyre-id '/vitriol/admin')
::
:: POST /vitriol/admin/set-price — set sats per PR
::
[%vitriol %admin %set-price ~]
Expand Down
15 changes: 15 additions & 0 deletions desk/lib/vitriol-ui.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
banned=(set @p)
require-payment=?
sats-per-pr=(unit @ud)
public-verify=?
mint=(unit @t)
wallet=(map @t (list cashu-proof))
pending-mints=(map @t pending-mint-quote)
Expand Down Expand Up @@ -266,6 +267,20 @@
;div.val: {(trip (to-hex 64 pub.u.ecash-key))}
==
==
;section
;h2: public verification
;div.toggle-form
;span
;+ ?: public-verify
;span.status.status-on: enabled
;span.status.status-off: disabled
==
;form(method "POST", action "/vitriol/admin/toggle-public-verify")
;input(type "submit", value ?:(public-verify "Disable" "Enable"));
==
==
;p: when enabled, /vitriol/verify-commit, /vitriol/verify-status, /vitriol/sats-per-pr, and /vitriol/ecash-pubkey are accessible without authentication. this allows other repos to use your ship for CI verification without needing an auth cookie.
==
;section
;h2: received tokens
;+ ?: (gth num-melts 0)
Expand Down
Loading