Compare commits

..

8 Commits

Author SHA1 Message Date
Gandalf feb2d26c5b Merge pull request 'ci: build multi-arch images (amd64, arm64, arm/v7)' (#3) from develop into release/0.1
Build and Push Docker Image / build (push) Has been cancelled
Reviewed-on: #3
2026-05-15 20:57:45 +01:00
gronod 67b816cd61 ci: build multi-arch images (amd64, arm64, arm/v7)
- Add QEMU for cross-platform emulation
- Add Docker Buildx for multi-platform builds
- Build for linux/amd64, linux/arm64, linux/arm/v7
2026-05-15 20:53:37 +01:00
gronod faaca310e9 chore: bump version to 0.1.2
Build and Push Docker Image / build (push) Successful in 4m20s
Create Release / release (push) Successful in 1m47s
2026-05-15 20:48:40 +01:00
gronod 0957f83411 feat: admin users can view all downloads with user badges
- Admin users (Emby IsAdministrator) see a 'Show all users' toggle
- When toggled, all tagged downloads are shown regardless of user
- Each download card shows the tagged user's name as a badge
- Non-admin users see only their own downloads (unchanged behavior)
- Backend accepts ?showAll=true query param (admin-only)
2026-05-15 20:46:56 +01:00
gronod 6463c6b3d1 docs: add docker-compose.yaml with sample configuration 2026-05-15 20:41:46 +01:00
gronod bd9868b4e1 chore: bump version to 0.1.1
Build and Push Docker Image / build (push) Successful in 2m8s
Create Release / release (push) Successful in 1m29s
2026-05-15 17:30:46 +01:00
Gandalf 07e5b185d7 Merge pull request 'develop' (#1) from develop into main
Reviewed-on: #1
2026-05-15 17:30:00 +01:00
gronod 6140808efb feat: compact UI with theme switcher (light/dark/mono)
- Redesign download cards to be significantly more compact
- Add CSS custom properties for theming
- Add theme switcher (Light, Dark, Mono) with localStorage persistence
- Update README with environment variable Docker deployment docs
- Update Docker Compose example to use environment: instead of volume mount
2026-05-15 17:28:48 +01:00
9 changed files with 573 additions and 224 deletions
+7
View File
@@ -22,11 +22,18 @@ jobs:
echo "release=${RELEASE_NAME}" >> $GITHUB_OUTPUT
echo "Building version ${VERSION} from branch ${BRANCH}"
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
push: true
platforms: linux/amd64,linux/arm64,linux/arm/v7
tags: |
reg.i3omb.com/sofarr:${{ steps.version.outputs.version }}
reg.i3omb.com/sofarr:${{ steps.version.outputs.release }}
+29 -2
View File
@@ -92,6 +92,25 @@ docker run -d \
3. **Access the dashboard** at `http://your-server:3001`
### Using Environment Variables (Alternative to .env file)
All configuration can be passed directly as environment variables instead of mounting a `.env` file. This is the preferred approach for orchestrated deployments (Docker Compose, Kubernetes, Portainer, etc).
```bash
docker run -d \
--name sofarr \
--restart unless-stopped \
-p 3001:3001 \
-e EMBY_URL=http://emby.local:8096 \
-e EMBY_API_KEY=your-emby-api-key \
-e SONARR_INSTANCES='[{"name":"main","url":"http://sonarr:8989","apiKey":"your-key"}]' \
-e RADARR_INSTANCES='[{"name":"main","url":"http://radarr:7878","apiKey":"your-key"}]' \
-e SABNZBD_INSTANCES='[{"name":"main","url":"http://sabnzbd:8080","apiKey":"your-key"}]' \
-e QBITTORRENT_INSTANCES='[{"name":"main","url":"http://qbit:8080","username":"admin","password":"pass"}]' \
-e LOG_LEVEL=info \
docker.i3omb.com/sofarr:latest
```
### Docker Compose
```yaml
@@ -103,10 +122,18 @@ services:
restart: unless-stopped
ports:
- "3001:3001"
volumes:
- /opt/sofarr/.env:/app/.env
environment:
- EMBY_URL=http://emby:8096
- EMBY_API_KEY=your-emby-api-key
- SONARR_INSTANCES=[{"name":"main","url":"http://sonarr:8989","apiKey":"your-key"}]
- RADARR_INSTANCES=[{"name":"main","url":"http://radarr:7878","apiKey":"your-key"}]
- SABNZBD_INSTANCES=[{"name":"main","url":"http://sabnzbd:8080","apiKey":"your-key"}]
- QBITTORRENT_INSTANCES=[{"name":"main","url":"http://qbit:8080","username":"admin","password":"pass"}]
- LOG_LEVEL=info
```
> **Tip:** You can also use a combination — mount a `.env` file for base config, and override specific values with `-e` flags. Environment variables always take precedence.
### Available Tags
| Tag | Description |
+17
View File
@@ -0,0 +1,17 @@
version: "3"
services:
sofarr:
image: docker.i3omb.com/sofarr:latest
container_name: sofarr
restart: unless-stopped
ports:
- "3001:3001"
environment:
- PORT=3001
- EMBY_URL=https://emby.example.com
- EMBY_API_KEY=your-emby-api-key
- SONARR_INSTANCES=[{"name":"main","url":"https://sonarr.example.com","apiKey":"your-sonarr-api-key"}]
- RADARR_INSTANCES=[{"name":"main","url":"https://radarr.example.com","apiKey":"your-radarr-api-key"}]
- SABNZBD_INSTANCES=[{"name":"main","url":"https://sabnzbd.example.com","apiKey":"your-sabnzbd-api-key"}]
- QBITTORRENT_INSTANCES=[{"name":"main","url":"https://qbittorrent.example.com","username":"admin","password":"your-password"}]
- LOG_LEVEL=info
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sofarr",
"version": "0.1.0",
"version": "0.1.2",
"description": "A personal media download dashboard that shows your downloads 'so far' while you relax on the sofa waiting for your *arr services to finish",
"main": "server/index.js",
"scripts": {
+44 -1
View File
@@ -2,16 +2,42 @@ let currentUser = null;
let downloads = [];
let refreshInterval = null;
let currentRefreshRate = 5000; // default 5 seconds
let isAdmin = false;
let showAll = false;
// Apply saved theme immediately (before DOMContentLoaded to avoid flash)
(function() {
const saved = localStorage.getItem('sofarr-theme') || 'light';
document.documentElement.setAttribute('data-theme', saved);
})();
// Check authentication on load
document.addEventListener('DOMContentLoaded', () => {
checkAuthentication();
initThemeSwitcher();
document.getElementById('login-form').addEventListener('submit', handleLogin);
document.getElementById('logout-btn').addEventListener('click', handleLogout);
document.getElementById('refresh-rate').addEventListener('change', handleRefreshRateChange);
document.getElementById('show-all-toggle').addEventListener('change', handleShowAllToggle);
});
function initThemeSwitcher() {
const saved = localStorage.getItem('sofarr-theme') || 'light';
document.querySelectorAll('.theme-btn').forEach(btn => {
btn.classList.toggle('active', btn.dataset.theme === saved);
btn.addEventListener('click', () => setTheme(btn.dataset.theme));
});
}
function setTheme(theme) {
document.documentElement.setAttribute('data-theme', theme);
localStorage.setItem('sofarr-theme', theme);
document.querySelectorAll('.theme-btn').forEach(btn => {
btn.classList.toggle('active', btn.dataset.theme === theme);
});
}
function startAutoRefresh() {
if (refreshInterval) clearInterval(refreshInterval);
if (currentRefreshRate > 0) {
@@ -25,6 +51,11 @@ function handleRefreshRateChange(e) {
startAutoRefresh();
}
function handleShowAllToggle(e) {
showAll = e.target.checked;
fetchUserDownloads(true);
}
function stopAutoRefresh() {
if (refreshInterval) {
clearInterval(refreshInterval);
@@ -39,6 +70,7 @@ async function checkAuthentication() {
if (data.authenticated) {
currentUser = data.user;
isAdmin = !!data.user.isAdmin;
showDashboard();
fetchUserDownloads(true);
startAutoRefresh();
@@ -70,6 +102,7 @@ async function handleLogin(e) {
if (data.success) {
currentUser = data.user;
isAdmin = !!data.user.isAdmin;
showDashboard();
fetchUserDownloads(true);
startAutoRefresh();
@@ -106,6 +139,7 @@ function showDashboard() {
document.getElementById('login-container').style.display = 'none';
document.getElementById('dashboard-container').style.display = 'block';
document.getElementById('currentUser').textContent = currentUser.name || '-';
document.getElementById('admin-controls').style.display = isAdmin ? 'flex' : 'none';
}
function showLoginError(message) {
@@ -126,10 +160,12 @@ async function fetchUserDownloads(isInitialLoad = false) {
hideError();
try {
const response = await fetch('/api/dashboard/user-downloads');
const url = showAll ? '/api/dashboard/user-downloads?showAll=true' : '/api/dashboard/user-downloads';
const response = await fetch(url);
const data = await response.json();
currentUser = data.user;
isAdmin = !!data.isAdmin;
downloads = data.downloads;
// Debug: log first download to see what fields are present
@@ -325,6 +361,13 @@ function createDownloadCard(download) {
movie.textContent = `Movie: ${download.movieName}`;
infoDiv.appendChild(movie);
}
if (showAll && download.userTag) {
const userBadge = document.createElement('span');
userBadge.className = 'download-user-badge';
userBadge.textContent = download.userTag;
header.appendChild(userBadge);
}
const details = document.createElement('div');
details.className = 'download-details';
+11
View File
@@ -32,6 +32,11 @@
<header class="app-header">
<h1>sofarr</h1>
<div class="header-controls">
<div class="theme-switcher">
<button class="theme-btn active" data-theme="light">Light</button>
<button class="theme-btn" data-theme="dark">Dark</button>
<button class="theme-btn" data-theme="mono">Mono</button>
</div>
<div class="refresh-control">
<label for="refresh-rate">Refresh:</label>
<select id="refresh-rate">
@@ -41,6 +46,12 @@
<option value="0">Off</option>
</select>
</div>
<div id="admin-controls" class="admin-controls" style="display: none;">
<label class="toggle-label">
<input type="checkbox" id="show-all-toggle">
<span>Show all users</span>
</label>
</div>
<div class="user-info">
<span class="user-label">Current User:</span>
<span class="user-name" id="currentUser">-</span>
+438 -205
View File
@@ -1,3 +1,113 @@
/* ===== Theme Variables ===== */
:root, [data-theme="light"] {
--bg-gradient-start: #667eea;
--bg-gradient-end: #764ba2;
--surface: #ffffff;
--surface-alt: #f5f5f5;
--text-primary: #333333;
--text-secondary: #666666;
--text-muted: #999999;
--border: #e0e0e0;
--accent: #667eea;
--accent-hover: #5568d3;
--accent-light: #e8eaf6;
--series-color: #667eea;
--series-bg: #e8eaf6;
--movie-color: #e040a0;
--movie-bg: #fce4ec;
--torrent-color: #26a69a;
--torrent-bg: #e0f2f1;
--success: #4caf50;
--success-bg: #e8f5e9;
--info: #2196f3;
--info-bg: #e3f2fd;
--danger: #f44336;
--danger-bg: #ffebee;
--danger-border: #ffcdd2;
--progress-bg: #ffebee;
--progress-border: #ffcdd2;
--progress-fill-start: #4caf50;
--progress-fill-end: #66bb6a;
--shadow: rgba(0, 0, 0, 0.1);
--shadow-strong: rgba(0, 0, 0, 0.15);
--footer-text: rgba(255, 255, 255, 0.9);
--input-bg: #ffffff;
--select-bg: #ffffff;
}
[data-theme="dark"] {
--bg-gradient-start: #1a1a2e;
--bg-gradient-end: #16213e;
--surface: #1e1e2f;
--surface-alt: #2a2a3d;
--text-primary: #e0e0e0;
--text-secondary: #a0a0b0;
--text-muted: #707080;
--border: #3a3a4d;
--accent: #7c8cf0;
--accent-hover: #6b7ce0;
--accent-light: #2a2a4d;
--series-color: #7c8cf0;
--series-bg: #2a2a4d;
--movie-color: #f080c0;
--movie-bg: #3d2035;
--torrent-color: #4dd0c8;
--torrent-bg: #1a3d3a;
--success: #66bb6a;
--success-bg: #1a3d1e;
--info: #64b5f6;
--info-bg: #1a2d3d;
--danger: #ef5350;
--danger-bg: #3d1a1a;
--danger-border: #5a2a2a;
--progress-bg: #2a2020;
--progress-border: #4a3030;
--progress-fill-start: #66bb6a;
--progress-fill-end: #81c784;
--shadow: rgba(0, 0, 0, 0.3);
--shadow-strong: rgba(0, 0, 0, 0.4);
--footer-text: rgba(200, 200, 220, 0.8);
--input-bg: #2a2a3d;
--select-bg: #2a2a3d;
}
[data-theme="mono"] {
--bg-gradient-start: #222222;
--bg-gradient-end: #333333;
--surface: #1a1a1a;
--surface-alt: #252525;
--text-primary: #d0d0d0;
--text-secondary: #909090;
--text-muted: #606060;
--border: #404040;
--accent: #b0b0b0;
--accent-hover: #c8c8c8;
--accent-light: #303030;
--series-color: #c0c0c0;
--series-bg: #303030;
--movie-color: #c0c0c0;
--movie-bg: #303030;
--torrent-color: #c0c0c0;
--torrent-bg: #303030;
--success: #a0a0a0;
--success-bg: #2a2a2a;
--info: #a0a0a0;
--info-bg: #2a2a2a;
--danger: #909090;
--danger-bg: #2a2a2a;
--danger-border: #484848;
--progress-bg: #2a2a2a;
--progress-border: #404040;
--progress-fill-start: #808080;
--progress-fill-end: #a0a0a0;
--shadow: rgba(0, 0, 0, 0.4);
--shadow-strong: rgba(0, 0, 0, 0.5);
--footer-text: rgba(180, 180, 180, 0.7);
--input-bg: #252525;
--select-bg: #252525;
}
/* ===== Base ===== */
* {
margin: 0;
padding: 0;
@@ -10,130 +120,217 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
min-height: 100vh;
transition: background 0.3s;
}
.app {
min-height: 100vh;
padding: 20px;
padding: 16px;
max-width: 1200px;
margin: 0 auto;
}
/* ===== Header ===== */
.app-header {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
margin-bottom: 20px;
background: var(--surface);
padding: 14px 20px;
border-radius: 8px;
box-shadow: 0 2px 4px var(--shadow);
margin-bottom: 12px;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 20px;
gap: 12px;
transition: background 0.3s;
}
.app-header h1 {
color: #333;
font-size: 2rem;
color: var(--text-primary);
font-size: 1.4rem;
}
.header-controls {
display: flex;
align-items: center;
gap: 14px;
}
.user-info {
display: flex;
align-items: center;
gap: 10px;
background: #f0f0f0;
padding: 10px 20px;
border-radius: 20px;
}
.logout-btn {
padding: 5px 15px;
background: #f44336;
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 0.9rem;
transition: background 0.3s;
}
.logout-btn:hover {
background: #d32f2f;
gap: 8px;
background: var(--surface-alt);
padding: 6px 14px;
border-radius: 16px;
font-size: 0.85rem;
}
.user-label {
color: #666;
color: var(--text-muted);
font-weight: 500;
}
.user-name {
color: #667eea;
color: var(--accent);
font-weight: bold;
font-size: 1.1rem;
font-size: 0.9rem;
}
.logout-btn {
padding: 4px 12px;
background: var(--danger);
color: white;
border: none;
border-radius: 4px;
cursor: pointer;
font-size: 0.8rem;
transition: opacity 0.2s;
}
.logout-btn:hover {
opacity: 0.85;
}
/* ===== Theme Switcher ===== */
.theme-switcher {
display: flex;
align-items: center;
gap: 4px;
background: var(--surface-alt);
padding: 3px;
border-radius: 16px;
}
.theme-btn {
padding: 4px 10px;
border: none;
border-radius: 14px;
cursor: pointer;
font-size: 0.75rem;
background: transparent;
color: var(--text-muted);
transition: all 0.2s;
}
.theme-btn.active {
background: var(--accent);
color: white;
}
.theme-btn:hover:not(.active) {
color: var(--text-primary);
}
/* ===== Refresh Control ===== */
.refresh-control {
display: flex;
align-items: center;
gap: 6px;
}
.refresh-control label {
color: var(--text-muted);
font-size: 0.8rem;
}
.refresh-control select {
padding: 4px 8px;
border: 1px solid var(--border);
border-radius: 4px;
background: var(--select-bg);
color: var(--text-primary);
cursor: pointer;
font-size: 0.8rem;
}
/* ===== Error / Loading ===== */
.error-message {
background: #fee;
color: #c33;
padding: 15px;
border-radius: 10px;
margin-bottom: 20px;
border-left: 4px solid #c33;
background: var(--danger-bg);
color: var(--danger);
padding: 10px 14px;
border-radius: 6px;
margin-bottom: 12px;
border-left: 3px solid var(--danger);
font-size: 0.9rem;
}
.loading {
text-align: center;
padding: 40px;
color: white;
font-size: 1.2rem;
padding: 30px;
color: var(--footer-text);
font-size: 1rem;
}
/* ===== Downloads Container ===== */
.downloads-container {
background: white;
padding: 30px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
background: var(--surface);
padding: 16px 20px;
border-radius: 8px;
box-shadow: 0 2px 4px var(--shadow);
transition: background 0.3s;
}
.downloads-container h2 {
color: #333;
margin-bottom: 20px;
font-size: 1.5rem;
color: var(--text-primary);
margin-bottom: 12px;
font-size: 1.1rem;
}
.no-downloads {
text-align: center;
padding: 40px;
color: #666;
padding: 30px;
color: var(--text-secondary);
font-size: 0.9rem;
}
.no-downloads p {
margin: 10px 0;
margin: 6px 0;
}
.downloads-list {
display: grid;
gap: 20px;
}
.download-card {
border: 2px solid #e0e0e0;
border-radius: 10px;
padding: 20px;
transition: transform 0.2s, box-shadow 0.2s;
display: flex;
gap: 20px;
align-items: flex-start;
flex-direction: column;
gap: 8px;
}
/* ===== Download Card (Compact) ===== */
.download-card {
border: 1px solid var(--border);
border-radius: 6px;
padding: 10px 14px;
display: flex;
gap: 12px;
align-items: flex-start;
transition: box-shadow 0.2s, background 0.3s;
background: var(--surface);
}
.download-card:hover {
box-shadow: 0 2px 8px var(--shadow);
}
.download-card.series {
border-left: 3px solid var(--series-color);
}
.download-card.movie {
border-left: 3px solid var(--movie-color);
}
.download-card.torrent {
border-left: 3px solid var(--torrent-color);
}
/* ===== Cover Art ===== */
.download-cover {
flex-shrink: 0;
width: 80px;
border-radius: 6px;
width: 50px;
border-radius: 4px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
box-shadow: 0 1px 4px var(--shadow-strong);
}
.download-cover img {
@@ -142,126 +339,175 @@ body {
display: block;
}
/* ===== Download Info ===== */
.download-info {
flex: 1;
min-width: 0;
}
.download-card:hover {
transform: translateY(-2px);
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
}
.download-card.series {
border-left: 4px solid #667eea;
}
.download-card.movie {
border-left: 4px solid #f093fb;
}
.download-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 15px;
margin-bottom: 4px;
}
.download-type {
padding: 5px 15px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 500;
padding: 2px 8px;
border-radius: 10px;
font-size: 0.7rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.3px;
}
.download-type.series {
background: #e8eaf6;
color: #667eea;
background: var(--series-bg);
color: var(--series-color);
}
.download-type.movie {
background: #fce4ec;
color: #f093fb;
background: var(--movie-bg);
color: var(--movie-color);
}
.download-type.torrent {
background: #e0f2f1;
color: #26a69a;
background: var(--torrent-bg);
color: var(--torrent-color);
}
.download-status {
padding: 5px 15px;
border-radius: 20px;
font-size: 0.9rem;
font-weight: 500;
padding: 2px 8px;
border-radius: 10px;
font-size: 0.7rem;
font-weight: 600;
text-transform: capitalize;
}
.download-status.downloading {
background: #e8f5e9;
color: #4caf50;
.download-status.downloading,
.download-status.Downloading {
background: var(--success-bg);
color: var(--success);
}
.download-status.completed {
background: #e3f2fd;
color: #2196f3;
.download-status.completed,
.download-status.Completed {
background: var(--info-bg);
color: var(--info);
}
.download-status.failed {
background: #ffebee;
color: #f44336;
.download-status.failed,
.download-status.Failed {
background: var(--danger-bg);
color: var(--danger);
}
.download-title {
color: #333;
margin-bottom: 10px;
font-size: 1.2rem;
color: var(--text-primary);
margin-bottom: 2px;
font-size: 0.9rem;
font-weight: 600;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.download-series,
.download-movie {
color: #666;
margin-bottom: 15px;
color: var(--text-secondary);
margin-bottom: 6px;
font-style: italic;
font-size: 0.8rem;
}
/* ===== Detail Row (Inline) ===== */
.download-details {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
gap: 15px;
padding-top: 15px;
border-top: 1px solid #e0e0e0;
display: flex;
flex-wrap: wrap;
gap: 4px 14px;
padding-top: 6px;
border-top: 1px solid var(--border);
align-items: center;
}
.detail-item {
display: flex;
flex-direction: column;
gap: 5px;
align-items: baseline;
gap: 4px;
font-size: 0.78rem;
}
.detail-label {
color: #999;
font-size: 0.85rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.5px;
letter-spacing: 0.3px;
font-size: 0.65rem;
font-weight: 600;
}
.detail-value {
color: #333;
color: var(--text-primary);
font-weight: 500;
}
/* ===== Progress Bar (Compact) ===== */
.progress-item {
flex-basis: 100%;
}
.progress-container {
display: flex;
align-items: center;
gap: 8px;
}
.progress-bar {
flex: 1;
height: 10px;
background: var(--progress-bg);
border-radius: 5px;
overflow: hidden;
position: relative;
border: 1px solid var(--progress-border);
}
.progress-segment {
height: 100%;
transition: width 0.3s ease;
}
.progress-segment.downloaded {
background: linear-gradient(90deg, var(--progress-fill-start) 0%, var(--progress-fill-end) 100%);
float: left;
}
.progress-text {
font-weight: 600;
color: var(--text-primary);
font-size: 0.78rem;
white-space: nowrap;
}
.missing-text {
color: var(--danger);
font-size: 0.72rem;
font-weight: 500;
white-space: nowrap;
}
/* ===== Footer ===== */
.app-footer {
margin-top: 20px;
margin-top: 12px;
text-align: center;
color: white;
font-size: 0.9rem;
color: var(--footer-text);
font-size: 0.8rem;
}
.app-footer p {
opacity: 0.9;
opacity: 0.8;
}
/* ===== Login ===== */
.login-container {
display: flex;
justify-content: center;
@@ -271,142 +517,129 @@ body {
}
.login-box {
background: white;
padding: 40px;
background: var(--surface);
padding: 36px;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
box-shadow: 0 4px 6px var(--shadow);
width: 100%;
max-width: 400px;
max-width: 380px;
transition: background 0.3s;
}
.login-box h2 {
color: #333;
margin-bottom: 30px;
color: var(--text-primary);
margin-bottom: 24px;
text-align: center;
font-size: 1.8rem;
font-size: 1.5rem;
}
.form-group {
margin-bottom: 20px;
margin-bottom: 16px;
}
.form-group label {
display: block;
color: #333;
color: var(--text-primary);
font-weight: 500;
margin-bottom: 8px;
margin-bottom: 6px;
font-size: 0.9rem;
}
.form-group input {
width: 100%;
padding: 12px;
border: 2px solid #e0e0e0;
border-radius: 5px;
font-size: 1rem;
padding: 10px;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 0.95rem;
background: var(--input-bg);
color: var(--text-primary);
}
.form-group input:focus {
outline: none;
border-color: #667eea;
border-color: var(--accent);
}
.login-btn {
width: 100%;
padding: 12px;
background: #667eea;
padding: 10px;
background: var(--accent);
color: white;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 1rem;
font-size: 0.95rem;
font-weight: 500;
transition: background 0.3s;
transition: background 0.2s;
}
.login-btn:hover {
background: #5568d3;
background: var(--accent-hover);
}
/* Progress bar with missing pieces */
.progress-item {
grid-column: 1 / -1;
}
.progress-container {
display: flex;
flex-direction: column;
gap: 5px;
}
.progress-bar {
width: 100%;
height: 20px;
background: #ffebee;
border-radius: 10px;
overflow: hidden;
position: relative;
border: 1px solid #ffcdd2;
}
.progress-segment {
height: 100%;
transition: width 0.3s ease;
}
.progress-segment.downloaded {
background: linear-gradient(90deg, #4caf50 0%, #66bb6a 100%);
float: left;
}
.progress-text {
font-weight: bold;
color: #333;
}
.missing-text {
color: #f44336;
font-size: 0.9rem;
font-weight: 500;
}
/* Refresh control styles */
.header-controls {
/* ===== Admin Controls ===== */
.admin-controls {
display: flex;
align-items: center;
gap: 20px;
}
.refresh-control {
.toggle-label {
display: flex;
align-items: center;
gap: 8px;
}
.refresh-control label {
color: #666;
font-size: 0.9rem;
}
.refresh-control select {
padding: 5px 10px;
border: 1px solid #ddd;
border-radius: 5px;
background: white;
gap: 6px;
cursor: pointer;
font-size: 0.8rem;
color: var(--text-secondary);
background: var(--surface-alt);
padding: 4px 12px;
border-radius: 14px;
}
.toggle-label input[type="checkbox"] {
width: 14px;
height: 14px;
cursor: pointer;
accent-color: var(--accent);
}
.download-user-badge {
padding: 2px 8px;
border-radius: 10px;
font-size: 0.65rem;
font-weight: 600;
text-transform: capitalize;
background: var(--accent-light);
color: var(--accent);
margin-left: auto;
}
/* ===== Mobile ===== */
@media (max-width: 768px) {
.app-header {
flex-direction: column;
align-items: flex-start;
padding: 12px 14px;
}
.controls {
flex-direction: column;
align-items: stretch;
.header-controls {
flex-wrap: wrap;
gap: 8px;
}
.download-card {
padding: 8px 10px;
}
.download-cover {
width: 40px;
}
.download-details {
grid-template-columns: 1fr;
flex-direction: column;
gap: 2px;
}
.progress-container {
flex-wrap: wrap;
}
}
+6 -2
View File
@@ -37,9 +37,11 @@ router.post('/login', async (req, res) => {
console.log(`[Auth] Login successful for user: ${user.Name}`);
// Set authentication cookie
const isAdmin = !!(user.Policy && user.Policy.IsAdministrator);
res.cookie('emby_user', JSON.stringify({
id: user.Id,
name: user.Name,
isAdmin: isAdmin,
token: authData.AccessToken
}), {
httpOnly: true,
@@ -50,7 +52,8 @@ router.post('/login', async (req, res) => {
success: true,
user: {
id: user.Id,
name: user.Name
name: user.Name,
isAdmin: isAdmin
}
});
} catch (error) {
@@ -76,7 +79,8 @@ router.get('/me', (req, res) => {
authenticated: true,
user: {
id: user.id,
name: user.name
name: user.name,
isAdmin: !!user.isAdmin
}
});
} catch (error) {
+20 -13
View File
@@ -53,7 +53,9 @@ router.get('/user-downloads', async (req, res) => {
const user = JSON.parse(userCookie);
const username = user.name.toLowerCase();
console.log(`[Dashboard] Fetching downloads for authenticated user: ${user.name} (${username})`);
const isAdmin = !!user.isAdmin;
const showAll = isAdmin && req.query.showAll === 'true';
console.log(`[Dashboard] Fetching downloads for authenticated user: ${user.name} (${username}), isAdmin: ${isAdmin}, showAll: ${showAll}`);
// Get all service instances
const sabInstances = getSABnzbdInstances();
@@ -301,7 +303,7 @@ router.get('/user-downloads', async (req, res) => {
const series = seriesMap.get(sonarrMatch.seriesId) || sonarrMatch.series;
if (series) {
const userTag = extractUserTag(series.tags, sonarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
userDownloads.push({
type: 'series',
title: nzbName,
@@ -314,7 +316,8 @@ router.get('/user-downloads', async (req, res) => {
speed: slotState.speed,
eta: slot.timeleft,
seriesName: series.title,
episodeInfo: sonarrMatch
episodeInfo: sonarrMatch,
userTag: userTag
});
}
}
@@ -330,7 +333,7 @@ router.get('/user-downloads', async (req, res) => {
const movie = moviesMap.get(radarrMatch.movieId) || radarrMatch.movie;
if (movie) {
const userTag = extractUserTag(movie.tags, radarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
userDownloads.push({
type: 'movie',
title: nzbName,
@@ -343,7 +346,8 @@ router.get('/user-downloads', async (req, res) => {
speed: slotState.speed,
eta: slot.timeleft,
movieName: movie.title,
movieInfo: radarrMatch
movieInfo: radarrMatch,
userTag: userTag
});
}
}
@@ -376,7 +380,7 @@ router.get('/user-downloads', async (req, res) => {
const series = seriesMap.get(sonarrMatch.seriesId) || sonarrMatch.series;
if (series) {
const userTag = extractUserTag(series.tags, sonarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
userDownloads.push({
type: 'series',
title: nzbName,
@@ -385,7 +389,8 @@ router.get('/user-downloads', async (req, res) => {
size: slot.size,
completedAt: slot.completed_time,
seriesName: series.title,
episodeInfo: sonarrMatch
episodeInfo: sonarrMatch,
userTag: userTag
});
}
}
@@ -401,7 +406,7 @@ router.get('/user-downloads', async (req, res) => {
const movie = moviesMap.get(radarrMatch.movieId) || radarrMatch.movie;
if (movie) {
const userTag = extractUserTag(movie.tags, radarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
userDownloads.push({
type: 'movie',
title: nzbName,
@@ -410,7 +415,8 @@ router.get('/user-downloads', async (req, res) => {
size: slot.size,
completedAt: slot.completed_time,
movieName: movie.title,
movieInfo: radarrMatch
movieInfo: radarrMatch,
userTag: userTag
});
}
}
@@ -462,7 +468,7 @@ router.get('/user-downloads', async (req, res) => {
const series = seriesMap.get(sonarrMatch.seriesId) || sonarrMatch.series;
if (series) {
const userTag = extractUserTag(series.tags, sonarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
console.log(`[Dashboard] Matched torrent "${torrentName}" to Sonarr series "${series.title}"`);
const download = mapTorrentToDownload(torrent);
download.type = 'series';
@@ -486,7 +492,7 @@ router.get('/user-downloads', async (req, res) => {
const movie = moviesMap.get(radarrMatch.movieId) || radarrMatch.movie;
if (movie) {
const userTag = extractUserTag(movie.tags, radarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
console.log(`[Dashboard] Matched torrent "${torrentName}" to Radarr movie "${movie.title}"`);
const download = mapTorrentToDownload(torrent);
download.type = 'movie';
@@ -510,7 +516,7 @@ router.get('/user-downloads', async (req, res) => {
const series = seriesMap.get(sonarrHistoryMatch.seriesId) || sonarrHistoryMatch.series;
if (series) {
const userTag = extractUserTag(series.tags, sonarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
console.log(`[Dashboard] Matched torrent "${torrentName}" to Sonarr history "${series.title}"`);
const download = mapTorrentToDownload(torrent);
download.type = 'series';
@@ -534,7 +540,7 @@ router.get('/user-downloads', async (req, res) => {
const movie = moviesMap.get(radarrHistoryMatch.movieId) || radarrHistoryMatch.movie;
if (movie) {
const userTag = extractUserTag(movie.tags, radarrTagMap);
if (userTag && userTag.toLowerCase() === username) {
if (userTag && (showAll || userTag.toLowerCase() === username)) {
console.log(`[Dashboard] Matched torrent "${torrentName}" to Radarr history "${movie.title}"`);
const download = mapTorrentToDownload(torrent);
download.type = 'movie';
@@ -561,6 +567,7 @@ router.get('/user-downloads', async (req, res) => {
res.json({
user: user.name,
isAdmin: isAdmin,
downloads: userDownloads
});
} catch (error) {