diff --git a/app.js b/app.js index a9cb208..e4d9acb 100755 --- a/app.js +++ b/app.js @@ -37,15 +37,10 @@ let requested; async function checkHost(req, res, next) { if ( (req.headers.host == 'test1.rexfue.de') || - (req.headers.host == 'multigeiger.rexfue.de') || - (req.headers.host == 'multigeiger.citysensor.de') || - (req.headers.host == 'test2.citysensor.de') || + (req.headers.host == 'multigeiger.ecocurious.de') || (req.headers.host == 'geiger2.citysensor.de') || (req.headers.host == 'localhost:'+PORT) || - (req.headers.host == 'nuccy:3005') || - (req.headers.host == 'h2953026.stratoserver.net:8082') || - (req.headers.host == '213.136.85.253:'+PORT) || - (req.headers.host == '192.168.178.78:'+PORT) || + (req.headers.host == '82.165.92.252') || (req.headers.host == 'macbig:'+PORT) //Port is important if the url has it ) { req.url = '/fs' + req.url; diff --git a/create-indexes.js b/create-indexes.js new file mode 100644 index 0000000..a47b904 --- /dev/null +++ b/create-indexes.js @@ -0,0 +1,79 @@ +// MongoDB Indexe für Geiger_WEB_26 Performance-Optimierung +// Führen Sie diese Datei mit: mongosh < create-indexes.js +// Oder: mongosh --eval "$(cat create-indexes.js)" + +// Verbindung zur Datenbank (passen Sie ggf. an) +use allsensors; + +print("=== STARTE INDEX-ERSTELLUNG ===\n"); + +// ============================================ +// HÖCHSTE PRIORITÄT - Essentiell für Performance +// ============================================ + +print("1. Erstelle Index auf radioactivity_sensors (sensorid + datetime)..."); +db.radioactivity_sensors.createIndex({ sensorid: 1, datetime: 1 }); +print(" ✓ Fertig\n"); + +print("2. Erstelle Index auf thp_sensors (sensorid + datetime)..."); +db.thp_sensors.createIndex({ sensorid: 1, datetime: 1 }); +print(" ✓ Fertig\n"); + +print("3. Erstelle 2dsphere Index auf properties (location.loc)..."); +db.properties.createIndex({ "location.loc": "2dsphere" }); +print(" ✓ Fertig\n"); + +// ============================================ +// HOHE PRIORITÄT - Stark empfohlen +// ============================================ + +print("4. Erstelle Compound Index auf properties (type + location)..."); +db.properties.createIndex({ type: 1, "location.loc": "2dsphere" }); +print(" ✓ Fertig\n"); + +// ============================================ +// MITTLERE PRIORITÄT - Optimierung +// ============================================ + +print("5. Erstelle Index auf radioactivity_sensors (datetime absteigend)..."); +db.radioactivity_sensors.createIndex({ datetime: -1 }); +print(" ✓ Fertig\n"); + +print("6. Erstelle Index auf thp_sensors (datetime absteigend)..."); +db.thp_sensors.createIndex({ datetime: -1 }); +print(" ✓ Fertig\n"); + +// ============================================ +// OPTIONAL - Zusätzliche Optimierungen +// ============================================ + +print("7. Erstelle Index auf properties (name.name)..."); +db.properties.createIndex({ "name.name": 1 }); +print(" ✓ Fertig\n"); + +print("8. Erstelle Index auf properties (location.country)..."); +db.properties.createIndex({ "location.country": 1 }); +print(" ✓ Fertig\n"); + +print("9. Erstelle Index auf problemsensors (problemNr)..."); +db.problemsensors.createIndex({ problemNr: 1 }); +print(" ✓ Fertig\n"); + +// ============================================ +// Index-Übersicht anzeigen +// ============================================ + +print("\n=== INDEX-ÜBERSICHT ===\n"); + +print("Indexe auf radioactivity_sensors:"); +printjson(db.radioactivity_sensors.getIndexes()); + +print("\nIndexe auf thp_sensors:"); +printjson(db.thp_sensors.getIndexes()); + +print("\nIndexe auf properties:"); +printjson(db.properties.getIndexes()); + +print("\n=== FERTIG! ==="); +print("Alle Indexe wurden erfolgreich erstellt."); +print("Ihre Datenbank-Performance sollte jetzt deutlich besser sein!"); diff --git a/package.json b/package.json index 21319af..b1dd6d6 100755 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "geiger2", - "version": "3.1.0", - "date": "2026-03-29", + "version": "3.1.1", + "date": "2026-03-30", "description": "Graphics for multigeiger sensors", "main": "app.js", "scripts": {