Enhance payment processing and rental features

- Updated the BTCPay service to support internal Lightning invoices with private route hints, improving payment routing for users with private channels.
- Added reconciliation methods for pending rents and subscriptions to ensure missed payments are processed on startup.
- Enhanced the rental and subscription services to handle payments in satoshis, aligning with Lightning Network standards.
- Improved the rental modal and content detail components to display rental status and pricing more clearly, including a countdown for rental expiration.
- Refactored various components to streamline user experience and ensure accurate rental access checks.
This commit is contained in:
Dorian
2026-02-12 23:24:25 +00:00
parent cdd24a5def
commit 0da83f461c
39 changed files with 1182 additions and 270 deletions

View File

@@ -136,30 +136,46 @@ export const useAuthStore = defineStore('auth', () => {
return
}
// Real mode: validate session with backend API
// Real mode: validate session with backend API.
// For Nostr sessions, skip the Cognito-only validate-session endpoint
// and go straight to /auth/me which uses HybridAuthGuard.
try {
const isValid = await authService.validateSession()
if (storedNostrToken && storedPubkey) {
// Nostr session: restore nip98Service state then fetch user profile
nip98Service.storeTokens(
storedNostrToken,
sessionStorage.getItem('indeehub_api_refresh') ?? sessionStorage.getItem('refresh_token') ?? '',
)
if (isValid) {
await fetchCurrentUser()
if (storedCognitoToken) {
nostrPubkey.value = storedPubkey
authType.value = 'nostr'
isAuthenticated.value = true
} else if (storedCognitoToken) {
// Cognito session: use legacy validate-session
const isValid = await authService.validateSession()
if (isValid) {
await fetchCurrentUser()
authType.value = 'cognito'
cognitoToken.value = storedCognitoToken
isAuthenticated.value = true
} else {
authType.value = 'nostr'
await logout()
}
isAuthenticated.value = true
} else {
await logout()
}
} catch (apiError: any) {
if (isConnectionError(apiError)) {
console.warn('Backend not reachable — falling back to mock session.')
restoreAsMock()
} else {
throw apiError
// Token likely expired or invalid
console.warn('Session validation failed:', apiError.message)
if (accountManager.active) {
// Still have a Nostr signer — try re-authenticating
restoreAsMock()
} else {
await logout()
}
}
}
} catch (error) {