This commit is contained in:
611
dev/html/control.html
Normal file
611
dev/html/control.html
Normal file
@@ -0,0 +1,611 @@
|
||||
<!-- half ai slop -->
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>control</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<script src="https://unpkg.com/lucide@latest/dist/umd/lucide.js"></script>
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700;800&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
<style>
|
||||
*,
|
||||
*::before,
|
||||
*::after {
|
||||
box-sizing: border-box;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
}
|
||||
[k-template] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
:root {
|
||||
--bg: #0d0d0f;
|
||||
--surface: #131316;
|
||||
--surface2: #1a1a1f;
|
||||
--border: rgba(255, 255, 255, 0.06);
|
||||
--border-bright: rgba(255, 255, 255, 0.14);
|
||||
--text: #ffffff;
|
||||
--muted: #d3d3dd;
|
||||
--too-muted: #84848f;
|
||||
--blue: #4f8ef7;
|
||||
--blue-dim: rgba(79, 142, 247, 0.12);
|
||||
--green: #3ecf8e;
|
||||
--green-dim: rgba(62, 207, 142, 0.12);
|
||||
--red: #f76f6f;
|
||||
--red-dim: rgba(247, 111, 111, 0.12);
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: "JetBrains Mono", monospace;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.shell {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 2rem 1rem;
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 100%;
|
||||
max-width: 820px;
|
||||
background: var(--surface);
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
box-shadow:
|
||||
0 0 0 1px rgba(0, 0, 0, 0.5),
|
||||
0 24px 64px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.titlebar {
|
||||
background: var(--surface2);
|
||||
border-bottom: 1px solid var(--border-bright);
|
||||
padding: 12px 18px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
position: relative;
|
||||
}
|
||||
.dots {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.dot {
|
||||
width: 11px;
|
||||
height: 11px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.dot-r {
|
||||
background: #f76f6f;
|
||||
}
|
||||
.dot-y {
|
||||
background: #f5c842;
|
||||
}
|
||||
.dot-g {
|
||||
background: #3ecf8e;
|
||||
}
|
||||
.titlebar-name {
|
||||
font-size: 17px;
|
||||
font-weight: 800;
|
||||
color: var(--text);
|
||||
margin-left: 20px;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.titlebar-by {
|
||||
position: absolute;
|
||||
right: 20px;
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.card-body {
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 24px;
|
||||
}
|
||||
|
||||
.section-label {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.15em;
|
||||
text-transform: uppercase;
|
||||
color: var(--muted);
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.section-label .pulse-dot {
|
||||
width: 7px;
|
||||
height: 7px;
|
||||
border-radius: 50%;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.pulse-dot.blue {
|
||||
background: var(--blue);
|
||||
animation: pulse 2s ease-in-out infinite;
|
||||
}
|
||||
.pulse-dot.green {
|
||||
background: var(--green);
|
||||
animation: pulse 2s ease-in-out infinite 0.4s;
|
||||
}
|
||||
@keyframes pulse {
|
||||
0%,
|
||||
100% {
|
||||
opacity: 1;
|
||||
box-shadow: 0 0 0 0 currentColor;
|
||||
}
|
||||
50% {
|
||||
opacity: 0.6;
|
||||
}
|
||||
}
|
||||
|
||||
.error-area p {
|
||||
font-size: 12px;
|
||||
color: var(--red);
|
||||
background: var(--red-dim);
|
||||
border: 1px solid rgba(247, 111, 111, 0.25);
|
||||
border-radius: 6px;
|
||||
padding: 8px 14px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.create-form {
|
||||
display: grid;
|
||||
grid-template-columns: 1.5fr 2fr;
|
||||
gap: 8px;
|
||||
}
|
||||
.create-form textarea {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
.create-form .btn-row {
|
||||
grid-column: 1 / -1;
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
}
|
||||
|
||||
.field {
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border-bright);
|
||||
border-radius: 6px;
|
||||
padding: 8px 12px;
|
||||
color: var(--text);
|
||||
font-family: inherit;
|
||||
font-size: 12px;
|
||||
outline: none;
|
||||
transition:
|
||||
border-color 0.15s,
|
||||
box-shadow 0.15s;
|
||||
width: 100%;
|
||||
}
|
||||
.field::placeholder {
|
||||
color: var(--too-muted);
|
||||
}
|
||||
.field:focus {
|
||||
border-color: var(--blue);
|
||||
box-shadow: 0 0 0 3px var(--blue-dim);
|
||||
}
|
||||
textarea.field {
|
||||
resize: none;
|
||||
min-height: 68px;
|
||||
}
|
||||
|
||||
.btn-add {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
background: var(--blue);
|
||||
color: #fff;
|
||||
font-family: inherit;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.08em;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
padding: 7px 14px;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 0.15s,
|
||||
transform 0.1s;
|
||||
}
|
||||
.btn-add:hover {
|
||||
background: #6aa3ff;
|
||||
}
|
||||
.btn-add:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
.tbl-wrap {
|
||||
overflow-x: auto;
|
||||
border-radius: 8px;
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
border-collapse: collapse;
|
||||
font-size: 12px;
|
||||
}
|
||||
thead {
|
||||
background: var(--surface2);
|
||||
}
|
||||
thead th {
|
||||
padding: 9px 14px;
|
||||
text-align: left;
|
||||
font-size: 10px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.12em;
|
||||
text-transform: uppercase;
|
||||
color: var(--muted);
|
||||
border-bottom: 1px solid var(--border-bright);
|
||||
white-space: nowrap;
|
||||
}
|
||||
tbody tr {
|
||||
border-bottom: 1px solid var(--border);
|
||||
transition: background 0.1s;
|
||||
}
|
||||
tbody tr:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
tbody tr:hover {
|
||||
background: rgba(255, 255, 255, 0.025);
|
||||
}
|
||||
tbody td {
|
||||
padding: 10px 14px;
|
||||
color: var(--text);
|
||||
vertical-align: middle;
|
||||
}
|
||||
tbody td a {
|
||||
color: var(--blue);
|
||||
text-decoration: none;
|
||||
font-size: 11px;
|
||||
}
|
||||
tbody td a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.row-actions {
|
||||
display: flex;
|
||||
gap: 6px;
|
||||
}
|
||||
.action-btn {
|
||||
min-width: 28px;
|
||||
padding: 0 6px;
|
||||
height: 28px;
|
||||
border-radius: 5px;
|
||||
border: 1px solid var(--border-bright);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
cursor: pointer;
|
||||
transition:
|
||||
background 0.15s,
|
||||
border-color 0.15s;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.action-btn.copy {
|
||||
background: var(--green-dim);
|
||||
border-color: rgba(62, 207, 142, 0.25);
|
||||
color: var(--green);
|
||||
}
|
||||
.action-btn.copy:hover {
|
||||
background: rgba(62, 207, 142, 0.22);
|
||||
}
|
||||
.action-btn.copy.alt {
|
||||
background: var(--blue-dim);
|
||||
border-color: rgba(62, 107, 242, 0.25);
|
||||
color: var(--blue);
|
||||
}
|
||||
.action-btn.copy.alt:hover {
|
||||
background: rgba(62, 107, 242, 0.22);
|
||||
}
|
||||
.action-btn.del {
|
||||
background: var(--red-dim);
|
||||
border-color: rgba(247, 111, 111, 0.25);
|
||||
color: var(--red);
|
||||
}
|
||||
.action-btn.del:hover {
|
||||
background: rgba(247, 111, 111, 0.22);
|
||||
}
|
||||
|
||||
.token-badge {
|
||||
font-size: 10px;
|
||||
background: var(--green-dim);
|
||||
color: var(--green);
|
||||
border: 1px solid rgba(62, 207, 142, 0.2);
|
||||
border-radius: 4px;
|
||||
padding: 2px 7px;
|
||||
letter-spacing: 0.04em;
|
||||
max-width: 160px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.empty-row td {
|
||||
text-align: center;
|
||||
color: var(--muted);
|
||||
padding: 24px;
|
||||
font-size: 11px;
|
||||
letter-spacing: 0.06em;
|
||||
}
|
||||
.token-hide {
|
||||
color: transparent;
|
||||
background: linear-gradient(to right, #fff 15%, transparent 60%);
|
||||
background-clip: text;
|
||||
transition: background 0.3s;
|
||||
}
|
||||
.token-hide:hover,
|
||||
tr:has(.token-hide):hover .token-hide {
|
||||
background-color: #fff;
|
||||
}
|
||||
.err {
|
||||
gap: 2px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div k-template id="t_login">
|
||||
<input type="hidden" name="l" value="{{l}}" />
|
||||
</div>
|
||||
<div id="t_error" k-template>
|
||||
<p class="text-red-500 text-center err">
|
||||
<i data-lucide="x_circle" height="14"></i>{{error}}
|
||||
</p>
|
||||
</div>
|
||||
<div k-template id="t_active_row">
|
||||
<template-tr>
|
||||
<template-td>{{name}}</template-td>
|
||||
<template-td>{{comment}}</template-td>
|
||||
<template-td
|
||||
><a class="text-blue-300" href="{{url}}">{{url}}</a></template-td
|
||||
>
|
||||
<template-td>
|
||||
<div class="row-actions">
|
||||
<div class="action-btn copy" onclick="copy_link('{{name}}')">
|
||||
<i data-lucide="copy" height="14"></i>
|
||||
link
|
||||
</div>
|
||||
<div class="action-btn del" onclick="delete_link('{{name}}')">
|
||||
<i data-lucide="trash" height="14"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template-td>
|
||||
</template-tr>
|
||||
</div>
|
||||
<div k-template id="t_complete_row">
|
||||
<template-tr>
|
||||
<template-td>{{name}}</template-td>
|
||||
<template-td class="token-hide">{{token}}</template-td>
|
||||
<template-td>{{comment}}</template-td>
|
||||
<template-td
|
||||
><a class="text-blue-300" href="{{url}}">{{url}}</a></template-td
|
||||
>
|
||||
<template-td>
|
||||
<div class="row-actions">
|
||||
<div class="action-btn copy alt" onclick="copy('{{token}}')">
|
||||
<i data-lucide="copy" height="14"></i>
|
||||
token
|
||||
</div>
|
||||
<div class="action-btn copy" onclick="copy_link('{{name}}')">
|
||||
<i data-lucide="copy" height="14"></i>
|
||||
link
|
||||
</div>
|
||||
<div class="action-btn del" onclick="delete_link('{{name}}')">
|
||||
<i data-lucide="trash" height="14"></i>
|
||||
</div>
|
||||
</div>
|
||||
</template-td>
|
||||
</template-tr>
|
||||
</div>
|
||||
|
||||
<div class="shell">
|
||||
<div class="card">
|
||||
<div class="titlebar">
|
||||
<div class="dots">
|
||||
<span class="dot dot-r"></span>
|
||||
<span class="dot dot-y"></span>
|
||||
<span class="dot dot-g"></span>
|
||||
</div>
|
||||
<span class="titlebar-name">totally not token stealer</span>
|
||||
<img
|
||||
src="https://assets.ktkz.ru/ktkzXtmb.svg"
|
||||
alt=""
|
||||
class="titlebar-by"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<div class="error-area" k-m-error></div>
|
||||
<div>
|
||||
<div class="section-label">
|
||||
<i data-lucide="plus-circle" width="13" height="13"></i>
|
||||
create new entry
|
||||
</div>
|
||||
<form class="create-form" action="" method="get">
|
||||
<input type="hidden" name="control" value="" />
|
||||
<template k-login></template>
|
||||
<input type="hidden" name="do" value="create" />
|
||||
<input
|
||||
class="field"
|
||||
type="text"
|
||||
name="name"
|
||||
k-link-name-format
|
||||
placeholder="link name e.g. homework => (?go=homework)"
|
||||
required
|
||||
/>
|
||||
<input
|
||||
class="field"
|
||||
type="text"
|
||||
name="url"
|
||||
placeholder="redirect URL e.g. https://example.com"
|
||||
required
|
||||
/>
|
||||
<textarea
|
||||
class="field"
|
||||
name="comment"
|
||||
placeholder="comment for you (optional)"
|
||||
></textarea>
|
||||
<div class="btn-row">
|
||||
<button type="submit" class="btn-add">
|
||||
<i data-lucide="plus" width="13" height="13"></i>
|
||||
Add entry
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<!-- Active -->
|
||||
<div>
|
||||
<div class="section-label">
|
||||
<span class="pulse-dot blue"></span>
|
||||
active
|
||||
</div>
|
||||
<div class="tbl-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>comment</th>
|
||||
<th>url</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody k-m-active>
|
||||
<!-- empty placeholder (script will clear this) -->
|
||||
<tr class="empty-row">
|
||||
<td colspan="4">no active entries</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="section-label">
|
||||
<span class="pulse-dot green"></span>
|
||||
completed
|
||||
</div>
|
||||
<div class="tbl-wrap">
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>name</th>
|
||||
<th>token</th>
|
||||
<th>comment</th>
|
||||
<th>url</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody k-m-completed>
|
||||
<tr class="empty-row">
|
||||
<td colspan="5">no completed entries</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
lucide.createIcons();
|
||||
</script>
|
||||
</body>
|
||||
<script>
|
||||
/** @param {{error?: string; password: string; data: {name: string; url: string; comment: string; token: string | null}[] }} data */
|
||||
const appendData = (data) => {
|
||||
if (data.error) {
|
||||
document.querySelector("[k-m-error]").innerHTML = renderTemplate(
|
||||
"error",
|
||||
data,
|
||||
);
|
||||
}
|
||||
document.querySelectorAll("[k-login]").forEach((a) => {
|
||||
a.outerHTML = renderTemplate("login", { l: data.password });
|
||||
});
|
||||
window.__password = data.password;
|
||||
if (data.data) {
|
||||
let completedBlocks = [];
|
||||
let activeBlocks = [];
|
||||
data.data.forEach((item) => {
|
||||
if (!!item.token) {
|
||||
completedBlocks.push(renderTemplate("complete_row", item));
|
||||
} else {
|
||||
activeBlocks.push(
|
||||
renderTemplate("active_row", {
|
||||
name: item.name,
|
||||
url: item.url,
|
||||
comment: item.comment,
|
||||
}),
|
||||
);
|
||||
}
|
||||
});
|
||||
if (completedBlocks.length > 0)
|
||||
document.querySelector("[k-m-completed]").innerHTML =
|
||||
completedBlocks.join("");
|
||||
if (activeBlocks.length > 0)
|
||||
document.querySelector("[k-m-active]").innerHTML =
|
||||
activeBlocks.join("");
|
||||
}
|
||||
};
|
||||
|
||||
/** @param {string} name
|
||||
* @param {object} values
|
||||
*/
|
||||
const renderTemplate = (name, values) => {
|
||||
const el = document.querySelector(`[k-template]#t_${name}`);
|
||||
if (!el) {
|
||||
throw `k-template ${name} not found`;
|
||||
return;
|
||||
}
|
||||
let d = el.innerHTML;
|
||||
Object.keys(values).forEach((i) => {
|
||||
d = d.split(`{{${i}}}`).join(values[i].toString());
|
||||
});
|
||||
d = d.split(`template-`).join("");
|
||||
return d;
|
||||
};
|
||||
|
||||
window["_appendData"] = appendData;
|
||||
</script>
|
||||
<script>
|
||||
function copy_link(link) {
|
||||
const url =
|
||||
location.href.substring(0, location.href.indexOf("?")) + `?go=${link}`;
|
||||
navigator.clipboard.writeText(url);
|
||||
alert("Link copied to clipboard");
|
||||
}
|
||||
function delete_link(link) {
|
||||
if (!window.__password) {
|
||||
console.error("no window password");
|
||||
return;
|
||||
}
|
||||
if (!confirm("Are you sure you want to delete this link?")) return;
|
||||
location.href =
|
||||
location.href.substring(0, location.href.indexOf("?")) +
|
||||
`?l=${window.__password}&do=delete&delete=${link}`;
|
||||
}
|
||||
function copy(text) {
|
||||
navigator.clipboard.writeText(text);
|
||||
alert("Token copied to clipboard");
|
||||
}
|
||||
</script>
|
||||
<script>
|
||||
window._appendData("<<BUILDER_PHP_VAR($data)>>");
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user