feat: implement MC domain filter proxy, API, dashboard

- proxy: asyncio TCP proxy with handshake parser, domain whitelist,
  transparent backend tunneling, SQLite logging, mtime hot reload
- api: FastAPI routes for config/domains/logs/status + restart trigger
- frontend: React + Vite NPM-style dashboard (dashboard/domains/logs/settings)
- nginx: reverse proxy for /api -> api:8000 and / -> frontend:3000
- docker-compose: full stack with shared data volume
- replace spec mc-domain-filter.md with README.md
This commit is contained in:
2026-05-20 16:39:18 +09:00
parent b45e884633
commit d10dae5cb9
33 changed files with 1872 additions and 223 deletions

301
frontend/src/styles.css Normal file
View File

@@ -0,0 +1,301 @@
:root {
color-scheme: dark light;
--bg: #0f1115;
--panel: #161a22;
--panel-2: #1d2230;
--border: #2a2f3a;
--text: #e6e8eb;
--muted: #8a93a6;
--accent: #4f8cff;
--ok: #3fb950;
--warn: #f0883e;
--danger: #f85149;
}
@media (prefers-color-scheme: light) {
:root {
--bg: #f5f6f8;
--panel: #ffffff;
--panel-2: #f0f2f5;
--border: #d8dde6;
--text: #1d2230;
--muted: #5b6478;
}
}
* {
box-sizing: border-box;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
background: var(--bg);
color: var(--text);
-webkit-font-smoothing: antialiased;
}
code {
font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
background: var(--panel-2);
padding: 2px 6px;
border-radius: 4px;
font-size: 13px;
}
.layout {
display: grid;
grid-template-columns: 220px 1fr;
min-height: 100vh;
}
.sidebar {
background: var(--panel);
border-right: 1px solid var(--border);
padding: 24px 16px;
display: flex;
flex-direction: column;
}
.logo {
font-size: 18px;
font-weight: 700;
margin-bottom: 24px;
display: flex;
align-items: center;
gap: 8px;
}
.dot {
width: 10px;
height: 10px;
border-radius: 50%;
background: var(--accent);
box-shadow: 0 0 8px var(--accent);
}
.sidebar nav {
display: flex;
flex-direction: column;
gap: 4px;
flex: 1;
}
.sidebar nav a {
color: var(--muted);
text-decoration: none;
padding: 10px 12px;
border-radius: 6px;
font-size: 14px;
font-weight: 500;
}
.sidebar nav a.active {
background: var(--bg);
color: var(--text);
}
.sidebar nav a:hover {
background: var(--panel-2);
color: var(--text);
}
.sidebar-footer {
color: var(--muted);
font-size: 12px;
padding: 8px 12px;
}
.content {
padding: 32px 40px;
max-width: 1200px;
}
h1 {
margin: 0 0 24px;
font-size: 24px;
font-weight: 700;
}
h2 {
margin: 0 0 16px;
font-size: 16px;
font-weight: 600;
}
.cards {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
}
.card {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 10px;
padding: 20px;
}
.card-title {
color: var(--muted);
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.06em;
font-weight: 600;
}
.card-value {
font-size: 26px;
font-weight: 700;
margin-top: 8px;
}
.card-value.ok { color: var(--ok); }
.card-value.warn { color: var(--warn); }
.card-value.small { font-size: 16px; font-weight: 600; }
button {
background: var(--accent);
color: white;
border: none;
padding: 8px 14px;
border-radius: 6px;
cursor: pointer;
font-weight: 500;
font-size: 14px;
}
button:hover { filter: brightness(1.1); }
button.danger { background: var(--danger); }
button.mt { margin-top: 12px; }
input,
select {
background: var(--bg);
color: var(--text);
border: 1px solid var(--border);
border-radius: 6px;
padding: 8px 10px;
font-size: 14px;
font-family: inherit;
}
input:focus,
select:focus {
outline: none;
border-color: var(--accent);
}
.form-row {
display: flex;
gap: 8px;
margin-bottom: 16px;
align-items: center;
}
.form-row input { flex: 1; }
.table {
width: 100%;
border-collapse: collapse;
background: var(--panel);
border: 1px solid var(--border);
border-radius: 10px;
overflow: hidden;
}
.table th,
.table td {
padding: 10px 14px;
text-align: left;
border-bottom: 1px solid var(--border);
font-size: 14px;
vertical-align: middle;
}
.table th {
background: var(--panel-2);
color: var(--muted);
font-weight: 600;
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.table tr:last-child td { border-bottom: none; }
.toolbar {
display: flex;
gap: 16px;
align-items: center;
margin-bottom: 16px;
flex-wrap: wrap;
}
.muted { color: var(--muted); font-size: 13px; }
.ok { color: var(--ok); font-size: 13px; }
.error {
background: rgba(248, 81, 73, 0.1);
border: 1px solid var(--danger);
color: var(--danger);
padding: 12px 14px;
border-radius: 6px;
margin-bottom: 16px;
font-size: 14px;
}
.switch {
display: inline-block;
width: 36px;
height: 20px;
position: relative;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
position: absolute;
cursor: pointer;
inset: 0;
background: var(--border);
border-radius: 20px;
transition: 0.2s;
}
.switch span:before {
content: "";
position: absolute;
height: 16px;
width: 16px;
left: 2px;
bottom: 2px;
background: white;
border-radius: 50%;
transition: 0.2s;
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span:before { transform: translateX(16px); }
section.card { margin-bottom: 16px; }
section.card label {
display: block;
margin-bottom: 12px;
font-size: 13px;
color: var(--muted);
}
section.card label input {
display: block;
margin-top: 4px;
width: 100%;
max-width: 320px;
color: var(--text);
}
section.card label.inline {
display: flex;
align-items: center;
gap: 8px;
color: var(--text);
font-size: 14px;
}
section.card label.inline input { width: auto; margin-top: 0; }
label.inline {
display: flex;
align-items: center;
gap: 8px;
font-size: 14px;
}
label.inline input { margin: 0; }
.actions {
display: flex;
align-items: center;
gap: 12px;
margin-top: 8px;
}
.pill {
display: inline-block;
padding: 2px 8px;
border-radius: 999px;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.04em;
}
.pill-allowed { background: rgba(63, 185, 80, 0.15); color: var(--ok); }
.pill-blocked { background: rgba(248, 81, 73, 0.15); color: var(--danger); }
.pill-error { background: rgba(240, 136, 62, 0.15); color: var(--warn); }