Remove Playwright dependency and related proxy service files from the backend. This commit deletes the node-fetch package and its associated files, as well as the nuscoreProxyRoutes and nuscoreProxyService, streamlining the backend by eliminating unused components.
This commit is contained in:
@@ -1,78 +0,0 @@
|
||||
import express from 'express';
|
||||
import nuscoreProxyService from '../services/nuscoreProxyService.js';
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
// Hauptroute für nuscore-Seite
|
||||
router.get('/', async (req, res) => {
|
||||
try {
|
||||
const { code, pin } = req.query;
|
||||
|
||||
if (!code) {
|
||||
return res.status(400).json({
|
||||
error: 'Code-Parameter ist erforderlich'
|
||||
});
|
||||
}
|
||||
|
||||
console.log(`📊 Proxy-Anfrage für Code: ${code}, PIN: ${pin || 'nicht angegeben'}`);
|
||||
|
||||
const html = await nuscoreProxyService.proxyNuscorePage(code, pin);
|
||||
|
||||
// CORS-Header setzen für iframe-Einbettung
|
||||
res.set({
|
||||
'Content-Type': 'text/html; charset=utf-8',
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
|
||||
'Access-Control-Allow-Headers': 'Content-Type',
|
||||
'X-Frame-Options': 'ALLOWALL',
|
||||
'Cache-Control': 'no-cache, no-store, must-revalidate'
|
||||
});
|
||||
|
||||
res.send(html);
|
||||
|
||||
} catch (error) {
|
||||
console.error('❌ Proxy-Fehler:', error);
|
||||
res.status(500).json({
|
||||
error: 'Fehler beim Laden der nuscore-Seite',
|
||||
details: error.message
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Asset-Proxy für CSS, JS, Bilder etc.
|
||||
router.get('/assets/*', async (req, res) => {
|
||||
try {
|
||||
const assetPath = req.params[0];
|
||||
const originalUrl = `https://ttde-apps.liga.nu/nuliga/nuscore-tt/${assetPath}`;
|
||||
|
||||
console.log(`📦 Lade Asset: ${originalUrl}`);
|
||||
|
||||
const { content, contentType } = await nuscoreProxyService.proxyAsset(originalUrl);
|
||||
|
||||
res.set({
|
||||
'Content-Type': contentType,
|
||||
'Access-Control-Allow-Origin': '*',
|
||||
'Cache-Control': 'public, max-age=3600'
|
||||
});
|
||||
|
||||
res.send(content);
|
||||
|
||||
} catch (error) {
|
||||
console.error(`❌ Asset-Fehler für ${req.params[0]}:`, error.message);
|
||||
res.status(404).json({
|
||||
error: 'Asset nicht gefunden',
|
||||
path: req.params[0]
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Health-Check Route
|
||||
router.get('/health', (req, res) => {
|
||||
res.json({
|
||||
status: 'ok',
|
||||
service: 'nuscore-proxy',
|
||||
timestamp: new Date().toISOString()
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user