BalanceBoard - Clean release

- Docker deployment ready
- Content aggregation and filtering
- User authentication
- Polling service for updates

🤖 Generated with Claude Code
This commit is contained in:
2025-10-11 21:24:21 +00:00
commit cb894b2159
53 changed files with 13514 additions and 0 deletions

View File

@@ -0,0 +1,418 @@
{% extends "base.html" %}
{% block title %}Filter Settings - BalanceBoard{% endblock %}
{% block extra_css %}
<style>
.settings-container {
max-width: 1000px;
margin: 0 auto;
padding: 24px;
}
.settings-header {
margin-bottom: 32px;
}
.settings-header h1 {
color: var(--text-primary);
margin-bottom: 8px;
}
.settings-header p {
color: var(--text-secondary);
font-size: 1.1rem;
}
.settings-content {
background: var(--surface-color);
border-radius: 12px;
padding: 32px;
border: 1px solid var(--border-color);
}
.current-filter {
background: var(--surface-elevation-1);
border-radius: 8px;
padding: 20px;
margin-bottom: 32px;
border-left: 4px solid var(--primary-color);
}
.current-filter h3 {
color: var(--text-primary);
margin-bottom: 8px;
}
.current-filter p {
color: var(--text-secondary);
margin: 0;
line-height: 1.6;
}
.filter-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
gap: 24px;
margin-bottom: 32px;
}
.filter-card {
background: var(--surface-color);
border: 2px solid var(--border-color);
border-radius: 12px;
padding: 24px;
transition: all 0.2s ease;
cursor: pointer;
position: relative;
}
.filter-card:hover {
border-color: var(--primary-color);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.filter-card.selected {
border-color: var(--primary-color);
background: rgba(77, 182, 172, 0.05);
}
.filter-card.selected::before {
content: '✓';
position: absolute;
top: 12px;
right: 12px;
width: 24px;
height: 24px;
background: var(--primary-color);
color: white;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 14px;
}
.filter-header {
margin-bottom: 16px;
}
.filter-header h3 {
color: var(--text-primary);
margin-bottom: 8px;
font-size: 1.2rem;
}
.filter-header .filter-id {
color: var(--text-secondary);
font-size: 0.9rem;
font-family: monospace;
background: var(--surface-elevation-1);
padding: 2px 6px;
border-radius: 4px;
}
.filter-description {
color: var(--text-secondary);
line-height: 1.6;
margin-bottom: 20px;
}
.filter-details {
border-top: 1px solid var(--divider-color);
padding-top: 16px;
}
.filter-detail {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8px;
font-size: 0.9rem;
}
.filter-detail:last-child {
margin-bottom: 0;
}
.filter-detail-label {
color: var(--text-secondary);
}
.filter-detail-value {
color: var(--text-primary);
font-weight: 500;
}
.filter-rules {
margin-top: 16px;
padding-top: 16px;
border-top: 1px solid var(--divider-color);
}
.filter-rules h4 {
color: var(--text-primary);
margin-bottom: 12px;
font-size: 1rem;
}
.rule-item {
background: var(--surface-elevation-1);
border-radius: 6px;
padding: 12px;
margin-bottom: 8px;
font-size: 0.85rem;
}
.rule-item:last-child {
margin-bottom: 0;
}
.rule-type {
color: var(--primary-color);
font-weight: 500;
margin-bottom: 4px;
}
.rule-details {
color: var(--text-secondary);
font-family: monospace;
font-size: 0.8rem;
}
.form-actions {
display: flex;
gap: 12px;
padding-top: 24px;
border-top: 1px solid var(--divider-color);
}
.btn-primary {
padding: 12px 24px;
background: var(--primary-color);
color: white;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.2s ease;
}
.btn-primary:hover {
background: var(--primary-hover);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(77, 182, 172, 0.3);
}
.btn-secondary {
background: var(--surface-elevation-1);
color: var(--text-primary);
}
.btn-secondary:hover {
background: var(--surface-elevation-2);
}
.flash-messages {
margin-bottom: 24px;
}
.flash-message {
padding: 12px 16px;
border-radius: 8px;
margin-bottom: 12px;
font-size: 0.95rem;
}
.flash-message.success {
background: #d4edda;
color: #155724;
border: 1px solid #c3e6cb;
}
.flash-message.error {
background: #f8d7da;
color: #721c24;
border: 1px solid #f5c6cb;
}
.no-filters {
text-align: center;
padding: 48px;
color: var(--text-secondary);
}
.no-filters h3 {
color: var(--text-primary);
margin-bottom: 8px;
}
@media (max-width: 768px) {
.filter-grid {
grid-template-columns: 1fr;
}
.form-actions {
flex-direction: column;
}
}
</style>
{% endblock %}
{% block content %}
<div class="settings-container">
<div class="settings-header">
<h1>Filter Settings</h1>
<p>Configure content filtering and safety preferences for your feed</p>
</div>
<div class="settings-content">
<div class="flash-messages">
{% with messages = get_flashed_messages(with_categories=true) %}
{% if messages %}
{% for category, message in messages %}
<div class="flash-message {{ category }}">{{ message }}</div>
{% endfor %}
{% endif %}
{% endwith %}
</div>
{% if filter_sets %}
<div class="current-filter">
<h3>Currently Active Filter</h3>
<p>
<strong>{{ filter_sets[current_filter].description or 'No Filter' }}</strong>
{% if current_filter != 'no_filter' %}
<br><small>Filter ID: <code>{{ current_filter }}</code></small>
{% endif %}
</p>
</div>
<form method="POST">
<div class="filter-section">
<h2>Available Filters</h2>
<p>Select a content filter to apply to your feed. Filters help control what type of content you see.</p>
<div class="filter-grid">
{% for filter_id, filter_config in filter_sets.items() %}
<div class="filter-card {% if filter_id == current_filter %}selected{% endif %}"
onclick="selectFilter(this, '{{ filter_id }}')">
<input type="radio"
name="filter_set"
value="{{ filter_id }}"
{% if filter_id == current_filter %}checked{% endif %}
style="display: none;">
<div class="filter-header">
<h3>{{ filter_config.description or filter_id|title }}</h3>
<span class="filter-id">{{ filter_id }}</span>
</div>
<div class="filter-description">
{{ filter_config.description or 'No description available' }}
</div>
{% if filter_config.post_rules or filter_config.comment_rules %}
<div class="filter-details">
{% if filter_config.post_rules %}
<div class="filter-detail">
<span class="filter-detail-label">Post Rules:</span>
<span class="filter-detail-value">{{ filter_config.post_rules|length }} rules</span>
</div>
{% endif %}
{% if filter_config.comment_rules %}
<div class="filter-detail">
<span class="filter-detail-label">Comment Rules:</span>
<span class="filter-detail-value">{{ filter_config.comment_rules|length }} rules</span>
</div>
{% endif %}
{% if filter_config.comment_filter_mode %}
<div class="filter-detail">
<span class="filter-detail-label">Comment Mode:</span>
<span class="filter-detail-value">{{ filter_config.comment_filter_mode }}</span>
</div>
{% endif %}
</div>
{% endif %}
{% if filter_id != 'no_filter' and (filter_config.post_rules or filter_config.comment_rules) %}
<div class="filter-rules">
<h4>Filter Rules Preview</h4>
{% if filter_config.post_rules %}
<div class="rule-item">
<div class="rule-type">Post Rules</div>
<div class="rule-details">
{% for rule, condition in filter_config.post_rules.items() %}
{{ rule }}: {{ condition }}<br>
{% endfor %}
</div>
</div>
{% endif %}
{% if filter_config.comment_rules %}
<div class="rule-item">
<div class="rule-type">Comment Rules</div>
<div class="rule-details">
{% for rule, condition in filter_config.comment_rules.items() %}
{{ rule }}: {{ condition }}<br>
{% endfor %}
</div>
</div>
{% endif %}
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
<div class="form-actions">
<button type="submit" class="btn-primary">Save Filter Preferences</button>
<a href="{{ url_for('settings') }}" class="btn-primary btn-secondary">Cancel</a>
</div>
</form>
{% else %}
<div class="no-filters">
<h3>No Filters Available</h3>
<p>There are currently no filter sets configured. Please contact an administrator to set up content filters.</p>
</div>
{% endif %}
</div>
</div>
<script>
function selectFilter(element, filterId) {
// Remove selected class from all cards
document.querySelectorAll('.filter-card').forEach(card => {
card.classList.remove('selected');
});
// Add selected class to clicked card
element.classList.add('selected');
// Check the radio button
const radio = element.querySelector('input[type="radio"]');
radio.checked = true;
// Update current filter display
const currentFilterDiv = document.querySelector('.current-filter p');
const filterTitle = element.querySelector('h3').textContent;
currentFilterDiv.innerHTML = `<strong>${filterTitle}</strong><br><small>Filter ID: <code>${filterId}</code></small>`;
}
// Handle click on filter cards
document.querySelectorAll('.filter-card').forEach(card => {
card.addEventListener('click', function(e) {
const radio = this.querySelector('input[type="radio"]');
const filterId = radio.value;
selectFilter(this, filterId);
});
});
</script>
{% endblock %}