diff --git a/src/middleware.js b/src/middleware.js index e74ec76..cc3f264 100644 --- a/src/middleware.js +++ b/src/middleware.js @@ -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) { diff --git a/src/pages/api/auth/[...nextauth].js b/src/pages/api/auth/[...nextauth].js index 9982ba5..4e80084 100644 --- a/src/pages/api/auth/[...nextauth].js +++ b/src/pages/api/auth/[...nextauth].js @@ -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;