Spaces:
Running
Running
Upload 35 files
Browse files- README.md +3 -0
- app/page.tsx +7 -3
- next.config.ts +5 -0
README.md
CHANGED
|
@@ -6,6 +6,9 @@ colorTo: yellow
|
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
app_port: 7860
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# Nano Banana Node Editor π
|
|
|
|
| 6 |
sdk: docker
|
| 7 |
pinned: false
|
| 8 |
app_port: 7860
|
| 9 |
+
hf_oauth: true
|
| 10 |
+
hf_oauth_scopes:
|
| 11 |
+
- inference-api
|
| 12 |
---
|
| 13 |
|
| 14 |
# Nano Banana Node Editor π
|
app/page.tsx
CHANGED
|
@@ -1025,10 +1025,14 @@ export default function EditorPage() {
|
|
| 1025 |
}
|
| 1026 |
} else {
|
| 1027 |
// Login with HF OAuth
|
| 1028 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1029 |
if (!clientId) {
|
| 1030 |
-
console.error('OAuth client ID not configured');
|
| 1031 |
-
alert('OAuth
|
| 1032 |
return;
|
| 1033 |
}
|
| 1034 |
|
|
|
|
| 1025 |
}
|
| 1026 |
} else {
|
| 1027 |
// Login with HF OAuth
|
| 1028 |
+
// When hf_oauth: true is set in README, HF injects OAUTH_CLIENT_ID
|
| 1029 |
+
// Check multiple sources for the client ID
|
| 1030 |
+
const clientId = process.env.NEXT_PUBLIC_OAUTH_CLIENT_ID ||
|
| 1031 |
+
(typeof window !== 'undefined' && (window as any).OAUTH_CLIENT_ID);
|
| 1032 |
+
|
| 1033 |
if (!clientId) {
|
| 1034 |
+
console.error('OAuth client ID not configured. Make sure hf_oauth: true is set in README.md');
|
| 1035 |
+
alert('OAuth is not configured for this Space. Please ensure hf_oauth: true is set in the Space configuration.');
|
| 1036 |
return;
|
| 1037 |
}
|
| 1038 |
|
next.config.ts
CHANGED
|
@@ -8,6 +8,11 @@ const nextConfig: NextConfig = {
|
|
| 8 |
serverRuntimeConfig: {
|
| 9 |
bodySizeLimit: '50mb',
|
| 10 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
// Redirect /editor to main page
|
| 12 |
async redirects() {
|
| 13 |
return [
|
|
|
|
| 8 |
serverRuntimeConfig: {
|
| 9 |
bodySizeLimit: '50mb',
|
| 10 |
},
|
| 11 |
+
// Expose HuggingFace OAuth environment variables to the client
|
| 12 |
+
// HF injects OAUTH_CLIENT_ID when hf_oauth: true is set in README
|
| 13 |
+
env: {
|
| 14 |
+
NEXT_PUBLIC_OAUTH_CLIENT_ID: process.env.OAUTH_CLIENT_ID || process.env.NEXT_PUBLIC_OAUTH_CLIENT_ID || '',
|
| 15 |
+
},
|
| 16 |
// Redirect /editor to main page
|
| 17 |
async redirects() {
|
| 18 |
return [
|