refactor: Improve Gitea API error reporting and proxy logging, update tab content display, and add Globe texture cleanup.
This commit is contained in:
@@ -22,11 +22,12 @@ const GlobeMesh = () => {
|
|||||||
// Detect mobile device and reduce polygon count accordingly
|
// Detect mobile device and reduce polygon count accordingly
|
||||||
const isMobile = useMemo(() => {
|
const isMobile = useMemo(() => {
|
||||||
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ||
|
||||||
(window.innerWidth <= 768);
|
(window.innerWidth <= 768);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Generate Borders Texture using D3
|
// Generate Borders Texture using D3
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
let texture = null;
|
||||||
const generateTexture = async () => {
|
const generateTexture = async () => {
|
||||||
try {
|
try {
|
||||||
// Fetch World Topology (small 110m res)
|
// Fetch World Topology (small 110m res)
|
||||||
@@ -55,7 +56,7 @@ const GlobeMesh = () => {
|
|||||||
context.stroke();
|
context.stroke();
|
||||||
|
|
||||||
// Create Texture
|
// Create Texture
|
||||||
const texture = new THREE.CanvasTexture(canvas);
|
texture = new THREE.CanvasTexture(canvas);
|
||||||
texture.needsUpdate = true;
|
texture.needsUpdate = true;
|
||||||
setBordersTexture(texture);
|
setBordersTexture(texture);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -64,6 +65,10 @@ const GlobeMesh = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
generateTexture();
|
generateTexture();
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
if (texture) texture.dispose();
|
||||||
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Ireland Coordinates
|
// Ireland Coordinates
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ const ActivityHeatmap = () => {
|
|||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn("Gitea API error:", e);
|
console.warn("Gitea API error:", e);
|
||||||
|
console.error('Failed to fetch Gitea heatmap. URL:', '/api/gitea/api/v1/users/Matiss/heatmap');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Process & Merge
|
// 3. Process & Merge
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ const GitHistory = () => {
|
|||||||
return commitsArrays.flat();
|
return commitsArrays.flat();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('Gitea history error:', err);
|
console.warn('Gitea history error:', err);
|
||||||
|
console.error('Failed to fetch Gitea history. Check if the proxy is correctly configured and the target URL is reachable.');
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -53,8 +53,12 @@ const InfoTabs = () => {
|
|||||||
|
|
||||||
{/* Content Area */}
|
{/* Content Area */}
|
||||||
<div>
|
<div>
|
||||||
{activeTab === 'location' && <WhereAmI />}
|
<div style={{ display: activeTab === 'location' ? 'block' : 'none' }}>
|
||||||
{activeTab === 'git' && <GitSection />}
|
<WhereAmI />
|
||||||
|
</div>
|
||||||
|
<div style={{ display: activeTab === 'git' ? 'block' : 'none' }}>
|
||||||
|
<GitSection />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -9,7 +9,19 @@ export default defineConfig({
|
|||||||
'/api/gitea': {
|
'/api/gitea': {
|
||||||
target: 'https://git.mati.ss',
|
target: 'https://git.mati.ss',
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api\/gitea/, '')
|
secure: false,
|
||||||
|
rewrite: (path) => path.replace(/^\/api\/gitea/, ''),
|
||||||
|
configure: (proxy, _options) => {
|
||||||
|
proxy.on('error', (err, _req, _res) => {
|
||||||
|
console.log('proxy error', err);
|
||||||
|
});
|
||||||
|
proxy.on('proxyReq', (proxyReq, req, _res) => {
|
||||||
|
console.log('Sending Request to the Target:', req.method, req.url);
|
||||||
|
});
|
||||||
|
proxy.on('proxyRes', (proxyRes, req, _res) => {
|
||||||
|
console.log('Received Response from the Target:', proxyRes.statusCode, req.url);
|
||||||
|
});
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user