Compare commits

..

6 Commits

Author SHA1 Message Date
c39dc9dcaf Add admin components: stats, activity feed, system status, torrent management 2026-03-09 00:09:45 +01:00
de634b87eb Add admin page with route configuration 2026-03-09 00:09:41 +01:00
c8262a3bda Feat: Misc improvements (#107)
* Expand SCSS variables for improved theming

* Redesign 404 page with dynamic movie quotes

* Add password generator page

* Add missing Plex authentication page

* Improve torrent table and torrents page

* Enhance toast notification component

* Enhance popup components

* Refine UI components and remove DarkmodeToggle

* Add user profile component for settings

* Update autocomplete dropdown component

* Update register page

* Redesign signin and register pages with improved UX

* Improve torrent table with sort toggle and highlight colors

* eslint & prettier fixes
2026-03-09 00:01:05 +01:00
cb90281e5e Feat: Activity page enhancements (#106)
* Add activity page components and Tautulli stats integration

- Add StatsOverview component for watch statistics display
- Add WatchHistory component for recent watch activity
- Add useTautulliStats composable for Tautulli API integration
- Components display total plays, watch time, movies/episodes watched
- Support for fetching home stats and last watched content

* Enhance Graph component with improved styling and options

- Add wrapper div for better layout control
- Update color scheme with modern palette (Indigo, Amber, Emerald)
- Add Filler plugin for filled area charts
- Improve bar chart styling with rounded corners
- Add proper lifecycle cleanup with onBeforeUnmount
- Enhance tooltip formatting for time and number values
- Add deep watch for reactive data updates
- Better TypeScript type safety with Chart.js types

* Refactor ActivityPage with enhanced stats and visualizations

- Integrate StatsOverview component for at-a-glance metrics
- Add WatchHistory component for recent watch activity
- Add hourly viewing patterns chart
- Modernize UI with card-based layout
- Improve controls styling with better labels and input handling
- Remove authentication dependency (now handled by route guards)
- Use useTautulliStats composable for data fetching
- Add comprehensive watch statistics (total plays, hours, by media type)
- Support for both plays and duration view modes

* Improve Plex authentication check with cookie fallback

- Add usePlexAuth composable import to routes
- Enhance hasPlexAccount() to check cookies when Vuex store is empty
- Fixes authentication check after page refreshes
- Ensures activity page remains accessible with valid Plex auth
2026-03-08 21:38:22 +01:00
0cd2a73a8b Feat: Command palette (#105)
* Add command palette with smart navigation and usage tracking

- Add CommandPalette.vue component with keyboard shortcut (Cmd+K/Ctrl+K)
- Implement smart route navigation with parameter input support
- Add content search integration via Elasticsearch
- Create commandTracking.ts utility for usage analytics
- Track command frequency and recency with scoring algorithm
- Support for all application routes with metadata and icons
- Includes badge system for auth requirements and shortcuts

* Integrate CommandPalette into main application

- Add CommandPalette component to App.vue
- Enable global keyboard shortcut (Cmd+K/Ctrl+K)
- Command palette is now accessible from anywhere in the app
2026-03-08 21:29:07 +01:00
c309016299 Feat/settings page redesign (#104)
* include credentials on login fetch requests, allows set header response

* Add theme composable and utility improvements

- Create useTheme composable for centralized theme management
- Update main.ts to use useTheme for initialization
- Generalize getCookie utility in user module
- Add utility functions for data formatting

* Add Plex integration composables and icons

- Create usePlexAuth composable for Plex OAuth flow
- Create usePlexApi composable for Plex API interactions
- Create useRandomWords composable for password generation
- Add Plex-related icons (IconPlex, IconServer, IconSync)
- Add Plex helper utilities
- Update API with Plex-related endpoints

* Add storage management components for data & privacy section

- Create StorageManager component for browser storage overview
- Create StorageSectionBrowser for localStorage/sessionStorage/cookies
- Create StorageSectionServer for server-side data (mock)
- Create ExportSection for data export functionality
- Refactor DataExport component with modular sections
- Add storage icons (IconCookie, IconDatabase, IconTimer)
- Implement collapsible sections with visual indicators
- Add colored borders per storage type
- Display item counts and total size in headers

* Add theme, password, and security settings components

- Create ThemePreferences with visual theme selector
- Create PasswordGenerator with passphrase and random modes
- Create SecuritySettings wrapper for password management
- Update ChangePassword to work with new layout
- Implement improved slider UX with visual feedback
- Add theme preview cards with gradients
- Standardize component styling and typography

* Add Plex settings and authentication components

- Create PlexSettings component for Plex account management
- Create PlexAuthButton with improved OAuth flow
- Create PlexServerInfo for server details display
- Use icon components instead of inline SVGs
- Add sync and unlink functionality
- Implement user-friendly authentication flow

* Redesign settings page with two-column layout and ProfileHero

- Create ProfileHero component with avatar and user info
- Create RequestHistory component for Plex requests (placeholder)
- Redesign SettingsPage with modern two-column grid layout
- Add shared-settings.scss for consistent styling
- Organize sections: Appearance, Security, Integrations, Data & Privacy
- Implement responsive mobile layout
- Standardize typography (h2: 1.5rem, 700 weight)
- Add compact modifier for tighter sections
2026-03-08 21:16:36 +01:00
17 changed files with 790 additions and 426 deletions

View File

@@ -13,7 +13,7 @@
<!-- Popup that will show above existing rendered content --> <!-- Popup that will show above existing rendered content -->
<popup /> <popup />
<!-- Command Palette --> <!-- Command Palette for quick navigation -->
<command-palette /> <command-palette />
</div> </div>
</template> </template>
@@ -62,6 +62,7 @@
grid-column: 2 / 3; grid-column: 2 / 3;
width: calc(100% - var(--header-size)); width: calc(100% - var(--header-size));
grid-row: 2; grid-row: 2;
z-index: 5;
@include mobile { @include mobile {
grid-column: 1 / 3; grid-column: 1 / 3;

View File

@@ -1,9 +1,25 @@
<template> <template>
<li class="card"> <li class="cast-card">
<a @click="openCastItem" @keydown.enter="openCastItem"> <a
<img :src="pictureUrl" alt="Movie or person poster image" /> class="cast-card__link"
<p class="name">{{ creditItem.name || creditItem.title }}</p> role="button"
<p class="meta">{{ creditItem.character || creditItem.year }}</p> tabindex="0"
:aria-label="ariaLabel"
@click="openCastItem"
@keydown.enter="openCastItem"
>
<div class="cast-card__image-wrapper">
<img
class="cast-card__image"
:src="pictureUrl"
:alt="imageAltText"
loading="lazy"
/>
</div>
<div class="cast-card__content">
<p class="cast-card__name">{{ creditItem.name || creditItem.title }}</p>
<p v-if="metaText" class="cast-card__meta">{{ metaText }}</p>
</div>
</a> </a>
</li> </li>
</template> </template>
@@ -33,85 +49,139 @@
return "/assets/no-image_small.svg"; return "/assets/no-image_small.svg";
}); });
const metaText = computed(() => {
if ("character" in props.creditItem && props.creditItem.character) {
return props.creditItem.character;
}
if ("job" in props.creditItem && props.creditItem.job) {
return props.creditItem.job;
}
if ("year" in props.creditItem && props.creditItem.year) {
return props.creditItem.year;
}
return "";
});
const imageAltText = computed(() => {
const name = props.creditItem.name || (props.creditItem as any).title || "";
if ("character" in props.creditItem) {
return `${name} as ${props.creditItem.character}`;
}
if ("job" in props.creditItem) {
return `${name}, ${props.creditItem.job}`;
}
return name ? `Poster for ${name}` : "No image available";
});
const ariaLabel = computed(() => {
const name = props.creditItem.name || (props.creditItem as any).title || "";
if ("character" in props.creditItem && props.creditItem.character) {
return `View ${name}, played ${props.creditItem.character}`;
}
if ("job" in props.creditItem && props.creditItem.job) {
return `View ${name}, ${props.creditItem.job}`;
}
return `View ${name}`;
});
function openCastItem() { function openCastItem() {
store.dispatch("popup/open", { ...props.creditItem }); store.dispatch("popup/open", { ...props.creditItem });
} }
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
li a p:first-of-type { @import "scss/variables";
padding-top: 10px;
}
li.card p { .cast-card {
font-size: 1em; list-style: none;
padding: 0 10px; margin: 0 10px 10px 0;
margin: 0; width: 150px;
overflow: hidden; flex-shrink: 0;
text-overflow: ellipsis;
max-height: calc(10px + ((16px * var(--line-height)) * 3));
}
li.card {
margin: 10px;
margin-right: 4px;
padding-bottom: 10px;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
min-width: 140px;
width: 140px;
background-color: var(--background-color-secondary);
color: var(--text-color);
transition: all 0.3s ease;
transform: scale(0.97) translateZ(0);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
&:first-of-type { &:first-of-type {
margin-left: 0; margin-left: 0;
} }
}
&:hover { .cast-card__link {
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3); display: flex;
transform: scale(1.03); flex-direction: column;
height: 100%;
text-decoration: none;
color: inherit;
cursor: pointer;
border-radius: 10px;
overflow: hidden;
background-color: var(
--highlight-secondary,
var(--background-color-secondary)
);
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
&:hover,
&:focus {
transform: translateY(-4px);
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
outline: none;
} }
.name { &:focus-visible {
font-weight: 500; outline: 2px solid var(--highlight-color);
} outline-offset: 2px;
.character {
font-size: 0.9em;
}
.meta {
font-size: 0.9em;
color: var(--text-color-70);
display: -webkit-box;
overflow: hidden;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
// margin-top: auto;
max-height: calc((0.9em * var(--line-height)) * 1);
}
a {
display: block;
text-decoration: none;
height: 100%;
display: flex;
flex-direction: column;
}
img {
width: 100%;
height: auto;
max-height: 210px;
background-color: var(--background-color);
object-fit: cover;
} }
} }
.cast-card__image-wrapper {
position: relative;
width: 100%;
aspect-ratio: 2 / 3;
overflow: hidden;
background: linear-gradient(
135deg,
var(--background-color) 0%,
var(--background-color-secondary) 100%
);
}
.cast-card__image {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.cast-card__content {
padding: 12px;
display: flex;
flex-direction: column;
gap: 4px;
min-height: 60px;
}
.cast-card__name {
margin: 0;
font-size: 0.95rem;
font-weight: 500;
line-height: 1.3;
color: var(--highlight-bg, var(--text-color));
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
.cast-card__meta {
margin: 0;
font-size: 0.85rem;
font-weight: 400;
line-height: 1.3;
color: var(--highlight-bg, var(--text-color-70));
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
text-overflow: ellipsis;
}
</style> </style>

View File

@@ -41,7 +41,7 @@
const signinNavigationIcon: INavigationIcon = { const signinNavigationIcon: INavigationIcon = {
title: "Signin", title: "Signin",
route: "/signin", route: "/login",
icon: IconProfileLock icon: IconProfileLock
}; };

View File

@@ -9,14 +9,19 @@
unclickable: !!!stat.clickable unclickable: !!!stat.clickable
}" }"
@click=" @click="
stat.clickable && stat.value?.total > 0 && !loading && handleClick(stat.key) stat.clickable &&
stat.value?.total > 0 &&
!loading &&
handleClick(stat.key)
" "
> >
<div class="stat-icon"> <div class="stat-icon">
<component :is="stat.icon" /> <component :is="stat.icon" />
</div> </div>
<div class="stat-content"> <div class="stat-content">
<div class="stat-value" v-if="!loading">{{ formatNumber(stat.value?.total) }}</div> <div class="stat-value" v-if="!loading">
{{ formatNumber(stat.value?.total) }}
</div>
<div class="stat-value loading-dots" v-else>...</div> <div class="stat-value loading-dots" v-else>...</div>
<div class="stat-label">{{ stat.label }}</div> <div class="stat-label">{{ stat.label }}</div>
</div> </div>
@@ -26,7 +31,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { computed } from "vue"; import { computed } from "vue";
import { formatNumber } from '@/utils' import { formatNumber } from "@/utils";
import IconMovie from "@/icons/IconMovie.vue"; import IconMovie from "@/icons/IconMovie.vue";
import IconShow from "@/icons/IconShow.vue"; import IconShow from "@/icons/IconShow.vue";
import IconMusic from "@/icons/IconMusic.vue"; import IconMusic from "@/icons/IconMusic.vue";

View File

@@ -3,14 +3,14 @@
<div class="plex-details"> <div class="plex-details">
<div class="detail-row"> <div class="detail-row">
<span class="detail-label"> <span class="detail-label">
<IconServer class="label-icon" /> <IconServer class="label-icon" style="fill: var(--text-color)" />
Plex server name Plex server name
</span> </span>
<span class="detail-value">{{ serverName || "Unknown" }}</span> <span class="detail-value">{{ serverName || "Unknown" }}</span>
</div> </div>
<div class="detail-row"> <div class="detail-row">
<span class="detail-label"> <span class="detail-label">
<IconSync class="label-icon" /> <IconSync class="label-icon" style="stroke: var(--text-color)" />
Last Sync Last Sync
</span> </span>
<span class="detail-value">{{ lastSync || "Never" }}</span> <span class="detail-value">{{ lastSync || "Never" }}</span>
@@ -82,7 +82,6 @@
} }
svg { svg {
color: var(--text-color-60);
flex-shrink: 0; flex-shrink: 0;
} }

