diff --git a/public/s/css/f0ckm.css b/public/s/css/f0ckm.css
index 77b039a..03c2d15 100644
--- a/public/s/css/f0ckm.css
+++ b/public/s/css/f0ckm.css
@@ -7642,6 +7642,48 @@ video.autoplay-gif {
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.3);
padding: 6px 8px;
+ position: relative;
+}
+
+.image-embed-wrap {
+ position: relative;
+ display: inline-block;
+ max-width: 100%;
+}
+
+.admin-delete-attachment-btn {
+ position: absolute;
+ top: 5px;
+ right: 5px;
+ background: rgba(0, 0, 0, 0.6);
+ color: #ff4d4d;
+ border: none;
+ border-radius: 3px;
+ padding: 3px 6px;
+ cursor: pointer;
+ font-size: 11px;
+ font-family: monospace;
+ z-index: 10;
+ opacity: 0;
+ pointer-events: none;
+ transition: opacity 0.2s ease-in-out, background 0.2s;
+ box-shadow: 0 2px 4px rgba(0,0,0,0.5);
+}
+
+.image-embed-wrap:hover .admin-delete-attachment-btn,
+.video-embed-wrap:hover .admin-delete-attachment-btn,
+.audio-embed-wrap:hover .admin-delete-attachment-btn {
+ opacity: 1;
+ pointer-events: auto;
+}
+
+.admin-delete-attachment-btn:hover {
+ background: rgba(0, 0, 0, 0.8);
+ color: #ff6666;
+}
+
+.admin-delete-attachment-btn:active {
+ transform: scale(0.95);
}
.audio-embed-wrap audio {
diff --git a/public/s/js/comments.js b/public/s/js/comments.js
index fc91ef7..42507d0 100644
--- a/public/s/js/comments.js
+++ b/public/s/js/comments.js
@@ -1541,6 +1541,16 @@ class CommentSystem {
return `${displayText}${extraSuffix}`;
};
+ renderer.image = (href, title, text) => {
+ const src = (typeof href === 'object' && href !== null) ? (href.href || '') : (href || '');
+ const imgHtml = ``;
+ if (this.isAdmin && src && src.startsWith('/c/')) {
+ const filename = src.substring(3); // Remove '/c/'
+ return ``;
+ }
+ return imgHtml;
+ };
+
// Pre-compile regexes used in the loop
const escapedSiteHost = window.location.host.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
const allowedHosts = [escapedSiteHost];
@@ -1556,7 +1566,7 @@ class CommentSystem {
// "Safe non-whitespace" — matches any \S except the start of an https?:// boundary.
// Prevents concatenated URLs (url1.webpurl2.webp) being consumed as one giant src.
const safeS = `(?:(?!https?:\\/\\/)\\S)`;
- const imageRegex = new RegExp(`(? {
const isConvertedGif = url.endsWith('#gif');
const cleanUrl = url.replace(/#gif$/, '');
- if (isConvertedGif) {
- return ``;
+ let deleteBtn = '';
+ if (this.isAdmin && cleanUrl.startsWith('/c/')) {
+ const filename = cleanUrl.substring(3);
+ deleteBtn = ``;
}
- return ``;
+ if (isConvertedGif) {
+ return ``;
+ }
+ return ``;
});
// Audio embed: replace anchor links pointing to audio files from allowed hosters with an audio player
const audioEmbedRegex = new RegExp(`]*href="(${mediaDomainOrRelative}(?:\\/[^\\s\\[\\]\\(\\)]+\\.(?:mp3|ogg|wav|flac|aac|opus|m4a)(?:\\?[^\\s\\[\\]\\(\\)]+)?))"[^>]*>([\\s\\S]*?)<\\/a>`, 'gi');
md = md.replace(audioEmbedRegex, (match, url) => {
- return ``;
+ let deleteBtn = '';
+ if (this.isAdmin && url.startsWith('/c/')) {
+ const filename = url.substring(3);
+ deleteBtn = ``;
+ }
+ return ``;
});
// Handle spoilers [spoiler]text[/spoiler] (supports nesting)
@@ -1749,7 +1769,7 @@ class CommentSystem {
v.autoplay = true;
v.muted = true;
v.play().catch(() => {
- v.addEventListener('canplay', () => v.play().catch(() => {}), { once: true });
+ v.addEventListener('canplay', () => v.play().catch(() => { }), { once: true });
});
});
}
@@ -1887,7 +1907,7 @@ class CommentSystem {
${timeAgo}