Inital commit
This commit is contained in:
commit
a6af7dbfcb
114 files changed
+27520
No files matched your search
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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 & 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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
·
|
||||
Last used: <span class="ISO-date-raw"><%= isNaN(ip.lastUsed.getTime()) ? '?' : ip.lastUsed.toISOString() %></span>
|
||||
·
|
||||
<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: '© 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>
|
||||
@@ -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) => ({
|
||||
'&': '&', '<': '<', '>': '>', '"': '"', "'": '''
|
||||
}[c]));
|
||||
|
||||
const map = L.map('map').setView([20, 0], 2);
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
||||
attribution: '© 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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
@@ -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>
|
||||
Reference in new issue
Block a user