feat(web): serve the web app under /app and send every billing link there (WS-B)
apps/web was never deployed, so /billing on the public domain returned the landing page and d3ro.dev (desktop "upgrade") did not resolve. - apps/web runs with basePath /app and output standalone; /download and /releases redirect to the site's #download. A Dockerfile and a d3ro-web compose service (port 3002) deploy it to the NAS with the other images. - The site bridge worker forwards /app/* to WEB_APP_ORIGIN (the tunnel host) and rewrites upstream redirects; everything else still goes to Pages. With no origin configured /app answers 503 instead of the landing page. - Desktop upgrade, desktop Stripe return, mobile subscription management, the web checkout/portal returns and the site all use billingUrl(); the return query is success=1 / canceled=1, which the billing page reads. The billing page highlights ?tier=pro|pro_plus, and signing in from a billing link returns to the same plan. - auth/callback pins the redirect origin in production and rejects protocol-relative next= values (open redirect). - Mobile legal links use SITE_URLS (fixes the missing slash on /terms). - Compose drops the unused NEXT_PUBLIC_API_URL and the dead wwwroot legal mounts; deploy scripts add the web image and the SUPABASE_* values the NAS compose already required; .dockerignore keeps app .env files out of images. - Supabase auth redirects allow /app/** (remote dashboard must match). Policy: docs/REFACTOR_POLICY.md Wave 3, W3-3 and W3-4.
This commit is contained in:
parent
88f24d84a1
commit
b6fe588a7c
30 changed files with 493 additions and 95 deletions
|
|
@ -11,6 +11,12 @@ import { Box, Stack, Alert } from '@mui/material'
|
|||
import { useI18n } from '@d3ro/i18n'
|
||||
import { getSupabaseBrowserClient, isSupabaseConfigured } from '@/lib/supabase-browser'
|
||||
import { useAuth } from '@/components/providers/auth-provider'
|
||||
import { appUrlFor, safeReturnPath } from '@/lib/web-app-url'
|
||||
|
||||
/** (app) 레이아웃이 붙여 보낸 `?next=` — 로그인 뒤 돌아갈 웹앱 내부 경로. */
|
||||
function returnPathFromLocation(): string {
|
||||
return safeReturnPath(new URLSearchParams(window.location.search).get('next'))
|
||||
}
|
||||
|
||||
export default function LoginPage(): React.ReactElement {
|
||||
const router = useRouter()
|
||||
|
|
@ -24,7 +30,7 @@ export default function LoginPage(): React.ReactElement {
|
|||
|
||||
useEffect(() => {
|
||||
if (!loading && user) {
|
||||
router.replace('/dashboard')
|
||||
router.replace(returnPathFromLocation())
|
||||
}
|
||||
}, [loading, user, router])
|
||||
|
||||
|
|
@ -38,7 +44,10 @@ export default function LoginPage(): React.ReactElement {
|
|||
|
||||
try {
|
||||
const supabase = getSupabaseBrowserClient()
|
||||
const redirectTo = `${window.location.origin}/auth/callback`
|
||||
const redirectTo = appUrlFor(
|
||||
window.location.origin,
|
||||
`/auth/callback?next=${encodeURIComponent(returnPathFromLocation())}`
|
||||
)
|
||||
const { error: err } = await supabase.auth.signInWithOAuth({
|
||||
provider: provider === 'apple' ? 'apple' : provider,
|
||||
options: { redirectTo }
|
||||
|
|
@ -69,7 +78,7 @@ export default function LoginPage(): React.ReactElement {
|
|||
setError(err.message)
|
||||
setSigningIn(false)
|
||||
} else {
|
||||
router.replace('/dashboard')
|
||||
router.replace(returnPathFromLocation())
|
||||
}
|
||||
} catch (e) {
|
||||
setError(e instanceof Error ? e.message : 'Unknown error')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue