forked from Kieran/snort
feat: select forward type
This commit is contained in:
parent
c689bd39dc
commit
e248889170
@ -8,6 +8,7 @@ export interface ManageHandle {
|
||||
pubkey: string;
|
||||
created: Date;
|
||||
lnAddress?: string;
|
||||
forwardType?: ForwardType;
|
||||
}
|
||||
|
||||
export enum ForwardType {
|
||||
|
@ -5,13 +5,14 @@ import { LNURL } from "@snort/shared";
|
||||
import { ApiHost } from "Const";
|
||||
import AsyncButton from "Element/AsyncButton";
|
||||
import useEventPublisher from "Hooks/useEventPublisher";
|
||||
import SnortServiceProvider, { ManageHandle } from "Nip05/SnortServiceProvider";
|
||||
import SnortServiceProvider, { ForwardType, ManageHandle } from "Nip05/SnortServiceProvider";
|
||||
|
||||
export default function LNForwardAddress({ handle }: { handle: ManageHandle }) {
|
||||
const { formatMessage } = useIntl();
|
||||
const { publisher } = useEventPublisher();
|
||||
|
||||
const [newAddress, setNewAddress] = useState(handle.lnAddress ?? "");
|
||||
const [fwdType, setFwdType] = useState(handle.forwardType ?? ForwardType.Redirect);
|
||||
const [error, setError] = useState("");
|
||||
|
||||
async function startUpdate() {
|
||||
@ -19,6 +20,7 @@ export default function LNForwardAddress({ handle }: { handle: ManageHandle }) {
|
||||
|
||||
const req = {
|
||||
lnAddress: newAddress,
|
||||
forwardType: fwdType,
|
||||
};
|
||||
|
||||
setError("");
|
||||
@ -49,18 +51,28 @@ export default function LNForwardAddress({ handle }: { handle: ManageHandle }) {
|
||||
<p>
|
||||
<FormattedMessage defaultMessage="Your handle will act like a lightning address and will redirect to your chosen LNURL or Lightning address" />
|
||||
</p>
|
||||
<div className="flex">
|
||||
<div className="grow">
|
||||
|
||||
<p>
|
||||
<small>
|
||||
<FormattedMessage defaultMessage="Redirect issues HTTP redirect to the supplied lightning address" />
|
||||
<br />
|
||||
<FormattedMessage defaultMessage="Proxy uses HODL invoices to forward the payment, which hides the pubkey of your node" />
|
||||
</small>
|
||||
</p>
|
||||
<div className="flex g8">
|
||||
<input
|
||||
type="text"
|
||||
className="w-max mr10"
|
||||
className="w-max"
|
||||
placeholder={formatMessage({
|
||||
defaultMessage: "LNURL or Lightning Address",
|
||||
})}
|
||||
value={newAddress}
|
||||
onChange={e => setNewAddress(e.target.value)}
|
||||
/>
|
||||
</div>
|
||||
<select value={fwdType} onChange={e => setFwdType(Number(e.target.value))}>
|
||||
<option value={ForwardType.Redirect}>Redirect</option>
|
||||
<option value={ForwardType.ProxyDirect}>Proxy</option>
|
||||
</select>
|
||||
<AsyncButton onClick={() => startUpdate()}>
|
||||
<FormattedMessage defaultMessage="Update" />
|
||||
</AsyncButton>
|
||||
|
@ -235,6 +235,9 @@
|
||||
"7/h1jn": {
|
||||
"defaultMessage": "After submitting the pin there may be a slight delay as we encrypt the key."
|
||||
},
|
||||
"712i26": {
|
||||
"defaultMessage": "Proxy uses HODL invoices to forward the payment, which hides the pubkey of your node"
|
||||
},
|
||||
"7BX/yC": {
|
||||
"defaultMessage": "Account Switcher"
|
||||
},
|
||||
@ -470,6 +473,9 @@
|
||||
"FSYL8G": {
|
||||
"defaultMessage": "Trending Users"
|
||||
},
|
||||
"FcNSft": {
|
||||
"defaultMessage": "Redirect issues HTTP redirect to the supplied lightning address"
|
||||
},
|
||||
"FdhSU2": {
|
||||
"defaultMessage": "Claim Now"
|
||||
},
|
||||
|
@ -77,6 +77,7 @@
|
||||
"6uMqL1": "Unpaid",
|
||||
"7+Domh": "Notes",
|
||||
"7/h1jn": "After submitting the pin there may be a slight delay as we encrypt the key.",
|
||||
"712i26": "Proxy uses HODL invoices to forward the payment, which hides the pubkey of your node",
|
||||
"7BX/yC": "Account Switcher",
|
||||
"7UOvbT": "Offline",
|
||||
"7hp70g": "NIP-05",
|
||||
@ -154,6 +155,7 @@
|
||||
"FMfjrl": "Show status messages on profile pages",
|
||||
"FS3b54": "Done!",
|
||||
"FSYL8G": "Trending Users",
|
||||
"FcNSft": "Redirect issues HTTP redirect to the supplied lightning address",
|
||||
"FdhSU2": "Claim Now",
|
||||
"FfYsOb": "An error has occured!",
|
||||
"FmXUJg": "follows you",
|
||||
|
Loading…
Reference in New Issue
Block a user