From c2f11f3d96147f82f05330c6130cdc6365cc9cec Mon Sep 17 00:00:00 2001 From: padreug Date: Sun, 10 Aug 2025 10:43:01 +0200 Subject: [PATCH] chore: update LNBits API configuration in environment and documentation - Added VITE_LNBITS_API_URL to .env.example for LNBits API integration. - Updated AUTHENTICATION.md to reflect changes in LNBits base URL configuration. - Refactored ProfileDialog.vue and config files to use VITE_LNBITS_BASE_URL instead of VITE_API_BASE_URL for API calls. --- AUTHENTICATION.md | 10 +++++----- src/components/auth/ProfileDialog.vue | 2 +- src/lib/config/index.ts | 2 +- src/lib/config/lnbits.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/AUTHENTICATION.md b/AUTHENTICATION.md index ed8e0ad..71c23fd 100644 --- a/AUTHENTICATION.md +++ b/AUTHENTICATION.md @@ -18,10 +18,10 @@ The authentication system has been completely replaced with a traditional userna Create a `.env` file in the `web-app` directory with the following variables: ```env -# LNBits API Configuration -# Set this to your LNBits instance API URL -# Example: http://localhost:5000/api/v1 or https://your-lnbits-instance.com/api/v1 -VITE_LNBITS_API_URL=/api/v1 +# LNBits Base URL Configuration +# Set this to your LNBits instance base URL +# Example: http://localhost:5000 or https://your-lnbits-instance.com +VITE_LNBITS_BASE_URL=http://localhost:5000 # Enable debug logging for LNBits API calls VITE_LNBITS_DEBUG=false @@ -102,7 +102,7 @@ To run the application with the new authentication system: 1. **CORS Errors**: Ensure your LNBits instance allows requests from your frontend domain 2. **Authentication Failures**: Check that username/password auth is enabled in LNBits -3. **API Connection**: Verify the `VITE_LNBITS_API_URL` is correct +3. **API Connection**: Verify the `VITE_LNBITS_BASE_URL` is correct and points to your LNBits instance (without /api/v1) ### Debug Mode diff --git a/src/components/auth/ProfileDialog.vue b/src/components/auth/ProfileDialog.vue index 26f3640..39be3aa 100644 --- a/src/components/auth/ProfileDialog.vue +++ b/src/components/auth/ProfileDialog.vue @@ -22,7 +22,7 @@ const emit = defineEmits() const userDisplay = computed(() => auth.userDisplay.value) // Get the API base URL from environment variables -const apiBaseUrl = import.meta.env.VITE_API_BASE_URL || '' +const apiBaseUrl = import.meta.env.VITE_LNBITS_BASE_URL || '' function handleLogout() { auth.logout() diff --git a/src/lib/config/index.ts b/src/lib/config/index.ts index 103ce98..aeea484 100644 --- a/src/lib/config/index.ts +++ b/src/lib/config/index.ts @@ -52,7 +52,7 @@ export const config: AppConfig = { adminPubkeys: parseJsonEnv(import.meta.env.VITE_ADMIN_PUBKEYS, []) }, api: { - baseUrl: import.meta.env.VITE_API_BASE_URL || '', + baseUrl: import.meta.env.VITE_LNBITS_BASE_URL || '', key: import.meta.env.VITE_API_KEY || '' }, push: { diff --git a/src/lib/config/lnbits.ts b/src/lib/config/lnbits.ts index 74a5ead..b267a5f 100644 --- a/src/lib/config/lnbits.ts +++ b/src/lib/config/lnbits.ts @@ -2,7 +2,7 @@ export const LNBITS_CONFIG = { // Base URL for the LNBits API // This should point to your LNBits instance - API_BASE_URL: import.meta.env.VITE_LNBITS_API_URL || '/api/v1', + API_BASE_URL: `${import.meta.env.VITE_LNBITS_BASE_URL || ''}/api/v1`, // Whether to enable debug logging DEBUG: import.meta.env.VITE_LNBITS_DEBUG === 'true',