Inital commit

This commit is contained in:
Terncode committed 2026-11-24 22:05:11 +01:00
commit a6af7dbfcb
114 files changed
+27520

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('./partials/head'); -%>
<title><%= title %></title>
</head>
<body>
<div class="container">
<div class="center">
<div class="title-img">
<img src="/assets/images/avatar.webp" alt="<%= title %>">
</div>
</div>
<div class="center">
<h1>404 Not found</h1>
<%- include('./partials/back-link', {
href: t('/'),
label: 'Back home',
useHistoryBack: true
}); -%>
</div>
<% if (tracer) {%>
<script src="/scripts/<%= tracer.scriptId %>.js"> </script>
<% } %>
</body>
</html>
+114
View File
@@ -0,0 +1,114 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Access codes</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<div>
<strong>Server time:</strong> <%= new Date().toLocaleString() %>
</div>
<section>
<h2>Add access code</h2>
<form action="<%= endpoint %>/access-code/add" method="post" class="editor-form editor-form--stacked">
<input type="text" name="data" placeholder="any..." required>
<input type="number" name="ipLimit" min="1" placeholder="IP Limit" required>
<select name="type" id="typeSelect" required>
<option value="both">Both</option>
<option value="quota">Quota</option>
<option value="time">Time</option>
</select>
<div>
<label>Expires (server time)</label>
<input type="datetime-local" name="expires" required>
</div>
<div id="timeFields" class="hidden">
<label>Time (seconds)</label>
<input type="number" name="time" min="1">
</div>
<div id="quotaFields">
<label>Quota</label>
<input type="number" name="quota" min="1">
</div>
<button type="submit">Add</button>
</form>
</section>
<% for (var i = 0; i < codes.length; i++) { %>
<section>
<form method="post" class="editor-form">
<input type="hidden" name="id" value="<%= codes[i].id %>">
<div>
<label>Access code:</label>
<input type="text" name="accessCode" value="<%= codes[i].accessCode%>" readonly>
</div>
<div>
<label>Data:</label>
<input type="text" name="data" value="<%= codes[i].data%>" readonly>
</div>
<div>
<label>Expires (server time)</label>
<input type="datetime-local" name="expires" value="<%= codes[i].expires.toISOString().slice(0, 16)%>" readonly>
</div>
<% if (codes[i].type === 'both' || codes[i].type === 'time') {%>
<div>
<label>Time (seconds)</label>
<input type="number" name="time" min="1" value="<%= codes[i].expiresAfterActivation%>" readonly>
</div>
<% } %>
<% if (codes[i].type === 'both' || codes[i].type === 'quota') {%>
<div>
<label>Quota</label>
<input type="number" name="quota" min="1" value="<%= codes[i].quota %>" readonly>
</div>
<% } %>
</form>
<form action="<%= endpoint %>/access-code/revoke" method="post" class="editor-form">
<input type="hidden" name="id" value="<%= codes[i].id %>">
<button type="submit" class="delete">Revoke</button>
</form>
</section>
<% } %>
</div>
<%- include('../footer'); -%>
<script>
const typeSelect = document.getElementById('typeSelect');
const timeFields = document.getElementById('timeFields');
const quotaFields = document.getElementById('quotaFields');
function toggleFields() {
if (typeSelect.value === 'time') {
timeFields.classList.remove('hidden');
quotaFields.classList.add('hidden');
} else if (typeSelect.value === 'quota') {
timeFields.classList.add('hidden');
quotaFields.classList.remove('hidden');
} else {
timeFields.classList.remove('hidden');
quotaFields.classList.remove('hidden');
}
}
typeSelect.addEventListener('change', toggleFields);
toggleFields();
</script>
</body>
</html>
+326
View File
@@ -0,0 +1,326 @@
<%
const palette = ['#cee5ff', '#39a8ff', '#ffcf5f', '#ff7a7a', '#c08bff', '#5ff0d0', '#ff9f43', '#8fbf00', '#ff5fd2', '#7a8cff'];
const flag = (cc) => {
if (!cc || cc.length !== 2) { return ''; }
return String.fromCodePoint(...[...cc.toUpperCase()].map(c => 0x1F1E6 + c.charCodeAt(0) - 65));
};
const maxOf = (arr, key) => arr.reduce((m, e) => Math.max(m, e[key]), 0) || 1;
const urlMax = maxOf(topUrls, 'count');
const countryMax = maxOf(topCountries, 'count');
const providerMax = maxOf(topProviders, 'count');
const browserMax = maxOf(browsers, 'count');
const osMax = maxOf(operatingSystems, 'count');
const deviceMax = maxOf(devices, 'count');
const dailyMax = maxOf(daily, 'count');
const hourMax = maxOf(hourly, 'count');
const dailyTotal = daily.reduce((s, d) => s + d.count, 0);
const hourlyTotal = hourly.reduce((s, h) => s + h.count, 0);
const totalCountry = topCountries.reduce((s, c) => s + c.count, 0) || 1;
let acc = 0;
const stops = [];
topCountries.slice(0, 6).forEach((c, i) => {
const start = (acc / totalCountry) * 360;
acc += c.count;
const end = (acc / totalCountry) * 360;
stops.push(`${palette[i]} ${start}deg ${end}deg`);
});
if (acc < totalCountry) {
stops.push(`#333 ${(acc / totalCountry) * 360}deg 360deg`);
}
const conic = stops.length ? `conic-gradient(${stops.join(', ')})` : 'var(--admin-surface-3)';
const dowLabels = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const fmtRange = (d) => d ? new Date(d).toLocaleString() : 'n/a';
%>
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-base'); -%>
<title>Admin - Analytics</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="admin-shell admin-shell--wide">
<div class="page-head">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<h1>Analytics</h1>
<div class="spacer"></div>
<div class="range-tabs">
<a href="?range=7d" class="<%= range === '7d' ? 'active' : '' %>">7 days</a>
<a href="?range=30d" class="<%= range === '30d' ? 'active' : '' %>">30 days</a>
<a href="?range=90d" class="<%= range === '90d' ? 'active' : '' %>">90 days</a>
<a href="?range=all" class="<%= range === 'all' ? 'active' : '' %>">All time</a>
</div>
</div>
<form class="toolbar" method="get">
<input type="hidden" name="range" value="custom">
<label class="sub">From
<input type="date" name="start" value="<%= from %>">
</label>
<label class="sub">To
<input type="date" name="end" value="<%= to %>">
</label>
<button class="btn" type="submit">Apply</button>
</form>
<div class="stat-grid">
<div class="stat-card">
<span class="kpi"><%= kpi.totalVisits.toLocaleString() %></span>
<span class="label">Total visits</span>
<span class="foot">First: <%= fmtRange(span.first) %></span>
</div>
<div class="stat-card">
<span class="kpi"><%= kpi.uniqueIps.toLocaleString() %></span>
<span class="label">Unique visitors</span>
<span class="foot">by IP address</span>
</div>
<div class="stat-card">
<span class="kpi"><%= kpi.uniqueUrls.toLocaleString() %></span>
<span class="label">Distinct pages</span>
<span class="foot">Last visit: <%= fmtRange(span.last) %></span>
</div>
<div class="stat-card">
<span class="kpi"><%= kpi.countries.toLocaleString() %></span>
<span class="label">Countries</span>
<span class="foot">geolocated sources</span>
</div>
<div class="stat-card">
<span class="kpi"><%= peakHour.count.toLocaleString() %></span>
<span class="label">Peak hour</span>
<span class="foot"><%= String(peakHour.hour).padStart(2, '0') %>:00</span>
</div>
<div class="stat-card">
<span class="kpi"><%= busiestDay.count.toLocaleString() %></span>
<span class="label">Busiest day</span>
<span class="foot"><%= busiestDay.date %></span>
</div>
</div>
<div class="grid grid-2">
<section class="card">
<h2>Traffic over time <span class="hint">visits per day</span></h2>
<% if (dailyTotal > 0) { %>
<div class="vchart">
<% daily.forEach(d => { %>
<div class="vbar" title="<%= d.date %>: <%= d.count %> visits">
<span class="vtip"><%= d.date %> · <%= d.count %></span>
<span class="vfill" style="height: <%= Math.round((d.count / dailyMax) * 100) %>%"></span>
<span class="vlabel"><%= d.label %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No visits recorded in this period.</p>
<% } %>
</section>
<section class="card">
<h2>Visits by hour <span class="hint">server time</span></h2>
<% if (hourlyTotal > 0) { %>
<div class="vchart">
<% hourly.forEach(h => { %>
<div class="vbar" title="<%= String(h.hour).padStart(2, '0') %>:00: <%= h.count %> visits">
<span class="vtip"><%= String(h.hour).padStart(2, '0') %>:00 · <%= h.count %></span>
<span class="vfill" style="height: <%= Math.round((h.count / hourMax) * 100) %>%"></span>
<span class="vlabel"><%= h.hour %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No visits recorded in this period.</p>
<% } %>
</section>
</div>
<div class="grid grid-2">
<section class="card">
<h2>Most visited pages</h2>
<% if (topUrls.length) { %>
<div class="bars">
<% topUrls.forEach(u => { %>
<div class="bar-row">
<span class="bar-label" title="<%= u.url %>"><%= u.url %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((u.count / urlMax) * 100) %>%"></span></span>
<span class="bar-value"><%= u.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No page data yet.</p>
<% } %>
</section>
<section class="card">
<h2>Top countries</h2>
<% if (topCountries.length) { %>
<div class="donut-wrap">
<div class="donut" style="background: <%= conic %>;">
<div class="donut-center">
<strong><%= kpi.countries %></strong>
<span>countries</span>
</div>
</div>
<div class="legend">
<% topCountries.slice(0, 6).forEach((c, i) => { %>
<div class="lg-item">
<span class="swatch" style="background: <%= palette[i] %>;"></span>
<span class="flag"><%= flag(c.code) %></span>
<span><%= c.country %></span>
<span class="lg-val"><%= c.count %></span>
</div>
<% }) %>
<% if (topCountries.length > 6) { %>
<div class="lg-item">
<span class="swatch" style="background: #333;"></span>
<span>Other</span>
<span class="lg-val"><%= topCountries.slice(6).reduce((s, c) => s + c.count, 0) %></span>
</div>
<% } %>
</div>
</div>
<% } else { %>
<p class="none">No geolocation data yet.</p>
<% } %>
</section>
</div>
<div class="grid grid-2">
<section class="card">
<h2>Top providers / ISPs</h2>
<% if (topProviders.length) { %>
<div class="bars">
<% topProviders.forEach(p => { %>
<div class="bar-row">
<span class="bar-label" title="<%= p.provider %>"><%= p.provider %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((p.count / providerMax) * 100) %>%"></span></span>
<span class="bar-value"><%= p.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No provider data yet.</p>
<% } %>
</section>
<section class="card">
<h2>Browsers</h2>
<% if (browsers.length) { %>
<div class="bars">
<% browsers.forEach(b => { %>
<div class="bar-row">
<span class="bar-label"><%= b.name %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((b.count / browserMax) * 100) %>%"></span></span>
<span class="bar-value"><%= b.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No user agent data yet.</p>
<% } %>
</section>
</div>
<div class="grid grid-2">
<section class="card">
<h2>Operating systems</h2>
<% if (operatingSystems.length) { %>
<div class="bars">
<% operatingSystems.forEach(o => { %>
<div class="bar-row">
<span class="bar-label"><%= o.name %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((o.count / osMax) * 100) %>%"></span></span>
<span class="bar-value"><%= o.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No OS data yet.</p>
<% } %>
</section>
<section class="card">
<h2>Devices</h2>
<% if (devices.length) { %>
<div class="bars">
<% devices.forEach(d => { %>
<div class="bar-row">
<span class="bar-label"><%= d.name %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((d.count / deviceMax) * 100) %>%"></span></span>
<span class="bar-value"><%= d.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No device data yet.</p>
<% } %>
</section>
</div>
<section class="card">
<h2>Activity heatmap <span class="hint">day of week × hour, darker = busier</span></h2>
<% if (heatMax > 0) { %>
<div class="heatmap">
<span class="hm-row-label"></span>
<% for (let h = 0; h < 24; h++) { %>
<span class="hm-col-label"><%= h %></span>
<% } %>
<% for (let d = 0; d < 7; d++) { %>
<span class="hm-row-label"><%= dowLabels[d] %></span>
<% for (let h = 0; h < 24; h++) { const v = heatmap[d][h]; const a = heatMax ? v / heatMax : 0; %>
<span class="hm-cell" title="<%= dowLabels[d] %> <%= String(h).padStart(2, '0') %>:00 · <%= v %> visits"
style="background: <%= v ? `rgba(206, 229, 255, ${0.08 + a * 0.85})` : '' %>;"></span>
<% } %>
<% } %>
</div>
<% } else { %>
<p class="none">No activity to display yet.</p>
<% } %>
</section>
<section class="card">
<h2>Top visitors</h2>
<div class="table-wrap">
<table class="admin-table">
<thead>
<tr>
<th>IP</th>
<th>Location</th>
<th>ISP</th>
<th>Visits</th>
<th></th>
</tr>
</thead>
<tbody>
<% topIps.forEach(ip => { %>
<tr>
<td><a class="ip-link" style="color:var(--accent);font-weight:600;font-family:'Courier New',monospace;" href="<%= endpoint %>/stalker/<%= ip.id %>"><%= ip.ip %></a></td>
<td>
<% if (ip.info.country) { %>
<span class="flag"><%= flag(ip.info.countryCode) %></span>
<%= [ip.info.city, ip.info.country].filter(Boolean).join(', ') %>
<% } else { %>
<span class="none">Unknown</span>
<% } %>
</td>
<td><%= ip.info.isp || ip.info.org || '—' %></td>
<td class="num"><%= ip.count %></td>
<td><a class="btn" href="<%= endpoint %>/stalker/<%= ip.id %>">Details</a></td>
</tr>
<% }) %>
<% if (!topIps.length) { %>
<tr><td colspan="5" class="empty">No visitors yet.</td></tr>
<% } %>
</tbody>
</table>
</div>
</section>
</div>
<%- include('../footer'); -%>
</body>
</html>
+53
View File
@@ -0,0 +1,53 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Artist editor</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h2>Add Artist</h2>
<form action="<%= endpoint %>/artists/add" method="post" class="editor-form editor-form--compact">
<input type="text" name="name" placeholder="Name" required>
<input type="text" name="tag" placeholder="Tag" required>
<textarea type="text" name="urls" placeholder="urls"></textarea>
<button type="submit">Add</button>
</form>
</section>
<% for (var i = 0; i < artists.length; i++) { %>
<section>
<form action="<%= endpoint %>/artists/edit" method="post" class="editor-form editor-form--compact">
<input type="hidden" name="id" value="<%= artists[i].id %>">
<input type="text" name="name" value="<%= artists[i].name %>" placeholder="Name" required>
<input type="text" name="tag" value="<%= artists[i].tag %>" placeholder="Tag" required>
<textarea type="text" name="urls" placeholder="urls"><%= artists[i].urls.join(', ') %></textarea>
<button type="submit">Save</button>
</form>
<form action="<%= endpoint %>/artists/delete" method="post" class="editor-form editor-form--compact">
<input type="hidden" name="id" value="<%= artists[i].id %>">
<button type="submit" style="color: var(--admin-danger); border-color: var(--admin-danger);">Delete</button>
</form>
</section>
<% } %>
</div>
<script>
<%- include('../partials/icon-select-script'); -%>
</script>
<%- include('../footer'); -%>
</body>
</html>
+104
View File
@@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Badge editor</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h2>Add badge</h2>
<form action="<%= endpoint %>/badge/add" method="post" class="editor-form editor-form--compact">
<input type="text" name="name" placeholder="Name" required>
<div class="icon-select">
<input type="hidden" name="icon" value="">
<button type="button" class="icon-select-trigger">
<span style="color:#bbb;">None</span>
</button>
<div class="icon-options">
<div class="icon-option" data-id="" data-name="">
<span style="color:#bbb;">None</span>
</div>
<% icons.forEach(icon => { %>
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
<span><%= icon.alt %></span>
</div>
<% }) %>
</div>
</div>
<button type="submit">Add</button>
</form>
</section>
<% for (var i = 0; i < badges.length; i++) { %>
<section>
<form action="<%= endpoint %>/badge/edit" method="post" class="editor-form editor-form--compact">
<input type="hidden" name="id" value="<%= i %>">
<input type="text" name="name" value="<%= badges[i].name %>" placeholder="Name" required>
<div class="icon-select">
<input type="hidden" name="icon" value="<%= badges[i].iconId ?? '' %>">
<button type="button" class="icon-select-trigger">
<% if (badges[i].iconName) { %>
<img src="/assets/images/<%= badges[i].iconName %>" alt="">
<% } else { %>
<span style="color:#bbb;">None</span>
<% } %>
</button>
<div class="icon-options">
<div class="icon-option" data-id="" data-name="">
<span style="color:#bbb;">None</span>
</div>
<% icons.forEach(icon => { %>
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
<span><%= icon.alt %></span>
</div>
<% }) %>
</div>
</div>
<button type="submit">Save</button>
</form>
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
<form action="<%= endpoint %>/badge/delete" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" style="border-color:var(--admin-danger);color:var(--admin-danger);">Delete</button>
</form>
<form action="<%= endpoint %>/badge/move/up" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" aria-label="Move up" title="Move up">↑</button>
</form>
<form action="<%= endpoint %>/badge/move/down" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" aria-label="Move down" title="Move down">↓</button>
</form>
</div>
<% if (badges[i].icon) { %>
<img class="preview" src="<%= badges[i].icon %>" alt="<%= badges[i].icon %>">
<% } else { %>
<span class="preview" style="color:#bbb;">No image</span> <% }
%>
</section>
<% } %>
</div>
<script>
<%- include('../partials/icon-select-script'); -%>
</script>
<%- include('../footer'); -%>
</body>
</html>
+83
View File
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-base'); -%>
<title>Admin - Dashboard</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="admin-shell">
<div class="page-head">
<h1>The dashboard</h1>
<div class="spacer"></div>
<a class="btn" href="<%= endpoint %>/logout">Logout</a>
</div>
<div class="stat-grid">
<div class="stat-card">
<span class="kpi"><%= stats.visits.toLocaleString() %></span>
<span class="label">Total visits</span>
</div>
<div class="stat-card">
<span class="kpi"><%= stats.visitors.toLocaleString() %></span>
<span class="label">Tracked visitors</span>
</div>
<div class="stat-card">
<span class="kpi"><%= stats.countries.toLocaleString() %></span>
<span class="label">Countries</span>
</div>
<div class="stat-card">
<span class="kpi"><%= stats.last24h.toLocaleString() %></span>
<span class="label">Visits (24h)</span>
</div>
</div>
<a class="card" href="<%= endpoint %>/analytics" style="display:flex;align-items:center;gap:1rem;text-decoration:none;">
<span class="ico" style="width:14px;height:14px;border:2px solid var(--accent);border-radius:0;transform:rotate(45deg);flex:0 0 auto;"></span>
<span style="display:flex;flex-direction:column;gap:0.2rem;">
<strong style="color:var(--accent);font-size:1.05rem;">Open Analytics</strong>
<span class="sub">Traffic over time, most visited pages, countries, providers, browsers and activity heatmap.</span>
</span>
</a>
<div class="admin-section-title">Content</div>
<div class="admin-nav">
<a href="<%= endpoint %>/meta-editor"><span class="ico"></span> Metadata</a>
<a href="<%= endpoint %>/meta-editor#page-font"><span class="ico"></span> Page font</a>
<a href="<%= endpoint %>/icon-editor"><span class="ico"></span> Icons</a>
<a href="<%= endpoint %>/link-editor"><span class="ico"></span> Links</a>
<a href="<%= endpoint %>/project-editor"><span class="ico"></span> Projects</a>
<a href="<%= endpoint %>/badge-editor"><span class="ico"></span> Badges</a>
<a href="<%= endpoint %>/redirect-editor"><span class="ico"></span> Redirects</a>
</div>
<div class="admin-section-title">Media</div>
<div class="admin-nav">
<a href="<%= endpoint %>/gallery-editor"><span class="ico"></span> Gallery</a>
<a href="<%= endpoint %>/storage-editor"><span class="ico"></span> Files</a>
<a href="<%= endpoint %>/artist-editor"><span class="ico"></span> Artists</a>
</div>
<div class="admin-section-title">Access &amp; analytics</div>
<div class="admin-nav">
<a href="<%= endpoint %>/access-code-editor"><span class="ico"></span> Access codes</a>
<a href="<%= endpoint %>/stalker"><span class="ico"></span> IP tracker</a>
<a href="<%= endpoint %>/stalker-map"><span class="ico"></span> IP map</a>
<a href="<%= endpoint %>/analytics"><span class="ico"></span> Analytics</a>
</div>
<% if (links.length) { %>
<div class="admin-section-title">Traffic reports</div>
<div class="admin-nav">
<% links.forEach(link => { %>
<a href="<%= link %>"><span class="ico"></span> <%= link %></a>
<% }) %>
</div>
<% } %>
</div>
<%- include('../footer'); -%>
</body>
</html>
+198
View File
@@ -0,0 +1,198 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Add Media</title>
<style>
.upload-progress {
display: none;
margin-top: 0.5rem;
}
.upload-progress.active {
display: block;
}
.progress-bar-container {
width: 100%;
height: 28px;
background: rgba(0, 0, 0, 0.5);
border: 1px solid var(--border-muted);
border-radius: 0;
overflow: hidden;
position: relative;
}
.progress-bar {
height: 100%;
width: 0%;
background: var(--accent);
transition: width 0.3s ease;
}
.progress-text {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.85rem;
font-weight: bold;
color: var(--text);
text-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}
.progress-status {
margin-top: 0.4rem;
font-size: 0.85rem;
color: var(--text-muted);
}
.progress-status.error {
color: var(--danger);
}
</style>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h1>Add New Media</h1>
<form id="uploadForm" action="<%= endpoint %>/gallery/upload" method="post" enctype="multipart/form-data" class="editor-form editor-form--stacked">
<label>
Name
<input type="text" name="name" required>
</label>
<label>
Description
<textarea name="description" rows="3"></textarea>
</label>
<label>
Artists (comma-separated)
<input type="text" name="artists" class="multi-input">
</label>
<label>
Sources (comma-separated)
<input type="text" name="sources" class="multi-input">
</label>
<label>
Tags (comma-separated)
<input type="text" name="tags" class="multi-input">
</label>
<label>
Access Codes (comma-separated)
<input type="text" name="accessCodes" class="multi-input">
</label>
<label>
Created Date
<input type="date" name="created">
</label>
<label>
Main File (Image, Video, or Animated Image)
<input type="file" name="image" accept="image/*,video/*" required>
</label>
<div class="upload-progress" id="uploadProgress">
<div class="progress-bar-container">
<div class="progress-bar" id="progressBar"></div>
<div class="progress-text" id="progressText">0%</div>
</div>
<div class="progress-status" id="progressStatus">Uploading...</div>
</div>
<button type="submit" id="submitBtn">Add Media</button>
</form>
</section>
</div>
<%- include('../../footer'); -%>
<script>
document.getElementById('uploadForm').addEventListener('submit', async function(e) {
e.preventDefault();
const form = this;
const submitBtn = document.getElementById('submitBtn');
const progressContainer = document.getElementById('uploadProgress');
const progressBar = document.getElementById('progressBar');
const progressText = document.getElementById('progressText');
const progressStatus = document.getElementById('progressStatus');
submitBtn.disabled = true;
submitBtn.textContent = 'Uploading...';
progressContainer.classList.add('active');
progressBar.style.width = '0%';
progressText.textContent = '0%';
progressStatus.className = 'progress-status';
progressStatus.textContent = 'Uploading file to server...';
try {
// Step 1: Upload file
const formData = new FormData(form);
const uploadRes = await fetch(form.action, {
method: 'POST',
body: formData,
credentials: 'include'
});
if (!uploadRes.ok) {
throw new Error('Upload failed');
}
const { jobId } = await uploadRes.json();
progressBar.style.width = '10%';
progressText.textContent = '10%';
progressStatus.textContent = 'File received. Processing...';
// Step 2: Connect to SSE for progress
const evtSource = new EventSource(`<%= endpoint %>/gallery/progress/${jobId}`);
evtSource.onmessage = function(event) {
const data = JSON.parse(event.data);
progressBar.style.width = data.progress + '%';
progressText.textContent = data.progress + '%';
progressStatus.textContent = data.message;
if (data.status === 'done') {
evtSource.close();
progressBar.style.width = '100%';
progressText.textContent = '100%';
progressStatus.textContent = 'Upload complete!';
window.location.href = data.redirectUrl;
} else if (data.status === 'error') {
evtSource.close();
progressStatus.className = 'progress-status error';
progressStatus.textContent = 'Error: ' + (data.error || 'Unknown error');
submitBtn.disabled = false;
submitBtn.textContent = 'Add Media';
}
};
evtSource.onerror = function() {
evtSource.close();
progressStatus.className = 'progress-status error';
progressStatus.textContent = 'Connection lost. Please try again.';
submitBtn.disabled = false;
submitBtn.textContent = 'Add Media';
};
} catch (err) {
progressStatus.className = 'progress-status error';
progressStatus.textContent = 'Upload failed: ' + err.message;
submitBtn.disabled = false;
submitBtn.textContent = 'Add Media';
}
});
</script>
</body>
</html>
+88
View File
@@ -0,0 +1,88 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Edit Image</title>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<% if (image) { %>
<section>
<h1>Edit image</h1>
<form action="<%= endpoint %>/gallery/edit" method="post" class="editor-form editor-form--stacked">
<% if (image.isVideo) { %>
<video class="editor-preview-img" src="/gallery/thumbnail/<%= image.thumbnailName %>" alt="<%= image.name %>" muted playsinline loop></video>
<% } else { %>
<img class="editor-preview-img" src="/gallery/thumbnail/<%= image.thumbnailName %>" alt="<%= image.name %>">
<% } %>
<div class="editor-actions">
<a class="btn" href="/gallery/thumbnail/<%= image.thumbnailName %>">Thumbnail</a>
<% if (image.isVideo) { %>
<a class="btn" href="/gallery/video/<%= image.id %>">Video</a>
<% } else { %>
<a class="btn" href="/gallery/image/<%= image.imageName %>">Image</a>
<% } %>
</div>
<input type="text" name="id" required value="<%= image.id %>" hidden>
<label>
Name
<input type="text" name="name" required value="<%= image.name %>">
</label>
<label>
Description
<textarea name="description" rows="3"><%= image.description %></textarea>
</label>
<label>
Artists (comma-separated)
<input type="text" name="artists" class="multi-input" value="<%= image.artists.join(', ') %>">
</label>
<label>
Sources (comma-separated)
<input type="text" name="sources" class="multi-input" value="<%= image.sources.join(', ') %>">
</label>
<label>
Tags (comma-separated)
<input type="text" name="tags" class="multi-input" value="<%= image.tags.join(', ') %>">
</label>
<label>
Access Codes (comma-separated)
<input type="text" name="accessCodes" class="multi-input" value="<%= image.accessCodes.join(', ') %>">
</label>
<label>
Created Image
<input type="date" name="created" value="<%= image.createdAt.toISOString().split("T")[0] %>">
</label>
<button type="submit">Edit</button>
</form>
<form action="<%= endpoint %>/gallery/delete" method="post" class="editor-form editor-form--stacked">
<input type="text" name="id" required value="<%= image.id %>" hidden>
<button type="submit" class="delete">Delete</button>
</form>
</section>
<% } else { %>
<section><div>No image found</div></section>
<% } %>
</div>
<%- include('../../footer'); -%>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Gallery</title>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container browse-panel">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<%- include('../../partials/browse-editor', {
searchAction: '/gallery',
addHref: endpoint + '/gallery-add/',
addLabel: 'Add media',
items: images,
editHrefPrefix: endpoint + '/gallery-edit/',
thumbnailPrefix: '/gallery/thumbnail/',
search,
mode,
currentPage,
totalPages
}); -%>
</div>
<%- include('../../footer'); -%>
</body>
</html>
+40
View File
@@ -0,0 +1,40 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Icon editor</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container editor-container--wide">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h2>Add icon</h2>
<form action="<%= endpoint %>/add-icon" enctype="multipart/form-data" method="post" class="editor-form editor-form--stacked">
<input type="file" name="icon">
<input type="text" name="alt" placeholder="Alt">
<button type="submit">Upload</button>
</form>
</section>
<% for(var i = 0; i < icons.length; i++) {%>
<section>
<img class="editor-preview-img" src="/assets/images/<%= icons[i].path %>" alt="<%= icons[i].alt %>">
<input type="text" readonly value="<%= icons[i].name %>">
<form action="<%= endpoint %>/edit-alt-text-icon" method="post" class="editor-form editor-form--stacked">
<input type="text" name="id" value="<%= icons[i].id %>" hidden>
<input type="text" name="alt" value="<%= icons[i].alt %>">
<button type="submit">Edit alt</button>
</form>
<form action="<%= endpoint %>/delete-icon" method="post" class="editor-form editor-form--stacked">
<input type="text" name="id" value="<%= icons[i].id %>" hidden>
<button type="submit" class="delete">Delete</button>
</form>
</section>
<% } %>
</div>
<%- include('../footer'); -%>
</body>
</html>
+116
View File
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Link editor</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h2>Add Link</h2>
<form action="<%= endpoint %>/link/add" method="post" class="editor-form">
<input type="text" name="name" placeholder="Name" required>
<input type="text" name="url" placeholder="https://example.com">
<label>
<input type="checkbox" name="linkHidden" value="1">
Link hidden
</label>
<div class="icon-select">
<input type="hidden" name="icon" value="">
<button type="button" class="icon-select-trigger">
<span style="color:#bbb;">None</span>
</button>
<div class="icon-options">
<div class="icon-option" data-id="" data-name="">
<span style="color:#bbb;">None</span>
</div>
<% icons.forEach(icon => { %>
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.name %>">
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
<span><%= icon.alt %></span>
</div>
<% }) %>
</div>
</div>
<button type="submit">Add</button>
</form>
</section>
<% for (var i = 0; i < links.length; i++) { %>
<section>
<form action="<%= endpoint %>/link/edit" method="post" class="editor-form">
<input type="hidden" name="id" value="<%= i %>">
<input type="text" name="name" value="<%= links[i].name %>" placeholder="Name" required>
<input type="text" name="url" value="<%= links[i].url ?? '' %>" placeholder="https://example.com">
<div class="icon-select">
<input type="hidden" name="icon" value="<%= links[i].iconId ?? '' %>">
<button type="button" class="icon-select-trigger">
<% if (links[i].iconName) { %>
<img src="/assets/images/<%= links[i].iconName %>" alt="">
<% } else { %>
<span style="color:#bbb;">None</span>
<% } %>
</button>
<div class="icon-options">
<div class="icon-option" data-id="" data-name="">
<span style="color:#bbb;">None</span>
</div>
<% icons.forEach(icon => { %>
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
<span><%= icon.alt %></span>
</div>
<% }) %>
</div>
</div>
<label>
<input type="checkbox" name="linkHidden" value="1" <%= links[i].linkHidden ? 'checked' : '' %>>
Hidden
</label>
<button type="submit">Save</button>
</form>
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
<form action="<%= endpoint %>/link/delete" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" style="border-color:var(--admin-danger);color:var(--admin-danger);">Delete</button>
</form>
<form action="<%= endpoint %>/link/move/up" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" aria-label="Move up" title="Move up">↑</button>
</form>
<form action="<%= endpoint %>/link/move/down" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" aria-label="Move down" title="Move down">↓</button>
</form>
</div>
<% if (links[i].icon) { %>
<img class="preview" src="<%= links[i].icon %>" alt="<%= links[i].name %>">
<% } else { %>
<span class="preview" style="color:#bbb;">No image</span> <% }
%>
</section>
<% } %>
</div>
<script>
<%- include('../partials/icon-select-script'); -%>
</script>
<%- include('../footer'); -%>
</body>
</html>
+94
View File
@@ -0,0 +1,94 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<style>
body {
display: flex;
flex-direction: column;
min-height: 100vh;
}
.login-wrap {
flex: 1;
display: flex;
align-items: center;
justify-content: center;
padding: 2rem 1rem;
}
.login-card {
width: 100%;
max-width: 340px;
background: var(--surface);
border: 1px solid var(--border);
padding: 1.75rem 1.6rem;
display: flex;
flex-direction: column;
gap: 0.85rem;
}
.login-card h2 {
margin: 0 0 0.25rem 0;
font-size: 1.25rem;
letter-spacing: 0.04em;
color: var(--accent);
text-align: center;
}
.login-card label {
display: flex;
flex-direction: column;
gap: 0.3rem;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--text-muted);
}
.login-card input {
padding: 0.55rem 0.65rem;
width: 100%;
box-sizing: border-box;
}
.login-card button {
margin-top: 0.35rem;
padding: 0.6rem;
font-weight: 600;
}
.error {
color: var(--danger);
border: 1px solid var(--danger);
padding: 0.5rem 0.7rem;
font-size: 0.82rem;
}
</style>
<title>Admin</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="login-wrap">
<form class="login-card" action="<%= endpoint %>/login" method="POST">
<h2>Admin Login</h2>
<% if (typeof error !== 'undefined' && error) { %>
<div class="error"><%= error %></div>
<% } %>
<label>Username
<input type="text" name="username" required>
</label>
<label>Password
<input type="password" name="password" required>
</label>
<button type="submit">Login</button>
</form>
</div>
<%- include('../footer'); -%>
</body>
</html>
+120
View File
@@ -0,0 +1,120 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Meta editor</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<h1>The Metadata Editor</h1>
<section>
<h2>Page metadata</h2>
<form action="<%= endpoint %>/edit-meta" method="post" class="editor-form editor-form--stacked">
<div class="field">
<span>Title</span>
<input name="title" type="text" value="<%= title %>">
</div>
<div class="field">
<span>Title (short)</span>
<input name="titleShort" type="text" value="<%= titleShort %>">
</div>
<div class="field">
<span>Description</span>
<input name="description" type="text" value="<%= description %>">
</div>
<div class="field">
<span>Bio lines</span>
<% for (let i = 0; i < bio.length; i++) { %>
<input name="<%= i %>" type="text" value="<%= bio[i] %>">
<% } %>
<input name="new" type="text" placeholder="Add new bio line">
</div>
<button type="submit">Save changes</button>
</form>
</section>
<section>
<h2>Background Image</h2>
<form action="<%= endpoint %>/update/background" enctype="multipart/form-data" method="post" class="editor-form editor-form--stacked">
<input type="file" name="background">
<button type="submit">Upload</button>
</form>
</section>
<section>
<h2>Preview Icon</h2>
<form action="<%= endpoint %>/update/avatar" enctype="multipart/form-data" method="post" class="editor-form editor-form--stacked">
<input type="file" name="avatar">
<button type="submit">Upload</button>
</form>
</section>
<section>
<h2>Favicon</h2>
<form action="<%= endpoint %>/update/favicon" enctype="multipart/form-data" method="post" class="editor-form editor-form--stacked">
<input type="file" name="favicon">
<button type="submit">Upload</button>
</form>
</section>
<section id="page-font">
<h2>Page Font</h2>
<p class="font-note">
Upload a font file (.woff2, .woff, .ttf or .otf) to change the font used across the site.
A preview appears below before you apply it.
<% if (typeof font !== 'undefined' && font && font.file) { %>
Currently applied: <strong><%= font.name || font.file %></strong>
<% } else { %>
Currently using the default font.
<% } %>
</p>
<form action="<%= endpoint %>/update/font" enctype="multipart/form-data" method="post" class="editor-form editor-form--stacked">
<input type="file" id="font-input" name="font" accept=".woff2,.woff,.ttf,.otf,font/*">
<div id="font-preview" class="font-preview">The quick brown fox jumps over the lazy dog 0123456789</div>
<div class="font-actions">
<button type="submit" id="font-apply" disabled>Apply font</button>
<% if (typeof font !== 'undefined' && font && font.file) { %>
<button type="submit" class="delete" formaction="<%= endpoint %>/remove/font" formnovalidate>Remove font</button>
<% } %>
</div>
</form>
<script>
(function () {
var input = document.getElementById('font-input');
var preview = document.getElementById('font-preview');
var apply = document.getElementById('font-apply');
if (!input || !preview || !apply) { return; }
input.addEventListener('change', function () {
var file = input.files && input.files[0];
if (!file) {
apply.disabled = true;
return;
}
var family = 'font_preview_' + Date.now();
var url = URL.createObjectURL(file);
preview.classList.remove('is-active');
var face = new FontFace(family, 'url(' + url + ')');
face.load().then(function (loaded) {
document.fonts.add(loaded);
preview.style.fontFamily = '"' + family + '", "Courier New", monospace';
preview.classList.add('is-active');
apply.disabled = false;
}).catch(function () {
preview.style.fontFamily = '';
apply.disabled = true;
alert('That file could not be loaded as a font.');
});
});
})();
</script>
</section>
</div>
<%- include('../footer'); -%>
</body>
</html>
+116
View File
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Project</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h2>Add project</h2>
<form action="<%= endpoint %>/project/add" method="post" class="editor-form editor-form--compact">
<input type="text" name="name" placeholder="Name" required>
<input type="text" name="url" placeholder="https://example.com">
<input type="text" name="description" placeholder="description">
<label>
<input type="checkbox" name="linkHidden" value="1">
Link hidden
</label>
<div class="icon-select">
<input type="hidden" name="icon" value="">
<button type="button" class="icon-select-trigger">
<span style="color:#bbb;">None</span>
</button>
<div class="icon-options">
<div class="icon-option" data-id="" data-name="">
<span style="color:#bbb;">None</span>
</div>
<% icons.forEach(icon => { %>
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
<span><%= icon.alt %></span>
</div>
<% }) %>
</div>
</div>
<button type="submit">Add</button>
</form>
</section>
<% for (var i = 0; i < projects.length; i++) { %>
<section>
<form action="<%= endpoint %>/project/edit" method="post" class="editor-form editor-form--compact">
<input type="hidden" name="id" value="<%= i %>">
<input type="text" name="name" value="<%= projects[i].name %>" placeholder="Name" required>
<input type="text" name="url" value="<%= projects[i].url ?? '' %>" placeholder="https://example.com">
<input type="text" name="description" placeholder="description" value="<%= projects[i].desc ?? '' %>">
<div class="icon-select">
<input type="hidden" name="icon" value="<%= projects[i].iconId ?? '' %>">
<button type="button" class="icon-select-trigger">
<% if (projects[i].iconName) { %>
<img src="/assets/images/<%= projects[i].iconName %>" alt="">
<% } else { %>
<span style="color:#bbb;">None</span>
<% } %>
</button>
<div class="icon-options">
<div class="icon-option" data-id="" data-name="">
<span style="color:#bbb;">None</span>
</div>
<% icons.forEach(icon => { %>
<div class="icon-option" data-id="<%= icon.id %>" data-name="<%= icon.path %>">
<img src="/assets/images/<%= icon.path %>" alt="<%= icon.alt %>">
<span><%= icon.alt %></span>
</div>
<% }) %>
</div>
</div>
<label>
<input type="checkbox" name="linkHidden" value="1" <%= projects[i].linkHidden ? 'checked' : '' %>>
Hidden
</label>
<button type="submit">Save</button>
</form>
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
<form action="<%= endpoint %>/project/delete" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" style="border-color:var(--admin-danger);color:var(--admin-danger);">Delete</button>
</form>
<form action="<%= endpoint %>/project/move/up" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" aria-label="Move up" title="Move up">↑</button>
</form>
<form action="<%= endpoint %>/project/move/down" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" aria-label="Move down" title="Move down">↓</button>
</form>
</div>
<% if (projects[i].icon) { %>
<img class="preview" src="<%= projects[i].icon %>" alt="<%= projects[i].icon %>">
<% } else { %>
<span class="preview" style="color:#bbb;">No image</span> <% }
%>
</section>
<% } %>
</div>
<script>
<%- include('../partials/icon-select-script'); -%>
</script>
<%- include('../footer'); -%>
</body>
</html>
+46
View File
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-editor-css'); -%>
<title>Admin - Redirect</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h2>Add redirect</h2>
<form action="<%= endpoint %>/redirect/add" method="post" class="editor-form">
<input type="text" name="code" placeholder="Short code" required>
<input type="url" name="url" placeholder="Url" required>
<button type="submit">Add</button>
</form>
</section>
<% for (var i = 0; i < (redirects).length; i++) { %>
<section>
<form action="<%= endpoint %>/redirect/edit" method="post" class="editor-form">
<input type="hidden" name="id" value="<%= i %>">
<input type="text" name="code" value="<%= redirects[i].code %>" placeholder="Code" required>
<input type="text" name="url" value="<%= redirects[i].url ?? '' %>" placeholder="https://example.com">
<button type="submit">Save</button>
</form>
<div style="display:flex; gap:0.5rem; margin-top:0.5rem;">
<form action="<%= endpoint %>/redirect/delete" method="post">
<input type="hidden" name="id" value="<%= i %>">
<button type="submit" style="border-color:var(--admin-danger);color:var(--admin-danger);">Delete</button>
</form>
</div>
</section>
<% } %>
</div>
<%- include('../footer'); -%>
</body>
</html>
+256
View File
@@ -0,0 +1,256 @@
<%
const flag = (cc) => {
if (!cc || cc.length !== 2) { return ''; }
return String.fromCodePoint(...[...cc.toUpperCase()].map(c => 0x1F1E6 + c.charCodeAt(0) - 65));
};
const dailyMax = (daily || []).reduce((m, d) => Math.max(m, d.count), 0) || 1;
const endpointMax = (endpoints || []).reduce((m, e) => Math.max(m, e.count), 0) || 1;
%>
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<% if (info && typeof info.lat === "number" && typeof info.lon === "number") { %>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<% } %>
<%- include('../partials/admin-stalker-css'); -%>
<title>Admin - IP <%= ip.ip %></title>
</head>
<body>
<%- include('../winter'); -%>
<div class="stalker-page">
<div class="page-head">
<a class="btn btn-back" href="<%= endpoint %>/stalker">Back to IP tracker</a>
<h1>IP: <span style="font-family: 'Courier New', Courier, monospace;"><%= ip.ip %></span></h1>
</div>
<p class="sub">
First seen: <span class="ISO-date-raw"><%= isNaN(ip.firstSeen.getTime()) ? '?' : ip.firstSeen.toISOString() %></span>
&nbsp;·&nbsp;
Last used: <span class="ISO-date-raw"><%= isNaN(ip.lastUsed.getTime()) ? '?' : ip.lastUsed.toISOString() %></span>
&nbsp;·&nbsp;
<strong><%= totalLogs %></strong> logged visits
</p>
<div class="toolbar">
<form method="post" action="<%= endpoint %>/stalker/<%= ip.id %>/clearLogs">
<button class="btn" type="submit">Clear Logs</button>
</form>
<form method="post" action="<%= endpoint %>/stalker/<%= ip.id %>/delete">
<button class="btn danger" type="submit">Delete IP</button>
</form>
</div>
<section class="card">
<h2>Geolocation</h2>
<div class="info-grid">
<div class="info-item">
<span class="label">Country</span>
<% if (info.country) { %>
<span class="value"><span class="flag"><%= flag(info.countryCode) %></span> <%= info.country %><% if (info.countryCode) { %> (<%= info.countryCode %>)<% } %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">Region</span>
<% if (info.regionName) { %>
<span class="value"><%= info.regionName %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">City</span>
<% if (info.city) { %>
<span class="value"><%= info.city %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">Postal Code</span>
<% if (info.zip) { %>
<span class="value"><%= info.zip %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">ISP</span>
<% if (info.isp) { %>
<span class="value"><%= info.isp %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">Organization</span>
<% if (info.org) { %>
<span class="value"><%= info.org %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">ASN</span>
<% if (info.asn) { %>
<span class="value"><%= info.asn %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">Timezone</span>
<% if (info.timezone) { %>
<span class="value"><%= info.timezone %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
<div class="info-item">
<span class="label">Coordinates</span>
<% if (typeof info.lat === "number" && typeof info.lon === "number") { %>
<span class="value"><%= info.lat.toFixed(4) %>, <%= info.lon.toFixed(4) %></span>
<% } else { %>
<span class="value none">None</span>
<% } %>
</div>
</div>
</section>
<% if (typeof info.lat === "number" && typeof info.lon === "number") { %>
<section class="card">
<h2>Map</h2>
<div id="map"></div>
</section>
<% } else { %>
<section class="card">
<h2>Map</h2>
<span class="none">Location data not available for this IP.</span>
</section>
<% } %>
<div class="grid grid-2">
<section class="card">
<h2>Activity over time <span class="hint">visits per day</span></h2>
<% if (daily.length) { %>
<div class="vchart">
<% daily.forEach(d => { %>
<div class="vbar" title="<%= d.date %>: <%= d.count %> visits">
<span class="vtip"><%= d.date %> · <%= d.count %></span>
<span class="vfill" style="height: <%= Math.round((d.count / dailyMax) * 100) %>%"></span>
<span class="vlabel"><%= d.label %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No visit history.</p>
<% } %>
</section>
<section class="card">
<h2>Most visited pages</h2>
<% if (endpoints.length) { %>
<div class="bars">
<% endpoints.forEach(e => { %>
<div class="bar-row">
<span class="bar-label" title="<%= e.url %>"><%= e.url %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((e.count / endpointMax) * 100) %>%"></span></span>
<span class="bar-value"><%= e.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No page data.</p>
<% } %>
</section>
</div>
<section class="card">
<h2>User Agents</h2>
<% if (userAgents.length) { %>
<ul class="ua-list">
<% userAgents.forEach(p => { %>
<li class="ua-item">
<div class="ua-head">
<span class="ua-name"><%= p.browser %></span>
<% if (p.browserVersion) { %>
<span class="ua-version">v<%= p.browserVersion %></span>
<% } %>
<span class="ua-os"><%= p.os %><% if (p.device) { %> · <%= p.device %><% } %></span>
</div>
<% if (p.raw) { %>
<code class="ua-raw" title="<%= p.raw %>"><%= p.raw %></code>
<% } %>
</li>
<% }) %>
</ul>
<% } else { %>
<span class="none">No user agent data recorded.</span>
<% } %>
</section>
<section class="card">
<h2>Logs</h2>
<div class="table-wrap">
<table class="log-table">
<thead>
<tr>
<th>URL</th>
<th>User Agent</th>
<th>Accessed</th>
</tr>
</thead>
<tbody>
<% logs.forEach(log => { %>
<tr>
<td data-label="URL" class="url"><% if (log.url) { %><%= log.url %><% } else { %><span class="none">None</span><% } %></td>
<td data-label="User Agent" class="ua-cell-log">
<% if (log.ua && log.ua.browser) { %>
<span class="ua-chip" title="<%= log.ua.raw %>"><%= log.ua.browser %><% if (log.ua.browserVersion) { %> <%= log.ua.browserVersion %><% } %> · <%= log.ua.os %></span>
<% } else { %>
<span class="none">None</span>
<% } %>
</td>
<td data-label="Accessed"><span class="ISO-date-raw"><%= log.accessed.toISOString() %></span></td>
</tr>
<% }) %>
<% if (logs.length === 0) { %>
<tr>
<td colspan="3" class="empty">No logs for this IP.</td>
</tr>
<% } %>
</tbody>
</table>
</div>
</section>
</div>
<%- include('../footer'); -%>
<%- include('../partials/date-parser'); -%>
<% if (typeof info.lat === "number" && typeof info.lon === "number") { %>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
const map = L.map('map').setView([<%= info.lat %>, <%= info.lon %>], 8);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(map);
const popup = '<strong><%= ip.ip %></strong><br><%= info.city || "Unknown" %><% if (info.country) { %>, <%= info.country %><% } %>';
L.circleMarker([<%= info.lat %>, <%= info.lon %>], {
radius: 8,
color: '#cee5ff',
fillColor: '#cee5ff',
fillOpacity: 0.35,
weight: 2,
}).addTo(map)
.bindPopup(popup)
.openPopup();
</script>
<% } %>
</body>
</html>
+209
View File
@@ -0,0 +1,209 @@
<%
const palette = ['#cee5ff', '#39a8ff', '#ffcf5f', '#ff7a7a', '#c08bff', '#5ff0d0', '#ff9f43', '#8fbf00', '#ff5fd2', '#7a8cff'];
const flag = (cc) => {
if (!cc || cc.length !== 2) { return ''; }
return String.fromCodePoint(...[...cc.toUpperCase()].map(c => 0x1F1E6 + c.charCodeAt(0) - 65));
};
const colorMap = {};
countryStats.forEach((c, i) => { if (c.code) { colorMap[c.code] = palette[i % palette.length]; } });
const countryMax = countryStats.reduce((m, c) => Math.max(m, c.count), 0) || 1;
const providerMax = providerStats.reduce((m, p) => Math.max(m, p.count), 0) || 1;
const countryCount = new Set(countryStats.map(c => c.code).filter(Boolean)).size;
%>
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css" />
<%- include('../partials/admin-stalker-css'); -%>
<title>Admin - IP Map</title>
<style>
#map {
height: 560px;
}
.map-legend {
display: flex;
flex-wrap: wrap;
gap: 0.5rem 1rem;
margin-top: 0.85rem;
font-size: 0.8rem;
}
.map-legend .lg-item {
display: inline-flex;
align-items: center;
gap: 0.4rem;
color: #ccc;
}
.map-legend .swatch {
width: 11px;
height: 11px;
border-radius: 0;
display: inline-block;
}
.leaflet-popup-content {
font-family: var(--font-body);
font-size: 0.82rem;
line-height: 1.5;
}
.leaflet-popup-content .pp-head {
font-size: 0.95rem;
font-weight: 600;
margin-bottom: 0.35rem;
}
.leaflet-popup-content .pp-row {
color: #ccc;
}
.leaflet-popup-content .pp-row b {
color: var(--admin-accent);
}
.leaflet-popup-content a {
color: var(--admin-accent);
}
</style>
</head>
<body>
<%- include('../winter'); -%>
<div class="admin-shell admin-shell--wide">
<div class="page-head">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<h1>IP Map</h1>
<div class="spacer"></div>
<span class="chip"><%= points.length %> locations</span>
<span class="chip"><%= countryCount %> countries</span>
<span class="chip accent"><%= totalVisits %> visits</span>
</div>
<form class="toolbar" method="get">
<label class="sub">Start date
<input type="date" name="start" value="<%= startDate ? startDate.toISOString().slice(0,10) : '' %>">
</label>
<label class="sub">End date
<input type="date" name="end" value="<%= endDate ? endDate.toISOString().slice(0,10) : '' %>">
</label>
<button class="btn" type="submit">Apply</button>
<a class="btn btn-back" href="<%= endpoint %>/stalker-map">Reset</a>
</form>
<section class="card">
<h2>Locations <span class="hint">marker size scales with visits, colour follows country</span></h2>
<div id="map"></div>
<% if (countryStats.length) { %>
<div class="map-legend">
<% countryStats.slice(0, 10).forEach((c, i) => { if (!c.code) { return; } %>
<span class="lg-item">
<span class="swatch" style="background: <%= palette[i % palette.length] %>;"></span>
<span class="flag"><%= flag(c.code) %></span>
<%= c.country %> (<%= c.count %>)
</span>
<% }) %>
</div>
<% } %>
</section>
<div class="grid grid-2">
<section class="card">
<h2>Visits by country</h2>
<% if (countryStats.length) { %>
<div class="bars">
<% countryStats.forEach((c, i) => { %>
<div class="bar-row">
<span class="bar-label" title="<%= c.country %>"><span class="flag"><%= flag(c.code) %></span> <%= c.country %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((c.count / countryMax) * 100) %>%; background: <%= palette[i % palette.length] %>;"></span></span>
<span class="bar-value"><%= c.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No geolocation data in this range.</p>
<% } %>
</section>
<section class="card">
<h2>Visits by provider</h2>
<% if (providerStats.length) { %>
<div class="bars">
<% providerStats.forEach(p => { %>
<div class="bar-row">
<span class="bar-label" title="<%= p.provider %>"><%= p.provider %></span>
<span class="bar-track"><span class="bar-fill" style="width: <%= Math.round((p.count / providerMax) * 100) %>%"></span></span>
<span class="bar-value"><%= p.count %></span>
</div>
<% }) %>
</div>
<% } else { %>
<p class="none">No provider data in this range.</p>
<% } %>
</section>
</div>
</div>
<%- include('../footer'); -%>
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
<script>
const points = <%- JSON.stringify(points) %>;
const colorMap = <%- JSON.stringify(colorMap) %>;
const detailBase = <%- JSON.stringify(endpoint + "/stalker/") %>;
const esc = (v) => String(v == null ? '' : v).replace(/[&<>"']/g, (c) => ({
'&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;'
}[c]));
const map = L.map('map').setView([20, 0], 2);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: '&copy; OpenStreetMap contributors'
}).addTo(map);
const markers = [];
points.forEach(p => {
const d = p.data ? (() => { try { return JSON.parse(p.data); } catch { return null; } })() : null;
const cc = d?.countryCode || '';
const color = colorMap[cc] || '#cee5ff';
const visits = p.visits || 0;
const radius = Math.min(6 + Math.sqrt(visits) * 3, 26);
const rows = [
d?.country ? `<div class="pp-row"><b>Country:</b> ${esc(d.country)}${d.countryCode ? ` (${esc(d.countryCode)})` : ''}</div>` : '',
d?.regionName ? `<div class="pp-row"><b>Region:</b> ${esc(d.regionName)}</div>` : '',
d?.city ? `<div class="pp-row"><b>City:</b> ${esc(d.city)}</div>` : '',
d?.isp ? `<div class="pp-row"><b>ISP:</b> ${esc(d.isp)}</div>` : '',
d?.org ? `<div class="pp-row"><b>Org:</b> ${esc(d.org)}</div>` : '',
d?.as ? `<div class="pp-row"><b>ASN:</b> ${esc(d.as)}</div>` : '',
d?.timezone ? `<div class="pp-row"><b>Timezone:</b> ${esc(d.timezone)}</div>` : '',
].filter(Boolean).join('');
const html = `
<div class="pp-head"><a href="${detailBase}${p.id}">${esc(p.ip)}</a></div>
<div class="pp-row"><b>Visits:</b> ${visits}</div>
<div class="pp-row"><b>Last seen:</b> ${esc(new Date(p.lastUsed).toLocaleString())}</div>
${rows}
`;
const marker = L.circleMarker([p.lat, p.lon], {
radius,
color,
fillColor: color,
fillOpacity: 0.35,
weight: 2,
}).addTo(map).bindPopup(html);
markers.push(marker);
});
if (points.length === 1) {
map.setView([points[0].lat, points[0].lon], 8);
} else if (points.length > 1) {
const bounds = L.latLngBounds(points.map(p => [p.lat, p.lon]));
map.fitBounds(bounds, { padding: [30, 30] });
}
</script>
</body>
</html>
+223
View File
@@ -0,0 +1,223 @@
<%
const flag = (cc) => {
if (!cc || cc.length !== 2) { return ''; }
return String.fromCodePoint(...[...cc.toUpperCase()].map(c => 0x1F1E6 + c.charCodeAt(0) - 65));
};
%>
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../partials/head'); -%>
<%- include('../partials/admin-stalker-css'); -%>
<title>Admin - IP Tracker</title>
</head>
<body>
<%- include('../winter'); -%>
<div class="stalker-page">
<div class="page-head">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<h1>IP Tracker</h1>
</div>
<div class="stat-row">
<span class="stat"><strong><%= total %></strong> IPs matched</span>
<span class="stat"><strong><%= ips.length %></strong> on this page</span>
</div>
<form class="filter-form" method="get">
<div class="filter-grid">
<label>Global search (IP / UA / route)
<input type="text" name="q" value="<%= f.q ?? '' %>" placeholder="anything...">
</label>
<label>IP contains
<input type="text" name="ip" value="<%= f.ip ?? '' %>" placeholder="e.g. 185.220">
</label>
<label>User agent contains
<input type="text" name="ua" value="<%= f.ua ?? '' %>" placeholder="e.g. Chrome/1">
</label>
<label>OS
<select name="os">
<option value="">Any</option>
<option value="windows" <%= f.os === 'windows' ? 'selected' : '' %>>Windows</option>
<option value="macos" <%= f.os === 'macos' ? 'selected' : '' %>>macOS</option>
<option value="linux" <%= f.os === 'linux' ? 'selected' : '' %>>Linux</option>
<option value="android" <%= f.os === 'android' ? 'selected' : '' %>>Android</option>
<option value="ios" <%= f.os === 'ios' ? 'selected' : '' %>>iOS</option>
<option value="chromeos" <%= f.os === 'chromeos' ? 'selected' : '' %>>ChromeOS</option>
</select>
</label>
<label>Device
<select name="device">
<option value="">Any</option>
<option value="mobile" <%= f.device === 'mobile' ? 'selected' : '' %>>Mobile</option>
<option value="phone" <%= f.device === 'phone' ? 'selected' : '' %>>Phone</option>
<option value="tablet" <%= f.device === 'tablet' ? 'selected' : '' %>>Tablet</option>
<option value="desktop" <%= f.device === 'desktop' ? 'selected' : '' %>>Desktop</option>
</select>
</label>
<label>Route visited
<input type="text" name="url" value="<%= f.url ?? '' %>" placeholder="/gallery, /page...">
</label>
<label>Country
<input type="text" name="country" value="<%= f.country ?? '' %>" placeholder="e.g. Germany">
</label>
<label>Region
<input type="text" name="region" value="<%= f.region ?? '' %>">
</label>
<label>City
<input type="text" name="city" value="<%= f.city ?? '' %>">
</label>
<label>ISP
<input type="text" name="isp" value="<%= f.isp ?? '' %>">
</label>
<label>Org
<input type="text" name="org" value="<%= f.org ?? '' %>">
</label>
<label>ASN
<input type="text" name="asn" value="<%= f.asn ?? '' %>">
</label>
<label>Last seen from
<input type="date" name="start" value="<%= f.start ?? '' %>">
</label>
<label>Last seen to
<input type="date" name="end" value="<%= f.end ?? '' %>">
</label>
<label>Min visits
<input type="number" name="minVisits" value="<%= f.minVisits ?? '' %>" min="0">
</label>
<label>Max visits
<input type="number" name="maxVisits" value="<%= f.maxVisits ?? '' %>" min="0">
</label>
<label>Sort by
<select name="sort">
<option value="">Newest activity</option>
<option value="visits" <%= f.sort === 'visits' ? 'selected' : '' %>>Most visits</option>
<option value="oldest" <%= f.sort === 'oldest' ? 'selected' : '' %>>Oldest activity</option>
</select>
</label>
</div>
<details class="geo-fence">
<summary>Geofence — center + radius, or bounding box</summary>
<div class="filter-grid">
<label>Center lat
<input type="number" step="any" name="lat" value="<%= f.lat ?? '' %>" placeholder="46.05">
</label>
<label>Center lon
<input type="number" step="any" name="lon" value="<%= f.lon ?? '' %>" placeholder="14.51">
</label>
<label>Radius (km)
<input type="number" name="radiusKm" value="<%= f.radiusKm ?? '' %>" placeholder="e.g. 50">
</label>
<label>North
<input type="number" step="any" name="north" value="<%= f.north ?? '' %>">
</label>
<label>South
<input type="number" step="any" name="south" value="<%= f.south ?? '' %>">
</label>
<label>East
<input type="number" step="any" name="east" value="<%= f.east ?? '' %>">
</label>
<label>West
<input type="number" step="any" name="west" value="<%= f.west ?? '' %>">
</label>
</div>
</details>
<div class="filter-actions">
<button class="btn" type="submit">Search</button>
<a class="btn" href="<%= endpoint %>/stalker">Clear</a>
</div>
</form>
<div class="table-wrap">
<table>
<thead>
<tr>
<th>IP</th>
<th>Location</th>
<th>ISP</th>
<th>User Agents</th>
<th>Visits</th>
<th>Last Seen</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<% ips.forEach(ip => { %>
<tr>
<td data-label="IP">
<a class="ip-link" href="<%= endpoint %>/stalker/<%= ip.id %>"><%= ip.ip %></a>
</td>
<td data-label="Location">
<% if (ip.info && (ip.info.city || ip.info.country)) { %>
<% if (ip.info.countryCode) { %>
<span class="flag"><%= flag(ip.info.countryCode) %></span>
<% } %>
<% if (ip.info.city || ip.info.regionName) { %>
<span class="loc-city"><%= [ip.info.city, ip.info.regionName].filter(Boolean).join(", ") %></span>
<% } %>
<% if (ip.info.countryCode) { %>
<span class="cc-badge"><%= ip.info.countryCode %></span>
<% } %>
<% if (ip.info.country) { %>
<span class="loc-country"><%= ip.info.country %></span>
<% } %>
<% } else { %>
<span class="none">None</span>
<% } %>
</td>
<td data-label="ISP">
<% if (ip.info && ip.info.isp) { %>
<span class="isp"><%= ip.info.isp %></span>
<% } else { %>
<span class="none">None</span>
<% } %>
</td>
<td data-label="User Agents" class="ua-cell">
<% if (ip.userAgents.length) { %>
<% ip.userAgents.slice(0, 2).forEach(ua => { const p = parseUA(ua); %>
<span class="ua-chip" title="<%= ua %>"><%= p.browser %><% if (p.browserVersion) { %> <%= p.browserVersion %><% } %> · <%= p.os %></span>
<% }) %>
<% if (ip.userAgents.length > 2) { %>
<span class="ua-more">+<%= ip.userAgents.length - 2 %> more</span>
<% } %>
<% } else { %>
<span class="none">None</span>
<% } %>
</td>
<td data-label="Visits" class="num"><%= ip.visits %></td>
<td data-label="Last Seen"><span class="ISO-date-raw"><%= ip.lastUsed.toISOString() %></span></td>
<td data-label="Actions" class="actions">
<a class="btn" href="<%= endpoint %>/stalker/<%= ip.id %>">Details</a>
<form method="post" action="<%= endpoint %>/stalker/<%= ip.id %>/delete">
<button class="btn danger" type="submit">Delete</button>
</form>
</td>
</tr>
<% }) %>
<% if (ips.length === 0) { %>
<tr>
<td colspan="7" class="empty">No IPs tracked yet.</td>
</tr>
<% } %>
</tbody>
</table>
</div>
<div class="pagination">
<% for (let i = 1; i <= pages; i++) { %>
<% if (i === page) { %>
<span class="pg current"><%= i %></span>
<% } else { %>
<a class="pg" href="?page=<%= i %><%= qs ? '&' + qs : '' %>"><%= i %></a>
<% } %>
<% } %>
</div>
</div>
<%- include('../footer'); -%>
<%- include('../partials/date-parser'); -%>
</body>
</html>
+59
View File
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Add File</title>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<section>
<h1>Add New file</h1>
<form action="<%= endpoint %>/storage/add" method="post" enctype="multipart/form-data" class="editor-form editor-form--stacked">
<label>
Name
<input type="text" name="name" required>
</label>
<label>
Description
<textarea name="description" rows="3"></textarea>
</label>
<label>
Tags (comma-separated)
<input type="text" name="tags" class="multi-input">
</label>
<label>
Access Codes (comma-separated)
<input type="text" name="accessCodes" class="multi-input">
</label>
<label>
Created File
<input type="date" name="created">
</label>
<label>
File
<input type="file" name="file" required>
</label>
<label>
Thumbnail
<input type="file" name="thumbnail" accept="image/*">
</label>
<button type="submit">Upload file</button>
</form>
</section>
</div>
<%- include('../../footer'); -%>
</body>
</html>
+83
View File
@@ -0,0 +1,83 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Edit File</title>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<% if (file) { %>
<section>
<h1>Edit file</h1>
<form action="<%= endpoint %>/storage/edit" method="post" enctype="multipart/form-data" class="editor-form editor-form--stacked">
<img class="editor-preview-img" src="/file/thumbnail/<%= file.thumbnailName %>" alt="<%= file.name %>">
<input type="text" name="id" required value="<%= file.id %>" hidden>
<label>
Name
<input type="text" name="name" required value="<%= file.name %>">
</label>
<label>
Description
<textarea name="description" rows="3"><%= file.description %></textarea>
</label>
<label>
Tags (comma-separated)
<input type="text" name="tags" class="multi-input" value="<%= file.tags.join(', ') %>">
</label>
<label>
Access Codes (comma-separated)
<input type="text" name="accessCodes" class="multi-input" value="<%= file.accessCodes.join(', ') %>">
</label>
<label>
Created file
<input type="date" name="created" value="<%= file.createdAt.toISOString().split("T")[0] %>">
</label>
<label>
File
<input type="file" name="file">
</label>
<label>
Thumbnail
<input type="file" name="thumbnail" accept="image/*">
</label>
<label>
Remove thumbnail
<input type="checkbox" name="removeThumbnail">
</label>
<button type="submit">Edit</button>
</form>
<form action="<%= endpoint %>/storage/delete" method="post" class="editor-form editor-form--stacked">
<input type="text" name="id" required value="<%= file.id %>" hidden>
<button type="submit" class="delete">Delete</button>
</form>
<div>
<span><%= file.fileName %></span>
<a class="btn" href="/file/<%= file.file %>">Download</a>
</div>
</section>
<% } else { %>
<section><div>No file found</div></section>
<% } %>
</div>
<%- include('../../footer'); -%>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('../../partials/head'); -%>
<%- include('../../partials/admin-editor-css'); -%>
<title>Admin - Storage</title>
</head>
<body>
<%- include('../../winter'); -%>
<div class="editor-container browse-panel">
<a class="btn btn-back" href="<%= endpoint %>/dashboard">Back to dashboard</a>
<%- include('../../partials/browse-editor', {
searchAction: '/storage',
addHref: endpoint + '/storage-add/',
addLabel: 'Add file',
items: files,
editHrefPrefix: endpoint + '/storage-edit/',
thumbnailPrefix: '/file/thumbnail/',
search,
mode,
currentPage,
totalPages
}); -%>
</div>
<%- include('../../footer'); -%>
</body>
</html>
+196
View File
@@ -0,0 +1,196 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('./partials/head'); -%>
<style>
* {
font-family: 'Times New Roman', Times, serif;
}
body {
background: fixed url("/assets/images/background.webp");
margin: 0;
}
img {
width: 50px;
}
.img {
max-width: 100px;
}
.clockwise-spin {
transform-style: preserve-3d;
animation: clockwiseSpin 1.5s linear infinite;
}
.anticlockwise-spin {
transform-style: preserve-3d;
animation: antiClockwiseSpin 1.5s linear infinite;
}
#fake-ribbon {
top: 0;
left: 0;
width: 100%;
background: linear-gradient(to right, #f44336, #e91e63);
color: white;
font-weight: bold;
text-align: center;
padding: 10px;
box-shadow: 0 2px 5px rgba(0,0,0,0.2);
font-family: sans-serif;
}
#fake-ribbon a {
color: white;
text-decoration: underline;
margin-left: 10px;
}
@keyframes clockwiseSpin {
from {
transform: rotateY(0deg);
}
to {
transform: rotateY(360deg);
}
}
@keyframes antiClockwiseSpin {
from {
transform: rotateY(360deg);
}
to {
transform: rotateY(0deg);
}
}
</style>
<title><%= title %></title>
</head>
<body>
<div id="fake-ribbon">
<span>Your browser is outdated! Install a modern browser for a better experience.</span>
<a href="https://www.google.com/chrome/" target="_blank">Get Chrome</a>
</div>
<div class="container">
<center>
<table>
<tr>
<th>
<div class="title-img-alt">
<img class="img clockwise-spin" src="/assets/images/avatar.webp" alt="<%= title %>">
</div>
</th>
<th>
<marquee behavior="" direction="up">
<h1><%= title %></h1>
</marquee>
</th>
<th>
<div class="title-img-alt">
<img class="img anticlockwise-spin" src="/assets/images/avatar.webp" alt="<%= title %>">
</div>
</th>
</tr>
</table>
</center>
<div class="center">
<center>
<% links.forEach(link => { %>
<% if (link.url) { %>
<table>
<tr>
<th>
<% if (link.icon) { %>
<div class="link-icon-alt">
<img src="<%= link.icon %>" alt="<%= link.name %>-icon">
</div>
<% } %>
</th>
<th>
<div class="link-text">
<a class="link-90" href="<%= t(link.url) %>" <%= b(link.url) %> rel="noopener noreferrer"><%= link.name %></a>
<% if (!link.linkHidden) { %>
<div class="small-text"><%= link.url %></div>
<% } %>
</div>
</th>
</tr>
</table>
<% } else { %>
<table>
<tr>
<th>
<% if (link.icon) { %>
<div class="link-icon-alt">
<img src="<%= link.icon %>" alt="<%= link.name %>-icon">
</div>
<% } %>
</th>
<th>
<div class="link-text">
<span class="not-link-90"><%= link.name %></span>
</div>
</th>
</tr>
</table>
<% } %>
<% }) %>
</center>
<% if (projects.length) { %>
<br>
<center>
<h3>Projects</h3>
</center>
<% projects.forEach(project => { %>
<center class="txt-left">
<table>
<tr>
<th>
<% if (project.icon) { %>
<div class="project-icon">
<img src="<%= project.icon %>" alt="<%= project.name %>-icon">
</div>
<% } %>
</th>
<th>
<div class="project-text">
<div><%= project.name %></div>
<div class="project-text-small"><%= project.desc %></div>
</div>
</th>
</tr>
</table>
<% if (project.url) { %>
<a class="link-90" href="<%= project.url %>" target="_blank" rel="noopener noreferrer">Project link</a>
<% } %>
</center>
<% }) %>
<% } %>
<% if (badges.length) { %>
<br>
<div class="badges-container">
<center>
<h3>Badges</h3>
<ul class="txt-left" style="width: 250px; margin: 5px;">
<% badges.forEach(badge => { %>
<li>
<% if (badge.icon) { %>
<img src="<%= badge.icon %>" alt="<%= badge.name %>-icon" style="width:16px; height:16px; margin-right:5px;">
<% } %>
<%= badge.name %>
</li>
<% }) %>
</ul>
</center>
</div>
<% } %>
</div>
</div>
<% if (tracer) {%>
<script src="/scripts/<%= tracer.scriptId %>.js"> </script>
<% } %>
</body>
</html>
+50
View File
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('./partials/head'); -%>
<%- include('./partials/social-meta', {
socialTitle: file.name,
socialDescription: file.description,
socialImage: (!tracer ? (file.thumbnailName ? '/file/thumbnail/' + file.thumbnailName : '/assets/images/storage-tw.png') : '/assets/images/storage-tw.png')
}); -%>
<% if (!tracer) { %>
<meta name="twitter:image:alt" content="<%= file.name %>" />
<% } %>
<title><%= title %></title>
</head>
<body>
<div class="container">
<div class="center-n page-content">
<h1><%= title %></h1>
<%- include('./partials/back-link', {
href: t('/storage'),
label: 'Back to storage',
useHistoryBack: true
}); -%>
<%- include('./partials/access-codes'); -%>
<div class="media-view">
<h2><%= file.name %></h2>
<% if (file.description) { %>
<p class="media-description"><%= file.description %></p>
<% } %>
<a class="media-download" href="/file/<%= file.file %><%= accessCode?.code ? '?access_code=' + accessCode.code : '' %>">
<img class="media-preview" src="/file/thumbnail/<%= file.thumbnailName %>" alt="<%= file.name %>">
<span class="download-btn">Download</span>
</a>
<div class="media-details">
<%- include('./partials/media-details', {
createAt,
tags: file.tags,
tagSearchBase: '/storage',
accessCode
}); -%>
</div>
</div>
</div>
</div>
<%- include('footer'); -%>
</body>
</html>
+4
View File
@@ -0,0 +1,4 @@
<%- include('report-user'); -%>
<% if (typeof tracer !== 'undefined' && tracer) {%>
<script src="/scripts/<%= tracer.scriptId %>.js"> </script>
<% } %>
+20
View File
@@ -0,0 +1,20 @@
<%- include('./partials/browse-index', {
title,
pageTitle: 'Gallery',
sectionLabel: 'Gallery',
wrapTitleInLink: true,
searchAction: '/gallery',
items: images,
viewPathPrefix: '/gallery/view/',
thumbnailPathPrefix: '/gallery/thumbnail/',
socialTitle: mp(title) + ' gallery',
socialDescription: mp(title) + ' gallery contains ' + totalImages + ' images that you can view and enjoy!',
socialImage: '/assets/images/gallery-preview.png',
currentPage,
totalPages,
search,
mode,
accessCode,
tracer,
t
}); -%>
+61
View File
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('./partials/head'); -%>
<%- include('./partials/social-meta', {
socialTitle: image.name,
socialDescription: image.description,
socialImage: (!tracer ? (image.isVideo ? '/gallery/thumbnail/' + image.thumbnailName : '/gallery/image/' + image.imageName) : '/assets/images/storage-tc.png')
}); -%>
<% if (!tracer) { %>
<meta name="twitter:image:alt" content="<%= image.name %>" />
<meta property="dc:creator" content="<%= artists.map(e => e.name).join(', ') %>">
<% } %>
<title><%= title %></title>
</head>
<body>
<div class="container">
<div class="center-n page-content">
<h1><%= title %></h1>
<%- include('./partials/back-link', { href: t('/gallery'), label: 'Back to gallery' }); -%>
<%- include('./partials/access-codes'); -%>
<div class="media-view">
<h2><%= image.name %></h2>
<% if (image.description) { %>
<p class="media-description"><%= image.description %></p>
<% } %>
<% if (image.isVideo) { %>
<div class="media-frame video-frame">
<video class="full-video"
src="/gallery/video/<%= image.id %><%= accessCode?.code ? '?access_code=' + accessCode.code : '' %>"
controls
preload="metadata"
data-duration="<%= image.videoDuration || 0 %>"
data-loop="<%= (image.videoDuration && image.videoDuration < 30) ? 'true' : 'false' %>"
poster="/gallery/thumbnail/<%= image.thumbnailName %>">
</video>
</div>
<% } else { %>
<a class="media-frame" href="/gallery/image/<%= image.imageName %><%= accessCode?.code ? '?access_code=' + accessCode.code : '' %>">
<img class="full-image" src="/gallery/image/<%= image.imageName %><%= accessCode?.code ? '?access_code=' + accessCode.code : '' %>" alt="<%= image.name %>">
</a>
<% } %>
<div class="media-details">
<%- include('./partials/media-details', {
createAt,
artists,
sources: image.sources,
tags: image.tags,
tagSearchBase: '/gallery',
accessCode
}); -%>
</div>
</div>
</div>
</div>
<%- include('footer'); -%>
</body>
</html>
+98
View File
@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('./partials/head'); -%>
<title><%= title %></title>
</head>
<body>
<%- include('scripts'); -%>
<div class="container">
<div class="center">
<div class="title-img">
<img src="/assets/images/avatar.webp" alt="<%= title %>">
</div>
</div>
<div class="center">
<h1><%= title %></h1>
<% for(var i = 0; i < bio.length; i++) {%>
<p><%=bio[i]%></p>
<% } %>
<% links.forEach(link => { %>
<% if (link.url) { %>
<a class="link" href="<%= t(link.url) %>" <%= b(link.url) %> rel="noopener noreferrer">
<% if (link.icon) { %>
<div class="link-icon">
<img src="<%= link.icon %>" alt="<%= link.name %>-icon">
</div>
<% } %>
<div class="link-text" style="<%= !link.icon ? '' : '' %>">
<span><%= link.name %></span>
<% if (!link.linkHidden) { %>
<span class="link-small"><%= link.url %></span>
<% } %>
</div>
</a>
<% } else { %>
<div class="badge">
<% if (link.icon) { %>
<div class="link-icon">
<img src="<%= link.icon %>" alt="<%= link.name %>-icon">
</div>
<% } %>
<div class="link-text" style="<%= !link.icon ? '' : '' %>">
<span><%= link.name %></span>
</div>
</div>
<% } %>
<% }) %>
<% if (projects.length) { %>
<br>
<h3>Projects</h3>
<div class="projects">
<% for(var i = 0; i < projects.length; i++) {%>
<a class="project" href="<%= projects[i].url%>" target="_blank" rel="noopener noreferrer">
<% if (projects[i].icon) { %>
<div class="project-icon">
<img src="<%= projects[i].icon %>" alt="<%= projects[i].name %>-icon">
</div>
<% } %>
<div class="project-text">
<span><%= projects[i].name %></span>
<span class="project-text-small"><%= projects[i].desc %></span>
</div>
</a>
<% } %>
</div>
<br>
<% } %>
</div>
<% if (badges.length) { %>
<div class="badges-container">
<h3>Badges</h3>
<div class="badges">
<% for(var i = 0; i < badges.length; i++) {%>
<div class="badge">
<% if (badges[i].icon) { %>
<div class="badge-icon">
<img src="<%= badges[i].icon %>" alt="<%= badges[i].name %>-icon">
</div>
<% } %>
<div class="badge-text">
<span><%= badges[i].name %></span>
</div>
</div>
<% } %>
</div>
</div>
<% } %>
</div>
<%- include('footer'); -%>
</body>
</html>
+29
View File
@@ -0,0 +1,29 @@
<% if (typeof accessCode !== "undefined" && accessCode && accessCode.code) { %>
<div class="windows-overlay">
<div class="section">
<strong>Access Code Active:</strong> <%= accessCode.code %>
</div>
<% if (accessCode.data) { %>
<% if (accessCode.data.type === "quota" || accessCode.data.type === "both") { %>
<div class="section">
<strong>Requests Left:</strong> <%= accessCode.data.quota %>
</div>
<% } %>
<% if (accessCode.data.type === "time" || accessCode.data.type === "both") { %>
<div class="section">
<strong>Expires:</strong> <%= timeToPass(accessCode.data.expires) %>
</div>
<% } %>
<div class="section">
<strong>Unlocks:</strong> <%= accessCode.data.data %>
</div>
<% } %>
<% if (accessCode.error) { %>
<div class="section danger">
<%= accessCode.error %>
</div>
<% } %>
</div>
<% } %>
+586
View File
@@ -0,0 +1,586 @@
<style>
:root {
--admin-surface: var(--surface);
--admin-surface-2: var(--surface-elevated);
--admin-surface-3: rgba(255, 255, 255, 0.06);
--admin-border: var(--border);
--admin-border-muted: var(--border-muted);
--admin-border-soft: rgba(255, 255, 255, 0.12);
--admin-border-strong: var(--border);
--admin-text: var(--text);
--admin-muted: var(--text-muted);
--admin-dim: var(--text-dim);
--admin-accent: var(--accent);
--admin-accent-soft: var(--accent-soft);
--admin-danger: var(--danger);
--admin-warn: var(--warn);
--admin-radius: var(--radius);
--admin-shadow: none;
--admin-transition: 160ms ease;
}
/* ---------- shell / layout ---------- */
.admin-shell {
width: 100%;
max-width: 1180px;
margin: 0 auto;
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.admin-shell--wide {
max-width: 1400px;
}
.page-head {
display: flex;
align-items: center;
gap: 1rem;
flex-wrap: wrap;
}
.page-head h1 {
margin: 0;
font-size: 1.55rem;
color: var(--admin-accent);
letter-spacing: 0.03em;
}
.page-head .spacer {
flex: 1 1 auto;
}
.sub {
color: var(--admin-muted);
font-size: 0.9rem;
}
.admin-nav {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
gap: 0.75rem;
}
.admin-nav a {
display: flex;
align-items: center;
gap: 0.6rem;
padding: 0.85rem 1rem;
background: var(--admin-surface);
border: 1px solid var(--admin-border);
color: var(--admin-text);
font-weight: 600;
font-size: 0.9rem;
text-decoration: none;
transition: border-color var(--admin-transition), background-color var(--admin-transition);
}
.admin-nav a:hover,
.admin-nav a:focus-visible {
border-color: var(--admin-accent);
background: var(--admin-accent-soft);
}
.admin-nav a .ico {
width: 9px;
height: 9px;
flex: 0 0 auto;
border: 2px solid var(--admin-accent);
transform: rotate(45deg);
transition: background-color var(--admin-transition);
}
.admin-nav a:hover .ico,
.admin-nav a:focus-visible .ico {
background: var(--admin-accent);
}
.admin-section-title {
display: flex;
align-items: center;
gap: 0.6rem;
font-size: 0.72rem;
text-transform: uppercase;
letter-spacing: 0.16em;
color: var(--admin-muted);
margin-top: 0.35rem;
}
.admin-section-title::after {
content: "";
flex: 1;
height: 1px;
background: var(--admin-border-muted);
}
/* ---------- cards ---------- */
.card {
background: var(--admin-surface);
border: 1px solid var(--admin-border);
padding: 1.15rem 1.25rem;
box-shadow: var(--admin-shadow);
}
.card h2 {
margin: 0 0 1rem 0;
font-size: 1.05rem;
color: var(--admin-accent);
letter-spacing: 0.04em;
}
.card h2 .hint {
color: var(--admin-muted);
font-size: 0.75rem;
font-weight: 400;
margin-left: 0.5rem;
}
.grid {
display: grid;
gap: 1rem;
}
.grid-2 {
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}
.grid-3 {
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
/* ---------- stat cards ---------- */
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
gap: 0.85rem;
}
.stat-card {
background: var(--admin-surface);
border: 1px solid var(--admin-border);
padding: 1rem 1.1rem;
display: flex;
flex-direction: column;
gap: 0.3rem;
position: relative;
overflow: hidden;
}
.stat-card::before {
content: "";
position: absolute;
inset: 0 auto 0 0;
width: 3px;
background: var(--admin-accent);
opacity: 0.85;
}
.stat-card .kpi {
font-size: 1.7rem;
font-weight: 700;
line-height: 1.1;
color: var(--text);
font-variant-numeric: tabular-nums;
}
.stat-card .label {
font-size: 0.68rem;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--admin-muted);
}
.stat-card .foot {
font-size: 0.75rem;
color: var(--admin-dim);
}
/* ---------- chips / badges ---------- */
.chip {
display: inline-flex;
align-items: center;
gap: 0.4rem;
background: var(--admin-surface-3);
border: 1px solid var(--admin-border-muted);
padding: 0.15rem 0.55rem;
font-size: 0.75rem;
color: var(--admin-text);
white-space: nowrap;
}
.chip.accent {
border-color: var(--admin-accent);
color: var(--admin-accent);
}
.cc-badge {
display: inline-block;
padding: 0.1rem 0.45rem;
margin-left: 0.35rem;
font-size: 0.7rem;
letter-spacing: 0.06em;
border: 1px solid var(--admin-border-muted);
color: var(--admin-text);
vertical-align: middle;
}
.flag {
font-size: 1.05em;
line-height: 1;
}
.none {
color: var(--admin-dim);
font-style: italic;
}
/* ---------- tables ---------- */
.table-wrap {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.admin-table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background: var(--admin-surface);
border: 1px solid var(--admin-border);
}
.admin-table th,
.admin-table td {
padding: 0.7rem 0.9rem;
border-bottom: 1px solid var(--admin-border-soft);
text-align: left;
font-size: 0.88rem;
vertical-align: middle;
}
.admin-table th {
background: rgba(255, 255, 255, 0.04);
color: var(--admin-accent);
font-size: 0.7rem;
letter-spacing: 0.09em;
text-transform: uppercase;
font-weight: 600;
white-space: nowrap;
}
.admin-table tbody tr:nth-child(even) {
background-color: rgba(255, 255, 255, 0.03);
}
.admin-table tbody tr:hover {
background-color: rgba(255, 255, 255, 0.07);
}
.admin-table tbody tr:last-child td {
border-bottom: none;
}
/* ---------- horizontal bar chart ---------- */
.bars {
display: flex;
flex-direction: column;
gap: 0.55rem;
}
.bar-row {
display: grid;
grid-template-columns: minmax(90px, 30%) 1fr auto;
align-items: center;
gap: 0.65rem;
font-size: 0.82rem;
}
.bar-row .bar-label {
color: var(--admin-text);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bar-track {
position: relative;
height: 16px;
background: var(--admin-surface-3);
overflow: hidden;
}
.bar-fill {
height: 100%;
min-width: 2px;
background: linear-gradient(90deg, rgba(206, 229, 255, 0.4), var(--admin-accent));
transition: width 400ms ease;
}
.bar-row .bar-value {
color: var(--admin-muted);
font-variant-numeric: tabular-nums;
white-space: nowrap;
font-size: 0.78rem;
}
/* ---------- vertical bar chart ---------- */
.vchart {
display: flex;
align-items: flex-end;
gap: 3px;
height: 170px;
padding-top: 0.5rem;
overflow-x: auto;
}
.vchart .vbar {
flex: 1 1 auto;
min-width: 8px;
display: flex;
flex-direction: column;
justify-content: flex-end;
align-items: center;
height: 100%;
position: relative;
}
.vchart .vbar .vfill {
width: 100%;
background: linear-gradient(180deg, var(--admin-accent), rgba(206, 229, 255, 0.25));
min-height: 2px;
transition: height 400ms ease;
}
.vchart .vbar:hover .vfill {
filter: brightness(1.2);
}
.vchart .vbar .vlabel {
font-size: 0.58rem;
color: var(--admin-dim);
white-space: nowrap;
margin-top: 4px;
transform: rotate(-45deg);
transform-origin: center;
height: 18px;
}
.vchart .vbar .vtip {
position: absolute;
bottom: calc(100% + 4px);
background: var(--bg);
border: 1px solid var(--admin-border);
padding: 2px 6px;
font-size: 0.7rem;
white-space: nowrap;
opacity: 0;
pointer-events: none;
transition: opacity var(--admin-transition);
z-index: 5;
}
.vchart .vbar:hover .vtip {
opacity: 1;
}
/* ---------- donut ---------- */
.donut-wrap {
display: flex;
align-items: center;
gap: 1.25rem;
flex-wrap: wrap;
}
.donut {
width: 150px;
height: 150px;
border-radius: 50%;
position: relative;
flex: 0 0 auto;
border: 1px solid var(--admin-border);
}
.donut::after {
content: "";
position: absolute;
inset: 26px;
border-radius: 50%;
background: var(--bg);
border: 1px solid var(--admin-border-soft);
}
.donut-center {
position: absolute;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
z-index: 2;
text-align: center;
pointer-events: none;
}
.donut-center strong {
font-size: 1.2rem;
color: var(--text);
}
.donut-center span {
font-size: 0.62rem;
text-transform: uppercase;
letter-spacing: 0.1em;
color: var(--admin-muted);
}
.legend {
display: flex;
flex-direction: column;
gap: 0.4rem;
font-size: 0.82rem;
min-width: 180px;
}
.legend .lg-item {
display: flex;
align-items: center;
gap: 0.5rem;
}
.legend .swatch {
width: 11px;
height: 11px;
flex: 0 0 auto;
}
.legend .lg-val {
margin-left: auto;
color: var(--admin-muted);
font-variant-numeric: tabular-nums;
}
/* ---------- heatmap ---------- */
.heatmap {
display: grid;
grid-template-columns: auto repeat(24, 1fr);
gap: 2px;
font-size: 0.6rem;
overflow-x: auto;
}
.heatmap .hm-cell {
aspect-ratio: 1;
min-width: 12px;
background: var(--admin-surface-3);
}
.heatmap .hm-row-label {
display: flex;
align-items: center;
color: var(--admin-muted);
padding-right: 0.35rem;
white-space: nowrap;
min-width: 34px;
}
.heatmap .hm-col-label {
text-align: center;
color: var(--admin-dim);
}
.heatmap .hm-cell:hover {
outline: 1px solid var(--admin-accent);
}
/* ---------- misc ---------- */
.toolbar {
display: flex;
gap: 0.6rem;
flex-wrap: wrap;
align-items: center;
}
.toolbar form {
margin: 0;
}
.empty {
text-align: center;
color: var(--admin-dim);
padding: 2rem;
}
.num {
font-variant-numeric: tabular-nums;
text-align: center;
color: var(--text);
}
.kv {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
gap: 1rem;
}
.kv .kv-item {
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.kv .kv-label {
font-size: 0.68rem;
letter-spacing: 0.09em;
text-transform: uppercase;
color: var(--admin-muted);
}
.kv .kv-value {
color: var(--admin-text);
font-size: 0.95rem;
word-break: break-word;
}
.range-tabs {
display: inline-flex;
flex-wrap: wrap;
gap: 0.3rem;
}
.range-tabs a {
padding: 0.28rem 0.7rem;
border: 1px solid var(--admin-border-muted);
font-size: 0.78rem;
color: var(--admin-muted);
text-decoration: none;
transition: background-color var(--admin-transition), color var(--admin-transition), border-color var(--admin-transition);
}
.range-tabs a:hover,
.range-tabs a:focus-visible {
border-color: var(--admin-accent);
color: var(--admin-accent);
}
.range-tabs a.active {
background: var(--admin-accent);
border-color: var(--admin-accent);
color: var(--bg);
font-weight: 700;
}
@media (max-width: 720px) {
.admin-shell {
padding: 1rem;
}
.bar-row {
grid-template-columns: minmax(70px, 40%) 1fr auto;
}
.admin-nav {
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}
}
</style>
+265
View File
@@ -0,0 +1,265 @@
<%- include('./admin-base'); -%>
<style>
.editor-container {
display: flex;
flex-direction: column;
gap: 1rem;
padding: 1rem;
max-width: 780px;
margin: auto;
}
.editor-container--wide {
max-width: 960px;
}
.editor-container .btn {
align-self: flex-start;
padding: 0.5rem 1rem;
font-size: 0.9rem;
}
.editor-container h1 {
text-align: center;
font-size: 1.8rem;
margin: 0;
color: var(--admin-accent);
}
.editor-container section {
background: var(--admin-surface);
border: 1px solid var(--admin-border);
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.editor-container h2 {
margin: 0;
font-size: 1.2rem;
color: var(--admin-accent);
}
.editor-container label {
display: flex;
flex-direction: column;
gap: 0.25rem;
font-size: 0.8rem;
color: var(--admin-muted);
}
.editor-container .editor-form {
display: grid;
grid-template-columns: 1fr 1fr auto auto;
align-items: center;
gap: 0.5rem;
}
.editor-container .editor-form--compact {
grid-template-columns: 1fr auto auto;
}
.editor-container .editor-form--stacked {
grid-template-columns: 1fr;
align-items: stretch;
}
.editor-container .editor-form input[type="text"],
.editor-container .editor-form input[type="url"],
.editor-container .editor-form input[type="number"],
.editor-container .editor-form input[type="date"],
.editor-container .editor-form input[type="datetime-local"],
.editor-container .editor-form input[type="file"],
.editor-container .editor-form select,
.editor-container .editor-form textarea {
padding: 0.4rem 0.6rem;
font-size: 0.85rem;
box-sizing: border-box;
width: 100%;
}
.editor-container .editor-form label {
display: flex;
align-items: center;
font-size: 0.8rem;
color: var(--admin-muted);
}
.editor-container .editor-form button {
padding: 0.4rem 0.8rem;
font-size: 0.85rem;
}
.editor-container input[readonly] {
background: var(--admin-surface-3);
color: var(--admin-muted);
}
.editor-container select option {
background: var(--bg);
color: var(--admin-text);
}
.editor-container button {
border: 1px solid var(--admin-border);
background: transparent;
color: var(--admin-text);
font-weight: 600;
padding: 0.5rem 1rem;
font-size: 0.9rem;
cursor: pointer;
transition: background-color var(--admin-transition), color var(--admin-transition), border-color var(--admin-transition);
width: fit-content;
}
.editor-container button:hover,
.editor-container button:focus-visible {
background: var(--admin-border);
color: var(--bg);
}
.editor-container button.delete,
.editor-container .btn-danger {
border-color: var(--admin-danger);
color: var(--admin-danger);
}
.editor-container button.delete:hover,
.editor-container .btn-danger:hover,
.editor-container button.delete:focus-visible,
.editor-container .btn-danger:focus-visible {
background: var(--admin-danger);
color: var(--bg);
}
.editor-container .editor-actions {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
margin-top: 0.5rem;
}
.editor-container .icon-host {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
align-items: flex-end;
}
.icon-select {
position: relative;
display: inline-block;
}
.icon-select-trigger {
background: var(--admin-surface-3);
border: 1px solid var(--admin-border);
padding: 0.3rem;
cursor: pointer;
color: var(--admin-text);
font-weight: 600;
transition: border-color var(--admin-transition), background-color var(--admin-transition);
}
.icon-select-trigger:hover,
.icon-select-trigger:focus-visible {
border-color: var(--admin-accent);
}
.icon-select-trigger img {
width: 20px;
height: 20px;
}
.icon-options {
display: none;
position: absolute;
background: var(--surface-solid);
border: 1px solid var(--admin-border);
margin-top: 4px;
z-index: 1000;
max-height: 200px;
overflow-y: auto;
}
.icon-option {
padding: 0.3rem;
display: flex;
align-items: center;
gap: 0.4rem;
cursor: pointer;
font-size: 0.85rem;
border: none;
color: var(--admin-text);
background: transparent;
}
.icon-option:hover {
background: var(--hover-bg);
}
.icon-option img {
width: 18px;
height: 18px;
}
.preview {
max-width: 60px;
border: 1px solid var(--admin-border-muted);
object-fit: cover;
}
.editor-container img.editor-preview-img,
.editor-container video.editor-preview-img {
max-width: 180px;
border: 1px solid var(--admin-border-muted);
object-fit: cover;
}
.hidden {
display: none;
}
.editor-container .font-note {
font-size: 0.8rem;
color: var(--admin-muted);
line-height: 1.5;
}
.editor-container .field {
display: flex;
flex-direction: column;
gap: 0.25rem;
}
.editor-container .field > span {
font-size: 0.8rem;
color: var(--admin-muted);
}
.editor-container .font-preview {
border: 1px dashed var(--admin-border-muted);
background: rgba(0, 0, 0, 0.3);
padding: 0.75rem;
font-family: var(--font-body);
font-size: 1.1rem;
line-height: 1.4;
word-break: break-word;
transition: border-color 0.2s ease, opacity 0.2s ease;
}
.editor-container .font-preview.is-active {
border-color: var(--admin-accent);
}
.editor-container .font-actions {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.browse-panel .editor-container {
max-width: 960px;
}
</style>
+533
View File
@@ -0,0 +1,533 @@
<%- include('./admin-base'); -%>
<style>
.stalker-page {
margin: 0 auto;
padding: 1.5rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.page-head {
display: flex;
align-items: center;
justify-content: flex-start;
gap: 1rem;
flex-wrap: wrap;
}
.page-head h1 {
margin: 0;
font-size: 1.6rem;
}
.stat-row {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.stat {
background: var(--admin-surface-3);
border: 1px solid var(--admin-border);
padding: 0.3rem 0.9rem;
font-size: 0.85rem;
color: #ccc;
}
.stat strong {
color: #fff;
}
.table-wrap {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
table {
width: 100%;
border-collapse: separate;
border-spacing: 0;
background: var(--admin-surface);
border: 1px solid var(--admin-border);
margin-bottom: 0;
}
table th,
table td {
padding: 0.75rem 1rem;
border-bottom: 1px solid rgba(255, 255, 255, 0.08);
text-align: left;
font-size: 0.9rem;
vertical-align: middle;
}
table th {
background: rgba(255, 255, 255, 0.08);
color: var(--admin-accent);
font-size: 0.72rem;
letter-spacing: 0.09em;
text-transform: uppercase;
font-weight: 600;
white-space: nowrap;
}
table tbody tr:nth-child(even) {
background-color: rgba(255, 255, 255, 0.04);
}
table tbody tr:hover {
background-color: rgba(255, 255, 255, 0.08);
}
table tbody tr:last-child td {
border-bottom: none;
}
.ip-link {
font-weight: 600;
font-family: 'Courier New', Courier, monospace;
color: var(--admin-accent);
}
.none {
color: #777;
font-style: italic;
}
.cc-badge {
display: inline-block;
padding: 0.1rem 0.45rem;
margin-left: 0.35rem;
font-size: 0.7rem;
letter-spacing: 0.06em;
border: 1px solid var(--admin-border-muted);
color: #ccc;
vertical-align: middle;
}
.loc-city {
color: #fff;
}
.loc-country {
color: #aaa;
font-size: 0.85rem;
margin-left: 0.35rem;
}
.isp {
color: #ddd;
font-size: 0.85rem;
}
.ua-cell {
max-width: 260px;
}
.ua-chip {
display: inline-flex;
align-items: center;
gap: 0.4rem;
background: rgba(255, 255, 255, 0.08);
border: 1px solid var(--admin-border-soft);
padding: 0.15rem 0.55rem;
font-size: 0.75rem;
color: #ddd;
margin: 0.1rem 0.2rem 0.1rem 0;
white-space: nowrap;
}
.ua-more {
font-size: 0.75rem;
color: #999;
}
.num {
font-variant-numeric: tabular-nums;
text-align: center;
color: #fff;
}
.actions {
display: flex;
align-items: center;
gap: 0.5rem;
}
.actions form {
margin: 0;
}
.empty {
text-align: center;
color: #888;
padding: 2rem;
}
.pagination {
display: flex;
flex-wrap: wrap;
gap: 0.35rem;
align-items: center;
}
.pagination .pg {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: 2rem;
padding: 0.3rem 0.6rem;
border: 1px solid var(--admin-border-muted);
font-size: 0.85rem;
color: #ccc;
}
.pagination a.pg:hover {
border-color: var(--admin-accent);
color: var(--admin-accent);
}
.pagination .pg.current {
background: var(--admin-accent);
border-color: var(--admin-accent);
color: var(--bg);
font-weight: 700;
}
.sub {
color: #aaa;
font-size: 0.9rem;
}
.toolbar {
display: flex;
gap: 0.6rem;
flex-wrap: wrap;
}
.toolbar form {
margin: 0;
}
.card {
background: var(--admin-surface);
border: 1px solid var(--admin-border);
padding: 1.25rem;
}
.card h2 {
margin: 0 0 1rem 0;
font-size: 1.1rem;
color: var(--admin-accent);
}
.info-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
gap: 1.1rem;
}
.info-item {
display: flex;
flex-direction: column;
gap: 0.2rem;
}
.info-item .label {
font-size: 0.7rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #888;
}
.info-item .value {
color: #eee;
font-size: 0.95rem;
word-break: break-word;
}
#map {
height: 380px;
width: 100%;
border: 1px solid var(--admin-border);
z-index: 0;
}
.leaflet-container {
background: #222;
}
.leaflet-bar {
border-radius: 0;
}
.leaflet-bar a,
.leaflet-bar a:hover {
background-color: #1a1a1a;
color: #fff;
border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}
.leaflet-bar a.leaflet-disabled {
background-color: #2a2a2a;
color: #666;
}
.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
background: #111;
color: #eee;
border: 1px solid var(--admin-border-muted);
border-radius: 0;
}
.leaflet-popup-content {
margin: 10px 14px;
font-family: var(--font-body);
}
.leaflet-container a.leaflet-popup-close-button {
color: #fff;
}
.leaflet-container a.leaflet-popup-close-button:hover {
color: #ff5f5f;
}
.leaflet-control-attribution {
background: rgba(17, 17, 17, 0.8);
color: #aaa;
}
.leaflet-control-attribution a {
color: var(--admin-accent);
}
.ua-list {
list-style: none;
display: flex;
flex-direction: column;
gap: 0.75rem;
padding: 0;
margin: 0;
}
.ua-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
padding: 0.75rem 0.9rem;
background: rgba(255, 255, 255, 0.05);
border: 1px solid var(--admin-border-soft);
}
.ua-item .ua-head {
display: flex;
align-items: baseline;
gap: 0.6rem;
flex-wrap: wrap;
}
.ua-name {
color: #fff;
font-weight: 600;
}
.ua-version {
color: #999;
font-weight: 400;
font-size: 0.85rem;
}
.ua-os {
color: #bbb;
font-size: 0.85rem;
}
.ua-raw {
font-family: 'Courier New', Courier, monospace;
font-size: 0.75rem;
color: #888;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.log-table td.url {
font-family: 'Courier New', Courier, monospace;
color: var(--text);
font-size: 0.85rem;
word-break: break-all;
max-width: 360px;
}
.log-table td.ua-cell-log {
max-width: 260px;
}
.filter-form {
background: var(--admin-surface);
border: 1px solid var(--admin-border);
padding: 1rem;
display: flex;
flex-direction: column;
gap: 0.85rem;
}
.filter-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
gap: 0.75rem;
}
.filter-grid label {
display: flex;
flex-direction: column;
gap: 0.3rem;
font-size: 0.7rem;
letter-spacing: 0.08em;
text-transform: uppercase;
color: #888;
}
.filter-grid input,
.filter-grid select {
background: rgba(255, 255, 255, 0.08);
border: 1px solid var(--admin-border-muted);
color: #eee;
padding: 0.45rem 0.6rem;
font-family: inherit;
font-size: 0.85rem;
color-scheme: dark;
}
option {
background-color: black;
}
.filter-grid input:focus,
.filter-grid select:focus {
outline: none;
border-color: var(--admin-accent);
}
.filter-actions {
display: flex;
gap: 0.6rem;
align-items: center;
flex-wrap: wrap;
}
.geo-fence summary {
cursor: pointer;
color: var(--admin-accent);
font-size: 0.8rem;
letter-spacing: 0.08em;
text-transform: uppercase;
user-select: none;
}
.geo-fence .filter-grid {
margin-top: 0.85rem;
}
@media (max-width: 720px) {
.filter-grid {
grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
}
@media (max-width: 720px) {
.stalker-page {
padding: 1rem;
}
.table-wrap table {
border: none;
background: transparent;
}
.table-wrap table,
.table-wrap tbody,
.table-wrap tr,
.table-wrap td {
display: block;
width: 100%;
}
.table-wrap thead {
display: none;
}
.table-wrap tbody {
display: flex;
flex-direction: column;
gap: 0.75rem;
}
.table-wrap tr {
background: var(--admin-surface);
border: 1px solid var(--admin-border);
padding: 0.35rem 0.9rem;
}
.table-wrap tr:nth-child(even) {
background: var(--admin-surface);
}
.table-wrap tr:hover {
background-color: var(--admin-surface);
}
.table-wrap td {
display: flex;
align-items: center;
justify-content: space-between;
gap: 1rem;
padding: 0.45rem 0;
border-bottom: 1px solid rgba(255, 255, 255, 0.06);
text-align: right;
}
.table-wrap td:last-child {
border-bottom: none;
}
.table-wrap td::before {
content: attr(data-label);
color: #888;
font-size: 0.7rem;
text-transform: uppercase;
letter-spacing: 0.06em;
white-space: nowrap;
}
.table-wrap td .none,
.table-wrap td .num {
text-align: right;
}
.table-wrap td.actions {
justify-content: flex-end;
}
.table-wrap td.actions::before {
margin-right: auto;
}
.table-wrap td.ua-cell,
.table-wrap td.ua-cell-log {
max-width: none;
overflow-x: auto;
justify-content: flex-start;
-webkit-overflow-scrolling: touch;
scrollbar-width: thin;
}
.log-table td.url {
max-width: none;
word-break: break-word;
}
}
</style>
+3
View File
@@ -0,0 +1,3 @@
<a class="link nav-link" href="<%= href %>"<% if (typeof useHistoryBack !== 'undefined' && useHistoryBack) { %> onclick="if(history.length > 1){ history.back(); return false; }"<% } %>>
<div class="link-text"><%= label %></div>
</a>
+22
View File
@@ -0,0 +1,22 @@
<div class="gallery-editor">
<div class="container">
<div class="center-n">
<%- include('./search-form', { action: searchAction, search, mode }); -%>
<a class="btn" href="<%= addHref %>"><%= addLabel %></a>
<%- include('./pagination', { currentPage, totalPages, search, mode, t }); -%>
<div class="gallery-grid">
<% items.forEach(item => { %>
<div class="gallery-box">
<div class="image-title"><%= item.name %></div>
<a href="<%= editHrefPrefix %><%= item.id %>">
<img class="grid-thumb" src="<%= thumbnailPrefix %><%= item.thumbnailName %>">
</a>
</div>
<% }) %>
</div>
</div>
</div>
</div>
+22
View File
@@ -0,0 +1,22 @@
<div class="gallery-grid">
<% items.forEach(item => { %>
<div class="gallery-box">
<div class="image-title"><%= item.name %><% if (item.isVideo) { %> <span class="video-badge">▶</span><% } %></div>
<a href="<%= t(viewPathPrefix + item.id + (typeof accessCode !== 'undefined' && accessCode?.code ? `?access_code=${accessCode.code}` : '')) %>">
<% if (item.isVideo) { %>
<video class="grid-thumb grid-video"
src="/gallery/video/<%= item.id %><%= typeof accessCode !== 'undefined' && accessCode?.code ? `?access_code=${accessCode.code}` : '' %>"
alt="<%= item.name %>"
muted
playsinline
preload="metadata"
loop
poster="<%= thumbnailPathPrefix %><%= item.thumbnailName %>">
</video>
<% } else { %>
<img class="grid-thumb" src="<%= thumbnailPathPrefix %><%= item.thumbnailName %>" alt="<%= item.name %>">
<% } %>
</a>
</div>
<% }) %>
</div>
+35
View File
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<head>
<%- include('./head'); -%>
<%- include('./social-meta', {
socialTitle,
socialDescription,
socialImage
}); -%>
<title><%= pageTitle %></title>
</head>
<body>
<%- include('../scripts'); -%>
<%- include('./browse-page', {
title,
sectionLabel,
wrapTitleInLink: typeof wrapTitleInLink !== 'undefined' ? wrapTitleInLink : false,
useHistoryBack: typeof useHistoryBack !== 'undefined' ? useHistoryBack : false,
searchAction,
items,
viewPathPrefix,
thumbnailPathPrefix,
currentPage,
totalPages,
search,
mode,
accessCode,
tracer,
t
}); -%>
<%- include('../footer'); -%>
</body>
</html>
+24
View File
@@ -0,0 +1,24 @@
<div class="container">
<div class="center-a page-content">
<% if (typeof wrapTitleInLink !== 'undefined' && wrapTitleInLink) { %>
<a class="page-title-link" href="<%= t('/') %>">
<h1><%= title %> - <%= sectionLabel %></h1>
</a>
<% } else { %>
<h1><%= title %> - <%= sectionLabel %></h1>
<% } %>
<h2 class="section-heading"><%= sectionLabel %></h2>
<%- include('./back-link', {
href: t('/'),
label: 'Back home',
useHistoryBack: typeof useHistoryBack !== 'undefined' ? useHistoryBack : false
}); -%>
<%- include('./search-form', { action: searchAction, search, mode, accessCode, tracer }); -%>
<%- include('./access-codes'); -%>
<%- include('./pagination', { currentPage, totalPages, search, mode, accessCode, t }); -%>
<%- include('./browse-grid', { items, viewPathPrefix, thumbnailPathPrefix, accessCode, t }); -%>
</div>
</div>
+10
View File
@@ -0,0 +1,10 @@
<script>
const dates = [...document.getElementsByClassName("ISO-date-raw")];
for (const date of dates) {
const d = new Date(date.textContent.trim());
if (!isNaN(d.getTime())) {
date.textContent = d.toLocaleString();
}
}
</script>
+10
View File
@@ -0,0 +1,10 @@
<meta content="#cee5ff" name="theme-color">
<meta name="twitter:title" content="<%= titleShort %>">
<meta name="twitter:description" content="<%= description %>">
<meta name="twitter:image" content="/assets/images/avatar.png">
<meta property="og:title" content="<%= titleShort %>" />
<meta property="og:type" content="website" />
<meta property="og:image" content="/assets/images/avatar.png" />
<meta property="og:description" content="<%= description %>">
<meta property="description" content="<%= description %>">
<meta name="robots" content="index, follow" />
+2
View File
@@ -0,0 +1,2 @@
<%- include('./upperHead'); -%>
<%- include('./discoverables'); -%>
+26
View File
@@ -0,0 +1,26 @@
document.querySelectorAll('.icon-select').forEach(select => {
const trigger = select.querySelector('.icon-select-trigger');
const options = select.querySelector('.icon-options');
const hiddenInput = select.querySelector('input[name="icon"]');
trigger.addEventListener('click', () => {
options.style.display = options.style.display === 'block' ? 'none' : 'block';
});
options.querySelectorAll('.icon-option').forEach(option => {
option.addEventListener('click', () => {
const id = option.dataset.id;
const name = option.dataset.name;
hiddenInput.value = id;
if (name) {
trigger.innerHTML = `<img src="/assets/images/${name}" alt="">`;
} else {
trigger.innerHTML = `<span style="color:#bbb;">None</span>`;
}
options.style.display = 'none';
});
});
});
+49
View File
@@ -0,0 +1,49 @@
<% if (createAt) { %>
<p class="media-meta"><strong>Created at</strong>: <%= createAt %></p>
<% } %>
<% if (typeof artists !== 'undefined' && artists && artists.length) { %>
<div class="slight-border">
<h5>Artists</h5>
<% artists.forEach(artist => { %>
<div class="artist">
<span class="artist-name"><%= artist.name %></span>
<% if (artist.urls.length > 0) { %>
<div class="artist-links">
<% artist.urls.forEach(url => { %>
<a href="<%= url %>" target="_blank" rel="noopener noreferrer" class="underline chip-link">
<%= url %>
</a>
<% }) %>
</div>
<% } %>
</div>
<% }) %>
</div>
<% } %>
<% if (typeof sources !== 'undefined' && sources && sources.length > 0) { %>
<div class="slight-border">
<h5>Sources</h5>
<div class="sources">
<% sources.forEach(source => { %>
<a href="<%= source %>" target="_blank" rel="noopener noreferrer" class="underline chip-link">
<%= source %>
</a>
<% }) %>
</div>
</div>
<% } %>
<% if (typeof tags !== 'undefined' && tags && tags.length > 0) { %>
<div class="slight-border">
<h5>Tags</h5>
<div class="tags">
<% tags.forEach(tag => { %>
<a href="<%= tagSearchBase %>?search=<%= tag %>&mode=tags<%= typeof accessCode !== 'undefined' && accessCode?.code ? `&access_code=${accessCode.code}` : '' %>" rel="noopener noreferrer" class="underline chip-tag">
<%= tag %>
</a>
<% }) %>
</div>
</div>
<% } %>
+30
View File
@@ -0,0 +1,30 @@
<%
let start = Math.max(1, currentPage - 3);
let end = Math.min(totalPages, currentPage + 3);
if (currentPage <= 4) {
start = 1;
end = Math.min(7, totalPages);
} else if (currentPage + 3 > totalPages) {
end = totalPages;
start = Math.max(1, totalPages - 6);
}
const accessSuffix = typeof accessCode !== "undefined" && accessCode?.code
? `&access_code=${accessCode.code}`
: "";
const querySuffix = `&search=${search}&mode=${mode}${accessSuffix}`;
%>
<div class="pagination">
<% if (currentPage > 1) { %>
<a href="<%= t('?page=' + (currentPage - 1) + querySuffix) %>">Prev</a>
<% } %>
<% for (let p = start; p <= end; p++) { %>
<a href="<%= t('?page=' + p + querySuffix) %>" class="<%= p === currentPage ? 'active' : '' %>"><%= p %></a>
<% } %>
<% if (currentPage < totalPages) { %>
<a href="<%= t('?page=' + (currentPage + 1) + querySuffix) %>">Next</a>
<% } %>
</div>
+17
View File
@@ -0,0 +1,17 @@
<form method="get" action="<%= action %>" class="search-form">
<input type="text" name="search" value="<%= search %>" placeholder="Search...">
<% if (typeof accessCode !== "undefined" && accessCode && accessCode.code) { %>
<input type="text" name="access_code" value="<%= accessCode.code %>" hidden>
<% } %>
<% if (typeof tracer !== 'undefined' && tracer) { %>
<input type="text" name="t" value="<%= tracer.id %>" hidden>
<% } %>
<select name="mode">
<option value="general" <%= mode === "general" ? "selected" : "" %>>General</option>
<option value="tags" <%= mode === "tags" ? "selected" : "" %>>Tags</option>
</select>
<button type="submit">Search</button>
</form>
+8
View File
@@ -0,0 +1,8 @@
<meta content="#cee5ff" name="theme-color">
<meta name="twitter:title" content="<%= socialTitle %>">
<meta name="twitter:description" content="<%= socialDescription %>">
<meta name="twitter:image" content="<%= socialImage %>">
<meta property="og:title" content="<%= socialTitle %>" />
<meta property="og:type" content="website" />
<meta property="og:image" content="<%= socialImage %>" />
<meta property="og:description" content="<%= socialDescription %>">
+19
View File
@@ -0,0 +1,19 @@
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="/favicon.ico" type="image/x-icon"/>
<link rel="manifest" href="/site.webmanifest">
<link rel="stylesheet" href="/assets/styles.css">
<% if (typeof font !== 'undefined' && font && font.file) { %>
<style>
@font-face {
font-family: '<%= font.family %>';
src: url('/assets/fonts/<%= font.file %>?v=<%= font.updated || 0 %>');
font-display: swap;
}
:root {
--font-body: '<%= font.family %>', 'Courier New', Courier, monospace;
}
</style>
<% } %>
+8
View File
@@ -0,0 +1,8 @@
<script>
const d = ['mousemove', 'touchstart', 'scroll', 'wheel', 'keydown', 'keyup'];
const ping = () => {
fetch(`/science?url=${encodeURIComponent(location.href)}`);
d.forEach(e => window.removeEventListener(e, ping));
}
d.forEach(e => window.addEventListener(e, ping));
</script>
+3
View File
@@ -0,0 +1,3 @@
<script src="/assets/js/screensaver.js"></script>
<script src="/assets/js/gallery.js"></script>
<%- include('winter'); -%>
+19
View File
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Stats</title>
</head>
<body>
<% for(var i = 0; i < stats.length; i++) {%>
<% if (stats[i][0] === 1) { %>
<h4><%=stats[i][1]%></h4>
<% } else { %>
<li><%=stats[i][1] %></li>
<% } %>
<% } %>
</body>
</html>
+20
View File
@@ -0,0 +1,20 @@
<%- include('./partials/browse-index', {
title,
pageTitle: title + ' - Storage',
sectionLabel: 'Storage',
useHistoryBack: true,
searchAction: '/storage',
items: files,
viewPathPrefix: '/storage/view/',
thumbnailPathPrefix: '/file/thumbnail/',
socialTitle: mp(title) + ' storage',
socialDescription: mp(title) + ' storage contains ' + totalfiles + ' files that you can download and use!',
socialImage: '/assets/images/storage-preview.png',
currentPage,
totalPages,
search,
mode,
accessCode,
tracer,
t
}); -%>
+20
View File
@@ -0,0 +1,20 @@
<% const snow = [];%>
<noscript>
<%
const m = new Date().getMonth();
snowflakes = "❅❆❃❊❉";
if ([11,0,1].includes(m)) {
const winter = 10;
for (let i = 0; i < winter; i++) {
snow.push(snowflakes[Math.floor(Math.random() * snowflakes.length)]);
}
}
for(var i = 0; i < snow.length; i++) { %>
<div class="snowflake"><%= snow[i] %> </div>
<% } %>
</noscript>
<% if (snow.length) { %>
<script src="/assets/js/snow.js"></script>
<% } %>