Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- nginx.conf +11 -0
- src/components/StockSearch.jsx +2 -3
nginx.conf
CHANGED
|
@@ -8,6 +8,17 @@ server {
|
|
| 8 |
try_files $uri $uri/ /index.html;
|
| 9 |
}
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Error handling
|
| 12 |
error_page 500 502 503 504 /50x.html;
|
| 13 |
location = /50x.html {
|
|
|
|
| 8 |
try_files $uri $uri/ /index.html;
|
| 9 |
}
|
| 10 |
|
| 11 |
+
location /api/yahoo/ {
|
| 12 |
+
proxy_pass https://query2.finance.yahoo.com/;
|
| 13 |
+
proxy_set_header Host query2.finance.yahoo.com;
|
| 14 |
+
proxy_set_header X-Real-IP $remote_addr;
|
| 15 |
+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
| 16 |
+
proxy_set_header X-Forwarded-Proto $scheme;
|
| 17 |
+
|
| 18 |
+
# Add CORS headers if needed (though since it's same-origin now it should be fine)
|
| 19 |
+
add_header 'Access-Control-Allow-Origin' '*' always;
|
| 20 |
+
}
|
| 21 |
+
|
| 22 |
# Error handling
|
| 23 |
error_page 500 502 503 504 /50x.html;
|
| 24 |
location = /50x.html {
|
src/components/StockSearch.jsx
CHANGED
|
@@ -22,8 +22,7 @@ export default function StockSearch({ isOpen, onClose, onAddStock, currentPortfo
|
|
| 22 |
if (query.length > 1) {
|
| 23 |
setLoading(true);
|
| 24 |
try {
|
| 25 |
-
const
|
| 26 |
-
const url = `${proxy}https://query2.finance.yahoo.com/v1/finance/search?q=${query}&newsCount=0`;
|
| 27 |
const response = await fetch(url);
|
| 28 |
const data = await response.json();
|
| 29 |
|
|
@@ -223,7 +222,7 @@ export default function StockSearch({ isOpen, onClose, onAddStock, currentPortfo
|
|
| 223 |
type="button"
|
| 224 |
onClick={() => {
|
| 225 |
console.log("Analyze button clicked", { selectedStock, shares });
|
| 226 |
-
|
| 227 |
}}
|
| 228 |
className="flex items-center gap-2 bg-gs-gold text-gs-navy px-4 py-2 rounded-lg text-xs font-bold hover:bg-white transition-all shadow-lg active:scale-95"
|
| 229 |
>
|
|
|
|
| 22 |
if (query.length > 1) {
|
| 23 |
setLoading(true);
|
| 24 |
try {
|
| 25 |
+
const url = `/api/yahoo/v1/finance/search?q=${query}&newsCount=0`;
|
|
|
|
| 26 |
const response = await fetch(url);
|
| 27 |
const data = await response.json();
|
| 28 |
|
|
|
|
| 222 |
type="button"
|
| 223 |
onClick={() => {
|
| 224 |
console.log("Analyze button clicked", { selectedStock, shares });
|
| 225 |
+
analyzeImpact(selectedStock, shares);
|
| 226 |
}}
|
| 227 |
className="flex items-center gap-2 bg-gs-gold text-gs-navy px-4 py-2 rounded-lg text-xs font-bold hover:bg-white transition-all shadow-lg active:scale-95"
|
| 228 |
>
|