Adding option to log users ips

This commit is contained in:
2026-05-11 07:45:00 +02:00
parent 862b145c77
commit 1221e0580f
16 changed files with 306 additions and 38 deletions

View File

@@ -11642,15 +11642,13 @@ i.iconset#a_oc {
.responsive-table td {
border: none;
position: relative;
padding: 12px 15px 12px 42% !important;
/* Slightly reduced labels width for more content space */
padding: 12px 15px !important;
min-height: 48px;
display: flex;
align-items: center;
justify-content: flex-start;
flex-wrap: nowrap;
/* Prevent wrapping inside standard cells */
gap: 12px;
flex-direction: column;
align-items: flex-start;
justify-content: center;
gap: 6px;
text-align: left !important;
border-bottom: 1px solid rgba(255, 255, 255, 0.03);
box-sizing: border-box;
@@ -11682,9 +11680,8 @@ i.iconset#a_oc {
.responsive-table td::before {
content: attr(data-label);
position: absolute;
left: 15px;
width: 35%;
position: static;
width: auto;
white-space: nowrap;
font-weight: 800;
color: var(--accent);
@@ -11692,6 +11689,7 @@ i.iconset#a_oc {
text-transform: uppercase;
letter-spacing: 1px;
opacity: 0.8;
margin-bottom: 2px;
}
/* Special handling for the Actions cell */
@@ -13508,4 +13506,56 @@ body.scroller-active #gchat-reopen-bubble {
#nav-meme-link, #nav-upload-link {
white-space: nowrap;
}
}
/* --- Admin IP History Styles --- */
.admin-ips-table {
width: 100%;
border-collapse: separate;
border-spacing: 0 8px;
color: var(--white);
}
.admin-ips-table th {
padding: 15px;
text-align: left;
text-transform: uppercase;
font-size: 0.75rem;
letter-spacing: 1px;
color: #888;
border-bottom: 1px solid rgba(255,255,255,0.05);
}
.admin-ips-table tr {
transition: all 0.2s ease;
}
.admin-ips-table tbody tr {
background: rgba(255, 255, 255, 0.02);
}
.admin-ips-table tbody tr:hover {
background: rgba(255, 255, 255, 0.05);
}
.admin-ips-table td {
padding: 15px;
vertical-align: middle;
}
.ip-badge {
font-family: monospace;
padding: 4px 10px;
background: rgba(var(--accent-rgb, 153, 255, 0), 0.1);
border: 1px solid rgba(var(--accent-rgb, 153, 255, 0), 0.2);
color: var(--accent);
border-radius: 4px;
font-size: 0.9rem;
word-break: break-all;
display: inline-block;
max-width: 100%;
}
.date-cell {
font-size: 0.85rem;
color: #aaa;
}
.date-label {
display: block;
font-size: 0.7rem;
color: #666;
text-transform: uppercase;
margin-bottom: 2px;
}

View File

@@ -23,6 +23,14 @@ window.cancelAnimFrame = (function () {
return div.innerHTML;
};
window.getCurrentItemId = () => {
const path = window.location.pathname;
// Explicitly ignore admin/mod/settings paths to avoid false positives from user IDs, etc.
if (path.includes('/admin/') || path.includes('/mod/') || path.includes('/settings') || path.includes('/user/')) return null;
const match = path.match(/\/(\d+)\/?$/);
return match ? match[1] : null;
};
// OS and Browser detection for CSS targeting
const ua = navigator.userAgent;
const htmlEl = document.documentElement;
@@ -120,9 +128,7 @@ window.cancelAnimFrame = (function () {
});
// Refresh background canvas if it matches the current item
const pathParts = window.location.pathname.split('/');
const numParts = pathParts.filter(s => /^\d+$/.test(s));
const currentId = numParts.length > 0 ? numParts[numParts.length - 1] : null;
const currentId = window.getCurrentItemId();
if (currentId === idStr && window.initBackground) {
window.initBackground();
}
@@ -943,9 +949,7 @@ window.cancelAnimFrame = (function () {
// Always use the thumbnail first for instant backdrop — thumbnails are tiny,
// often browser-cached from grid view, and give us a frame-0 equivalent for GIFs too.
// Extract item ID from URL for thumbnail path.
const pathParts = window.location.pathname.split('/');
const numParts = pathParts.filter(s => /^\d+$/.test(s));
const itemId = numParts.length > 0 ? numParts[numParts.length - 1] : null;
const itemId = window.getCurrentItemId();
const showCanvas = () => {
canvas.classList.remove('fader-out', 'fast-fade');
@@ -1055,9 +1059,7 @@ window.cancelAnimFrame = (function () {
if (background) {
canvas._bgFadingOut = false;
// Draw the item thumbnail if we have an item ID in the URL
const pathParts = window.location.pathname.split('/');
const numParts = pathParts.filter(s => /^\d+$/.test(s));
const itemId = numParts.length > 0 ? numParts[numParts.length - 1] : null;
const itemId = window.getCurrentItemId();
if (itemId) {
const context = canvas.getContext('2d');
const cw = canvas.width = canvas.clientWidth | 0;

View File

@@ -1,11 +1,11 @@
const escapeHtmlUpload = (unsafe) => {
window.escapeHtmlUpload = window.escapeHtmlUpload || ((unsafe) => {
return (unsafe || '').toString()
.replace(/&/g, "&")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")
.replace(/"/g, "&quot;")
.replace(/'/g, "&#039;");
};
});
window.initUploadForm = (selector) => {
const form = (typeof selector === 'string') ? document.querySelector(selector) : selector;
@@ -749,7 +749,7 @@ window.initUploadForm = (selector) => {
chip.className = 'tag-chip';
chip.style.cursor = 'pointer';
chip.title = 'Click to edit prefix or tag';
chip.innerHTML = `<span class="tag-text">${escapeHtmlUpload(tagName)}</span><button type="button">&times;</button>`;
chip.innerHTML = `<span class="tag-text">${window.escapeHtmlUpload(tagName)}</span><button type="button">&times;</button>`;
// Remove button logic
chip.querySelector('button').addEventListener('click', (e) => {
@@ -867,7 +867,7 @@ window.initUploadForm = (selector) => {
const sug = document.createElement('div');
sug.className = 'meta-suggestion';
sug.setAttribute('data-text', text);
sug.innerHTML = `<i class="fa fa-plus-circle" style="user-select:none"></i> <span>${escapeHtmlUpload(text)}</span>`;
sug.innerHTML = `<i class="fa fa-plus-circle" style="user-select:none"></i> <span>${window.escapeHtmlUpload(text)}</span>`;
sug.addEventListener('mouseup', (ev) => {
const sel = window.getSelection?.()?.toString().trim();
@@ -976,7 +976,7 @@ window.initUploadForm = (selector) => {
const scoreStr = typeof s.score === 'number' ? s.score.toFixed(2) : '0.00';
html += `
<div class="tag-suggestion-item">
<span class="tag-suggestion-name">${escapeHtmlUpload(s.tag)}</span>
<span class="tag-suggestion-name">${window.escapeHtmlUpload(s.tag)}</span>
<span class="tag-suggestion-meta">${s.tagged || 0}× · ${scoreStr}</span>
</div>
`;