Files
yottob/static/style.css
Ryan Chen 1a4413ae1a Implement complete user authentication system
- Configured Flask-Login with user_loader
- Added register, login, logout routes with proper validation
- Created login.html and register.html templates with auth forms
- Updated base.html navigation to show username and conditional menu
- Added auth page styling to style.css
- Protected all routes with @login_required decorator
- Updated all routes to filter by current_user.id
- Added user ownership validation for:
  - Channels (can only view/refresh own channels)
  - Videos (can only watch/download own videos)
  - Streams (can only stream videos from own channels)
- Updated save_to_db() calls to pass current_user.id
- Improved user_loader to properly handle session management

Features:
- User registration with password confirmation
- Secure password hashing with bcrypt
- Login with "remember me" functionality
- Flash messages for all auth actions
- Redirect to requested page after login
- User-specific data isolation (multi-tenant)

Security:
- All sensitive routes require authentication
- Users can only access their own data
- Passwords hashed with bcrypt salt
- Session-based authentication via Flask-Login

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-26 14:29:31 -05:00

661 lines
11 KiB
CSS

/* Global Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--primary-color: #ff0000;
--secondary-color: #282828;
--background-color: #0f0f0f;
--card-background: #1f1f1f;
--text-primary: #ffffff;
--text-secondary: #aaaaaa;
--border-color: #303030;
--success-color: #00aa00;
--error-color: #cc0000;
--info-color: #0066cc;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
background-color: var(--background-color);
color: var(--text-primary);
line-height: 1.6;
}
/* Navigation */
.navbar {
background-color: var(--secondary-color);
border-bottom: 1px solid var(--border-color);
padding: 1rem 0;
position: sticky;
top: 0;
z-index: 1000;
}
.nav-container {
max-width: 1400px;
margin: 0 auto;
padding: 0 2rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.logo a {
color: var(--primary-color);
text-decoration: none;
font-size: 1.5rem;
font-weight: bold;
}
.nav-menu {
display: flex;
list-style: none;
gap: 2rem;
}
.nav-menu a {
color: var(--text-primary);
text-decoration: none;
padding: 0.5rem 1rem;
border-radius: 4px;
transition: background-color 0.2s;
}
.nav-menu a:hover,
.nav-menu a.active {
background-color: var(--border-color);
}
.nav-user {
display: flex;
align-items: center;
gap: 1rem;
}
.nav-user span {
color: var(--text-primary);
font-weight: 500;
}
/* Container */
.container {
max-width: 1400px;
margin: 0 auto;
padding: 2rem;
min-height: calc(100vh - 200px);
}
/* Alerts */
.alert {
padding: 1rem;
margin-bottom: 1rem;
border-radius: 4px;
border-left: 4px solid;
}
.alert-success {
background-color: rgba(0, 170, 0, 0.1);
border-color: var(--success-color);
}
.alert-error {
background-color: rgba(204, 0, 0, 0.1);
border-color: var(--error-color);
}
.alert-info {
background-color: rgba(0, 102, 204, 0.1);
border-color: var(--info-color);
}
/* Dashboard */
.dashboard-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
}
.video-count {
color: var(--text-secondary);
}
/* Video Grid */
.video-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 1.5rem;
}
.video-card {
background-color: var(--card-background);
border-radius: 8px;
overflow: hidden;
transition: transform 0.2s, box-shadow 0.2s;
}
.video-card:hover {
transform: translateY(-4px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.video-thumbnail {
position: relative;
display: block;
aspect-ratio: 16/9;
overflow: hidden;
background-color: var(--secondary-color);
}
.video-thumbnail img {
width: 100%;
height: 100%;
object-fit: cover;
}
.thumbnail-placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
color: var(--text-secondary);
}
.video-duration {
position: absolute;
bottom: 8px;
right: 8px;
}
.video-info {
padding: 1rem;
}
.video-title {
font-size: 1rem;
margin-bottom: 0.5rem;
line-height: 1.4;
}
.video-title a {
color: var(--text-primary);
text-decoration: none;
}
.video-title a:hover {
color: var(--primary-color);
}
.video-channel {
color: var(--text-secondary);
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
.video-meta {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.85rem;
}
.video-date {
color: var(--text-secondary);
}
/* Badges */
.badge {
padding: 0.25rem 0.5rem;
border-radius: 4px;
font-size: 0.75rem;
font-weight: bold;
}
.badge-success {
background-color: var(--success-color);
color: white;
}
.badge-info {
background-color: var(--info-color);
color: white;
}
.badge-error {
background-color: var(--error-color);
color: white;
}
/* Buttons */
.btn {
padding: 0.5rem 1rem;
border: none;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
display: inline-block;
font-size: 0.9rem;
transition: opacity 0.2s;
}
.btn:hover {
opacity: 0.8;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
}
.btn-secondary {
background-color: var(--border-color);
color: var(--text-primary);
}
.btn-link {
background-color: transparent;
color: var(--primary-color);
border: 1px solid var(--primary-color);
}
.btn-download {
background-color: transparent;
color: var(--primary-color);
border: none;
cursor: pointer;
font-size: 0.85rem;
padding: 0.25rem 0.5rem;
}
.btn-download:hover {
text-decoration: underline;
}
/* Empty State */
.empty-state {
text-align: center;
padding: 4rem 2rem;
}
.empty-state h3 {
margin-bottom: 1rem;
font-size: 1.5rem;
}
.empty-state p {
color: var(--text-secondary);
margin-bottom: 2rem;
}
/* Channels Page */
.page-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 2rem;
}
.channels-list {
display: flex;
flex-direction: column;
gap: 1rem;
}
.channel-card {
background-color: var(--card-background);
border-radius: 8px;
padding: 1.5rem;
display: flex;
justify-content: space-between;
align-items: center;
}
.channel-info h3 {
margin-bottom: 0.5rem;
}
.channel-url {
color: var(--text-secondary);
font-size: 0.9rem;
margin-bottom: 0.5rem;
}
.channel-url a {
color: var(--text-secondary);
text-decoration: none;
}
.channel-url a:hover {
color: var(--primary-color);
}
.channel-meta {
display: flex;
gap: 2rem;
font-size: 0.85rem;
color: var(--text-secondary);
}
.channel-actions {
display: flex;
gap: 1rem;
}
/* Form */
.form-container {
max-width: 600px;
margin: 0 auto;
}
.channel-form {
background-color: var(--card-background);
padding: 2rem;
border-radius: 8px;
}
.form-group {
margin-bottom: 1.5rem;
}
.form-group label {
display: block;
margin-bottom: 0.5rem;
font-weight: 500;
}
.form-input {
width: 100%;
padding: 0.75rem;
background-color: var(--secondary-color);
border: 1px solid var(--border-color);
border-radius: 4px;
color: var(--text-primary);
font-size: 1rem;
}
.form-input:focus {
outline: none;
border-color: var(--primary-color);
}
.form-help {
display: block;
margin-top: 0.5rem;
color: var(--text-secondary);
font-size: 0.85rem;
}
.form-actions {
display: flex;
gap: 1rem;
}
/* Help Section */
.help-section {
max-width: 800px;
margin: 3rem auto 0;
padding: 2rem;
background-color: var(--card-background);
border-radius: 8px;
}
.help-section h3,
.help-section h4 {
margin-bottom: 1rem;
}
.help-section ol,
.help-section ul {
margin-left: 2rem;
margin-bottom: 1rem;
}
.help-section li {
margin-bottom: 0.5rem;
}
.help-section code {
background-color: var(--secondary-color);
padding: 0.2rem 0.4rem;
border-radius: 3px;
font-family: 'Courier New', monospace;
font-size: 0.9rem;
}
/* Watch Page */
.watch-page {
max-width: 1200px;
margin: 0 auto;
}
.video-player-container {
width: 100%;
aspect-ratio: 16/9;
background-color: var(--secondary-color);
border-radius: 8px;
overflow: hidden;
margin-bottom: 1.5rem;
}
.video-player {
width: 100%;
height: 100%;
}
.video-placeholder {
width: 100%;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
text-align: center;
}
.placeholder-content {
padding: 2rem;
}
.placeholder-thumbnail {
max-width: 100%;
max-height: 300px;
margin-bottom: 1rem;
border-radius: 8px;
}
.video-details {
background-color: var(--card-background);
padding: 2rem;
border-radius: 8px;
}
.video-details .video-title {
font-size: 1.5rem;
margin-bottom: 1rem;
}
.video-metadata {
display: flex;
justify-content: space-between;
padding-bottom: 1rem;
margin-bottom: 1rem;
border-bottom: 1px solid var(--border-color);
}
.channel-info h3 {
margin-bottom: 0.5rem;
}
.channel-link {
color: var(--text-secondary);
text-decoration: none;
font-size: 0.9rem;
}
.channel-link:hover {
color: var(--primary-color);
}
.video-stats {
display: flex;
flex-direction: column;
align-items: flex-end;
font-size: 0.9rem;
color: var(--text-secondary);
}
.video-description {
margin-bottom: 1.5rem;
}
.video-description h4 {
margin-bottom: 0.5rem;
}
.video-description p {
color: var(--text-secondary);
white-space: pre-wrap;
}
.video-links {
display: flex;
gap: 1rem;
}
.back-link {
margin-top: 2rem;
}
.back-link a {
color: var(--text-secondary);
text-decoration: none;
}
.back-link a:hover {
color: var(--primary-color);
}
/* Auth Pages */
.auth-page {
display: flex;
justify-content: center;
align-items: center;
min-height: calc(100vh - 200px);
padding: 2rem;
}
.auth-container {
max-width: 450px;
width: 100%;
background-color: var(--card-background);
padding: 3rem;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.auth-container h2 {
margin-bottom: 0.5rem;
text-align: center;
}
.auth-subtitle {
text-align: center;
color: var(--text-secondary);
margin-bottom: 2rem;
}
.auth-form {
margin-bottom: 1.5rem;
}
.checkbox-group {
display: flex;
align-items: center;
}
.checkbox-label {
display: flex;
align-items: center;
cursor: pointer;
color: var(--text-secondary);
}
.checkbox-label input[type="checkbox"] {
margin-right: 0.5rem;
cursor: pointer;
}
.btn-block {
width: 100%;
}
.auth-footer {
text-align: center;
padding-top: 1.5rem;
border-top: 1px solid var(--border-color);
}
.auth-footer p {
color: var(--text-secondary);
margin: 0;
}
.auth-footer a {
color: var(--primary-color);
text-decoration: none;
}
.auth-footer a:hover {
text-decoration: underline;
}
/* Footer */
.footer {
background-color: var(--secondary-color);
border-top: 1px solid var(--border-color);
padding: 2rem;
text-align: center;
color: var(--text-secondary);
}
/* Responsive */
@media (max-width: 768px) {
.nav-container {
flex-direction: column;
gap: 1rem;
}
.video-grid {
grid-template-columns: 1fr;
}
.channel-card {
flex-direction: column;
gap: 1rem;
}
.channel-actions {
width: 100%;
flex-direction: column;
}
.page-header {
flex-direction: column;
gap: 1rem;
align-items: flex-start;
}
.video-metadata {
flex-direction: column;
gap: 1rem;
}
.video-stats {
align-items: flex-start;
}
}