V 3.1.1 app.js angepasst

This commit is contained in:
rxf
2026-03-31 09:18:37 +02:00
parent 7b13fc7bff
commit b6516ea56f
3 changed files with 83 additions and 9 deletions

9
app.js
View File

@@ -37,15 +37,10 @@ let requested;
async function checkHost(req, res, next) { async function checkHost(req, res, next) {
if ( if (
(req.headers.host == 'test1.rexfue.de') || (req.headers.host == 'test1.rexfue.de') ||
(req.headers.host == 'multigeiger.rexfue.de') || (req.headers.host == 'multigeiger.ecocurious.de') ||
(req.headers.host == 'multigeiger.citysensor.de') ||
(req.headers.host == 'test2.citysensor.de') ||
(req.headers.host == 'geiger2.citysensor.de') || (req.headers.host == 'geiger2.citysensor.de') ||
(req.headers.host == 'localhost:'+PORT) || (req.headers.host == 'localhost:'+PORT) ||
(req.headers.host == 'nuccy:3005') || (req.headers.host == '82.165.92.252') ||
(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 == 'macbig:'+PORT) //Port is important if the url has it (req.headers.host == 'macbig:'+PORT) //Port is important if the url has it
) { ) {
req.url = '/fs' + req.url; req.url = '/fs' + req.url;

79
create-indexes.js Normal file
View File

@@ -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!");

View File

@@ -1,7 +1,7 @@
{ {
"name": "geiger2", "name": "geiger2",
"version": "3.1.0", "version": "3.1.1",
"date": "2026-03-29", "date": "2026-03-30",
"description": "Graphics for multigeiger sensors", "description": "Graphics for multigeiger sensors",
"main": "app.js", "main": "app.js",
"scripts": { "scripts": {