Initial scaffold: Flask webui + APScheduler + Playwright automation for MassPrice rule scheduling
Some checks failed
Deploy / deploy (push) Failing after 51s

Drives massprice.tcgplayer.com's Run Rule action per-rule on a
user-configured schedule (multiple times/day, day-of-week toggles),
replacing MassPrice's native scheduler (capped at 15 schedules
account-wide, one run/day, with observed clock drift). Deployed via
Forgejo push-to-deploy on Unraid, matching arr-summary/card-grader.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01H6TgffxTvYhqxykAbVQg2v
This commit is contained in:
Barely Removable 2026-08-31 17:31:53 -07:00
commit 2fdb9be9b9
19 changed files with 1197 additions and 0 deletions

26
templates/_shell.html Normal file
View file

@ -0,0 +1,26 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{% block title %}MassPrice Scheduler{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
<header class="topbar">
<div class="brand">MassPrice <span>Scheduler</span></div>
{% if session.get('authenticated') %}
<nav>
<a href="{{ url_for('dashboard') }}" class="{{ 'active' if request.endpoint == 'dashboard' else '' }}">Dashboard</a>
<a href="{{ url_for('activity') }}" class="{{ 'active' if request.endpoint == 'activity' else '' }}">Activity</a>
<a href="{{ url_for('logout') }}">Log Out</a>
</nav>
{% endif %}
</header>
<main>
{% block content %}{% endblock %}
</main>
<footer>v{{ app_version }} &middot; {{ app_version_date }}</footer>
{% block scripts %}{% endblock %}
</body>
</html>

24
templates/activity.html Normal file
View file

@ -0,0 +1,24 @@
{% extends "_shell.html" %}
{% block title %}Activity &middot; MassPrice Scheduler{% endblock %}
{% block content %}
<h1>Activity</h1>
{% if not history %}
<p class="empty-state">No runs recorded yet.</p>
{% else %}
<table class="activity-table">
<thead>
<tr><th>Time</th><th>Rule</th><th>Status</th><th>Message</th></tr>
</thead>
<tbody>
{% for entry in history %}
<tr class="status-row-{{ entry.status }}">
<td>{{ entry.timestamp }}</td>
<td>{{ entry.rule_name or entry.rule_id }}</td>
<td><span class="status-dot status-{{ entry.status }}"></span>{{ entry.status }}</td>
<td class="muted">{{ entry.message }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
{% endblock %}

68
templates/dashboard.html Normal file
View file

@ -0,0 +1,68 @@
{% extends "_shell.html" %}
{% block title %}Dashboard &middot; MassPrice Scheduler{% endblock %}
{% block content %}
<div class="page-header">
<h1>Rules</h1>
<div class="page-header-meta">
{% if rules_updated_at %}<span class="muted">Rules last synced {{ rules_updated_at }}</span>{% endif %}
<button id="refresh-rules" class="btn btn-secondary">Refresh Rules</button>
</div>
</div>
{% if not rules %}
<p class="empty-state">No rules loaded yet. Click "Refresh Rules" to pull the current rule list from MassPrice.</p>
{% endif %}
<div class="rule-grid">
{% for rule in rules %}
<div class="rule-card" data-rule-id="{{ rule.id }}">
<div class="rule-card-header">
<h2>{{ rule.name }}</h2>
<label class="switch" title="Enabled">
<input type="checkbox" class="rule-enabled" {{ 'checked' if rule.enabled else '' }}>
<span class="slider"></span>
</label>
</div>
<div class="rule-last-run">
{% if rule.last_run %}
<span class="status-dot status-{{ rule.last_run.status }}"></span>
Last run {{ rule.last_run.timestamp }} &mdash; {{ rule.last_run.status }}
{% if rule.last_run.status == 'failure' %}<div class="muted small">{{ rule.last_run.message }}</div>{% endif %}
{% else %}
<span class="muted">No runs yet</span>
{% endif %}
</div>
<ul class="schedule-list">
{% for entry in rule.schedules %}
<li class="schedule-chip">
<span class="chip-time">{{ entry.time }}</span>
<span class="chip-days">{{ entry.days | join(' ') }}</span>
<button type="button" class="chip-remove" title="Remove">&times;</button>
</li>
{% endfor %}
</ul>
<div class="schedule-add">
<div class="schedule-add-row">
<input type="time" class="new-time" value="06:00">
<button type="button" class="btn btn-small add-schedule">Add Time</button>
</div>
<div class="day-toggles">
{% for d in days %}
<button type="button" class="day-toggle" data-day="{{ d }}">{{ day_labels[d] }}</button>
{% endfor %}
</div>
</div>
<div class="rule-actions">
<button type="button" class="btn btn-primary run-now">Run Now</button>
</div>
</div>
{% endfor %}
</div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/app.js') }}"></script>
{% endblock %}

13
templates/login.html Normal file
View file

@ -0,0 +1,13 @@
{% extends "_shell.html" %}
{% block title %}Log In &middot; MassPrice Scheduler{% endblock %}
{% block content %}
<div class="login-card">
<h1>MassPrice Scheduler</h1>
{% if error %}<p class="error">{{ error }}</p>{% endif %}
<form method="post">
<label for="password">Password</label>
<input type="password" id="password" name="password" autofocus required>
<button type="submit" class="btn btn-primary">Log In</button>
</form>
</div>
{% endblock %}