kopia lustrzana https://gitlab.com/soapbox-pub/soapbox
Merge branch 'set-lightning-address' into 'main'
Allow users to set their lightning address and website Closes #1662 and #1664 See merge request soapbox-pub/soapbox!3032environments/review-main-yi2y9f/deployments/4637
commit
9c01fc41f2
|
@ -56,6 +56,7 @@ const messages = defineMessages({
|
|||
websitePlaceholder: { id: 'edit_profile.fields.website_placeholder', defaultMessage: 'Display a Link' },
|
||||
locationPlaceholder: { id: 'edit_profile.fields.location_placeholder', defaultMessage: 'Location' },
|
||||
nip05Placeholder: { id: 'edit_profile.fields.nip05_placeholder', defaultMessage: 'user@{domain}' },
|
||||
lud16Placeholder: { id: 'edit_profile.fields.lud16_placeholder', defaultMessage: 'user@example.com' },
|
||||
cancel: { id: 'common.cancel', defaultMessage: 'Cancel' },
|
||||
});
|
||||
|
||||
|
@ -128,6 +129,11 @@ interface AccountCredentials {
|
|||
birthday?: string;
|
||||
/** Nostr NIP-05 identifier. */
|
||||
nip05?: string;
|
||||
/**
|
||||
* Lightning address.
|
||||
* https://github.com/lnurl/luds/blob/luds/16.md
|
||||
*/
|
||||
lud16?: string;
|
||||
}
|
||||
|
||||
/** Convert an account into an update_credentials request object. */
|
||||
|
@ -151,6 +157,7 @@ const accountToCredentials = (account: Account): AccountCredentials => {
|
|||
location: account.location,
|
||||
birthday: account.pleroma?.birthday ?? undefined,
|
||||
nip05: account.source?.nostr?.nip05 ?? '',
|
||||
lud16: account?.nostr?.lud16 ?? '',
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -354,12 +361,25 @@ const EditProfile: React.FC = () => {
|
|||
</FormGroup>
|
||||
)}
|
||||
|
||||
{features.lightning && (
|
||||
<FormGroup
|
||||
labelText={<FormattedMessage id='edit_profile.fields.lud16_label' defaultMessage='Lightning Address' />}
|
||||
>
|
||||
<Input
|
||||
type='email'
|
||||
value={data.lud16}
|
||||
onChange={handleTextChange('lud16')}
|
||||
placeholder={intl.formatMessage(messages.lud16Placeholder)}
|
||||
/>
|
||||
</FormGroup>
|
||||
)}
|
||||
|
||||
{features.accountWebsite && (
|
||||
<FormGroup
|
||||
labelText={<FormattedMessage id='edit_profile.fields.website_label' defaultMessage='Website' />}
|
||||
>
|
||||
<Input
|
||||
type='text'
|
||||
type='url'
|
||||
value={data.website}
|
||||
onChange={handleTextChange('website')}
|
||||
placeholder={intl.formatMessage(messages.websitePlaceholder)}
|
||||
|
|
|
@ -658,6 +658,8 @@
|
|||
"edit_profile.fields.location_label": "Location",
|
||||
"edit_profile.fields.location_placeholder": "Location",
|
||||
"edit_profile.fields.locked_label": "Lock account",
|
||||
"edit_profile.fields.lud16_label": "Lightning Address",
|
||||
"edit_profile.fields.lud16_placeholder": "user@example.com",
|
||||
"edit_profile.fields.meta_fields.content_placeholder": "Content",
|
||||
"edit_profile.fields.meta_fields.label_placeholder": "Label",
|
||||
"edit_profile.fields.meta_fields_label": "Profile fields",
|
||||
|
|
|
@ -63,6 +63,7 @@ const baseAccountSchema = z.object({
|
|||
]).catch(null),
|
||||
nostr: coerceObject({
|
||||
pubkey: n.id().optional().catch(undefined),
|
||||
lud16: z.string().email().optional().catch(undefined),
|
||||
}),
|
||||
note: contentSchema,
|
||||
/** Fedibird extra settings. */
|
||||
|
@ -183,4 +184,4 @@ const accountSchema = baseAccountSchema.extend({
|
|||
|
||||
type Account = Resolve<z.infer<typeof accountSchema>>;
|
||||
|
||||
export { accountSchema, type Account };
|
||||
export { accountSchema, type Account };
|
||||
|
|
|
@ -184,7 +184,7 @@ const getInstanceFeatures = (instance: Instance) => {
|
|||
* Ability to set one's website on their profile.
|
||||
* @see PATCH /api/v1/accounts/update_credentials
|
||||
*/
|
||||
accountWebsite: v.software === TRUTHSOCIAL,
|
||||
accountWebsite: v.software === TRUTHSOCIAL || v.software === DITTO,
|
||||
|
||||
/**
|
||||
* Ability to manage announcements by admins.
|
||||
|
@ -701,6 +701,12 @@ const getInstanceFeatures = (instance: Instance) => {
|
|||
v.software === PLEROMA && v.build === REBASED && gte(v.version, '2.5.54'),
|
||||
]),
|
||||
|
||||
/**
|
||||
* Ability to set one's lightning address on their profile.
|
||||
* @see PATCH /api/v1/accounts/update_credentials
|
||||
*/
|
||||
lightning: v.software === DITTO,
|
||||
|
||||
/**
|
||||
* Can create, view, and manage lists.
|
||||
* @see {@link https://docs.joinmastodon.org/methods/lists/}
|
||||
|
|
Ładowanie…
Reference in New Issue