From 58222fb82f76e3e88fe6d9db81b4e0a6893d9a59 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sun, 1 Nov 2026 14:19:24 +0000 Subject: [PATCH 1/2] feat: import OpenProfile on connect --- apps/web/package.json | 2 +- apps/web/src/routes/coinpay.js | 14 +++++++++++++- apps/web/src/views/pages.jsx | 3 ++- bun.lock | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/apps/web/package.json b/apps/web/package.json index aad1578..90b4547 100644 --- a/apps/web/package.json +++ b/apps/web/package.json @@ -29,7 +29,7 @@ "@profullstack/notifications": "^0.1.4", "@profullstack/openprofile": "^0.2.0", "@profullstack/partners": "0.2.0", - "@profullstack/profile": "0.1.6", + "@profullstack/profile": "0.1.7", "@profullstack/redeem-credits": "^0.2.0", "@profullstack/throttle": "^0.4.0", "@profullstack/webhooks": "0.2.1", diff --git a/apps/web/src/routes/coinpay.js b/apps/web/src/routes/coinpay.js index d94f7bf..99f7a58 100644 --- a/apps/web/src/routes/coinpay.js +++ b/apps/web/src/routes/coinpay.js @@ -1,4 +1,5 @@ import { getCookie, setCookie } from 'hono/cookie'; +import { saveOpenProfileContact } from '@profullstack/profile'; import { beginSignIn, coinpayConfig, @@ -119,7 +120,18 @@ export function registerCoinpay(app, overrides = null) { if (!user || c.get('viaKey') || String(user.id) !== String(pending.userId)) return c.redirect(back('/login', 'Sign in first, then connect CoinPay.'), 303); const r = await store.link(user.id, { sub: who.sub, email: who.email }); - if (r.ok) return c.redirect(back('/settings', 'CoinPay connected.', 'notice'), 303); + if (r.ok) { + const openprofileUrl = who.userinfo?.openprofile_url; + if (typeof openprofileUrl === 'string') { + try { + const { profiles } = await import('../lib/profile.js'); + await saveOpenProfileContact(profiles, String(user.id), openprofileUrl); + } catch (err) { + console.warn('[coinpay] OpenProfile import skipped:', err instanceof Error ? err.message : err); + } + } + return c.redirect(back('/settings', 'CoinPay connected.', 'notice'), 303); + } const why = r.reason === 'taken' ? 'That CoinPay account is already linked to another nichedb account.' diff --git a/apps/web/src/views/pages.jsx b/apps/web/src/views/pages.jsx index 66d9244..34bdc5b 100644 --- a/apps/web/src/views/pages.jsx +++ b/apps/web/src/views/pages.jsx @@ -837,11 +837,12 @@ export const Settings = ({ {user.email}. Also at /api/v1/me/profile.

- {raw(renderProfileFields({ fields: PROFILE_FIELDS, values: contact ?? {} }))} + {raw(renderProfileFields({ fields: PROFILE_FIELDS, values: contact ?? {}, importOpenProfile: true }))}
+