View File

@@ -215,8 +215,7 @@
const props = defineProps<Props>(); const props = defineProps<Props>();
const ASSET_URL = "https://image.tmdb.org/t/p/"; const ASSET_URL = "https://image.tmdb.org/t/p/";
// const COLORS_URL = "https://colors.schleppe.cloud/colors"; const COLORS_API = import.meta.env.VITE_SEASONED_COLORS_API || "";
const COLORS_URL = "http://localhost:8080/colors";
const ASSET_SIZES = ["w500", "w780", "original"]; const ASSET_SIZES = ["w500", "w780", "original"];
const media: Ref<IMovie | IShow> = ref(); const media: Ref<IMovie | IShow> = ref();
@@ -353,7 +352,7 @@
} }
async function colorsFromPoster(posterPath: string) { async function colorsFromPoster(posterPath: string) {
const url = new URL(COLORS_URL); const url = new URL("/colors", COLORS_API);
url.searchParams.append("id", posterPath.replace("/", "")); url.searchParams.append("id", posterPath.replace("/", ""));
url.searchParams.append("size", "w342"); url.searchParams.append("size", "w342");

View File

@@ -24,8 +24,8 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "vue"; import { ref } from "vue";
import StorageManager from "./StorageManager.vue"; import StorageManager from "./StorageManager.vue";
import ExportSection from "./ExportSection.vue" import ExportSection from "./ExportSection.vue";
import RequestHistory from "./RequestHistory.vue" import RequestHistory from "./RequestHistory.vue";
import DangerZoneAction from "./DangerZoneAction.vue"; import DangerZoneAction from "./DangerZoneAction.vue";
const requestStats = ref({ const requestStats = ref({

View File

@@ -72,8 +72,6 @@
function convertToCSV(data: any): string { function convertToCSV(data: any): string {
return `Username,Total Requests,Approved,Pending,Export Date\n${data.username},${data.requests.total},${data.requests.approved},${data.requests.pending},${data.exportDate}`; return `Username,Total Requests,Approved,Pending,Export Date\n${data.username},${data.requests.total},${data.requests.approved},${data.requests.pending},${data.exportDate}`;
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View File

@@ -74,7 +74,6 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -1,68 +1,69 @@
<template> <template>
<table> <div class="torrent-table">
<thead class="table__header noselect"> <div class="sort-toggle">
<tr> <span class="sort-label">Sort by:</span>
<th <div class="sort-options">
v-for="column in visibleColumns" <button
:key="column" v-for="option in sortOptions"
:class="column === selectedColumn ? 'active' : null" :key="option.value"
@click="sortTable(column)" :class="['sort-btn', { active: selectedSort === option.value }]"
@click="changeSort(option.value)"
> >
{{ column }} {{ option.label }}
<span v-if="prevCol === column && direction"></span> </button>
<span v-if="prevCol === column && !direction"></span> </div>
</th> </div>
</tr>
</thead>
<tbody> <table>
<tr <thead class="table__header noselect">
v-for="torrent in torrents" <tr>
:key="torrent.magnet" <th
class="table__content" class="name-header"
> :class="selectedSort === 'name' ? 'active' : null"
<td @click="changeSort('name')"
class="torrent-info" >
@click="expand($event, torrent.name)" Name
@keydown.enter="expand($event, torrent.name)" <span v-if="selectedSort === 'name'">{{
direction ? "" : ""
}}</span>
</th>
<th class="add-header">Add</th>
</tr>
</thead>
<tbody>
<tr
v-for="torrent in sortedTorrents"
:key="torrent.magnet"
class="table__content"
> >
<div class="torrent-title">{{ torrent.name }}</div> <td
<div v-if="isMobile" class="torrent-meta"> class="torrent-info"
<span class="meta-item">{{ torrent.size }}</span> @click="expand($event, torrent.name)"
<span class="meta-separator"></span> @keydown.enter="expand($event, torrent.name)"
<span class="meta-item">{{ torrent.seed }} seeders</span> >
</div> <div class="torrent-title">{{ torrent.name }}</div>
</td> <div class="torrent-meta">
<td <span class="meta-item">{{ torrent.size }}</span>
v-if="!isMobile" <span class="meta-separator"></span>
class="torrent-seed" <span class="meta-item">{{ torrent.seed }} seeders</span>
@click="expand($event, torrent.name)" </div>
@keydown.enter="expand($event, torrent.name)" </td>
> <td
{{ torrent.seed }} class="download"
</td> @click="() => emit('magnet', torrent)"
<td @keydown.enter="() => emit('magnet', torrent)"
v-if="!isMobile" >
class="torrent-size" <IconMagnet />
@click="expand($event, torrent.name)" </td>
@keydown.enter="expand($event, torrent.name)" </tr>
> </tbody>
{{ torrent.size }} </table>
</td> </div>
<td
class="download"
@click="() => emit('magnet', torrent)"
@keydown.enter="() => emit('magnet', torrent)"
>
<IconMagnet />
</td>
</tr>
</tbody>
</table>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from "vue"; import { ref, computed } from "vue";
import IconMagnet from "@/icons/IconMagnet.vue"; import IconMagnet from "@/icons/IconMagnet.vue";
import type { Ref } from "vue"; import type { Ref } from "vue";
import { sortableSize } from "../../utils"; import { sortableSize } from "../../utils";
@@ -79,31 +80,55 @@
const props = defineProps<Props>(); const props = defineProps<Props>();
const emit = defineEmits<Emit>(); const emit = defineEmits<Emit>();
const columns: string[] = ["name", "seed", "size", "add"]; const sortOptions = [
const windowWidth = ref(window.innerWidth); { value: "name", label: "Name" },
const isMobile = computed(() => windowWidth.value <= 768); { value: "size", label: "Size" },
const visibleColumns = computed(() => { value: "seed", label: "Seeders" }
isMobile.value ? ["name", "add"] : columns ];
);
const torrents: Ref<ITorrent[]> = ref(props.torrents); const torrents: Ref<ITorrent[]> = ref(props.torrents);
const direction: Ref<boolean> = ref(false); const direction: Ref<boolean> = ref(false);
const selectedColumn: Ref<string> = ref(columns[0]); const selectedSort: Ref<string> = ref("size");
const prevCol: Ref<string> = ref(""); const prevSort: Ref<string> = ref("");
function handleResize() { const sortedTorrents = computed(() => {
windowWidth.value = window.innerWidth; const sorted = [...torrents.value];
if (selectedSort.value === "name") {
sorted.sort((a, b) =>
direction.value
? a.name.localeCompare(b.name)
: b.name.localeCompare(a.name)
);
} else if (selectedSort.value === "size") {
sorted.sort((a, b) =>
direction.value
? sortableSize(a.size) - sortableSize(b.size)
: sortableSize(b.size) - sortableSize(a.size)
);
} else if (selectedSort.value === "seed") {
sorted.sort((a, b) =>
direction.value
? parseInt(a.seed, 10) - parseInt(b.seed, 10)
: parseInt(b.seed, 10) - parseInt(a.seed, 10)
);
}
return sorted;
});
function changeSort(sortBy: string) {
if (prevSort.value === sortBy) {
direction.value = !direction.value;
} else {
direction.value = false;
selectedSort.value = sortBy;
}
prevSort.value = sortBy;
} }
onMounted(() => {
window.addEventListener("resize", handleResize);
});
onUnmounted(() => {
window.removeEventListener("resize", handleResize);
});
function expand(event: MouseEvent, text: string) { function expand(event: MouseEvent, text: string) {
return;
const elementClicked = event.target as HTMLElement; const elementClicked = event.target as HTMLElement;
const tableRow = elementClicked.parentElement; const tableRow = elementClicked.parentElement;
const scopedStyleDataVariable = Object.keys(tableRow.dataset)[0]; const scopedStyleDataVariable = Object.keys(tableRow.dataset)[0];
@@ -116,8 +141,6 @@
if (existingExpandedElement) { if (existingExpandedElement) {
existingExpandedElement.remove(); existingExpandedElement.remove();
// Clicked the same element twice, remove and return
// not recreate and collapse
if (clickedSameTwice) return; if (clickedSameTwice) return;
} }
@@ -128,59 +151,11 @@
expandedRow.className = "expanded"; expandedRow.className = "expanded";
expandedCol.innerText = text; expandedCol.innerText = text;
// Colspan: 2 on mobile (name + add), 4 on desktop (name + seed + size + add) expandedCol.colSpan = 2;
expandedCol.colSpan = isMobile.value ? 2 : 4;
expandedRow.appendChild(expandedCol); expandedRow.appendChild(expandedCol);
tableRow.insertAdjacentElement("afterend", expandedRow); tableRow.insertAdjacentElement("afterend", expandedRow);
} }
function sortName() {
const torrentsCopy = [...torrents.value];
if (direction.value) {
torrents.value = torrentsCopy.sort((a, b) => (a.name < b.name ? 1 : -1));
} else {
torrents.value = torrentsCopy.sort((a, b) => (a.name > b.name ? 1 : -1));
}
}
function sortSeed() {
const torrentsCopy = [...torrents.value];
if (direction.value) {
torrents.value = torrentsCopy.sort(
(a, b) => parseInt(a.seed, 10) - parseInt(b.seed, 10)
);
} else {
torrents.value = torrentsCopy.sort(
(a, b) => parseInt(b.seed, 10) - parseInt(a.seed, 10)
);
}
}
function sortSize() {
const torrentsCopy = [...torrents.value];
if (direction.value) {
torrents.value = torrentsCopy.sort((a, b) =>
sortableSize(a.size) > sortableSize(b.size) ? 1 : -1
);
} else {
torrents.value = torrentsCopy.sort((a, b) =>
sortableSize(a.size) < sortableSize(b.size) ? 1 : -1
);
}
}
function sortTable(col, sameDirection = false) {
if (prevCol.value === col && sameDirection === false) {
direction.value = !direction.value;
}
if (col === "name") sortName();
else if (col === "seed") sortSeed();
else if (col === "size") sortSize();
prevCol.value = col;
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@@ -188,6 +163,58 @@
@import "scss/media-queries"; @import "scss/media-queries";
@import "scss/elements"; @import "scss/elements";
.torrent-table {
width: 100%;
}
.sort-toggle {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.75rem;
flex-wrap: wrap;
.sort-label {
font-size: 0.85rem;
color: var(--text-color-70);
text-transform: uppercase;
letter-spacing: 0.5px;
}
.sort-options {
display: flex;
gap: 0.25rem;
}
.sort-btn {
border: 1px solid var(--highlight-bg, var(--background-color-40));
color: var(--text-color-70);
padding: 0.35rem 0.65rem;
font-size: 0.8rem;
border-radius: 4px;
cursor: pointer;
transition: all 0.2s ease;
text-transform: uppercase;
letter-spacing: 0.5px;
&:hover {
background: var(--highlight-bg, var(--background-color));
color: var(--text-color);
}
&.active {
background: var(--highlight-color);
color: var(--text-color);
border-color: var(--highlight-color, $green);
}
@include mobile {
padding: 0.4rem 0.6rem;
font-size: 0.75rem;
}
}
}
table { table {
border-spacing: 0; border-spacing: 0;
margin-top: 0.5rem; margin-top: 0.5rem;
@@ -195,16 +222,11 @@
max-width: 100%; max-width: 100%;
border-radius: 0.5rem; border-radius: 0.5rem;
overflow: hidden; overflow: hidden;
table-layout: fixed; table-layout: auto;
@include mobile {
table-layout: auto;
}
} }
th, th,
td { td {
border: 0.5px solid var(--background-color-40);
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
@@ -217,16 +239,16 @@
position: relative; position: relative;
user-select: none; user-select: none;
-webkit-user-select: none; -webkit-user-select: none;
color: var(--table-header-text-color); color: var(--highlight-bg, var(--table-header-text-color));
text-transform: uppercase; text-transform: uppercase;
cursor: pointer; cursor: pointer;
background-color: var(--table-background-color); background-color: var(--highlight-color, var(--highlight-color));
background-color: var(--highlight-color);
letter-spacing: 0.8px; letter-spacing: 0.8px;
font-size: 1rem; font-size: 1rem;
th:last-of-type { th:last-of-type {
padding-right: 0.4rem; padding: 0 0.4rem;
border-left: 1px solid var(--highlight-bg, var(--background-color));
} }
} }
@@ -237,7 +259,7 @@
padding: 0.5rem 0.6rem; padding: 0.5rem 0.6rem;
cursor: default; cursor: default;
word-break: break-word; word-break: break-word;
border-left: 1px solid var(--table-background-color); border-left: 1px solid var(--highlight-secondary, var(--highlight-color));
@include mobile { @include mobile {
width: 100%; width: 100%;
@@ -258,8 +280,8 @@
.torrent-meta { .torrent-meta {
font-size: 0.85rem; font-size: 0.85rem;
color: var(--text-color-60);
display: flex; display: flex;
opacity: 70%;
align-items: center; align-items: center;
gap: 0.5rem; gap: 0.5rem;
flex-wrap: wrap; flex-wrap: wrap;
@@ -275,20 +297,12 @@
} }
} }
// seed and size columns (desktop only)
.torrent-seed,
.torrent-size {
text-align: center;
white-space: nowrap;
padding: 0.5rem;
}
// last column - action // last column - action
tr td:last-of-type { tr td:last-of-type {
vertical-align: middle; vertical-align: middle;
cursor: pointer; cursor: pointer;
border-right: 1px solid var(--table-background-color); border-right: 1px solid var(--highlight-secondary, var(--highlight-color));
width: 60px; max-width: 60px;
text-align: center; text-align: center;
@include mobile { @include mobile {
@@ -300,7 +314,7 @@
display: block; display: block;
margin: auto; margin: auto;
padding: 0.3rem 0; padding: 0.3rem 0;
fill: var(--text-color); fill: var(inherit, var(--text-color));
@include mobile { @include mobile {
width: 18px; width: 18px;
@@ -310,16 +324,30 @@
// alternate background color per row // alternate background color per row
tr { tr {
background-color: var(--background-color); background-color: var(--highlight-bg, var(--background-90));
color: var(--text-color);
td {
border-left: 1px solid
var(--highlight-secondary, var(--highlight-color));
fill: var(--text-color);
}
} }
tr:nth-child(even) { tr:nth-child(odd) {
background-color: var(--background-70); background-color: var(--highlight-secondary, var(--background-color));
color: var(--highlight-bg, var(--text-color));
td {
fill: var(--highlight-bg, var(--text-color)) !important;
}
} }
// last element rounded corner border // last element rounded corner border
tr:last-of-type { tr:last-of-type {
td { td {
border-bottom: 1px solid var(--table-background-color); border-bottom: 1px solid
var(--highlight-secondary, var(--highlight-color));
border-left: 1px solid var(--highlight-bg, var(--text-color));
} }
td:first-of-type { td:first-of-type {
@@ -335,15 +363,16 @@
.expanded { .expanded {
padding: 0.25rem 1rem; padding: 0.25rem 1rem;
max-width: 100%; max-width: 100%;
border-left: 1px solid $text-color; border-left: 1px solid var(--text-color);
border-right: 1px solid $text-color; border-right: 1px solid var(--text-color);
border-bottom: 1px solid $text-color; border-bottom: 1px solid var(--text-color);
td { td {
white-space: normal; white-space: normal;
word-break: break-all; word-break: break-all;
padding: 0.5rem 0.15rem; padding: 0.5rem 0.15rem;
width: 100%; width: 100%;
color: var(--text-color);
} }
} }
</style> </style>

View File

@@ -22,9 +22,9 @@ function applyTheme(theme: Theme) {
} }
export function useTheme() { export function useTheme() {
const savedTheme = computed(() => { const savedTheme = computed(
return (localStorage.getItem("theme-preference") as Theme) || "auto"; () => (localStorage.getItem("theme-preference") as Theme) || "auto"
}); );
function initTheme() { function initTheme() {
const theme = savedTheme.value; const theme = savedTheme.value;

View File

@@ -17,7 +17,7 @@ export interface CookieOptions {
* Read a cookie value. * Read a cookie value.
*/ */
export function getAuthorizationCookie(): string | null { export function getAuthorizationCookie(): string | null {
const key = 'authorization'; const key = "authorization";
const array = document.cookie.split(";"); const array = document.cookie.split(";");
let match = null; let match = null;

View File

@@ -257,6 +257,7 @@
text-align: center; text-align: center;
z-index: 10; z-index: 10;
padding: 2rem; padding: 2rem;
margin-top: calc(-1 * var(--header-size));
@include mobile { @include mobile {
padding: 1rem; padding: 1rem;

View File

@@ -1,40 +1,107 @@
<template> <template>
<section> <div class="register auth-page">
<h1>Register new user</h1> <div class="auth-content auth-content--wide">
<div class="auth-header">
<h1 class="auth-title">Register new user</h1>
<p class="auth-subtitle">Create an account to get started</p>
</div>
<form ref="formElement" class="form"> <form ref="formElement" class="auth-form" @submit.prevent>
<seasoned-input <seasoned-input
v-model="username" v-model="username"
placeholder="username" placeholder="Email address"
icon="Email" icon="Email"
type="email" type="email"
@keydown.enter="focusOnNextElement" @keydown.enter="focusOnNextElement"
/> />
<seasoned-input <div class="register__password-section">
v-model="password" <div class="password-generator">
placeholder="password" <button
icon="Keyhole" type="button"
type="password" class="generator-toggle"
@keydown.enter="focusOnNextElement" @click="toggleGenerator"
/> >
<seasoned-input <IconKey class="toggle-icon" />
v-model="passwordRepeat" <span>{{
placeholder="repeat password" showGenerator
icon="Keyhole" ? "Hide Password Generator"
type="password" : "Generate Strong Password"
@keydown.enter="submit" }}</span>
/> </button>
<div v-if="showGenerator" class="generator-content">
<password-generator
@password-generated="handlePasswordGenerated"
/>
</div>
</div>
<seasoned-button @click="submit">Register</seasoned-button> <seasoned-input
</form> v-model="password"
placeholder="Password"
icon="Keyhole"
type="password"
class="password-input"
@keydown.enter="focusOnNextElement"
/>
<router-link class="link" to="/login" <seasoned-input
>Have a user? Sign in here</router-link v-model="passwordRepeat"
> placeholder="Confirm password"
icon="Keyhole"
type="password"
class="password-input"
@keydown.enter="submit"
/>
</div>
<seasoned-messages v-model:messages="messages"></seasoned-messages> <div v-if="password.length > 0" class="register__password-requirements">
</section> <p class="requirements-title">Password must contain:</p>
<div class="requirements-grid">
<div class="requirement" :class="{ met: password.length >= 8 }">
<span class="requirement-icon">{{
password.length >= 8 ? "✓" : "✗"
}}</span>
<span class="requirement-text">At least 8 characters</span>
</div>
<div class="requirement" :class="{ met: /[A-Z]/.test(password) }">
<span class="requirement-icon">{{
/[A-Z]/.test(password) ? "✓" : "✗"
}}</span>
<span class="requirement-text">One uppercase letter</span>
</div>
<div class="requirement" :class="{ met: /[a-z]/.test(password) }">
<span class="requirement-icon">{{
/[a-z]/.test(password) ? "✓" : "✗"
}}</span>
<span class="requirement-text">One lowercase letter</span>
</div>
<div class="requirement" :class="{ met: /[0-9]/.test(password) }">
<span class="requirement-icon">{{
/[0-9]/.test(password) ? "✓" : "✗"
}}</span>
<span class="requirement-text">One number</span>
</div>
</div>
</div>
<seasoned-button class="auth-button" @click="submit">
Create Account
</seasoned-button>
</form>
<div class="auth-footer">
<p class="auth-footer-text">
Already have an account?
<router-link class="auth-link" to="/login">
Sign in here
</router-link>
</p>
</div>
<seasoned-messages v-model:messages="messages"></seasoned-messages>
</div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -44,6 +111,8 @@
import SeasonedButton from "@/components/ui/SeasonedButton.vue"; import SeasonedButton from "@/components/ui/SeasonedButton.vue";
import SeasonedInput from "@/components/ui/SeasonedInput.vue"; import SeasonedInput from "@/components/ui/SeasonedInput.vue";
import SeasonedMessages from "@/components/ui/SeasonedMessages.vue"; import SeasonedMessages from "@/components/ui/SeasonedMessages.vue";
import PasswordGenerator from "@/components/settings/PasswordGenerator.vue";
import IconKey from "@/icons/IconKey.vue";
import type { Ref } from "vue"; import type { Ref } from "vue";
import { register } from "../api"; import { register } from "../api";
import { focusFirstFormInput, focusOnNextElement } from "../utils"; import { focusFirstFormInput, focusOnNextElement } from "../utils";
@@ -55,6 +124,7 @@
const passwordRepeat: Ref<string> = ref(""); const passwordRepeat: Ref<string> = ref("");
const messages: Ref<IErrorMessage[]> = ref([]); const messages: Ref<IErrorMessage[]> = ref([]);
const formElement: Ref<HTMLFormElement> = ref(null); const formElement: Ref<HTMLFormElement> = ref(null);
const showGenerator = ref(false);
const store = useStore(); const store = useStore();
const router = useRouter(); const router = useRouter();
@@ -70,99 +140,198 @@
message, message,
title, title,
type: ErrorMessageTypes.Error type: ErrorMessageTypes.Error
} as IErrorMessage);
}
function addWarningMessage(message: string, title?: string) {
messages.value.push({
message,
title,
type: ErrorMessageTypes.Warning
} as IErrorMessage);
}
function validate(): Promise<boolean> {
return new Promise((resolve, reject) => {
if (!username.value || username?.value?.length === 0) {
addWarningMessage("Missing username", "Validation error");
reject();
}
if (!password.value || password?.value?.length === 0) {
addWarningMessage("Missing password", "Validation error");
reject();
}
if (passwordRepeat.value == null || passwordRepeat.value.length === 0) {
addWarningMessage("Missing repeat password", "Validation error");
reject();
}
if (passwordRepeat.value !== password.value) {
addWarningMessage("Passwords do not match", "Validation error");
reject();
}
resolve(true);
}); });
} }
function registerUser() { function addSuccessMessage(message: string, title?: string) {
register(username.value, password.value) messages.value.push({
.then(data => { message,
if (data?.success && store.dispatch("user/login")) { title,
router.push({ name: "profile" }); type: ErrorMessageTypes.Success
} });
}
function validate() {
const errors = [];
if (username.value.length === 0) {
errors.push("Email must not be empty");
}
if (password.value.length === 0) {
errors.push("Password must not be empty");
}
if (password.value.length < 8) {
errors.push("Password must be at least 8 characters");
}
if (!/[A-Z]/.test(password.value)) {
errors.push("Password must contain at least one uppercase letter");
}
if (!/[a-z]/.test(password.value)) {
errors.push("Password must contain at least one lowercase letter");
}
if (!/[0-9]/.test(password.value)) {
errors.push("Password must contain at least one number");
}
if (password.value !== passwordRepeat.value) {
errors.push("Passwords do not match");
}
if (errors.length > 0) {
errors.forEach(error => addErrorMessage(error, "Validation error"));
return Promise.reject();
}
return Promise.resolve(true);
}
function createUser() {
return register(username.value, password.value)
.then(response => {
addSuccessMessage(
"Account created successfully! Redirecting to login...",
"Success"
);
setTimeout(() => {
router.push("/login");
}, 2000);
return response;
}) })
.catch(error => { .catch(error => {
if (error?.status === 401) { addErrorMessage(error?.message || "Registration failed", "Error");
addErrorMessage("Incorrect username or password", "Access denied");
return null;
}
addErrorMessage(error?.message, "Unexpected error");
return null; return null;
}); });
} }
function submit() { function submit() {
clearMessages(); clearMessages();
validate().then(registerUser); validate().then(createUser);
}
function handlePasswordGenerated(generatedPassword: string) {
password.value = generatedPassword;
passwordRepeat.value = generatedPassword;
}
function toggleGenerator() {
showGenerator.value = !showGenerator.value;
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "scss/variables"; @import "scss/shared-auth";
section { .register {
padding: 1.3rem; // Password inputs use monospace font
:deep(.password-input input[type="password"]),
@include tablet-min { :deep(.password-input input[type="text"]) {
padding: 4rem; font-family: "Courier New", monospace;
} }
}
.form > div, .register__password-section {
input, display: flex;
button { flex-direction: column;
margin-bottom: 1rem; gap: 1.25rem;
}
&:last-child { .password-generator {
margin-bottom: 0px; .generator-toggle {
display: flex;
align-items: center;
gap: 0.5rem;
width: 100%;
padding: 0.875rem 1rem;
background: var(--background-ui);
border: 1px solid var(--text-color-10);
border-radius: 8px;
color: var(--text-color);
font-size: 0.95rem;
font-weight: 500;
cursor: pointer;
transition: all 0.2s;
&:hover {
background: var(--background-color-secondary);
border-color: var(--text-color-20);
}
.toggle-icon {
width: 18px;
height: 18px;
color: var(--highlight-color);
} }
} }
h1 { .generator-content {
margin: 0; margin-top: 1rem;
line-height: 16px; padding-top: 1rem;
border-top: 1px solid var(--text-color-10);
}
}
.register__password-requirements {
background: var(--background-ui);
border: 1px solid var(--text-color-10);
border-radius: 8px;
padding: 1.25rem;
margin-top: -0.25rem;
.requirements-title {
margin: 0 0 1rem 0;
font-size: 0.95rem;
font-weight: 500;
color: $text-color; color: $text-color;
font-weight: 300;
margin-bottom: 20px;
text-transform: uppercase;
} }
.link { .requirements-grid {
display: block; display: grid;
width: max-content; grid-template-columns: repeat(2, 1fr);
margin-top: 1rem; gap: 0.75rem;
@include mobile-only {
grid-template-columns: 1fr;
}
}
.requirement {
display: flex;
align-items: center;
gap: 0.5rem;
font-size: 0.9rem;
color: var(--text-color-60);
&-icon {
flex-shrink: 0;
width: 20px;
height: 20px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 50%;
background: var(--text-color-10);
font-size: 0.75rem;
font-weight: bold;
color: var(--text-color-60);
}
&-text {
line-height: 1.3;
}
&.met {
color: var(--success-color, #51cf66);
.requirement-icon {
background: var(--success-color, #51cf66);
color: white;
}
}
} }
} }
</style> </style>

View File

@@ -1,31 +1,44 @@
<template> <template>
<section> <div class="signin auth-page">
<h1>Sign in</h1> <div class="auth-content">
<div class="auth-header">
<h1 class="auth-title">Sign in</h1>
<p class="auth-subtitle">Welcome back! Please enter your credentials</p>
</div>
<form ref="formElement" class="form"> <form ref="formElement" class="auth-form">
<seasoned-input <seasoned-input
v-model="username" v-model="username"
placeholder="username" placeholder="Email address"
icon="Email" icon="Email"
type="email" type="email"
@keydown.enter="focusOnNextElement" @keydown.enter="focusOnNextElement"
/> />
<seasoned-input <seasoned-input
v-model="password" v-model="password"
placeholder="password" placeholder="Password"
icon="Keyhole" icon="Keyhole"
type="password" type="password"
@keydown.enter="submit" @keydown.enter="submit"
/> />
<seasoned-button @click="submit">sign in</seasoned-button> <seasoned-button class="auth-button" @click="submit">
</form> Sign In
<router-link class="link" to="/register" </seasoned-button>
>Don't have a user? Register here</router-link </form>
>
<seasoned-messages v-model:messages="messages" /> <div class="auth-footer">
</section> <p class="auth-footer-text">
Don't have an account?
<router-link class="auth-link" to="/register">
Register here
</router-link>
</p>
</div>
<seasoned-messages v-model:messages="messages" />
</div>
</div>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -60,43 +73,38 @@
message, message,
title, title,
type: ErrorMessageTypes.Error type: ErrorMessageTypes.Error
} as IErrorMessage);
}
function addWarningMessage(message: string, title?: string) {
messages.value.push({
message,
title,
type: ErrorMessageTypes.Warning
} as IErrorMessage);
}
function validate(): Promise<boolean> {
return new Promise((resolve, reject) => {
if (!username.value || username?.value?.length === 0) {
addWarningMessage("Missing username", "Validation error");
reject();
}
if (!password.value || password?.value?.length === 0) {
addWarningMessage("Missing password", "Validation error");
reject();
}
resolve(true);
}); });
} }
function validate() {
const errors = [];
if (username.value.length === 0) {
errors.push("Username must not be empty");
}
if (password.value.length === 0) {
errors.push("Password must not be empty");
}
if (errors.length > 0) {
errors.forEach(error => addErrorMessage(error, "Validation error"));
return Promise.reject();
}
return Promise.resolve(true);
}
function signin() { function signin() {
login(username.value, password.value, true) return login(username.value, password.value)
.then(data => { .then(response => {
if (data?.success && store.dispatch("user/login")) { store.dispatch("user/login", response.user);
router.push({ name: "profile" }); router.push("/");
} return response;
}) })
.catch(error => { .catch(error => {
if (error?.status === 401) { if (error.error === "Incorrect username or password.") {
addErrorMessage("Incorrect username or password", "Access denied"); addErrorMessage(error.error, "Authentication failed");
return null; return null;
} }
@@ -112,28 +120,13 @@
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@import "scss/variables"; @import "scss/shared-auth";
section { .signin {
padding: 1.3rem; // Password input uses monospace font
:deep(input[type="password"]),
@include tablet-min { :deep(input[type="text"][placeholder="Password"]) {
padding: 4rem; font-family: "Courier New", monospace;
}
h1 {
margin: 0;
line-height: 16px;
color: $text-color;
font-weight: 300;
margin-bottom: 20px;
text-transform: uppercase;
}
.link {
display: block;
width: max-content;
margin-top: 1rem;
} }
} }
</style> </style>

100
src/scss/shared-auth.scss Normal file
View File

@@ -0,0 +1,100 @@
// Shared styles for authentication pages (signin, register)
@import "variables";
@import "media-queries";
// Base auth page layout
.auth-page {
padding: 3rem;
max-width: 100%;
@include mobile-only {
padding: 0.75rem;
}
}
.auth-content {
max-width: 600px;
@include mobile-only {
max-width: 100%;
}
&--wide {
max-width: 700px;
}
}
.auth-header {
margin-bottom: 2.5rem;
@include mobile-only {
margin-bottom: 2rem;
}
}
.auth-title {
margin: 0 0 0.75rem 0;
font-size: 2.5rem;
font-weight: 600;
color: $text-color;
line-height: 1.2;
@include mobile-only {
font-size: 2rem;
}
}
.auth-subtitle {
margin: 0;
font-size: 1.1rem;
font-weight: 300;
color: var(--text-color-60);
line-height: 1.5;
@include mobile-only {
font-size: 1rem;
}
}
.auth-form {
display: flex;
flex-direction: column;
gap: 1.25rem;
margin-bottom: 2rem;
}
.auth-button {
margin-top: 0.5rem;
max-width: 200px;
@include mobile-only {
max-width: 100%;
}
}
.auth-footer {
padding-top: 2rem;
border-top: 1px solid var(--text-color-10);
}
.auth-footer-text {
margin: 0;
font-size: 1rem;
color: var(--text-color-60);
@include mobile-only {
font-size: 0.95rem;
}
}
.auth-link {
color: var(--highlight-color);
text-decoration: none;
font-weight: 500;
transition: opacity 0.2s;
&:hover {
opacity: 0.8;
text-decoration: underline;
}
}

View File

@@ -89,8 +89,9 @@ export function setUrlQueryParameter(parameter: string, value: string): void {
const params = new URLSearchParams(); const params = new URLSearchParams();
params.append(parameter, value); params.append(parameter, value);
const url = `${window.location.protocol}//${window.location.hostname}${window.location.port ? `:${window.location.port}` : "" const url = `${window.location.protocol}//${window.location.hostname}${
}${window.location.pathname}${params.toString().length ? `?${params}` : ""}`; window.location.port ? `:${window.location.port}` : ""
}${window.location.pathname}${params.toString().length ? `?${params}` : ""}`;
window.history.pushState({}, "search", url); window.history.pushState({}, "search", url);
} }
@@ -141,5 +142,5 @@ export function formatBytes(bytes: number): string {
const k = 1024; const k = 1024;
const sizes = ["Bytes", "KB", "MB"]; const sizes = ["Bytes", "KB", "MB"];
const i = Math.floor(Math.log(bytes) / Math.log(k)); const i = Math.floor(Math.log(bytes) / Math.log(k));
return Math.round((bytes / Math.pow(k, i)) * 100) / 100 + " " + sizes[i]; return `${Math.round((bytes / k ** i) * 100) / 100} ${sizes[i]}`;
} }