MovieMapper/index.html
opencode 8a29c4bc96 security: harden Electron app - context isolation, preload, fix XSS & command injection
- Enable contextIsolation, disable nodeIntegration, remove enableRemoteModule
- Add preload.js with safe contextBridge API exposure
- Fix OS command injection: exec() → execFile() in open-file-in-player
- Fix DOM XSS: replace innerHTML with textContent/createElement in FileListManager, UIManager, ModalManager
- Remove direct fs/electron access from renderer, route through IPC
- Add validate-folder and get-file-stats IPC handlers
- Load renderer modules via script tags with require polyfill
2026-07-05 07:31:06 +00:00

666 lines
18 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Movie Mapper</title>
<style>
* {
box-sizing: border-box;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
margin: 0;
padding: 0;
background-color: #1a1a2e;
color: #eee;
height: 100vh;
overflow: hidden;
}
.container {
display: flex;
height: 100vh;
}
/* Breadcrumb Navigation */
.breadcrumb-nav {
padding: 10px 20px;
background-color: #0f3460;
border-bottom: 1px solid #1a1a2e;
display: flex;
align-items: center;
gap: 10px;
overflow-x: auto;
flex-wrap: wrap;
}
.breadcrumb-item {
padding: 4px 8px;
background-color: #16213e;
border-radius: 4px;
cursor: pointer;
color: #eee;
font-size: 14px;
transition: all 0.2s;
white-space: nowrap;
display: flex;
align-items: center;
gap: 6px;
}
.breadcrumb-item:hover {
background-color: #e94560;
}
.breadcrumb-item:last-child {
background-color: #e94560;
cursor: default;
}
.breadcrumb-item:last-child:hover {
background-color: #ff6b6b;
}
.breadcrumb-item-active {
background-color: #e94560;
color: white;
font-weight: bold;
}
.breadcrumb-separator {
color: #888;
font-size: 12px;
}
/* Back Button */
.breadcrumb-back-btn {
padding: 6px 12px;
background-color: #e94560;
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 14px;
white-space: nowrap;
transition: all 0.2s;
}
.breadcrumb-back-btn:hover {
background-color: #ff6b6b;
}
.breadcrumb-back-btn:disabled {
background-color: #555;
cursor: not-allowed;
opacity: 0.5;
}
/* Left Sidebar - Search & Shows */
.sidebar {
width: 320px;
background-color: #16213e;
border-right: 1px solid #0f3460;
display: flex;
flex-direction: column;
flex-shrink: 0;
}
.sidebar-header {
padding: 20px;
background-color: #0f3460;
border-bottom: 1px solid #1a1a2e;
}
.sidebar-header h1 {
margin: 0;
font-size: 24px;
color: #e94560;
}
.search-section {
padding: 15px;
border-bottom: 1px solid #0f3460;
}
#search-input {
width: 100%;
padding: 12px;
font-size: 14px;
border: none;
border-radius: 8px;
background-color: #0f3460;
color: #eee;
outline: none;
}
#search-input::placeholder {
color: #888;
}
#search-input:focus {
box-shadow: 0 0 0 2px #e94560;
}
#search-results {
max-height: 200px;
overflow-y: auto;
margin-top: 10px;
background-color: #0f3460;
border-radius: 8px;
padding: 5px;
}
.search-result-item {
padding: 12px;
cursor: pointer;
border-radius: 6px;
margin-bottom: 4px;
background-color: #1a1a2e;
border: 1px solid #16213e;
color: #fff;
transition: all 0.2s;
}
.search-result-item:hover {
background-color: #e94560;
border-color: #e94560;
}
.search-result-item .show-name {
font-weight: 600;
font-size: 14px;
}
.search-result-item .show-year {
font-size: 12px;
color: #aaa;
margin-top: 2px;
}
.search-result-item:hover .show-year {
color: #fff;
}
/* Show Details Section */
#show-details {
flex: 1;
padding: 15px;
overflow-y: auto;
}
#show-title {
margin: 0 0 15px 0;
color: #e94560;
font-size: 18px;
}
#seasons-container {
display: flex;
flex-direction: column;
gap: 6px;
}
.season-item {
padding: 12px;
background-color: #1a1a2e;
border: 1px solid #16213e;
border-radius: 6px;
color: #fff;
cursor: pointer;
transition: all 0.2s;
}
.season-item:hover {
background-color: #e94560;
border-color: #e94560;
}
.season-item.selected {
background-color: #0f3460;
border-color: #e94560;
}
#episodes-container {
margin-top: 10px;
display: flex;
flex-direction: column;
gap: 4px;
}
.episode-item {
padding: 10px;
background-color: #0f3460;
border-radius: 4px;
color: #ccc;
font-size: 13px;
}
.episode-item:hover {
background-color: #16213e;
color: #fff;
}
/* Hover effect for sidebar episode items */
.episode-item.hovered-sidebar-episode {
background-color: #e94560;
color: white;
font-weight: bold;
box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}
.episode-item.highlighted-episode {
background-color: #e94560;
color: #fff;
font-weight: bold;
box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}
/* Main Content - Files */
.main-content {
flex: 1;
display: flex;
flex-direction: column;
background-color: #1a1a2e;
overflow: hidden;
}
.main-header {
padding: 15px 20px;
background-color: #16213e;
border-bottom: 1px solid #0f3460;
display: flex;
align-items: center;
gap: 15px;
}
#select-dir-btn {
background-color: #e94560;
color: white;
padding: 10px 20px;
border: none;
border-radius: 8px;
cursor: pointer;
font-size: 14px;
font-weight: 600;
transition: background-color 0.2s;
}
#select-dir-btn:hover {
background-color: #ff6b6b;
}
#selected-dir {
color: #888;
font-size: 13px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
/* Progress Spinner */
#progress-container {
display: none;
padding: 15px 20px;
background-color: #0f3460;
border-bottom: 1px solid #16213e;
}
.spinner {
width: 24px;
height: 24px;
border: 3px solid #16213e;
border-top: 3px solid #e94560;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
/* File List */
.file-list {
flex: 1;
overflow-y: auto;
padding: 10px;
border-radius: 8px;
}
#file-list {
display: flex;
flex-direction: column;
gap: 4px;
border-radius: 8px;
}
#file-list > p {
color: #888;
text-align: center;
padding: 40px;
}
.file-item {
display: flex;
align-items: center;
padding: 12px 15px;
background-color: #16213e;
border-radius: 8px;
transition: all 0.2s;
cursor: grab;
}
.file-item:hover {
background-color: #0f3460;
}
/* Hover to highlight episode styling */
.file-item.hovered-file {
background-color: #e94560;
color: white;
font-weight: bold;
box-shadow: 0 0 10px rgba(233, 69, 96, 0.5);
}
.file-item.dragging {
opacity: 0.5;
cursor: grabbing;
}
.file-item.drag-over {
border: 2px dashed #e94560;
background-color: #0f3460;
}
.file-item.folder-item {
cursor: pointer;
}
.episode-number-container {
display: flex;
align-items: center;
gap: 4px;
margin-right: 12px;
}
.episode-number {
min-width: 40px;
height: 28px;
display: flex;
align-items: center;
justify-content: center;
background-color: #e94560;
color: white;
font-weight: 600;
font-size: 12px;
border-radius: 4px;
flex: 1;
}
.episode-arrow {
width: 24px;
height: 24px;
display: flex;
align-items: center;
justify-content: center;
background-color: #0f3460;
color: #eee;
font-size: 14px;
border: none;
border-radius: 4px;
cursor: pointer;
transition: background-color 0.2s;
flex-shrink: 0;
}
.episode-arrow:hover {
background-color: #1a1a2e;
}
.episode-arrow:active {
background-color: #16213e;
}
.episode-arrow:disabled {
opacity: 0.3;
cursor: not-allowed;
}
.drag-handle {
color: #666;
margin-right: 10px;
cursor: grab;
font-size: 16px;
}
.drag-handle:hover {
color: #e94560;
}
.file-name {
flex: 1;
cursor: pointer;
padding: 4px 8px;
border-radius: 4px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-name.editing {
background-color: #0f3460;
outline: 2px solid #e94560;
}
.file-name.folder-name {
color: #4fc3f7;
font-weight: 500;
}
.file-duration, .file-quality, .file-fps {
color: #888;
font-size: 12px;
min-width: 60px;
text-align: center;
}
.file-tags {
display: flex;
gap: 6px;
align-items: center;
margin-left: 10px;
}
.tag-icon {
cursor: pointer;
font-size: 16px;
opacity: 0.6;
transition: all 0.2s;
padding: 4px;
border-radius: 4px;
}
.tag-icon:hover {
opacity: 1;
transform: scale(1.2);
}
.delete-tag:hover {
color: #dc3545;
}
.play-button {
background: none;
border: none;
font-size: 16px;
cursor: pointer;
padding: 4px;
}
/* Begin Mapping Button */
.begin-mapping-btn {
width: 100%;
padding: 16px 24px;
margin-top: 20px;
background: linear-gradient(135deg, #28a745, #20c997);
color: white;
border: none;
border-radius: 8px;
font-size: 18px;
font-weight: bold;
cursor: pointer;
transition: all 0.3s ease;
box-shadow: 0 4px 15px rgba(40, 167, 69, 0.3);
}
.begin-mapping-btn:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(40, 167, 69, 0.5);
}
.begin-mapping-btn:active {
transform: translateY(0);
}
.begin-mapping-btn:disabled {
background: #555;
cursor: not-allowed;
transform: none;
box-shadow: none;
}
/* Floating Action Button */
.floating-circle {
position: fixed;
bottom: 25px;
right: 25px;
width: 60px;
height: 60px;
background-color: #e94560;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
box-shadow: 0 4px 15px rgba(233, 69, 96, 0.4);
z-index: 1000;
transition: all 0.3s ease;
}
.floating-circle:hover {
transform: scale(1.1);
box-shadow: 0 6px 20px rgba(233, 69, 96, 0.6);
}
#tagged-count {
color: white;
font-weight: bold;
font-size: 18px;
}
/* Scrollbar Styling */
::-webkit-scrollbar {
width: 8px;
}
::-webkit-scrollbar-track {
background: #1a1a2e;
}
::-webkit-scrollbar-thumb {
background: #0f3460;
border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
background: #e94560;
}
</style>
</head>
<body>
<div class="container">
<!-- Left Sidebar -->
<div class="sidebar">
<div class="sidebar-header">
<h1>🎬 Movie Mapper</h1>
</div>
<!-- Breadcrumb Navigation -->
<div id="breadcrumb-nav" class="breadcrumb-nav" style="display: none;">
</div>
<div class="search-section">
<input type="text" id="search-input" placeholder="Search TV shows...">
<div id="search-results"></div>
</div>
<div id="show-details">
<h3 id="show-title"></h3>
<div id="seasons-container"></div>
</div>
</div>
<!-- Main Content -->
<div class="main-content">
<div class="main-header">
<button id="breadcrumb-back-btn" class="breadcrumb-back-btn" disabled>← Back</button>
<button id="select-dir-btn">Select Directory</button>
<div id="selected-dir">No directory selected</div>
</div>
<div id="progress-container">
<div style="display: flex; align-items: center; gap: 15px;">
<div class="spinner"></div>
<div>
<div id="progress-text" style="font-weight: 500;">Processing files...</div>
<div id="progress-count" style="color: #888; font-size: 13px;"></div>
</div>
</div>
</div>
<div class="file-list">
<div id="file-list">
<p>Click "Select Directory" to start browsing media files.</p>
</div>
</div>
<div style="display: flex; gap: 10px; margin-top: 10px;">
<button id="begin-mapping-btn" class="begin-mapping-btn" style="flex: 1;">Begin Mapping</button>
</div>
</div>
</div>
<!-- Floating Action Button -->
<div class="floating-circle" id="tagged-circle">
<span id="tagged-count">0</span>
</div>
<script>
// Module system polyfill for renderer (contextIsolation enabled, nodeIntegration disabled)
window.require = window.createModuleRequire();
var module = { exports: {} };
</script>
<script src="utils/renderer/AppState.js"></script>
<script>window.AppState = module.exports; module={exports:{};};</script>
<script src="utils/renderer/FileListManager.js"></script>
<script>window.FileListManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/FileManager.js"></script>
<script>window.FileManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/TagManager.js"></script>
<script>window.TagManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/EpisodeManager.js"></script>
<script>window.EpisodeManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/SearchManager.js"></script>
<script>window.SearchManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/ModalManager.js"></script>
<script>window.ModalManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/ProgressManager.js"></script>
<script>window.ProgressManager = module.exports; module={exports:{};};</script>
<script src="utils/renderer/UIManager.js"></script>
<script>window.UIManager = module.exports; module={exports:{};};</script>
<script src="renderer.js"></script>
</body>
</html>