Bereinigen und Entfernen von nicht mehr benötigten TinyMCE-Dateien und -Plugins; Aktualisierung der Internationalisierung für Deutsch und Englisch in den Falukant- und Navigationsmodulen; Verbesserung der Statusleiste und Router-Implementierung.

This commit is contained in:
Torsten Schulz (local)
2025-08-21 16:10:21 +02:00
parent 53c748a074
commit 3eb7ae4e93
170 changed files with 3850 additions and 7924 deletions

View File

@@ -142,6 +142,8 @@ class FalukantController {
this.getUndergroundTypes = this._wrapWithUser((userId) => this.service.getUndergroundTypes(userId));
this.getNotifications = this._wrapWithUser((userId) => this.service.getNotifications(userId));
this.getAllNotifications = this._wrapWithUser((userId, req) => this.service.getAllNotifications(userId, req.query.page, req.query.size));
this.markNotificationsShown = this._wrapWithUser((userId) => this.service.markNotificationsShown(userId), { successStatus: 202 });
this.getUndergroundTargets = this._wrapWithUser((userId) => this.service.getPoliticalOfficeHolders(userId));
this.searchUsers = this._wrapWithUser((userId, req) => {

View File

@@ -0,0 +1,128 @@
import match3Service from '../services/match3Service.js';
class Match3Controller {
/**
* Lädt alle aktiven Kampagnen
*/
async getCampaigns(req, res) {
try {
const campaigns = await match3Service.getActiveCampaigns();
res.json({ success: true, data: campaigns });
} catch (error) {
console.error('Error in getCampaigns:', error);
res.status(500).json({ success: false, message: 'Fehler beim Laden der Kampagnen' });
}
}
/**
* Lädt eine spezifische Kampagne
*/
async getCampaign(req, res) {
try {
const { campaignId } = req.params;
const campaign = await match3Service.getCampaign(campaignId);
if (!campaign) {
return res.status(404).json({ success: false, message: 'Kampagne nicht gefunden' });
}
res.json({ success: true, data: campaign });
} catch (error) {
console.error('Error in getCampaign:', error);
res.status(500).json({ success: false, message: 'Fehler beim Laden der Kampagne' });
}
}
/**
* Lädt den Benutzerfortschritt für eine Kampagne
*/
async getUserProgress(req, res) {
try {
const { campaignId } = req.params;
const userId = req.headers.userid || req.user?.id;
if (!userId) {
return res.status(401).json({ success: false, message: 'Benutzer-ID nicht gefunden' });
}
const userProgress = await match3Service.getUserProgress(userId, campaignId);
res.json({ success: true, data: userProgress });
} catch (error) {
console.error('Error in getUserProgress:', error);
res.status(500).json({ success: false, message: 'Fehler beim Laden des Fortschritts' });
}
}
/**
* Aktualisiert den Level-Fortschritt eines Benutzers
*/
async updateLevelProgress(req, res) {
try {
const { campaignId, levelId } = req.params;
const userId = req.headers.userid || req.user?.id;
const { score, moves, time, stars, isCompleted } = req.body;
if (!userId) {
return res.status(401).json({ success: false, message: 'Benutzer-ID nicht gefunden' });
}
if (!score || !moves || !stars) {
return res.status(400).json({
success: false,
message: 'Alle erforderlichen Felder müssen ausgefüllt werden'
});
}
const levelData = {
score: parseInt(score),
moves: parseInt(moves),
time: time ? parseInt(time) : 0,
stars: parseInt(stars),
isCompleted: Boolean(isCompleted)
};
const result = await match3Service.updateLevelProgress(userId, campaignId, levelId, levelData);
res.json({ success: true, data: result });
} catch (error) {
console.error('Error in updateLevelProgress:', error);
res.status(500).json({ success: false, message: 'Fehler beim Aktualisieren des Fortschritts' });
}
}
/**
* Lädt die Bestenliste für eine Kampagne
*/
async getLeaderboard(req, res) {
try {
const { campaignId } = req.params;
const { limit = 10 } = req.query;
const leaderboard = await match3Service.getLeaderboard(campaignId, parseInt(limit));
res.json({ success: true, data: leaderboard });
} catch (error) {
console.error('Error in getLeaderboard:', error);
res.status(500).json({ success: false, message: 'Fehler beim Laden der Bestenliste' });
}
}
/**
* Lädt Statistiken für einen Benutzer
*/
async getUserStats(req, res) {
try {
const userId = req.headers.userid || req.user?.id;
if (!userId) {
return res.status(401).json({ success: false, message: 'Benutzer-ID nicht gefunden' });
}
const stats = await match3Service.getUserStats(userId);
res.json({ success: true, data: stats });
} catch (error) {
console.error('Error in getUserStats:', error);
res.status(500).json({ success: false, message: 'Fehler beim Laden der Statistiken' });
}
}
}
export default new Match3Controller();

View File

@@ -0,0 +1,32 @@
import MinigamesService from '../services/minigamesService.js';
function extractHashedUserId(req) {
return req.headers?.userid;
}
class MinigamesController {
constructor() {
this.service = MinigamesService;
this.listCampaigns = this._wrap((userId, req) => this.service.listCampaigns());
this.getCampaign = this._wrap((userId, req) => this.service.getCampaign(req.params.code));
this.getProgress = this._wrap((userId, req) => this.service.getProgress(userId, req.params.code));
this.saveProgress = this._wrap((userId, req) => this.service.saveProgress(userId, req.params.code, req.body));
}
_wrap(fn, { successStatus = 200 } = {}) {
return async (req, res) => {
try {
const userId = extractHashedUserId(req);
if (!userId) return res.status(400).json({ error: 'Missing user identifier' });
const result = await fn(userId, req, res);
res.status(successStatus).json(result);
} catch (error) {
console.error('Minigames controller error:', error);
res.status(500).json({ error: error.message || 'Internal error' });
}
};
}
}
export default new MinigamesController();

View File

@@ -170,6 +170,12 @@ const menuStructure = {
minigames: {
visible: ["all"],
icon: "minigames16.png",
children: {
match3: {
visible: ["all"],
path: "/minigames/match3"
}
}
},
settings: {
visible: ["all"],