Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions app/(app)/dashboard/settings/profile-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export function ProfileCard() {
onChange={setValues}
errors={errors}
disabled={!loaded}
importOpenProfile
/>
{error && <p className="text-sm text-[var(--color-fail)]">{error}</p>}
<div className="flex items-center gap-3">
Expand Down
6 changes: 6 additions & 0 deletions app/api/v1/coinpay/oauth/callback/route.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { saveGlobalWalletProfile } from "@/lib/coinpay-wallets";
import { saveOpenProfileContact } from "@profullstack/profile";
import { profileStore } from "@/lib/profile";
import type { GlobalCoinpayWallet } from "@/lib/coinpay-wallet-data";
import { NextResponse, type NextRequest } from "next/server";
import { createClient } from "@/lib/supabase/server";
Expand Down Expand Up @@ -72,6 +74,10 @@ export async function GET(req: NextRequest) {
return back(failPath, "CoinPay sign-in failed. Try again.");
}
if (!resolved.ok) return back(failPath, resolved.error);
if (pending.mode === "connect" && claims.openprofile_url) {
try { await saveOpenProfileContact(profileStore(), resolved.userId, claims.openprofile_url); }
catch { console.warn("[coinpay-signin] OpenProfile import skipped"); }
}
if (wallets) {
try { await saveGlobalWalletProfile(sb, resolved.userId, claims.sub, wallets); }
catch { return back(pending.next, "Could not save CoinPay wallets. Reconnect to try again."); }
Expand Down
6 changes: 4 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/coinpay-signin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export function stateMatches(expected: string | null | undefined, got: string |
return a.length === b.length && timingSafeEqual(a, b);
}

export type CoinpayClaims = { sub: string; email: string | null; name: string | null };
export type CoinpayClaims = { sub: string; email: string | null; name: string | null; openprofile_url?: string };

/**
* Check the ID token that came straight back from the token endpoint over TLS
Expand Down Expand Up @@ -187,6 +187,7 @@ export async function fetchCoinpayClaims(
sub: info.sub,
email: typeof info.email === "string" && info.email.includes("@") ? info.email.slice(0, 320) : null,
name: typeof info.name === "string" && info.name.trim() ? info.name.trim().slice(0, 200) : null,
...(typeof info.openprofile_url === "string" ? { openprofile_url: info.openprofile_url } : {}),
},
};
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@profullstack/fleetbar": "0.2.0",
"@profullstack/footer": "latest",
"@profullstack/hqtui": "^0.11.0",
"@profullstack/profile": "0.1.6",
"@profullstack/profile": "0.1.7",
"@profullstack/redeem-credits": "^0.2.0",
"@profullstack/referrals": "^0.1.0",
"@profullstack/stack": "^0.5.0",
Expand Down