import cfg from "./inc/config.mjs"; import db from "./inc/sql.mjs"; import lib from "./inc/lib.mjs"; import cuffeo from "cuffeo"; import fs from "fs"; import path from "path"; import { execSync } from "child_process"; import { getMotd, setMotd } from "./inc/motd.mjs"; import { getAboutText, setAboutText, getRulesText, setRulesText, getTermsText, setTermsText } from "./inc/page_texts.mjs"; import flummpress from "flummpress"; import { handleUpload } from "./upload_handler.mjs"; import { handleAvatarUpload, handleAvatarDelete } from "./avatar_handler.mjs"; import { handleRethumbUpload } from "./rethumb_handler.mjs"; import { handleMemeUpload } from "./meme_upload_handler.mjs"; import { handleEmojiUpload } from "./emoji_upload_handler.mjs"; import { handleHallImageUpload, handleHallImageDelete, handleHallDelete, handleHallUpdate, handleHallCreate } from "./hall_image_handler.mjs"; import { handleMetaExtract } from "./meta_extract_handler.mjs"; import { handleMetaStrip } from "./meta_strip_handler.mjs"; import { getManualApproval, setManualApproval, getMinTags, setMinTags, getRegistrationOpen, setRegistrationOpen, getTrustedUploads, setTrustedUploads, getBypassDuplicateCheck, setBypassDuplicateCheck, getProtectFiles, setProtectFiles, getPrivateMessages, setPrivateMessages, getDefaultLayout, setDefaultLayout, getEnablePdf, setEnablePdf, getEnableCleanup, setEnableCleanup, getCleanupStartDate, setCleanupStartDate, getCleanupEndDate, setCleanupEndDate, getLogUserIps, setLogUserIps, getHashUserIps, setHashUserIps, getShitpostMode, setShitpostMode } from "./inc/settings.mjs"; import { updateHallsCache, getHalls } from "./inc/halls_cache.mjs"; import { createI18n } from "./inc/i18n.mjs"; import security from "./inc/security.mjs"; import { createRequire } from 'module'; const _require = createRequire(import.meta.url); // ─── Private Society Gate ──────────────────────────────────────────────────── // Powered by the cloudflare-error-page package. // Each request gets a fresh page with a unique Ray ID + current UTC timestamp. // // Customise the visible text and status icons here: const gateOptions = { title: 'Bad Gateway', error_code: '502', what_happened: "There is an internal server error on Cloudflare's network.", // what_can_i_do is injected dynamically below (Sign in button) error_source: 'host', browser_status: { status: 'ok', location: 'You', name: 'Browser', status_text: 'Working', }, cloudflare_status: { status: 'ok', location: 'Frankfurt', name: 'Cloudflare', status_text: 'Working', }, host_status: { status: 'error', location: cfg.main.url.domain, name: 'Host', status_text: 'Error', }, more_information: { hidden: false, text: 'cloudflare.com', link: '', for: 'more information', }, perf_sec_by: { text: '', link: '' }, }; // Fallback when the package isn't installed const nginx502Fallback = `