gdfgd
This commit is contained in:
+499
-3
@@ -12521,10 +12521,10 @@ body > nav.navbar {
|
|||||||
|
|
||||||
@media (max-width: 467px) {
|
@media (max-width: 467px) {
|
||||||
|
|
||||||
.nav-avatar-name,
|
/* .nav-avatar-name,
|
||||||
.nav-avatar-caret {
|
.nav-avatar-caret {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
} */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -12667,7 +12667,14 @@ input:checked+.slider:before {
|
|||||||
.rating-toggle-btn.locked {
|
.rating-toggle-btn.locked {
|
||||||
cursor: not-allowed !important;
|
cursor: not-allowed !important;
|
||||||
pointer-events: none !important;
|
pointer-events: none !important;
|
||||||
opacity: 0.85 !important;
|
}
|
||||||
|
|
||||||
|
.rating-toggle-btn.locked:not(.active) {
|
||||||
|
opacity: 0.45 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.rating-toggle-btn.locked.active {
|
||||||
|
opacity: 1 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Per-rating active colours */
|
/* Per-rating active colours */
|
||||||
@@ -20222,3 +20229,492 @@ div#flash,
|
|||||||
overflow: hidden !important;
|
overflow: hidden !important;
|
||||||
padding: 0 !important;
|
padding: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* ==========================================================================
|
||||||
|
Bulk Item Selection & Operations (Themed: No rounded corners, no box shadows)
|
||||||
|
========================================================================== */
|
||||||
|
|
||||||
|
/* Square checkbox indicator on thumbnails */
|
||||||
|
.thumb-select-check {
|
||||||
|
position: absolute;
|
||||||
|
top: 4px;
|
||||||
|
right: 4px;
|
||||||
|
width: 18px;
|
||||||
|
height: 18px;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
background: var(--bg, #111);
|
||||||
|
border: 1px solid var(--accent, #9f0);
|
||||||
|
color: var(--accent, #9f0);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 10px;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
z-index: 25;
|
||||||
|
pointer-events: none;
|
||||||
|
opacity: 0;
|
||||||
|
box-shadow: none !important;
|
||||||
|
transition: opacity 0.15s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-selection-active .thumb .thumb-select-check {
|
||||||
|
opacity: 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
.thumb.bulk-selected .thumb-select-check {
|
||||||
|
opacity: 1 !important;
|
||||||
|
background: var(--accent, #9f0) !important;
|
||||||
|
color: var(--black, #000) !important;
|
||||||
|
font-weight: bold !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Selected thumbnail outline: theme-colored border, no shadows, no transform */
|
||||||
|
.thumb.bulk-selected {
|
||||||
|
outline: 2px solid var(--accent, #9f0) !important;
|
||||||
|
outline-offset: -2px !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
transform: none !important;
|
||||||
|
filter: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Long-press holding indicator: dashed border */
|
||||||
|
.thumb.thumb-longpressing {
|
||||||
|
outline: 1px dashed var(--accent, #9f0) !important;
|
||||||
|
outline-offset: -1px !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
transform: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Floating Bulk Action Bar (fixed to bottom, themed border and background) */
|
||||||
|
#bulk-action-bar {
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%) translateY(100%);
|
||||||
|
z-index: 99999;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 8px;
|
||||||
|
background: var(--dropdown-bg, #232323) !important;
|
||||||
|
border-top: 2px solid var(--accent, #9f0) !important;
|
||||||
|
border-left: 1px solid var(--accent, #9f0) !important;
|
||||||
|
border-right: 1px solid var(--accent, #9f0) !important;
|
||||||
|
border-bottom: none !important;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 6px 12px;
|
||||||
|
box-shadow: none !important;
|
||||||
|
opacity: 0;
|
||||||
|
pointer-events: none;
|
||||||
|
transition: transform 0.2s ease, opacity 0.2s ease;
|
||||||
|
user-select: none;
|
||||||
|
font-family: var(--font, monospace) !important;
|
||||||
|
max-width: 100vw;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bulk-action-bar.visible {
|
||||||
|
transform: translateX(-50%) translateY(0);
|
||||||
|
opacity: 1;
|
||||||
|
pointer-events: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-count-box {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--white, #fff);
|
||||||
|
padding-right: 10px;
|
||||||
|
border-right: 1px solid var(--nav-border-color, #444);
|
||||||
|
white-space: nowrap;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-count-num {
|
||||||
|
background: var(--bg, #111);
|
||||||
|
color: var(--accent, #9f0);
|
||||||
|
border: 1px solid var(--accent, #9f0);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 1px 6px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: bold;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-actions-group {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
flex-wrap: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn {
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
padding: 5px 10px;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: var(--font, monospace) !important;
|
||||||
|
border: 1px solid var(--nav-border-color, #444);
|
||||||
|
background: var(--nav-bg, #2b2b2b);
|
||||||
|
color: var(--white, #fff);
|
||||||
|
cursor: pointer;
|
||||||
|
box-shadow: none !important;
|
||||||
|
transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn:hover {
|
||||||
|
background: var(--nav-link-hover-bg, #333);
|
||||||
|
color: var(--accent, #9f0);
|
||||||
|
border-color: var(--accent, #9f0);
|
||||||
|
transform: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn:active {
|
||||||
|
transform: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn-primary {
|
||||||
|
background: var(--accent, #9f0) !important;
|
||||||
|
color: var(--black, #000) !important;
|
||||||
|
border: 1px solid var(--accent, #9f0) !important;
|
||||||
|
font-weight: bold !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn-primary:hover {
|
||||||
|
filter: brightness(1.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn-close {
|
||||||
|
padding: 5px 8px;
|
||||||
|
background: var(--nav-bg, #2b2b2b);
|
||||||
|
color: var(--white, #fff);
|
||||||
|
border: 1px solid var(--nav-border-color, #444);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn-close:hover {
|
||||||
|
background: #ff4444 !important;
|
||||||
|
color: #fff !important;
|
||||||
|
border-color: #ff4444 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bulk rating dropdown wrapper */
|
||||||
|
.bulk-dropdown-wrap {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-dropdown-menu {
|
||||||
|
position: absolute;
|
||||||
|
bottom: calc(100% + 4px);
|
||||||
|
left: 0;
|
||||||
|
background: var(--dropdown-bg, #232323);
|
||||||
|
border: 1px solid var(--accent, #9f0);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 4px;
|
||||||
|
display: none;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: 2px;
|
||||||
|
box-shadow: none !important;
|
||||||
|
min-width: 120px;
|
||||||
|
z-index: 100000;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-dropdown-menu.show {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-menu-item {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
padding: 5px 8px;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
font-size: 11.5px;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
background: transparent;
|
||||||
|
border: none;
|
||||||
|
color: var(--white, #fff);
|
||||||
|
cursor: pointer;
|
||||||
|
text-align: left;
|
||||||
|
box-shadow: none !important;
|
||||||
|
transition: background 0.1s ease, color 0.1s ease;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-menu-item:hover {
|
||||||
|
background: var(--nav-link-hover-bg, #333);
|
||||||
|
color: var(--accent, #9f0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-menu-item.rating-sfw {
|
||||||
|
border-left: 3px solid var(--badge-sfw, #02500b);
|
||||||
|
}
|
||||||
|
.bulk-menu-item.rating-sfw:hover {
|
||||||
|
background: var(--badge-sfw, #02500b);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-menu-item.rating-nsfw {
|
||||||
|
border-left: 3px solid var(--badge-nsfw, #E10DC3);
|
||||||
|
}
|
||||||
|
.bulk-menu-item.rating-nsfw:hover {
|
||||||
|
background: var(--badge-nsfw, #E10DC3);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-menu-item.rating-nsfl {
|
||||||
|
border-left: 3px solid var(--badge-nsfl, #660000);
|
||||||
|
}
|
||||||
|
.bulk-menu-item.rating-nsfl:hover {
|
||||||
|
background: var(--badge-nsfl, #660000);
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Bulk Modals (Add Tags / Remove Tags) */
|
||||||
|
.bulk-modal-overlay {
|
||||||
|
position: fixed;
|
||||||
|
inset: 0;
|
||||||
|
background: rgba(0, 0, 0, 0.85);
|
||||||
|
backdrop-filter: blur(4px);
|
||||||
|
-webkit-backdrop-filter: blur(4px);
|
||||||
|
z-index: 100300;
|
||||||
|
display: none;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-overlay.visible {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-card {
|
||||||
|
background: var(--bg, #111);
|
||||||
|
border: 1px solid var(--accent, #9f0);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 18px;
|
||||||
|
width: 100%;
|
||||||
|
max-width: 440px;
|
||||||
|
box-shadow: none !important;
|
||||||
|
color: var(--white, #fff);
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
border-bottom: 1px solid var(--nav-border-color, #444);
|
||||||
|
padding-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-header h3 {
|
||||||
|
margin: 0;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 6px;
|
||||||
|
color: var(--accent, #9f0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-close {
|
||||||
|
background: none;
|
||||||
|
border: none;
|
||||||
|
color: var(--white, #fff);
|
||||||
|
font-size: 16px;
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 2px 6px;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-close:hover {
|
||||||
|
color: #ff4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-desc {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #aaa;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
line-height: 1.4;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-tag-chips-wrap {
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
gap: 4px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
min-height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-tag-chip {
|
||||||
|
background: var(--badge-bg, #171717);
|
||||||
|
border: 1px solid var(--accent, #9f0);
|
||||||
|
color: var(--white, #fff);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
padding: 2px 8px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
display: inline-flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 5px;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-tag-chip .remove-chip-btn {
|
||||||
|
cursor: pointer;
|
||||||
|
opacity: 0.7;
|
||||||
|
font-size: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-tag-chip .remove-chip-btn:hover {
|
||||||
|
opacity: 1;
|
||||||
|
color: #ff4444;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-input-container {
|
||||||
|
position: relative;
|
||||||
|
margin-bottom: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-text-input {
|
||||||
|
width: 100%;
|
||||||
|
background: rgba(255, 255, 255, 0.05);
|
||||||
|
border: 1px solid var(--nav-border-color, #444);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
padding: 8px 10px;
|
||||||
|
color: var(--white, #fff);
|
||||||
|
font-size: 13px;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
outline: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-text-input:focus {
|
||||||
|
border-color: var(--accent, #9f0);
|
||||||
|
outline: none;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-tag-suggestions {
|
||||||
|
position: absolute;
|
||||||
|
top: 100%;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
background: var(--dropdown-bg, #232323);
|
||||||
|
border: 1px solid var(--accent, #9f0);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
max-height: 160px;
|
||||||
|
overflow-y: auto;
|
||||||
|
z-index: 100310;
|
||||||
|
box-shadow: none !important;
|
||||||
|
display: none;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-suggestion-item {
|
||||||
|
padding: 6px 10px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: var(--font, monospace);
|
||||||
|
cursor: pointer;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: var(--white, #fff);
|
||||||
|
border-radius: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-suggestion-item:hover,
|
||||||
|
.bulk-suggestion-item.highlighted {
|
||||||
|
background: var(--accent, #9f0);
|
||||||
|
color: var(--black, #000);
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-suggestion-count {
|
||||||
|
font-size: 10px;
|
||||||
|
opacity: 0.7;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-actions {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-end;
|
||||||
|
gap: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-btn {
|
||||||
|
padding: 6px 14px;
|
||||||
|
border-radius: 0 !important;
|
||||||
|
font-size: 12px;
|
||||||
|
font-family: var(--font, monospace) !important;
|
||||||
|
cursor: pointer;
|
||||||
|
border: 1px solid var(--nav-border-color, #444);
|
||||||
|
background: var(--nav-bg, #2b2b2b);
|
||||||
|
color: var(--white, #fff);
|
||||||
|
box-shadow: none !important;
|
||||||
|
transition: all 0.12s ease;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-btn:hover {
|
||||||
|
background: var(--nav-link-hover-bg, #333);
|
||||||
|
color: var(--accent, #9f0);
|
||||||
|
border-color: var(--accent, #9f0);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-btn-submit {
|
||||||
|
background: var(--accent, #9f0) !important;
|
||||||
|
color: var(--black, #000) !important;
|
||||||
|
font-weight: bold !important;
|
||||||
|
border: 1px solid var(--accent, #9f0) !important;
|
||||||
|
box-shadow: none !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-btn-submit:hover {
|
||||||
|
filter: brightness(1.15);
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-btn-submit:disabled {
|
||||||
|
opacity: 0.5;
|
||||||
|
cursor: not-allowed;
|
||||||
|
filter: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Responsive tweaks for mobile devices */
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
#bulk-action-bar {
|
||||||
|
width: 100vw;
|
||||||
|
padding: 6px 8px;
|
||||||
|
justify-content: space-between;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-count-box {
|
||||||
|
padding-right: 6px;
|
||||||
|
font-size: 11.5px;
|
||||||
|
gap: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn {
|
||||||
|
padding: 5px 7px;
|
||||||
|
font-size: 11.5px;
|
||||||
|
gap: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-btn .btn-text-full {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bulk-modal-card {
|
||||||
|
padding: 14px;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
const tagsContainer = document.querySelector("#tags");
|
const tagsContainer = document.querySelector("#tags");
|
||||||
if (!tagsContainer) return;
|
if (!tagsContainer) return;
|
||||||
const inner = tagsContainer.querySelector(".tags-inner") || tagsContainer;
|
const inner = tagsContainer.querySelector(".tags-inner") || tagsContainer;
|
||||||
|
const activePostId = tagsContainer.dataset.itemId || (typeof window.getCurrentItemId === 'function' ? window.getCurrentItemId() : null);
|
||||||
|
|
||||||
const canManage = !!(
|
const canManage = !!(
|
||||||
document.querySelector('#tags[data-can-manage="true"]') ||
|
document.querySelector('#tags[data-can-manage="true"]') ||
|
||||||
@@ -96,6 +97,7 @@
|
|||||||
if (isRating) {
|
if (isRating) {
|
||||||
span.classList.add('rating-tag', `is-${tag.normalized}`);
|
span.classList.add('rating-tag', `is-${tag.normalized}`);
|
||||||
span.dataset.rating = tag.normalized;
|
span.dataset.rating = tag.normalized;
|
||||||
|
if (activePostId) span.dataset.itemId = activePostId;
|
||||||
if (canManage) {
|
if (canManage) {
|
||||||
span.classList.add('can-cycle');
|
span.classList.add('can-cycle');
|
||||||
}
|
}
|
||||||
@@ -124,6 +126,7 @@
|
|||||||
const untaggedSpan = document.createElement("span");
|
const untaggedSpan = document.createElement("span");
|
||||||
untaggedSpan.className = `badge badge-untagged rating-tag is-untagged${canManage ? ' can-cycle' : ''}`;
|
untaggedSpan.className = `badge badge-untagged rating-tag is-untagged${canManage ? ' can-cycle' : ''}`;
|
||||||
untaggedSpan.dataset.rating = 'untagged';
|
untaggedSpan.dataset.rating = 'untagged';
|
||||||
|
if (activePostId) untaggedSpan.dataset.itemId = activePostId;
|
||||||
const lbl = document.createElement("span");
|
const lbl = document.createElement("span");
|
||||||
lbl.className = "rating-label";
|
lbl.className = "rating-label";
|
||||||
lbl.textContent = "untagged";
|
lbl.textContent = "untagged";
|
||||||
@@ -139,6 +142,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update thumbnail data-mode in background grid (ensures div.posts > a > p::before updates in Onara)
|
||||||
|
if (activePostId) {
|
||||||
|
const modeAttr = lastRatingTag ? lastRatingTag.normalized : 'null';
|
||||||
|
document.querySelectorAll(`.posts > a.thumb[data-item-id="${activePostId}"], .posts a[data-item-id="${activePostId}"], .posts a[href$="/${activePostId}"]`).forEach(th => {
|
||||||
|
th.setAttribute('data-mode', modeAttr);
|
||||||
|
});
|
||||||
|
if (document.body.classList.contains('onara-modal-open')) {
|
||||||
|
const onaraThumb = document.querySelector('.posts > a.thumb.onara-active');
|
||||||
|
if (onaraThumb) onaraThumb.setAttribute('data-mode', modeAttr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle show more/less toggle visibility and count
|
// Handle show more/less toggle visibility and count
|
||||||
const allBadges = [...inner.querySelectorAll(".badge")];
|
const allBadges = [...inner.querySelectorAll(".badge")];
|
||||||
const realTags = allBadges.filter(b => !b.querySelector('#a_addtag') && !b.querySelector('#a_toggle') && !b.classList.contains('tag-ac-wrapper'));
|
const realTags = allBadges.filter(b => !b.querySelector('#a_addtag') && !b.querySelector('#a_toggle') && !b.classList.contains('tag-ac-wrapper'));
|
||||||
|
|||||||
+21
-4
@@ -645,11 +645,16 @@
|
|||||||
|
|
||||||
if (data.success) {
|
if (data.success) {
|
||||||
this.isSessionReady = true;
|
this.isSessionReady = true;
|
||||||
if (data.csrf_token) {
|
if (window.f0ckSession) {
|
||||||
if (window.f0ckSession) window.f0ckSession.csrf_token = data.csrf_token;
|
window.f0ckSession.user = 'anonymous';
|
||||||
const metaCsrf = document.querySelector('meta[name="csrf-token"]');
|
window.f0ckSession.is_anon = true;
|
||||||
if (metaCsrf) metaCsrf.content = data.csrf_token;
|
window.f0ckSession.logged_in = true;
|
||||||
|
window.f0ckSession.id = data.user_id;
|
||||||
|
window.f0ckSession.user_id = data.user_id;
|
||||||
|
if (data.csrf_token) window.f0ckSession.csrf_token = data.csrf_token;
|
||||||
}
|
}
|
||||||
|
const metaCsrf = document.querySelector('meta[name="csrf-token"]');
|
||||||
|
if (metaCsrf && data.csrf_token) metaCsrf.content = data.csrf_token;
|
||||||
window.f0ckAnonIdentity = {
|
window.f0ckAnonIdentity = {
|
||||||
userId: data.user_id,
|
userId: data.user_id,
|
||||||
fingerprint: data.fingerprint,
|
fingerprint: data.fingerprint,
|
||||||
@@ -657,6 +662,9 @@
|
|||||||
hwFingerprint: data.hw_fingerprint || hwFingerprint
|
hwFingerprint: data.hw_fingerprint || hwFingerprint
|
||||||
};
|
};
|
||||||
window.dispatchEvent(new CustomEvent('f0ck:anon_session_ready', { detail: window.f0ckAnonIdentity }));
|
window.dispatchEvent(new CustomEvent('f0ck:anon_session_ready', { detail: window.f0ckAnonIdentity }));
|
||||||
|
if (typeof window.syncRatingButtonUI === 'function') {
|
||||||
|
window.syncRatingButtonUI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.warn('[ANON_SSH] Session handshake failed:', err);
|
console.warn('[ANON_SSH] Session handshake failed:', err);
|
||||||
@@ -870,6 +878,15 @@
|
|||||||
const guestFavsLink = document.getElementById('nav-guest-favs-link');
|
const guestFavsLink = document.getElementById('nav-guest-favs-link');
|
||||||
if (guestFavsNav) guestFavsNav.style.display = isAnon ? '' : 'none';
|
if (guestFavsNav) guestFavsNav.style.display = isAnon ? '' : 'none';
|
||||||
if (guestFavsLink) guestFavsLink.style.display = isAnon ? '' : 'none';
|
if (guestFavsLink) guestFavsLink.style.display = isAnon ? '' : 'none';
|
||||||
|
|
||||||
|
if (isAnon && window.f0ckSession) {
|
||||||
|
window.f0ckSession.user = window.f0ckSession.user || 'anonymous';
|
||||||
|
window.f0ckSession.is_anon = true;
|
||||||
|
window.f0ckSession.logged_in = true;
|
||||||
|
}
|
||||||
|
if (typeof window.syncRatingButtonUI === 'function') {
|
||||||
|
window.syncRatingButtonUI();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1082
-46
File diff suppressed because it is too large
Load Diff
+50
-1
@@ -97,11 +97,34 @@
|
|||||||
let autoNextLoops = Math.max(0, parseInt(prefs.autoNextLoops ?? 1, 10));
|
let autoNextLoops = Math.max(0, parseInt(prefs.autoNextLoops ?? 1, 10));
|
||||||
let leftHandEnabled = prefs.leftHand === true;
|
let leftHandEnabled = prefs.leftHand === true;
|
||||||
|
|
||||||
|
const getIsScrollerGuest = () => {
|
||||||
|
if (!window.f0ckSession) return true;
|
||||||
|
if (window.f0ckSession.user && !window.f0ckSession.is_anon) return false;
|
||||||
|
if (window.f0ckSession.is_anon && (window.f0ckSession.logged_in || window.f0ckSession.user)) return false;
|
||||||
|
if (window.f0ckAnonSSH && (window.f0ckAnonSSH.isSessionReady || window.f0ckAnonSSH.pubkey)) return false;
|
||||||
|
if (typeof localStorage !== 'undefined' && localStorage.getItem('f0ck_anon_ssh_pub')) return false;
|
||||||
|
return !window.f0ckSession.logged_in;
|
||||||
|
};
|
||||||
|
const isScrollerGuest = getIsScrollerGuest();
|
||||||
const isScrollerAnon = !(window.f0ckSession && window.f0ckSession.user && !window.f0ckSession.is_anon);
|
const isScrollerAnon = !(window.f0ckSession && window.f0ckSession.user && !window.f0ckSession.is_anon);
|
||||||
const scrollerAllowedMimes = window.f0ckSession?.anon_permissions?.allowed_mimes;
|
const scrollerAllowedMimes = window.f0ckSession?.anon_permissions?.allowed_mimes;
|
||||||
const scrollerSingleMime = (isScrollerAnon && Array.isArray(scrollerAllowedMimes) && scrollerAllowedMimes.length === 1) ? scrollerAllowedMimes[0] : null;
|
const scrollerSingleMime = (isScrollerAnon && Array.isArray(scrollerAllowedMimes) && scrollerAllowedMimes.length === 1) ? scrollerAllowedMimes[0] : null;
|
||||||
|
|
||||||
let applied = { mode: defaultMode, mime: scrollerSingleMime || '', order: 'random', tags: [], externalUrl: null };
|
const scrollerAllowedModes = isScrollerGuest ? ['sfw'] : window.f0ckSession?.anon_permissions?.allowed_modes;
|
||||||
|
const scrollerModeNames = ['sfw', 'nsfw', 'untagged', 'all', 'nsfl'];
|
||||||
|
let effectiveScrollerMode = defaultMode;
|
||||||
|
if (isScrollerGuest) {
|
||||||
|
effectiveScrollerMode = 0;
|
||||||
|
} else if (isScrollerAnon && Array.isArray(scrollerAllowedModes)) {
|
||||||
|
const curName = scrollerModeNames[effectiveScrollerMode] || 'sfw';
|
||||||
|
if (!scrollerAllowedModes.includes(curName)) {
|
||||||
|
const fallbackName = scrollerAllowedModes[0] || 'sfw';
|
||||||
|
const fallbackIdx = scrollerModeNames.indexOf(fallbackName);
|
||||||
|
effectiveScrollerMode = fallbackIdx >= 0 ? fallbackIdx : 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let applied = { mode: effectiveScrollerMode, mime: scrollerSingleMime || '', order: 'random', tags: [], externalUrl: null };
|
||||||
let pending = { ...applied, tags: [] };
|
let pending = { ...applied, tags: [] };
|
||||||
|
|
||||||
// Volume / mute
|
// Volume / mute
|
||||||
@@ -3039,6 +3062,19 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
function syncPanelUI() {
|
function syncPanelUI() {
|
||||||
|
const isGuest = getIsScrollerGuest();
|
||||||
|
if (isGuest) {
|
||||||
|
pending.mode = 0;
|
||||||
|
applied.mode = 0;
|
||||||
|
} else {
|
||||||
|
document.querySelectorAll('#mode-pills .filter-pill').forEach(pill => {
|
||||||
|
pill.classList.remove('locked');
|
||||||
|
pill.disabled = false;
|
||||||
|
pill.style.cursor = '';
|
||||||
|
pill.style.opacity = '';
|
||||||
|
pill.querySelectorAll('.fa-lock').forEach(i => i.remove());
|
||||||
|
});
|
||||||
|
}
|
||||||
if (scrollerSingleMime) {
|
if (scrollerSingleMime) {
|
||||||
pending.mime = scrollerSingleMime;
|
pending.mime = scrollerSingleMime;
|
||||||
applied.mime = scrollerSingleMime;
|
applied.mime = scrollerSingleMime;
|
||||||
@@ -3055,6 +3091,10 @@
|
|||||||
if (!el) return;
|
if (!el) return;
|
||||||
el.querySelectorAll('.filter-pill').forEach(pill => {
|
el.querySelectorAll('.filter-pill').forEach(pill => {
|
||||||
pill.addEventListener('click', (e) => {
|
pill.addEventListener('click', (e) => {
|
||||||
|
if (groupId === 'mode-pills' && (getIsScrollerGuest() || pill.classList.contains('locked') || pill.disabled)) {
|
||||||
|
e.preventDefault();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (groupId === 'mime-pills' && scrollerSingleMime) {
|
if (groupId === 'mime-pills' && scrollerSingleMime) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return;
|
return;
|
||||||
@@ -3064,6 +3104,15 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.addEventListener('f0ck:anon_session_ready', () => {
|
||||||
|
if (window.f0ckSession) {
|
||||||
|
window.f0ckSession.user = 'anonymous';
|
||||||
|
window.f0ckSession.is_anon = true;
|
||||||
|
window.f0ckSession.logged_in = true;
|
||||||
|
}
|
||||||
|
syncPanelUI();
|
||||||
|
});
|
||||||
makePillListener('mode-pills', 'mode', v => +v);
|
makePillListener('mode-pills', 'mode', v => +v);
|
||||||
makePillListener('mime-pills', 'mime', v => v);
|
makePillListener('mime-pills', 'mime', v => v);
|
||||||
makePillListener('order-pills', 'order', v => v);
|
makePillListener('order-pills', 'order', v => v);
|
||||||
|
|||||||
@@ -1515,12 +1515,17 @@
|
|||||||
const getCurrentItemIdentifiers = () => {
|
const getCurrentItemIdentifiers = () => {
|
||||||
const ids = new Set();
|
const ids = new Set();
|
||||||
|
|
||||||
// 1. From DOM elements on the page (primary/direct)
|
// 1. From active item on the page (never match background grid thumbnails)
|
||||||
const idElem = document.querySelector('[data-item-id]');
|
if (typeof window.getCurrentItemId === 'function') {
|
||||||
if (idElem && idElem.dataset.itemId) {
|
const currentId = window.getCurrentItemId();
|
||||||
|
if (currentId) ids.add(String(currentId).trim());
|
||||||
|
} else {
|
||||||
|
const idElem = document.querySelector('#onara-item-mount [data-item-id], .item-layout-container[data-item-id], #comments-container[data-item-id]');
|
||||||
|
if (idElem?.dataset?.itemId) {
|
||||||
ids.add(String(idElem.dataset.itemId).trim());
|
ids.add(String(idElem.dataset.itemId).trim());
|
||||||
}
|
}
|
||||||
const idLink = document.querySelector('.id-link');
|
}
|
||||||
|
const idLink = document.querySelector('#onara-item-mount .id-link, .item-layout-container .id-link, #main.item-view .id-link');
|
||||||
if (idLink) {
|
if (idLink) {
|
||||||
if (idLink.dataset.itemId) ids.add(String(idLink.dataset.itemId).trim());
|
if (idLink.dataset.itemId) ids.add(String(idLink.dataset.itemId).trim());
|
||||||
const txt = idLink.textContent.trim();
|
const txt = idLink.textContent.trim();
|
||||||
|
|||||||
+16
-1
@@ -46,6 +46,7 @@
|
|||||||
const tagsContainer = document.querySelector("#tags");
|
const tagsContainer = document.querySelector("#tags");
|
||||||
if (!tagsContainer) return;
|
if (!tagsContainer) return;
|
||||||
const inner = tagsContainer.querySelector(".tags-inner") || tagsContainer;
|
const inner = tagsContainer.querySelector(".tags-inner") || tagsContainer;
|
||||||
|
const activePostId = tagsContainer.dataset.itemId || (typeof window.getCurrentItemId === 'function' ? window.getCurrentItemId() : null);
|
||||||
|
|
||||||
const canManage = !!(
|
const canManage = !!(
|
||||||
document.querySelector('#tags[data-can-manage="true"]') ||
|
document.querySelector('#tags[data-can-manage="true"]') ||
|
||||||
@@ -76,7 +77,7 @@
|
|||||||
contentEl.textContent = tag.tag;
|
contentEl.textContent = tag.tag;
|
||||||
} else {
|
} else {
|
||||||
contentEl = document.createElement("a");
|
contentEl = document.createElement("a");
|
||||||
contentEl.href = `/tag/${tag.normalized}`;
|
contentEl.href = "/tag/" + tag.normalized;
|
||||||
contentEl.style = "color: inherit !important";
|
contentEl.style = "color: inherit !important";
|
||||||
contentEl.textContent = tag.tag;
|
contentEl.textContent = tag.tag;
|
||||||
}
|
}
|
||||||
@@ -92,6 +93,7 @@
|
|||||||
if (isRating) {
|
if (isRating) {
|
||||||
span.classList.add('rating-tag', `is-${tag.normalized}`);
|
span.classList.add('rating-tag', `is-${tag.normalized}`);
|
||||||
span.dataset.rating = tag.normalized;
|
span.dataset.rating = tag.normalized;
|
||||||
|
if (activePostId) span.dataset.itemId = activePostId;
|
||||||
if (canManage) {
|
if (canManage) {
|
||||||
span.classList.add('can-cycle');
|
span.classList.add('can-cycle');
|
||||||
}
|
}
|
||||||
@@ -120,6 +122,7 @@
|
|||||||
const untaggedSpan = document.createElement("span");
|
const untaggedSpan = document.createElement("span");
|
||||||
untaggedSpan.className = `badge badge-untagged rating-tag is-untagged${canManage ? ' can-cycle' : ''}`;
|
untaggedSpan.className = `badge badge-untagged rating-tag is-untagged${canManage ? ' can-cycle' : ''}`;
|
||||||
untaggedSpan.dataset.rating = 'untagged';
|
untaggedSpan.dataset.rating = 'untagged';
|
||||||
|
if (activePostId) untaggedSpan.dataset.itemId = activePostId;
|
||||||
const lbl = document.createElement("span");
|
const lbl = document.createElement("span");
|
||||||
lbl.className = "rating-label";
|
lbl.className = "rating-label";
|
||||||
lbl.textContent = "untagged";
|
lbl.textContent = "untagged";
|
||||||
@@ -135,6 +138,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update thumbnail data-mode in background grid (ensures div.posts > a > p::before updates in Onara)
|
||||||
|
if (activePostId) {
|
||||||
|
const modeAttr = lastRatingTag ? lastRatingTag.normalized : 'null';
|
||||||
|
document.querySelectorAll(`.posts > a.thumb[data-item-id="${activePostId}"], .posts a[data-item-id="${activePostId}"], .posts a[href$="/${activePostId}"]`).forEach(th => {
|
||||||
|
th.setAttribute('data-mode', modeAttr);
|
||||||
|
});
|
||||||
|
if (document.body.classList.contains('onara-modal-open')) {
|
||||||
|
const onaraThumb = document.querySelector('.posts > a.thumb.onara-active');
|
||||||
|
if (onaraThumb) onaraThumb.setAttribute('data-mode', modeAttr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Handle show more/less toggle visibility and count
|
// Handle show more/less toggle visibility and count
|
||||||
const allBadges = [...inner.querySelectorAll(".badge")];
|
const allBadges = [...inner.querySelectorAll(".badge")];
|
||||||
const realTags = allBadges.filter(b => !b.querySelector('#a_addtag') && !b.querySelector('#a_toggle') && !b.classList.contains('tag-ac-wrapper'));
|
const realTags = allBadges.filter(b => !b.querySelector('#a_addtag') && !b.querySelector('#a_toggle') && !b.classList.contains('tag-ac-wrapper'));
|
||||||
|
|||||||
@@ -174,8 +174,8 @@ export async function getOrCreateAnonUser(pubkey, fingerprint, req = null, hwFin
|
|||||||
const userId = userRows[0].id;
|
const userId = userRows[0].id;
|
||||||
|
|
||||||
await db`
|
await db`
|
||||||
INSERT INTO user_options (user_id, mode, theme, fullscreen, avatar, display_name)
|
INSERT INTO user_options (user_id, mode, theme, fullscreen, avatar, display_name, use_alternative_infobox)
|
||||||
VALUES (${userId}, 0, 'amoled', 0, null, 'Anonymous')
|
VALUES (${userId}, 0, 'amoled', 0, null, 'Anonymous', ${cfg.websrv.user_alternative_infobox !== false})
|
||||||
ON CONFLICT (user_id) DO NOTHING
|
ON CONFLICT (user_id) DO NOTHING
|
||||||
`;
|
`;
|
||||||
|
|
||||||
|
|||||||
@@ -18,16 +18,12 @@ const computeBaseMode = (mode, ratings, session) => {
|
|||||||
let effMode = Number(mode ?? 0);
|
let effMode = Number(mode ?? 0);
|
||||||
const ratingsArr = (Array.isArray(ratings) && ratings.length > 0) ? ratings : null;
|
const ratingsArr = (Array.isArray(ratings) && ratings.length > 0) ? ratings : null;
|
||||||
|
|
||||||
// For guest sessions, sanitize ratingsArr to only allow permitted ratings
|
// For guest sessions, strictly force SFW mode and SFW rating
|
||||||
let safeRatingsArr = ratingsArr;
|
let safeRatingsArr = ratingsArr;
|
||||||
if (!session && ratingsArr) {
|
const isGuest = !session || !session.user;
|
||||||
const allowedRatings = ['sfw'];
|
if (isGuest) {
|
||||||
if (cfg.websrv.public_nsfw) allowedRatings.push('nsfw');
|
effMode = 0;
|
||||||
if (cfg.websrv.public_untagged) allowedRatings.push('untagged');
|
safeRatingsArr = ['sfw'];
|
||||||
safeRatingsArr = ratingsArr.filter(r => allowedRatings.includes(r));
|
|
||||||
if (safeRatingsArr.length === 0) {
|
|
||||||
return "1 = 0";
|
|
||||||
}
|
|
||||||
} else if (isAnonSession(session)) {
|
} else if (isAnonSession(session)) {
|
||||||
const allowedModes = getAnonAllowedModes();
|
const allowedModes = getAnonAllowedModes();
|
||||||
const canFilter = canAnonDo('filter');
|
const canFilter = canAnonDo('filter');
|
||||||
@@ -35,10 +31,14 @@ const computeBaseMode = (mode, ratings, session) => {
|
|||||||
if (!canFilter) {
|
if (!canFilter) {
|
||||||
safeRatingsArr = null;
|
safeRatingsArr = null;
|
||||||
effMode = 0;
|
effMode = 0;
|
||||||
} else if (safeRatingsArr) {
|
} else {
|
||||||
|
if (safeRatingsArr) {
|
||||||
safeRatingsArr = safeRatingsArr.filter(r => allowedModes.includes(r));
|
safeRatingsArr = safeRatingsArr.filter(r => allowedModes.includes(r));
|
||||||
if (safeRatingsArr.length === 0) {
|
if (safeRatingsArr.length === 0) {
|
||||||
return "1 = 0";
|
safeRatingsArr = (allowedModes.length === 1 && !allowedModes.includes('all'))
|
||||||
|
? [allowedModes[0]]
|
||||||
|
: (allowedModes.length < 5 ? [...allowedModes] : null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -84,11 +84,11 @@ const computeBaseMode = (mode, ratings, session) => {
|
|||||||
}
|
}
|
||||||
} else if (effMode === 2) {
|
} else if (effMode === 2) {
|
||||||
if (!cfg.websrv.public_untagged) {
|
if (!cfg.websrv.public_untagged) {
|
||||||
baseMode = "1 = 0";
|
baseMode = "items.id in (select item_id from tags_assign where tag_id = 1)";
|
||||||
}
|
}
|
||||||
} else if (effMode === 1) {
|
} else if (effMode === 1) {
|
||||||
if (!cfg.websrv.public_nsfw) {
|
if (!cfg.websrv.public_nsfw) {
|
||||||
baseMode = "1 = 0";
|
baseMode = "items.id in (select item_id from tags_assign where tag_id = 1)";
|
||||||
}
|
}
|
||||||
} else if (effMode === 4) {
|
} else if (effMode === 4) {
|
||||||
baseMode = "1 = 0";
|
baseMode = "1 = 0";
|
||||||
|
|||||||
@@ -34,10 +34,11 @@ export default (router, tpl) => {
|
|||||||
|
|
||||||
if (cfg.main.development) console.log(`[${new Date().toISOString()}] [AJAX] Starting item load for ${req.params.itemid}`);
|
if (cfg.main.development) console.log(`[${new Date().toISOString()}] [AJAX] Starting item load for ${req.params.itemid}`);
|
||||||
|
|
||||||
|
const isGuest = !req.session || !req.session.user;
|
||||||
const isRandom = query.random === '1' || req.cookies.random_mode === '1';
|
const isRandom = query.random === '1' || req.cookies.random_mode === '1';
|
||||||
const reqMode = query.mode !== undefined ? +query.mode : req.mode;
|
const reqMode = isGuest ? 0 : (query.mode !== undefined ? +query.mode : req.mode);
|
||||||
const ratingsRaw = req.cookies.ratings;
|
const ratingsRaw = req.cookies.ratings;
|
||||||
const ratingsArr = (reqMode === 2 || reqMode === 3) ? null : (ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null);
|
const ratingsArr = isGuest ? ['sfw'] : ((reqMode === 2 || reqMode === 3) ? null : (ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null));
|
||||||
|
|
||||||
const itemid = req.params.itemid || req.url.pathname.match(/\/ajax\/item\/([a-zA-Z0-9_-]{11}|\d+)/)?.[1];
|
const itemid = req.params.itemid || req.url.pathname.match(/\/ajax\/item\/([a-zA-Z0-9_-]{11}|\d+)/)?.[1];
|
||||||
const data = await f0cklib.getf0ck({
|
const data = await f0cklib.getf0ck({
|
||||||
@@ -256,10 +257,11 @@ export default (router, tpl) => {
|
|||||||
query = req.url.qs || {};
|
query = req.url.qs || {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isGuest = !req.session || !req.session.user;
|
||||||
const page = parseInt(query.page) || 1;
|
const page = parseInt(query.page) || 1;
|
||||||
const isRandom = query.random === '1' || req.cookies.random_mode === '1';
|
const isRandom = query.random === '1' || req.cookies.random_mode === '1';
|
||||||
const ratingsRaw = req.cookies.ratings;
|
const ratingsRaw = req.cookies.ratings;
|
||||||
const ratingsArr = ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null;
|
const ratingsArr = isGuest ? ['sfw'] : (ratingsRaw ? decodeURIComponent(ratingsRaw).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r)) : null);
|
||||||
|
|
||||||
const data = await f0cklib.getf0cks({
|
const data = await f0cklib.getf0cks({
|
||||||
page: page,
|
page: page,
|
||||||
@@ -269,7 +271,7 @@ export default (router, tpl) => {
|
|||||||
userHall: query.userHall || null,
|
userHall: query.userHall || null,
|
||||||
userHallOwner: query.userHallOwner || null,
|
userHallOwner: query.userHallOwner || null,
|
||||||
mime: query.mime || (req.cookies.mime || null),
|
mime: query.mime || (req.cookies.mime || null),
|
||||||
mode: query.mode !== undefined ? +query.mode : req.mode,
|
mode: isGuest ? 0 : (query.mode !== undefined ? +query.mode : req.mode),
|
||||||
ratings: ratingsArr,
|
ratings: ratingsArr,
|
||||||
session: req.session,
|
session: req.session,
|
||||||
user_id: req.session?.id,
|
user_id: req.session?.id,
|
||||||
|
|||||||
@@ -9,6 +9,259 @@ import { logAnonActivity } from "../../anon_auth.mjs";
|
|||||||
import { canAnonDo, isAnonSession } from "../../settings.mjs";
|
import { canAnonDo, isAnonSession } from "../../settings.mjs";
|
||||||
|
|
||||||
export default router => {
|
export default router => {
|
||||||
|
router.post(/^\/api\/v2\/tags\/bulk\/?$/, lib.loggedin, async (req, res) => {
|
||||||
|
const isModOrAdmin = !!(req.session?.admin || req.session?.is_moderator);
|
||||||
|
if (!isModOrAdmin) {
|
||||||
|
return res.json({ success: false, msg: 'Bulk selection is only available to administrators and moderators' }, 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
const action = req.body?.action || req.post?.action || 'add';
|
||||||
|
const rawIds = req.body?.item_ids || req.post?.item_ids;
|
||||||
|
if (!rawIds || !Array.isArray(rawIds) || rawIds.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'No items selected' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sanitize item IDs
|
||||||
|
const itemIds = [...new Set(rawIds.map(id => +id).filter(id => Number.isInteger(id) && id > 0))].slice(0, 500);
|
||||||
|
if (itemIds.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'Invalid item IDs' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. ADD TAGS
|
||||||
|
if (action === 'add') {
|
||||||
|
if (isAnonSession(req.session) && !canAnonDo('tag')) {
|
||||||
|
return res.json({ success: false, msg: 'Anonymous tagging is disabled' }, 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
let rawTags = req.body?.tags || req.post?.tags;
|
||||||
|
if (typeof rawTags === 'string') {
|
||||||
|
rawTags = rawTags.split(/[\n,]+/).map(t => t.trim()).filter(Boolean);
|
||||||
|
}
|
||||||
|
if (!Array.isArray(rawTags) || rawTags.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'No tags provided' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
const protectedTags = ['sfw', 'nsfw', 'nsfl'];
|
||||||
|
const validTags = [...new Set(
|
||||||
|
rawTags
|
||||||
|
.map(t => (typeof t === 'string' ? t.trim() : ''))
|
||||||
|
.filter(t => t.length > 0 && t.length <= 85 && !protectedTags.includes(t.toLowerCase()))
|
||||||
|
)];
|
||||||
|
|
||||||
|
if (validTags.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'Tags invalid or contain only reserved names' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
const tagIds = [];
|
||||||
|
for (const tagname of validTags) {
|
||||||
|
let tagRow = await db`
|
||||||
|
SELECT id FROM "tags"
|
||||||
|
WHERE normalized = slugify(${tagname})
|
||||||
|
LIMIT 1
|
||||||
|
`;
|
||||||
|
let tagid = tagRow?.[0]?.id;
|
||||||
|
if (!tagid) {
|
||||||
|
const created = await db`
|
||||||
|
INSERT INTO "tags" ${db({ tag: tagname })}
|
||||||
|
RETURNING id
|
||||||
|
`;
|
||||||
|
tagid = created?.[0]?.id;
|
||||||
|
}
|
||||||
|
if (tagid) tagIds.push({ id: +tagid, name: tagname });
|
||||||
|
}
|
||||||
|
|
||||||
|
// Insert assignments
|
||||||
|
for (const postid of itemIds) {
|
||||||
|
for (const { id: tagid } of tagIds) {
|
||||||
|
try {
|
||||||
|
await db`
|
||||||
|
INSERT INTO "tags_assign" (tag_id, item_id, user_id)
|
||||||
|
VALUES (${tagid}, ${postid}, ${+req.session.id})
|
||||||
|
ON CONFLICT DO NOTHING
|
||||||
|
`;
|
||||||
|
} catch (assignErr) {
|
||||||
|
// Ignore duplicate errors if table has constraint
|
||||||
|
if (assignErr.code !== '23505') {
|
||||||
|
console.warn(`[BULK_TAG_ASSIGN_WARN] Item ${postid}, tag ${tagid}:`, assignErr.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await audit.log(req.session.id, 'bulk_add_tags', 'items', null, { item_ids: itemIds, tags: validTags }).catch(() => {});
|
||||||
|
if (req.session?.is_anon) {
|
||||||
|
await logAnonActivity(req, {
|
||||||
|
action: 'bulk_tag',
|
||||||
|
targetId: itemIds[0],
|
||||||
|
details: { item_ids: itemIds, tags: validTags }
|
||||||
|
}).catch(() => {});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Notify affected items asynchronously
|
||||||
|
(async () => {
|
||||||
|
for (const postid of itemIds) {
|
||||||
|
try {
|
||||||
|
const freshTags = await lib.getTags(postid);
|
||||||
|
await db.notify('tags', JSON.stringify({ item_id: postid, fresh: true, tags: freshTags }));
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
})().catch(() => {});
|
||||||
|
|
||||||
|
return res.json({
|
||||||
|
success: true,
|
||||||
|
count: itemIds.length,
|
||||||
|
tags: validTags,
|
||||||
|
msg: `Successfully added ${validTags.length} tag(s) to ${itemIds.length} item(s)`
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[BULK_ADD_TAGS_ERROR]', err);
|
||||||
|
return res.json({ success: false, msg: 'Failed to add tags' }, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. REMOVE TAGS
|
||||||
|
if (action === 'remove') {
|
||||||
|
const isModOrAdmin = !!(req.session.admin || req.session.is_moderator);
|
||||||
|
|
||||||
|
let rawTags = req.body?.tags || req.post?.tags;
|
||||||
|
if (typeof rawTags === 'string') {
|
||||||
|
rawTags = rawTags.split(/[\n,]+/).map(t => t.trim()).filter(Boolean);
|
||||||
|
}
|
||||||
|
if (!Array.isArray(rawTags) || rawTags.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'No tags provided to remove' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
// Resolve tags to remove
|
||||||
|
const tagRows = await db`
|
||||||
|
SELECT id, tag, normalized FROM "tags"
|
||||||
|
WHERE normalized IN ${db(rawTags.map(t => t.trim().toLowerCase()))}
|
||||||
|
`;
|
||||||
|
if (tagRows.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'Tags not found' }, 404);
|
||||||
|
}
|
||||||
|
const tagIds = tagRows.map(r => r.id);
|
||||||
|
|
||||||
|
if (isModOrAdmin) {
|
||||||
|
await db`
|
||||||
|
DELETE FROM "tags_assign"
|
||||||
|
WHERE item_id IN ${db(itemIds)}
|
||||||
|
AND tag_id IN ${db(tagIds)}
|
||||||
|
`;
|
||||||
|
} else {
|
||||||
|
// Normal user can only remove tags from items they own
|
||||||
|
await db`
|
||||||
|
DELETE FROM "tags_assign"
|
||||||
|
WHERE item_id IN ${db(itemIds)}
|
||||||
|
AND tag_id IN ${db(tagIds)}
|
||||||
|
AND item_id IN (
|
||||||
|
SELECT id FROM items WHERE username = ${req.session.user}
|
||||||
|
)
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
|
||||||
|
await audit.log(req.session.id, 'bulk_remove_tags', 'items', null, { item_ids: itemIds, tags: tagRows.map(r => r.tag) }).catch(() => {});
|
||||||
|
|
||||||
|
// Realtime notifications
|
||||||
|
(async () => {
|
||||||
|
for (const postid of itemIds) {
|
||||||
|
try {
|
||||||
|
const freshTags = await lib.getTags(postid);
|
||||||
|
await db.notify('tags', JSON.stringify({ item_id: postid, fresh: true, tags: freshTags }));
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
})().catch(() => {});
|
||||||
|
|
||||||
|
return res.json({
|
||||||
|
success: true,
|
||||||
|
count: itemIds.length,
|
||||||
|
msg: `Successfully removed tag(s) from ${itemIds.length} item(s)`
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[BULK_REMOVE_TAGS_ERROR]', err);
|
||||||
|
return res.json({ success: false, msg: 'Failed to remove tags' }, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. SET RATING (sfw / nsfw / nsfl)
|
||||||
|
if (action === 'set_rating') {
|
||||||
|
if (isAnonSession(req.session) && !canAnonDo('rate_item')) {
|
||||||
|
return res.json({ success: false, msg: 'Anonymous rating is disabled' }, 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
const rating = (req.body?.rating || req.post?.rating || '').toLowerCase();
|
||||||
|
if (!['sfw', 'nsfw', 'nsfl'].includes(rating)) {
|
||||||
|
return res.json({ success: false, msg: 'Invalid rating. Choose sfw, nsfw, or nsfl' }, 400);
|
||||||
|
}
|
||||||
|
|
||||||
|
const isModOrAdmin = !!(req.session.admin || req.session.is_moderator);
|
||||||
|
const nsflTagRow = await db`SELECT id FROM tags WHERE normalized = 'nsfl' LIMIT 1`;
|
||||||
|
const nsflId = nsflTagRow.length > 0 ? nsflTagRow[0].id : (cfg.nsfl_tag_id || 11517);
|
||||||
|
const targetTagId = rating === 'sfw' ? 1 : (rating === 'nsfw' ? 2 : nsflId);
|
||||||
|
|
||||||
|
try {
|
||||||
|
let eligibleIds = itemIds;
|
||||||
|
if (!isModOrAdmin) {
|
||||||
|
const ownedItems = await db`
|
||||||
|
SELECT id FROM items
|
||||||
|
WHERE id IN ${db(itemIds)}
|
||||||
|
AND username = ${req.session.user}
|
||||||
|
AND active = true AND is_deleted = false
|
||||||
|
`;
|
||||||
|
eligibleIds = ownedItems.map(r => r.id);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (eligibleIds.length === 0) {
|
||||||
|
return res.json({ success: false, msg: 'You do not have permission to rate the selected items' }, 403);
|
||||||
|
}
|
||||||
|
|
||||||
|
await db.begin(async sql => {
|
||||||
|
// Delete existing rating tags
|
||||||
|
await sql`
|
||||||
|
DELETE FROM tags_assign
|
||||||
|
WHERE item_id IN ${sql(eligibleIds)}
|
||||||
|
AND (tag_id IN (1, 2, ${nsflId}) OR tag_id IN (SELECT id FROM tags WHERE normalized IN ('sfw', 'nsfw', 'nsfl')))
|
||||||
|
`;
|
||||||
|
|
||||||
|
// Insert new rating tags
|
||||||
|
for (const id of eligibleIds) {
|
||||||
|
await sql`
|
||||||
|
INSERT INTO tags_assign (item_id, tag_id, user_id)
|
||||||
|
VALUES (${id}, ${targetTagId}, ${+req.session.id})
|
||||||
|
`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await audit.log(req.session.id, 'bulk_set_rating', 'items', null, { item_ids: eligibleIds, rating }).catch(() => {});
|
||||||
|
|
||||||
|
// Queue blur thumbnail verification where needed
|
||||||
|
(async () => {
|
||||||
|
for (const id of eligibleIds) {
|
||||||
|
try {
|
||||||
|
const blurPath = path.join(cfg.paths.t, `${id}_blur.webp`);
|
||||||
|
await fs.promises.access(blurPath).catch(() => queue.genBlurredThumbnail(id, false));
|
||||||
|
const freshTags = await lib.getTags(id);
|
||||||
|
await db.notify('tags', JSON.stringify({ item_id: id, fresh: true, tags: freshTags }));
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
})().catch(() => {});
|
||||||
|
|
||||||
|
return res.json({
|
||||||
|
success: true,
|
||||||
|
count: eligibleIds.length,
|
||||||
|
rating,
|
||||||
|
msg: `Successfully set rating to ${rating.toUpperCase()} for ${eligibleIds.length} item(s)`
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[BULK_SET_RATING_ERROR]', err);
|
||||||
|
return res.json({ success: false, msg: 'Failed to update rating' }, 500);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return res.json({ success: false, msg: 'Unknown bulk action' }, 400);
|
||||||
|
});
|
||||||
|
|
||||||
router.group(/^\/api\/v2\/tags\/(?<postid>\d+)/, group => {
|
router.group(/^\/api\/v2\/tags\/(?<postid>\d+)/, group => {
|
||||||
group.get(/$/, lib.loggedin, async (req, res) => {
|
group.get(/$/, lib.loggedin, async (req, res) => {
|
||||||
// get tags
|
// get tags
|
||||||
|
|||||||
@@ -645,7 +645,19 @@ export default (router, tpl) => {
|
|||||||
const modeMatch = req.url.pathname.match(/^\/mode\/(\d)/);
|
const modeMatch = req.url.pathname.match(/^\/mode\/(\d)/);
|
||||||
const mode = modeMatch ? +modeMatch[1] : 0;
|
const mode = modeMatch ? +modeMatch[1] : 0;
|
||||||
|
|
||||||
if (isAnonSession(req.session)) {
|
const isGuest = !req.session || !req.session.user;
|
||||||
|
if (isGuest) {
|
||||||
|
if (mode !== 0) {
|
||||||
|
if (req.headers['x-requested-with'] === 'XMLHttpRequest') {
|
||||||
|
return res.reply({
|
||||||
|
code: 403,
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({ success: false, msg: 'Only SFW mode is allowed for guests' })
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return res.redirect('/');
|
||||||
|
}
|
||||||
|
} else if (isAnonSession(req.session)) {
|
||||||
if (!canAnonDo('filter') || !canAnonMode(mode)) {
|
if (!canAnonDo('filter') || !canAnonMode(mode)) {
|
||||||
if (req.headers['x-requested-with'] === 'XMLHttpRequest') {
|
if (req.headers['x-requested-with'] === 'XMLHttpRequest') {
|
||||||
return res.reply({
|
return res.reply({
|
||||||
|
|||||||
+112
-8
@@ -20,7 +20,7 @@ import { handleMetaExtract } from "./meta_extract_handler.mjs";
|
|||||||
import { handleMetaStrip } from "./meta_strip_handler.mjs";
|
import { handleMetaStrip } from "./meta_strip_handler.mjs";
|
||||||
import { handleCommentUpload, handleCommentUploadCancel } from "./comment_upload_handler.mjs";
|
import { handleCommentUpload, handleCommentUploadCancel } from "./comment_upload_handler.mjs";
|
||||||
import { handleDmAttachmentUpload, handleDmAttachmentDownload, handleDmAttachmentDelete } from "./dm_attachment_handler.mjs";
|
import { handleDmAttachmentUpload, handleDmAttachmentDownload, handleDmAttachmentDelete } from "./dm_attachment_handler.mjs";
|
||||||
import { getManualApproval, setManualApproval, getMinTags, setMinTags, getRegistrationOpen, setRegistrationOpen, getTrustedUploads, setTrustedUploads, getBypassDuplicateCheck, setBypassDuplicateCheck, getProtectFiles, setProtectFiles, getPrivateMessages, setPrivateMessages, getDmAttachments, setDmAttachments, getDmUnencrypted, setDmUnencrypted, getDefaultLayout, setDefaultLayout, getEnablePdf, setEnablePdf, getEnableCleanup, setEnableCleanup, getCleanupStartDate, setCleanupStartDate, getCleanupEndDate, setCleanupEndDate, getCleanupIncludeEngaged, setCleanupIncludeEngaged, getLogUserIps, setLogUserIps, getHashUserIps, setHashUserIps, getShitpostMode, setShitpostMode, getAllowCommentDeletion, setAllowCommentDeletion, getNsfpIds, setNsfpIds, getEnableExpiringUploads, getEnableItemSlugs, getEnableAnonymousAccess, getAnonPermissions, getAnonAnonymize, isAnonymizeSession, ensureAllItemsHaveSlugs } from "./inc/settings.mjs";
|
import { getManualApproval, setManualApproval, getMinTags, setMinTags, getRegistrationOpen, setRegistrationOpen, getTrustedUploads, setTrustedUploads, getBypassDuplicateCheck, setBypassDuplicateCheck, getProtectFiles, setProtectFiles, getPrivateMessages, setPrivateMessages, getDmAttachments, setDmAttachments, getDmUnencrypted, setDmUnencrypted, getDefaultLayout, setDefaultLayout, getEnablePdf, setEnablePdf, getEnableCleanup, setEnableCleanup, getCleanupStartDate, setCleanupStartDate, getCleanupEndDate, setCleanupEndDate, getCleanupIncludeEngaged, setCleanupIncludeEngaged, getLogUserIps, setLogUserIps, getHashUserIps, setHashUserIps, getShitpostMode, setShitpostMode, getAllowCommentDeletion, setAllowCommentDeletion, getNsfpIds, setNsfpIds, getEnableExpiringUploads, getEnableItemSlugs, getEnableAnonymousAccess, getAnonPermissions, getAnonAnonymize, isAnonymizeSession, ensureAllItemsHaveSlugs, isAnonSession, canAnonDo, getAnonAllowedModes, getAnonAllowedMimes } from "./inc/settings.mjs";
|
||||||
import { updateHallsCache, getHalls } from "./inc/halls_cache.mjs";
|
import { updateHallsCache, getHalls } from "./inc/halls_cache.mjs";
|
||||||
import { createI18n } from "./inc/i18n.mjs";
|
import { createI18n } from "./inc/i18n.mjs";
|
||||||
import { safeDeleteMediaFile, purgeExpiredUploads } from "./inc/lib_delete.mjs";
|
import { safeDeleteMediaFile, purgeExpiredUploads } from "./inc/lib_delete.mjs";
|
||||||
@@ -32,6 +32,18 @@ import { verifySignature } from "./inc/anon_auth.mjs";
|
|||||||
import { createRequire } from 'module';
|
import { createRequire } from 'module';
|
||||||
const _require = createRequire(import.meta.url);
|
const _require = createRequire(import.meta.url);
|
||||||
|
|
||||||
|
const addCookieHeader = (res, cookieStr) => {
|
||||||
|
if (!res || !res.setHeader) return;
|
||||||
|
const existing = res.getHeader('Set-Cookie');
|
||||||
|
if (!existing) {
|
||||||
|
res.setHeader('Set-Cookie', [cookieStr]);
|
||||||
|
} else if (Array.isArray(existing)) {
|
||||||
|
res.setHeader('Set-Cookie', [...existing, cookieStr]);
|
||||||
|
} else {
|
||||||
|
res.setHeader('Set-Cookie', [existing, cookieStr]);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// ─── Private Society Gate ────────────────────────────────────────────────────
|
// ─── Private Society Gate ────────────────────────────────────────────────────
|
||||||
// Powered by the cloudflare-error-page package.
|
// Powered by the cloudflare-error-page package.
|
||||||
// Each request gets a fresh page with a unique Ray ID + current UTC timestamp.
|
// Each request gets a fresh page with a unique Ray ID + current UTC timestamp.
|
||||||
@@ -1112,13 +1124,105 @@ process.on('uncaughtException', err => {
|
|||||||
const queryMode = req.url.qs?.mode !== undefined ? +req.url.qs.mode : undefined;
|
const queryMode = req.url.qs?.mode !== undefined ? +req.url.qs.mode : undefined;
|
||||||
req.mode = queryMode !== undefined ? queryMode : (req.session ? +(req.session.mode ?? 0) : +(req.cookies?.mode ?? 0));
|
req.mode = queryMode !== undefined ? queryMode : (req.session ? +(req.session.mode ?? 0) : +(req.cookies?.mode ?? 0));
|
||||||
|
|
||||||
// public_nsfw: when true, the *default* for guests is mode 3 (all content).
|
const isGuest = !req.session || !req.session.user;
|
||||||
// Only applies when the guest has no explicit mode preference (no ?mode= param, no cookie).
|
|
||||||
// If the guest has chosen a filter (e.g. SFW), that choice is always respected.
|
if (isGuest) {
|
||||||
if (!req.session) {
|
req.mode = 0;
|
||||||
const hasExplicitMode = queryMode !== undefined || req.cookies?.mode !== undefined;
|
|
||||||
if (!hasExplicitMode) {
|
// Ensure guests have mode=0 cookie
|
||||||
req.mode = cfg.websrv.public_nsfw ? 3 : 0;
|
if (req.cookies?.mode !== '0') {
|
||||||
|
req.cookies = req.cookies || {};
|
||||||
|
req.cookies.mode = '0';
|
||||||
|
addCookieHeader(res, `mode=0; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ensure guests have ratings=sfw cookie
|
||||||
|
if (req.cookies?.ratings !== 'sfw') {
|
||||||
|
req.cookies = req.cookies || {};
|
||||||
|
req.cookies.ratings = 'sfw';
|
||||||
|
addCookieHeader(res, `ratings=sfw; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Reconcile MIME cookie for guests
|
||||||
|
const allowedMimes = cfg.anonymous_permissions?.allowed_mimes || ['image', 'video', 'audio'];
|
||||||
|
if (req.cookies?.mime) {
|
||||||
|
const rawMimes = decodeURIComponent(req.cookies.mime).split(',').filter(m => ['video', 'audio', 'image', 'flash', 'pdf'].includes(m));
|
||||||
|
const validMimes = rawMimes.filter(m => allowedMimes.includes(m));
|
||||||
|
if (validMimes.length !== rawMimes.length) {
|
||||||
|
if (validMimes.length > 0) {
|
||||||
|
req.cookies.mime = validMimes.join(',');
|
||||||
|
addCookieHeader(res, `mime=${req.cookies.mime}; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
} else {
|
||||||
|
delete req.cookies.mime;
|
||||||
|
addCookieHeader(res, `mime=; ${lib.getCookieOptions(0, false)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (isAnonSession(req.session)) {
|
||||||
|
const canFilter = canAnonDo('filter');
|
||||||
|
const allowedModes = getAnonAllowedModes();
|
||||||
|
const allowedMimes = getAnonAllowedMimes();
|
||||||
|
const modeNames = ['sfw', 'nsfw', 'untagged', 'all', 'nsfl'];
|
||||||
|
|
||||||
|
// Validate & reconcile req.mode
|
||||||
|
const curModeName = modeNames[req.mode] || 'sfw';
|
||||||
|
if (!canFilter || !allowedModes.includes(curModeName)) {
|
||||||
|
const fallbackName = allowedModes.find(m => modeNames.includes(m)) || 'sfw';
|
||||||
|
const fallbackIdx = modeNames.indexOf(fallbackName);
|
||||||
|
req.mode = fallbackIdx >= 0 ? fallbackIdx : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If client sent a mode cookie that doesn't match the validated req.mode, auto-update it
|
||||||
|
if (req.cookies?.mode !== undefined && +req.cookies.mode !== req.mode) {
|
||||||
|
req.cookies.mode = String(req.mode);
|
||||||
|
addCookieHeader(res, `mode=${req.mode}; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate & reconcile ratings cookie
|
||||||
|
if (req.cookies?.ratings) {
|
||||||
|
const rawRatings = decodeURIComponent(req.cookies.ratings).split(/[|,]/).filter(r => ['sfw','nsfw','nsfl','untagged'].includes(r));
|
||||||
|
let validRatings = canFilter ? rawRatings.filter(r => allowedModes.includes(r)) : [];
|
||||||
|
if (validRatings.length !== rawRatings.length) {
|
||||||
|
if (validRatings.length === 0) {
|
||||||
|
if (allowedModes.length === 1 && !allowedModes.includes('all')) {
|
||||||
|
validRatings = [allowedModes[0]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (validRatings.length > 0) {
|
||||||
|
req.cookies.ratings = validRatings.join('|');
|
||||||
|
addCookieHeader(res, `ratings=${req.cookies.ratings}; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
} else {
|
||||||
|
delete req.cookies.ratings;
|
||||||
|
addCookieHeader(res, `ratings=; ${lib.getCookieOptions(0, false)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate & reconcile mime cookie
|
||||||
|
if (req.cookies?.mime) {
|
||||||
|
const rawMimes = decodeURIComponent(req.cookies.mime).split(',').filter(m => ['video', 'audio', 'image', 'flash', 'pdf'].includes(m));
|
||||||
|
const isSingleMime = allowedMimes.length === 1;
|
||||||
|
if (isSingleMime) {
|
||||||
|
const singleMime = allowedMimes[0];
|
||||||
|
if (req.cookies.mime !== singleMime) {
|
||||||
|
req.cookies.mime = singleMime;
|
||||||
|
addCookieHeader(res, `mime=${singleMime}; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
}
|
||||||
|
} else if (!canFilter) {
|
||||||
|
delete req.cookies.mime;
|
||||||
|
addCookieHeader(res, `mime=; ${lib.getCookieOptions(0, false)}`);
|
||||||
|
} else {
|
||||||
|
const validMimes = rawMimes.filter(m => allowedMimes.includes(m));
|
||||||
|
if (validMimes.length !== rawMimes.length) {
|
||||||
|
if (validMimes.length > 0) {
|
||||||
|
req.cookies.mime = validMimes.join(',');
|
||||||
|
addCookieHeader(res, `mime=${req.cookies.mime}; ${lib.getCookieOptions(31536000, false)}`);
|
||||||
|
} else {
|
||||||
|
delete req.cookies.mime;
|
||||||
|
addCookieHeader(res, `mime=; ${lib.getCookieOptions(0, false)}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
@include(snippets/page-title)
|
@include(snippets/page-title)
|
||||||
<div class="posts" data-current-page="{{ pagination.current }}" data-has-more="{{ pagination.next ? 'true' : 'false' }}">
|
<div class="posts" data-current-page="{{ pagination.current }}" data-has-more="{{ pagination.next ? 'true' : 'false' }}">
|
||||||
@each(items as item)
|
@each(items as item)
|
||||||
<a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }} {{ item.is_onara_active ? 'onara-active' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="@if(!is_anonymized){!! item.display_name || item.username !!}@else anonymous@endif" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}">
|
<a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }} {{ item.is_onara_active ? 'onara-active' : '' }}" data-item-id="{{ item.id }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="@if(!is_anonymized){!! item.display_name || item.username !!}@else anonymous@endif" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}">
|
||||||
@if(item.is_audio && !item.has_coverart)
|
@if(item.is_audio && !item.has_coverart)
|
||||||
<div class="sidebar-media-placeholder audio">
|
<div class="sidebar-media-placeholder audio">
|
||||||
<i class="fa-solid fa-music"></i>
|
<i class="fa-solid fa-music"></i>
|
||||||
@@ -20,6 +20,7 @@
|
|||||||
<span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
|
<span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
<div class="thumb-select-check"><i class="fa-solid fa-check"></i></div>
|
||||||
<p></p>
|
<p></p>
|
||||||
</a>
|
</a>
|
||||||
@endeach
|
@endeach
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{{-- LEGACY LAYOUT — 2-column (main + fixed right sidebar) --}}
|
{{-- LEGACY LAYOUT — 2-column (main + fixed right sidebar) --}}
|
||||||
{{-- Used by: members with use_new_layout = false --}}
|
{{-- Used by: members with use_new_layout = false --}}
|
||||||
<div class="item-layout-container">
|
<div class="item-layout-container" data-item-id="{{ item.id }}">
|
||||||
|
|
||||||
{{-- MAIN CONTENT: media + navigation + metadata + comments --}}
|
{{-- MAIN CONTENT: media + navigation + metadata + comments --}}
|
||||||
<div class="item-main-content">
|
<div class="item-main-content">
|
||||||
@@ -191,17 +191,17 @@
|
|||||||
<i class="iconset fa-solid fa-triangle-exclamation report-item-btn" data-item-id="{{ item.id }}" title="Report this post"></i>
|
<i class="iconset fa-solid fa-triangle-exclamation report-item-btn" data-item-id="{{ item.id }}" title="Report this post"></i>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
<span class="badge badge-dark" id="tags" data-can-manage="{{ can_manage_item ? 'true' : 'false' }}">
|
<span class="badge badge-dark" id="tags" data-item-id="{{ item.id }}" data-can-manage="{{ can_manage_item ? 'true' : 'false' }}">
|
||||||
<span class="tags-inner">
|
<span class="tags-inner">
|
||||||
@if(!item.is_sfw && !item.is_nsfw && !item.is_nsfl)
|
@if(!item.is_sfw && !item.is_nsfw && !item.is_nsfl)
|
||||||
<span class="badge badge-untagged rating-tag is-untagged @if(can_manage_item) can-cycle @endif" data-rating="untagged">
|
<span class="badge badge-untagged rating-tag is-untagged @if(can_manage_item) can-cycle @endif" data-item-id="{{ item.id }}" data-rating="untagged">
|
||||||
<span class="rating-label">?</span>
|
<span class="rating-label">?</span>
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
@if(typeof item.tags !== "undefined")
|
@if(typeof item.tags !== "undefined")
|
||||||
@each(item.tags as tag)
|
@each(item.tags as tag)
|
||||||
@if(tag.normalized === 'sfw' || tag.normalized === 'nsfw' || tag.normalized === 'nsfl')
|
@if(tag.normalized === 'sfw' || tag.normalized === 'nsfw' || tag.normalized === 'nsfl')
|
||||||
<span class="badge {{ tag.badge }} rating-tag is-{{ tag.normalized }} @if(can_manage_item) can-cycle @endif" data-rating="{{ tag.normalized }}">
|
<span class="badge {{ tag.badge }} rating-tag is-{{ tag.normalized }} @if(can_manage_item) can-cycle @endif" data-item-id="{{ item.id }}" data-rating="{{ tag.normalized }}">
|
||||||
<span class="rating-label">{!! tag.tag !!}</span>
|
<span class="rating-label">{!! tag.tag !!}</span>
|
||||||
</span>
|
</span>
|
||||||
@else
|
@else
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{{-- MODERN LAYOUT — 3-column grid --}}
|
{{-- MODERN LAYOUT — 3-column grid --}}
|
||||||
{{-- Used by: guests (no session) + members with use_new_layout = true --}}
|
{{-- Used by: guests (no session) + members with use_new_layout = true --}}
|
||||||
<div class="item-layout-container">
|
<div class="item-layout-container" data-item-id="{{ item.id }}">
|
||||||
|
|
||||||
{{-- LEFT SIDEBAR: comments + tags --}}
|
{{-- LEFT SIDEBAR: comments + tags --}}
|
||||||
<div class="item-sidebar-left">
|
<div class="item-sidebar-left">
|
||||||
@@ -40,16 +40,16 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<div class="sidebar-tags-container">
|
<div class="sidebar-tags-container">
|
||||||
<span class="badge badge-dark" id="tags" data-can-manage="{{ can_manage_item ? 'true' : 'false' }}" style="display: flex; flex-wrap: wrap; gap: 5px; background: transparent; padding: 0; text-align: left; white-space: normal;">
|
<span class="badge badge-dark" id="tags" data-item-id="{{ item.id }}" data-can-manage="{{ can_manage_item ? 'true' : 'false' }}" style="display: flex; flex-wrap: wrap; gap: 5px; background: transparent; padding: 0; text-align: left; white-space: normal;">
|
||||||
@if(!item.is_sfw && !item.is_nsfw && !item.is_nsfl)
|
@if(!item.is_sfw && !item.is_nsfw && !item.is_nsfl)
|
||||||
<span class="badge badge-untagged rating-tag is-untagged @if(can_manage_item) can-cycle @endif" data-rating="untagged">
|
<span class="badge badge-untagged rating-tag is-untagged @if(can_manage_item) can-cycle @endif" data-item-id="{{ item.id }}" data-rating="untagged">
|
||||||
<span class="rating-label">?</span>
|
<span class="rating-label">?</span>
|
||||||
</span>
|
</span>
|
||||||
@endif
|
@endif
|
||||||
@if(typeof item.tags !== "undefined")
|
@if(typeof item.tags !== "undefined")
|
||||||
@each(item.tags as tag)
|
@each(item.tags as tag)
|
||||||
@if(tag.normalized === 'sfw' || tag.normalized === 'nsfw' || tag.normalized === 'nsfl')
|
@if(tag.normalized === 'sfw' || tag.normalized === 'nsfw' || tag.normalized === 'nsfl')
|
||||||
<span class="badge {{ tag.badge }} rating-tag is-{{ tag.normalized }} @if(can_manage_item) can-cycle @endif" data-rating="{{ tag.normalized }}">
|
<span class="badge {{ tag.badge }} rating-tag is-{{ tag.normalized }} @if(can_manage_item) can-cycle @endif" data-item-id="{{ item.id }}" data-rating="{{ tag.normalized }}">
|
||||||
<span class="rating-label">{!! tag.tag !!}</span>
|
<span class="rating-label">{!! tag.tag !!}</span>
|
||||||
</span>
|
</span>
|
||||||
@else
|
@else
|
||||||
|
|||||||
+23
-12
@@ -1124,25 +1124,36 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="filter-scroll-area">
|
<div class="filter-scroll-area">
|
||||||
@js
|
@js
|
||||||
const _isScrollerAnon = !(typeof session !== 'undefined' && session && session.user && !session.is_anon);
|
const _isScrollerMember = typeof session !== 'undefined' && session && session.user && !session.is_anon;
|
||||||
const _scrollerAllowedModes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_modes) || ['sfw', 'nsfw', 'untagged', 'all', 'nsfl'];
|
const _isScrollerAnon = typeof session !== 'undefined' && session && (session.is_anon || session.user === 'anonymous' || (typeof session.user === 'string' && session.user.startsWith('anon_')));
|
||||||
const _scrollerShowSfw = !_isScrollerAnon || _scrollerAllowedModes.includes('sfw');
|
const _isScrollerGuest = !_isScrollerMember && !_isScrollerAnon;
|
||||||
const _scrollerShowNsfw = (typeof session !== 'undefined' && session && !session.is_anon) || (_isScrollerAnon && _scrollerAllowedModes.includes('nsfw'));
|
const _isScrollerAnonUser = !_isScrollerMember;
|
||||||
const _scrollerShowNsfl = enable_nsfl && ((typeof session !== 'undefined' && session && !session.is_anon) || (_isScrollerAnon && _scrollerAllowedModes.includes('nsfl')));
|
const _scrollerAllowedModes = _isScrollerGuest ? ['sfw'] : ((typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_modes) || ['sfw', 'nsfw', 'untagged', 'all', 'nsfl']);
|
||||||
const _scrollerShowAll = (typeof session !== 'undefined' && session && !session.is_anon) || (_isScrollerAnon && _scrollerAllowedModes.includes('all'));
|
const _scrollerShowSfw = true;
|
||||||
const _scrollerShowUntagged = (typeof session !== 'undefined' && session && (session.admin || session.is_moderator)) || (_isScrollerAnon && _scrollerAllowedModes.includes('untagged'));
|
const _scrollerShowNsfw = _isScrollerGuest || (!_isScrollerAnonUser || _scrollerAllowedModes.includes('nsfw'));
|
||||||
const _scrollerActiveModes = [_scrollerShowSfw ? 'sfw' : null, _scrollerShowNsfw ? 'nsfw' : null, _scrollerShowNsfl ? 'nsfl' : null, _scrollerShowUntagged ? 'untagged' : null].filter(Boolean);
|
const _scrollerShowNsfl = enable_nsfl && (_isScrollerGuest || (!_isScrollerAnonUser || _scrollerAllowedModes.includes('nsfl')));
|
||||||
const _scrollerIsSingleMode = _isScrollerAnon && _scrollerActiveModes.length === 1 && !_scrollerShowAll;
|
const _scrollerShowAll = _isScrollerGuest || (!_isScrollerAnonUser || _scrollerAllowedModes.includes('all'));
|
||||||
const _scrollerSingleMode = _scrollerIsSingleMode ? _scrollerActiveModes[0] : null;
|
const _scrollerShowUntagged = _isScrollerGuest || (typeof session !== 'undefined' && session && (session.admin || session.is_moderator)) || (_isScrollerAnonUser && _scrollerAllowedModes.includes('untagged'));
|
||||||
|
const _scrollerActiveModes = _isScrollerGuest ? ['sfw'] : [_scrollerShowSfw ? 'sfw' : null, _scrollerShowNsfw ? 'nsfw' : null, _scrollerShowNsfl ? 'nsfl' : null, _scrollerShowUntagged ? 'untagged' : null].filter(Boolean);
|
||||||
|
const _scrollerIsSingleMode = _isScrollerGuest || (_isScrollerAnonUser && _scrollerActiveModes.length === 1 && !_scrollerShowAll);
|
||||||
|
const _scrollerSingleMode = _isScrollerGuest ? 'sfw' : (_scrollerIsSingleMode ? _scrollerActiveModes[0] : null);
|
||||||
|
|
||||||
const _scrollerAllowedMimes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_mimes) || ['image', 'video', 'audio', 'flash', 'pdf'];
|
const _scrollerAllowedMimes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_mimes) || ['image', 'video', 'audio', 'flash', 'pdf'];
|
||||||
const _scrollerIsSingleMime = _isScrollerAnon && _scrollerAllowedMimes.length === 1;
|
const _scrollerIsSingleMime = _isScrollerAnonUser && _scrollerAllowedMimes.length === 1;
|
||||||
const _scrollerSingleMime = _scrollerIsSingleMime ? _scrollerAllowedMimes[0] : null;
|
const _scrollerSingleMime = _scrollerIsSingleMime ? _scrollerAllowedMimes[0] : null;
|
||||||
@endjs
|
@endjs
|
||||||
<div class="filter-section">
|
<div class="filter-section">
|
||||||
<div class="filter-section-label">{{ t('scroller.rating') }}</div>
|
<div class="filter-section-label">{{ t('scroller.rating') }}</div>
|
||||||
<div class="pill-group" id="mode-pills">
|
<div class="pill-group" id="mode-pills">
|
||||||
@if(_scrollerIsSingleMode)
|
@if(_isScrollerGuest)
|
||||||
|
<button class="filter-pill active locked" data-mode="0" style="cursor: default;" title="SFW"><i class="fa-solid fa-shield-halved"></i>SFW<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||||
|
<button class="filter-pill locked" data-mode="1" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled><i class="fa-solid fa-fire"></i>NSFW<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||||
|
@if(enable_nsfl)
|
||||||
|
<button class="filter-pill locked" data-mode="4" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled><i class="fa-solid fa-skull"></i>NSFL<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||||
|
@endif
|
||||||
|
<button class="filter-pill locked" data-mode="3" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled>ALL<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||||
|
<button class="filter-pill locked" data-mode="2" style="cursor: not-allowed; opacity: 0.45;" title="Only available for members" disabled>{{ t('scroller.untagged') }}<i class="fa-solid fa-lock" style="margin-left: 4px; font-size: 0.8em; opacity: 0.7;"></i></button>
|
||||||
|
@elseif(_scrollerIsSingleMode)
|
||||||
<button class="filter-pill active locked" data-mode="{{ _scrollerSingleMode === 'sfw' ? 0 : (_scrollerSingleMode === 'nsfw' ? 1 : (_scrollerSingleMode === 'nsfl' ? 4 : 2)) }}" style="cursor: not-allowed; pointer-events: none;" title="Locked by site permissions"><i class="fa-solid fa-lock" style="margin-right: 4px;"></i>{{ _scrollerSingleMode.toUpperCase() }}</button>
|
<button class="filter-pill active locked" data-mode="{{ _scrollerSingleMode === 'sfw' ? 0 : (_scrollerSingleMode === 'nsfw' ? 1 : (_scrollerSingleMode === 'nsfl' ? 4 : 2)) }}" style="cursor: not-allowed; pointer-events: none;" title="Locked by site permissions"><i class="fa-solid fa-lock" style="margin-right: 4px;"></i>{{ _scrollerSingleMode.toUpperCase() }}</button>
|
||||||
@else
|
@else
|
||||||
@if(_scrollerShowSfw)
|
@if(_scrollerShowSfw)
|
||||||
|
|||||||
@@ -2,18 +2,21 @@
|
|||||||
<div id="excluded-tags-close">×</div>
|
<div id="excluded-tags-close">×</div>
|
||||||
<div class="search-container">
|
<div class="search-container">
|
||||||
@js
|
@js
|
||||||
const _isAnonUser = !(typeof session !== 'undefined' && session && session.user && !session.is_anon);
|
const _isMember = typeof session !== 'undefined' && session && session.user && !session.is_anon;
|
||||||
|
const _isAnon = typeof session !== 'undefined' && session && (session.is_anon || session.user === 'anonymous' || (typeof session.user === 'string' && session.user.startsWith('anon_')));
|
||||||
|
const _isGuest = !_isMember && !_isAnon;
|
||||||
|
const _isAnonUser = !_isMember;
|
||||||
const _canExcludeTags = !_isAnonUser || (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.exclude_tags !== false && anon_permissions.filter !== false);
|
const _canExcludeTags = !_isAnonUser || (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.exclude_tags !== false && anon_permissions.filter !== false);
|
||||||
const _allowedModes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_modes) || ['sfw', 'nsfw', 'untagged', 'all', 'nsfl'];
|
const _allowedModes = _isGuest ? ['sfw'] : ((typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_modes) || ['sfw', 'nsfw', 'untagged', 'all', 'nsfl']);
|
||||||
const _showSfw = !_isAnonUser || _allowedModes.includes('sfw');
|
const _showSfw = true;
|
||||||
const _showNsfw = !_isAnonUser || _allowedModes.includes('nsfw');
|
const _showNsfw = _isGuest || (!_isAnonUser || _allowedModes.includes('nsfw'));
|
||||||
const _showNsfl = enable_nsfl && (!_isAnonUser || _allowedModes.includes('nsfl'));
|
const _showNsfl = enable_nsfl && (_isGuest || (!_isAnonUser || _allowedModes.includes('nsfl')));
|
||||||
const _showUntagged = (typeof session !== 'undefined' && session && (session.admin || session.is_moderator)) || (_isAnonUser && _allowedModes.includes('untagged'));
|
const _showUntagged = _isGuest || (typeof session !== 'undefined' && session && (session.admin || session.is_moderator)) || (_isAnonUser && _allowedModes.includes('untagged'));
|
||||||
const _showAll = !_isAnonUser || _allowedModes.includes('all');
|
const _showAll = _isGuest || (!_isAnonUser || _allowedModes.includes('all'));
|
||||||
|
|
||||||
const _activeRatingList = [_showSfw ? 'sfw' : null, _showNsfw ? 'nsfw' : null, _showNsfl ? 'nsfl' : null, _showUntagged ? 'untagged' : null].filter(Boolean);
|
const _activeRatingList = _isGuest ? ['sfw'] : [_showSfw ? 'sfw' : null, _showNsfw ? 'nsfw' : null, _showNsfl ? 'nsfl' : null, _showUntagged ? 'untagged' : null].filter(Boolean);
|
||||||
const _isSingleRating = _isAnonUser && _activeRatingList.length === 1 && !_showAll;
|
const _isSingleRating = _isGuest || (_isAnonUser && _activeRatingList.length === 1 && !_showAll);
|
||||||
const _singleRating = _isSingleRating ? _activeRatingList[0] : null;
|
const _singleRating = _isGuest ? 'sfw' : (_isSingleRating ? _activeRatingList[0] : null);
|
||||||
|
|
||||||
const _allowedMimes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_mimes) || ['image', 'video', 'audio', 'flash', 'pdf'];
|
const _allowedMimes = (typeof anon_permissions !== 'undefined' && anon_permissions && anon_permissions.allowed_mimes) || ['image', 'video', 'audio', 'flash', 'pdf'];
|
||||||
const _isSingleMime = _isAnonUser && _allowedMimes.length === 1;
|
const _isSingleMime = _isAnonUser && _allowedMimes.length === 1;
|
||||||
@@ -37,22 +40,22 @@
|
|||||||
@endif
|
@endif
|
||||||
<!-- modes -->
|
<!-- modes -->
|
||||||
<div class="mode-filter">
|
<div class="mode-filter">
|
||||||
<button id="nav-shuffle-btn" class="shuffle-btn" title="Random Mode — shuffle all items"@if(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.6;" title="Locked by site permissions"@endif><span class="shuffle-icon">( - _ - )</span> {{ t('filter.random_mode') }}</button>
|
<button id="nav-shuffle-btn" class="shuffle-btn" title="Random Mode — shuffle all items"><span class="shuffle-icon">( - _ - )</span> {{ t('filter.random_mode') }}</button>
|
||||||
<div class="rating-selector @if(_isSingleRating) locked @endif" id="rating-selector" @if(_isSingleRating) data-locked-rating="{{ _singleRating }}" @endif>
|
<div class="rating-selector @if(_isGuest || _isSingleRating) locked @endif" id="rating-selector" @if(_isGuest) data-guest-locked="true" data-locked-rating="sfw" @elseif(_isSingleRating) data-locked-rating="{{ _singleRating }}" @endif>
|
||||||
@if(_showSfw)
|
@if(_showSfw)
|
||||||
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'sfw') active locked @endif" data-rating="sfw" id="rating-btn-sfw" title="SFW"@if(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>SFW@if(_isSingleRating && _singleRating === 'sfw')<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
<button class="rating-toggle-btn @if(_isGuest || (_isSingleRating && _singleRating === 'sfw')) active locked @endif" data-rating="sfw" id="rating-btn-sfw" title="SFW"@if(_isGuest || (_isSingleRating && _singleRating === 'sfw')) disabled style="cursor: default; opacity: 1;"@endif>SFW@if(_isGuest || (_isSingleRating && _singleRating === 'sfw'))<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
||||||
@endif
|
@endif
|
||||||
@if(_showNsfw)
|
@if(_showNsfw)
|
||||||
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'nsfw') active locked @endif" data-rating="nsfw" id="rating-btn-nsfw" title="NSFW"@if(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>NSFW@if(_isSingleRating && _singleRating === 'nsfw')<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'nsfw') active locked @elseif(_isGuest) locked @endif" data-rating="nsfw" id="rating-btn-nsfw" title="@if(_isGuest)Only available for members@else NSFW @endif"@if(_isGuest) disabled style="cursor: not-allowed; opacity: 0.5;"@elseif(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>NSFW@if(_isGuest || (_isSingleRating && _singleRating === 'nsfw'))<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
||||||
@endif
|
@endif
|
||||||
@if(_showNsfl)
|
@if(_showNsfl)
|
||||||
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'nsfl') active locked @endif" data-rating="nsfl" id="rating-btn-nsfl" title="NSFL"@if(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>NSFL@if(_isSingleRating && _singleRating === 'nsfl')<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'nsfl') active locked @elseif(_isGuest) locked @endif" data-rating="nsfl" id="rating-btn-nsfl" title="@if(_isGuest)Only available for members@else NSFL @endif"@if(_isGuest) disabled style="cursor: not-allowed; opacity: 0.5;"@elseif(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>NSFL@if(_isGuest || (_isSingleRating && _singleRating === 'nsfl'))<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
||||||
@endif
|
@endif
|
||||||
@if(_showUntagged)
|
@if(_showUntagged)
|
||||||
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'untagged') active locked @endif" data-rating="untagged" id="rating-btn-untagged" title="Untagged"@if(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>UNT@if(_isSingleRating && _singleRating === 'untagged')<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
<button class="rating-toggle-btn @if(_isSingleRating && _singleRating === 'untagged') active locked @elseif(_isGuest) locked @endif" data-rating="untagged" id="rating-btn-untagged" title="@if(_isGuest)Only available for members@else Untagged @endif"@if(_isGuest) disabled style="cursor: not-allowed; opacity: 0.5;"@elseif(_isSingleRating) disabled style="cursor: not-allowed; opacity: 0.85;"@endif>UNT@if(_isGuest || (_isSingleRating && _singleRating === 'untagged'))<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
||||||
@endif
|
@endif
|
||||||
@if(_showAll && !_isSingleRating)
|
@if(_showAll && (!_isSingleRating || _isGuest))
|
||||||
<button class="rating-toggle-btn rating-toggle-all" id="rating-btn-all" title="Show All Ratings">ALL</button>
|
<button class="rating-toggle-btn rating-toggle-all @if(_isGuest) locked @endif" id="rating-btn-all" title="@if(_isGuest)Only available for members@else Show All Ratings @endif"@if(_isGuest) disabled style="cursor: not-allowed; opacity: 0.5;"@endif>ALL@if(_isGuest)<i class="fa-solid fa-lock" style="margin-left: 5px; font-size: 0.75em; opacity: 0.7;"></i>@endif</button>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@each(items as item)
|
@each(items as item)
|
||||||
<a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="@if(!is_anonymized){!! item.display_name || item.username !!}@else anonymous@endif" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').replace('x-zip-compressed', 'zip').replace('x-rar-compressed', 'rar').replace('vnd.rar', 'rar').replace('x-7z-compressed', '7z').replace('x-tar', 'tar').replace('x-bzip2', 'bz2').replace('x-xz', 'xz').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}">
|
<a href="{{ link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.has_notification ? 'has-notif' : '' }} {{ item.is_pinned ? 'is-pinned' : '' }}" data-item-id="{{ item.id }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="@if(!is_anonymized){!! item.display_name || item.username !!}@else anonymous@endif" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').replace('x-zip-compressed', 'zip').replace('x-rar-compressed', 'rar').replace('vnd.rar', 'rar').replace('x-7z-compressed', '7z').replace('x-tar', 'tar').replace('x-bzip2', 'bz2').replace('x-xz', 'xz').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp" data-size="{{ enable_dynamic_thumbs ? (item.thumb_size || 1) : 1 }}">
|
||||||
@if(item.is_audio && !item.has_coverart)
|
@if(item.is_audio && !item.has_coverart)
|
||||||
<div class="sidebar-media-placeholder audio">
|
<div class="sidebar-media-placeholder audio">
|
||||||
<i class="fa-solid fa-music"></i>
|
<i class="fa-solid fa-music"></i>
|
||||||
@@ -16,6 +16,7 @@
|
|||||||
<span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
|
<span class="thumb-xd-indicator xd-tier-{{ item.xd_tier }}" title="xD Score: {{ item.xd_score }}">xD</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
<div class="thumb-select-check"><i class="fa-solid fa-check"></i></div>
|
||||||
<p></p>
|
<p></p>
|
||||||
</a>
|
</a>
|
||||||
@endeach
|
@endeach
|
||||||
@@ -123,7 +123,7 @@
|
|||||||
@if(count.f0cks)
|
@if(count.f0cks)
|
||||||
<div class="posts no-infinite-scroll">
|
<div class="posts no-infinite-scroll">
|
||||||
@each(f0cks.items as item)
|
@each(f0cks.items as item)
|
||||||
<a href="{{ f0cks.link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.is_pinned ? 'is-pinned' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="{!! item.display_name || item.username !!}" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp">
|
<a href="{{ f0cks.link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.is_pinned ? 'is-pinned' : '' }}" data-item-id="{{ item.id }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="{!! item.display_name || item.username !!}" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp">
|
||||||
@if(item.is_audio && !item.has_coverart)
|
@if(item.is_audio && !item.has_coverart)
|
||||||
<div class="sidebar-media-placeholder audio">
|
<div class="sidebar-media-placeholder audio">
|
||||||
<i class="fa-solid fa-music"></i>
|
<i class="fa-solid fa-music"></i>
|
||||||
@@ -137,6 +137,7 @@
|
|||||||
<span class="oc-indicator anim">OC</span>
|
<span class="oc-indicator anim">OC</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
<div class="thumb-select-check"><i class="fa-solid fa-check"></i></div>
|
||||||
<p></p>
|
<p></p>
|
||||||
</a>
|
</a>
|
||||||
@endeach
|
@endeach
|
||||||
@@ -161,7 +162,7 @@
|
|||||||
@if(count.favs)
|
@if(count.favs)
|
||||||
<div class="posts no-infinite-scroll">
|
<div class="posts no-infinite-scroll">
|
||||||
@each(favs.items as item)
|
@each(favs.items as item)
|
||||||
<a href="{{ favs.link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.is_pinned ? 'is-pinned' : '' }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="{!! item.display_name || item.username !!}" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp">
|
<a href="{{ favs.link.main }}{{ (enable_item_slugs && item.slug) ? item.slug : item.id }}" class="{{ item.is_pinned ? 'anim-boxshadow ' : '' }}thumb lazy-thumb {{ item.is_pinned ? 'is-pinned' : '' }}" data-item-id="{{ item.id }}" data-file="{{ item.dest }}" data-mime="{{ item.mime }}" data-user="{!! item.display_name || item.username !!}" data-ext="{{ item.mime.split('/')[1].replace('youtube', 'yt').replace('x-shockwave-flash', 'flash').replace('vnd.adobe.flash.movie', 'flash').toUpperCase() }}" data-mode="{{ item.tag_id == nsfl_tag_id ? 'nsfl' : (item.tag_id == 2 ? 'nsfw' : (item.tag_id == 1 ? 'sfw' : 'null')) }}" data-bg="/t/{{ item.id }}.webp">
|
||||||
@if(item.is_audio && !item.has_coverart)
|
@if(item.is_audio && !item.has_coverart)
|
||||||
<div class="sidebar-media-placeholder audio">
|
<div class="sidebar-media-placeholder audio">
|
||||||
<i class="fa-solid fa-music"></i>
|
<i class="fa-solid fa-music"></i>
|
||||||
@@ -175,6 +176,7 @@
|
|||||||
<span class="oc-indicator anim">OC</span>
|
<span class="oc-indicator anim">OC</span>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
<div class="thumb-select-check"><i class="fa-solid fa-check"></i></div>
|
||||||
<p></p>
|
<p></p>
|
||||||
</a>
|
</a>
|
||||||
@endeach
|
@endeach
|
||||||
|
|||||||
Reference in New Issue
Block a user