ahaer
This commit is contained in:
parent
5c7f26db49
commit
efb8589a61
22
app.js
22
app.js
@ -59,8 +59,8 @@ app.use(
|
|||||||
defaultSrc: ["'self'"],
|
defaultSrc: ["'self'"],
|
||||||
scriptSrc: ["'self'", "'unsafe-inline'"],
|
scriptSrc: ["'self'", "'unsafe-inline'"],
|
||||||
scriptSrcAttr: ["'unsafe-inline'"],
|
scriptSrcAttr: ["'unsafe-inline'"],
|
||||||
styleSrc: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com"],
|
styleSrc: ["'self'", "'unsafe-inline'", "https://fonts.googleapis.com", "https://cdnjs.cloudflare.com"],
|
||||||
fontSrc: ["'self'", "https://fonts.gstatic.com"],
|
fontSrc: ["'self'", "https://fonts.gstatic.com", "https://cdnjs.cloudflare.com"],
|
||||||
imgSrc: ["'self'", "data:", "blob:"],
|
imgSrc: ["'self'", "data:", "blob:"],
|
||||||
connectSrc: ["'self'", "ws:", "wss:"],
|
connectSrc: ["'self'", "ws:", "wss:"],
|
||||||
frameAncestors: ["'self'"], // Erlaubt iframe von eigener Domain
|
frameAncestors: ["'self'"], // Erlaubt iframe von eigener Domain
|
||||||
@ -108,25 +108,9 @@ app.use(express.urlencoded({ extended: true }));
|
|||||||
app.use(express.static(path.join(__dirname, "public")));
|
app.use(express.static(path.join(__dirname, "public")));
|
||||||
|
|
||||||
/* ========================
|
/* ========================
|
||||||
Server Stats (öffentlich – kein Login nötig)
|
Login Middleware
|
||||||
Zählt online Spieler pro Server
|
|
||||||
via Socket.io Verbindungen
|
|
||||||
======================== */
|
======================== */
|
||||||
|
|
||||||
app.get("/api/server-stats", (req, res) => {
|
|
||||||
const stats = {};
|
|
||||||
|
|
||||||
// Alle verbundenen Sockets durchgehen
|
|
||||||
const sockets = io.sockets.sockets;
|
|
||||||
sockets.forEach((socket) => {
|
|
||||||
if (socket.user && socket.serverId) {
|
|
||||||
stats[socket.serverId] = (stats[socket.serverId] || 0) + 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
res.json(stats);
|
|
||||||
});
|
|
||||||
|
|
||||||
function requireLogin(req, res, next) {
|
function requireLogin(req, res, next) {
|
||||||
if (!req.session.user) {
|
if (!req.session.user) {
|
||||||
return res.status(401).json({ error: "Nicht eingeloggt" });
|
return res.status(401).json({ error: "Nicht eingeloggt" });
|
||||||
|
|||||||
@ -206,16 +206,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.hud-res-icon {
|
.hud-res-icon {
|
||||||
font-size: 0; /* Emoji unsichtbar */
|
display: inline-flex;
|
||||||
color: transparent;
|
align-items: center;
|
||||||
display: inline-block;
|
justify-content: center;
|
||||||
width: 20px;
|
width: 20px;
|
||||||
height: 20px;
|
height: 20px;
|
||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
background: url("/images/items/blauer-cristal.png") center / contain
|
font-size: 15px;
|
||||||
no-repeat;
|
|
||||||
filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
|
filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.7));
|
||||||
vertical-align: middle;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Ressource Icons (gem, silver, wood, stone, gold, iron) – einheitliche Größe */
|
/* Ressource Icons (gem, silver, wood, stone, gold, iron) – einheitliche Größe */
|
||||||
|
|||||||
@ -94,6 +94,7 @@
|
|||||||
<link rel="stylesheet" href="/css/quickmenu.css" />
|
<link rel="stylesheet" href="/css/quickmenu.css" />
|
||||||
<link rel="stylesheet" href="/css/events.css" />
|
<link rel="stylesheet" href="/css/events.css" />
|
||||||
<link rel="stylesheet" href="/css/hud.css" />
|
<link rel="stylesheet" href="/css/hud.css" />
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css" />
|
||||||
<link rel="stylesheet" href="/css/mine.css" />
|
<link rel="stylesheet" href="/css/mine.css" />
|
||||||
<script src="/js/heartbeat.js"></script>
|
<script src="/js/heartbeat.js"></script>
|
||||||
<script src="/js/map-scale.js"></script>
|
<script src="/js/map-scale.js"></script>
|
||||||
@ -654,12 +655,12 @@
|
|||||||
<div id="hud-currency">
|
<div id="hud-currency">
|
||||||
<div class="hud-res-row">
|
<div class="hud-res-row">
|
||||||
<div class="hud-res">
|
<div class="hud-res">
|
||||||
<span class="hud-res-icon">💠</span>
|
<span class="hud-res-icon"><i class="fa-solid fa-gem" style="color:#4fc3f7;"></i></span>
|
||||||
<span class="hud-res-value" id="hud-gems">0</span>
|
<span class="hud-res-value" id="hud-gems">0</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="hud-sep"></div>
|
<div class="hud-sep"></div>
|
||||||
<div class="hud-res">
|
<div class="hud-res">
|
||||||
<span class="hud-res-icon">🪙</span>
|
<span class="hud-res-icon"><i class="fa-solid fa-coins" style="color:#f0c040;"></i></span>
|
||||||
<span class="hud-res-value" id="hud-gold">0</span>
|
<span class="hud-res-value" id="hud-gold">0</span>
|
||||||
</div>
|
</div>
|
||||||
<button id="hud-gold-btn">Shop</button>
|
<button id="hud-gold-btn">Shop</button>
|
||||||
@ -667,12 +668,12 @@
|
|||||||
|
|
||||||
<div class="hud-res-row">
|
<div class="hud-res-row">
|
||||||
<div class="hud-res">
|
<div class="hud-res">
|
||||||
<span class="hud-res-icon">🪵</span>
|
<span class="hud-res-icon"><i class="fa-solid fa-tree" style="color:#66bb6a;"></i></span>
|
||||||
<span class="hud-res-value" id="hud-wood">0</span>
|
<span class="hud-res-value" id="hud-wood">0</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="hud-sep"></div>
|
<div class="hud-sep"></div>
|
||||||
<div class="hud-res">
|
<div class="hud-res">
|
||||||
<span class="hud-res-icon">🪨</span>
|
<span class="hud-res-icon"><i class="fa-solid fa-mountain" style="color:#a0a0a0;"></i></span>
|
||||||
<span class="hud-res-value" id="hud-stone">0</span>
|
<span class="hud-res-value" id="hud-stone">0</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user