Fix lnaddress issue on usercreation

This commit is contained in:
austinkelsay 2024-09-30 15:29:52 -05:00
parent 5fd17eaf30
commit b8a7057be1
2 changed files with 2 additions and 4 deletions

@ -19,7 +19,6 @@ export default async function combinedMiddleware(request) {
const ip = request.ip ?? '127.0.0.1';
const hostname = request.nextUrl.hostname;
const referer = request.headers.get('referer') || '';
console.log("hostname", hostname)
// Bypass rate limiting and referer check for the deployment IP
if (hostname === FRONTEND_HOSTNAME || hostname === FRONTEND_STAGING_HOSTNAME) {

@ -31,9 +31,8 @@ const authorize = async (pubkey) => {
const response = await axios.get(`${BACKEND_URL}/api/users/${pubkey}`);
if (response.status === 200 && response.data) {
const fields = await findKind0Fields(profile);
// Combine user object with kind0Fields, giving priority to kind0Fields
const combinedUser = { ...fields, ...response.data };
const combinedUser = { ...response.data, ...fields };
// Update the user on the backend if necessary
// await axios.put(`${BACKEND_URL}/api/users/${combinedUser.id}`, combinedUser);
@ -43,7 +42,7 @@ const authorize = async (pubkey) => {
// Create user
if (profile) {
const fields = await findKind0Fields(profile);
const payload = { pubkey, ...fields };
const payload = { pubkey, username: fields.username, avatar: fields.avatar };
const createUserResponse = await axios.post(`${BACKEND_URL}/api/users`, payload);
return createUserResponse.data;