handshake address regen through HTTP
This commit is contained in:
parent
b7ad45f1d5
commit
89b1263e80
1 changed files with 10 additions and 1 deletions
|
|
@ -1920,8 +1920,13 @@ module.exports = async (
|
|||
* @type {RequestHandler<{}>}
|
||||
*/
|
||||
const apiGunMePut = async (req, res) => {
|
||||
/**
|
||||
* @typedef {Omit<Common.Schema.User, 'publicKey'>} UserWithoutPK
|
||||
* @typedef {{ handshakeAddress: boolean }} HasHandshakeAddress
|
||||
* @typedef {UserWithoutPK & HasHandshakeAddress} MePutBody
|
||||
*/
|
||||
try {
|
||||
const { avatar, bio , displayName} = /** @type {Partial<Omit<Common.Schema.User, 'publicKey'>>} */ (req.body)
|
||||
const { avatar, bio , displayName, handshakeAddress } = /** @type {Partial<MePutBody>} */ (req.body)
|
||||
|
||||
if (avatar) {
|
||||
await GunActions.setAvatar(avatar, require('../services/gunDB/Mediator').getUser())
|
||||
|
|
@ -1935,6 +1940,10 @@ module.exports = async (
|
|||
await GunActions.setDisplayName(displayName, require('../services/gunDB/Mediator').getUser())
|
||||
}
|
||||
|
||||
if (handshakeAddress) {
|
||||
await GunActions.generateHandshakeAddress();
|
||||
}
|
||||
|
||||
return res.status(200).json({
|
||||
ok: true
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue