<% const body = ` ${typeof req !== 'undefined' && req.query && req.query.enabled ? `
Mod "${req.query.enabled}" enabled for ${selectedWorld}!
` : ''} ${typeof req !== 'undefined' && req.query && req.query.disabled ? `
Mod "${req.query.disabled}" disabled for ${selectedWorld}!
` : ''} ${typeof req !== 'undefined' && req.query && req.query.copied ? `
Mod "${req.query.copied}" copied to ${selectedWorld}!
` : ''} ${typeof req !== 'undefined' && req.query && req.query.removed ? `
Mod "${req.query.removed}" removed from ${selectedWorld}!
` : ''} ${typeof req !== 'undefined' && req.query && req.query.deleted ? `
Mod "${req.query.deleted}" deleted permanently!
` : ''}

Select World

${selectedWorld ? `

World Mods (${worldMods.length})

Mods installed specifically for ${selectedWorld}

${worldMods.length > 0 ? `
${worldMods.map(mod => `

${mod.title}

${mod.location === 'global-enabled' ? ` Enabled ` : mod.location === 'world-installed' ? ` World Copy ` : mod.location === 'global-missing' ? ` Missing ` : ` Unknown `}
${mod.description ? `

${mod.description}

` : ''}
${mod.author ? `Author: ${mod.author}` : ''} ${mod.depends && mod.depends.length > 0 ? `Depends: ${mod.depends.join(', ')}` : ''} Type: ${ mod.location === 'global-enabled' ? 'Global mod (enabled via config)' : mod.location === 'world-installed' ? 'World-specific installation' : mod.location === 'global-missing' ? 'Missing global mod' : 'Unknown' }
${mod.location === 'global-enabled' ? `
${typeof csrfToken !== 'undefined' && csrfToken ? `` : ''}
` : mod.location === 'world-installed' ? `
${typeof csrfToken !== 'undefined' && csrfToken ? `` : ''}
` : mod.location === 'global-missing' ? ` Missing from global mods ` : ''}
`).join('')}
` : `

No mods enabled for this world.

`}

Available Global Mods (${globalMods.length})

Install these mods to ${selectedWorld}

${globalMods.length > 0 ? `
${globalMods.map(mod => { const isEnabled = worldMods.some(wm => wm.name === mod.name && wm.location === 'global-enabled'); const isCopied = worldMods.some(wm => wm.name === mod.name && wm.location === 'world-installed'); const isInUse = isEnabled || isCopied; return `

${mod.title}

${isEnabled ? 'Enabled' : isCopied ? 'Copied' : 'Available'}
${mod.description ? `

${mod.description}

` : ''}
${mod.author ? `Author: ${mod.author}` : ''} ${mod.depends && mod.depends.length > 0 ? `Depends: ${mod.depends.join(', ')}` : ''}
${!isEnabled ? `
${typeof csrfToken !== 'undefined' && csrfToken ? `` : ''}
` : ''} ${!isCopied ? `
${typeof csrfToken !== 'undefined' && csrfToken ? `` : ''}
` : ''} Details
`; }).join('')}
` : `

No global mods found. Upload mods to the mods directory to see them here.

`}
` : `

Global Mods (${globalMods.length})

${globalMods.length > 0 ? `
${globalMods.map(mod => `

${mod.title}

Global
${mod.description ? `

${mod.description}

` : ''}
${mod.author ? `Author: ${mod.author}` : ''} ${mod.depends.length > 0 ? `Depends: ${mod.depends.join(', ')}` : ''}
Details
${typeof csrfToken !== 'undefined' && csrfToken ? `` : ''}
`).join('')}
` : `

No global mods found. Upload mods to the mods directory to see them here.

`}
`} `; %> <%- include('../layout', { body: body, currentPage: 'mods', title: title }) %>