Alte Mail-Links aufs Admin-Panel leiten ins Ticketsystem (Antrag direkt geoeffnet)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
95e2807dc7
commit
df8b952b81
3 files changed
+47
-1
No files matched your search
@@ -38,6 +38,7 @@ import adminAnalyseRoutes from './routes/admin/analyse.js'
|
||||
import { analyseLegalRouter } from './services/analyseLegal.js'
|
||||
import adminFinanzenRoutes from './routes/admin/finanzen.js'
|
||||
import teamRoutes from './routes/team/index.js'
|
||||
import legacyAdminRedirect from './routes/legacyAdminRedirect.js'
|
||||
import { corsMiddleware } from './middleware/cors.js'
|
||||
import { kundenansichtGuard } from './middleware/kundenansichtGuard.js'
|
||||
|
||||
@@ -104,6 +105,9 @@ app.use('/embed/', (_req, res, next) => {
|
||||
})
|
||||
// Adressen ohne Fassung: aktuelle geprüfte Fassung der Analyse-Rechtstexte (vor express.static)
|
||||
app.use('/rechtliches', analyseLegalRouter())
|
||||
// Abgeschaltetes Admin-Panel und Rechnungsanalyse: Links aus alten Team-Mails ins Ticketsystem
|
||||
app.use('/admin.html', legacyAdminRedirect.admin)
|
||||
app.use('/kalkulation.html', legacyAdminRedirect.kalkulation)
|
||||
app.use(express.static(publicDir))
|
||||
|
||||
app.get('/dashboard.html', (req, res, next) => {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { config } from '../config.js'
|
||||
|
||||
/**
|
||||
* Admin-Panel (/admin.html) und Rechnungsanalyse (/kalkulation.html) sind abgeschaltet (Etappe 4). Links aus
|
||||
* aelteren Team-Mails fuehren ins Ticketsystem; /admin.html?gutschrift=<id> oeffnet den Antrag unter
|
||||
* Kunden -> Gutschriften.
|
||||
*/
|
||||
const ANTRAG_ID = /^[A-Za-z0-9._-]{1,64}$/
|
||||
|
||||
const toTicketsystem = (pathFor) => (req, res, next) => {
|
||||
if (req.method !== 'GET' && req.method !== 'HEAD') return next()
|
||||
return res.redirect(302, `${config.womsBaseUrl}${pathFor(req)}`)
|
||||
}
|
||||
|
||||
export default {
|
||||
admin: toTicketsystem((req) => {
|
||||
const antrag = typeof req.query.gutschrift === 'string' ? req.query.gutschrift : ''
|
||||
return ANTRAG_ID.test(antrag) ? `/customers/gutschriften?antrag=${encodeURIComponent(antrag)}` : '/customers'
|
||||
}),
|
||||
kalkulation: toTicketsystem(() => '/customers'),
|
||||
}
|
||||
Reference in new issue
Block a user