module.exports = {
//mongodb connection string
dbURL: 'mongodb://username:password@localhost:27017',
dbName: 'jschan',
//redis connection info
redis: {
host: '127.0.0.1',
port: '6379',
password: 'long random string'
},
//backend webserver port
port: 7000,
//secrets/salts for various things
cookieSecret: 'long random string',
tripcodeSecret: 'long random string',
ipHashSecret: 'long random string',
postPasswordSecret: 'long random string',
//enable secure cookies, only use with https/not tor
secureCookies: true,
//check referrer to prevent some CSRF attack
refererCheck: true,
//list of allowed host for checking referrer
allowedHosts: ['domain.com', 'www.domain.com'],
//header for country codes
countryCodeHeader: 'x-country-code',
//header for visitor IP
ipHeader: 'x-real-ip',
//data used in opengraph meta tags. used to generate link previews in e.g. discord, twitter, etc
meta: {
siteName: 'imageboard',
url: 'https://domain.com'
},
//settings for captchas
captchaOptions: {
type: 'grid', //"text", "grid", "hcaptcha" or "google". If using google/hcaptcha, make sure your CSP header in nginx config allows the google/hcaptcha domain.
generateLimit: 1000, //max number of captchas to have generated at any time, prevent mass unsolved captcha spam, especially on TOR.
google: { //options for google captcha, when captcha type is google
siteKey: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz',
secretKey: 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'
},
hcaptcha: {
siteKey: "10000000-ffff-ffff-ffff-000000000001",
secretKey: "0x0000000000000000000000000000000000000000"
},
grid: {
size: 4,
imageSize: 120,
iconYOffset: 15,
},
numDistorts: {
min: 3,
max: 4
},
distortion: 9,
},
/* dnsbl, will add a small delay for uncached requests. You could also install some
kind of dns cache e.g. unbound to improve performance. DNSBL only checked for posting */
dnsbl: {
enabled: false,
blacklists: ['tor.dan.me.uk', 'zen.spamhaus.org'],
cacheTime: 3600 //in seconds, idk whats a good value
},
//disable file posting over .onion globally, overrides any board setting.
disableOnionFilePosting: false,
//count .onion posters as "users" in stats. if set to false, all .onion is counted as a single user. doesnt affect pph stat.
statsCountOnionUsers: true,
floodTimers: { //basic delays to stop flooding, in ms. 0 to disable
sameContentSameIp: 120000, //same message or any file from same ip
sameContentAnyIp: 30000, //same message or file from any ip
anyContentSameIp: 5000, //any post from the same ip
},
//block bypasses
blockBypass: {
enabled: false,
forceOnion: true, //option to override blockbypass setting for .onion users
expireAfterUses: 40, //however many (attempted) posts per block bypass captcha
expireAfterTime: 86400000, //expiry in ms regardless if the limit was reached, default 1 day
bypassDnsbl: false,
},
// permission level required to see UNHASHED ips. -1 for ips to be hashed even for root user. not recommended to change after installation
ipHashPermLevel: 0,
// permission level required to delete boards
deleteBoardPermLevel: 2,
/* delete files immediately rather than pruning later. usually disabled to prevent re-thumbnailing and processing commonly
uploaded files, but deleting immediately is better if you are concerned about "deleted" content not being immediately removed */
pruneImmediately: false,
rateLimitCost: { //Cost out of 100 per minute e.g. cost of 25 means 4 per minute. Cost is separate for each.
captcha: 10,
boardSettings: 30,
editPost: 30,
},
//how many threads to show on overboard index view
overboardLimit: 20,
//how many threads to show on overboard catalog view
overboardCatalogLimit: 50,
//cache templates in memory. disable only if editing templates and doing dev work
cacheTemplates: true,
//log extra info for debugging
debugLogs: true,
//max wait time in ms for obtaining locks for saving files
lockWait: 3000,
//optionally prune oldest modlog entries (prunes when newer modlog entries are generated i.e. dead boards wont have older logs pruned)
pruneModlogs: true,
pruneAfterDays: 30,
//enable the webring (also copy configs/webring.json.example -> configs/webring.json and edit)
enableWebring: false,
//let all users create new boards
enableUserBoardCreation: true,
//let all users register new accounts
enableUserAccountCreation: true,
//extension for thumbnails that do not contain transparency (png will be used)
thumbExtension: '.jpg',
//.gif images > thumbnail size will have animated .gif thumbnails, overriding thumbExtension
animatedGifThumbnails: false,
/* Recommended if animatedGifThumbnails is true. Uses ffmpeg for faster animated gif thumbnailing. Requires ffmpeg
>=4.3.x to handle transparent gifs properly. You can install from debian testing repo, or compile from source. */
ffmpegGifThumbnails: true,
//generate waveform thumbnails for audio
audioThumbnails: false,
//max thumb dimensions (square) in px
thumbSize: 250,
//0-100 percent through a video to try taking video thumbnails from, to remedy black first frames or fade-ins
videoThumbPercentage: 5,
/* extra mime types for files to be uploaded as attachments (no thumbnails) e.g. text files/archives
NOTE: appropriate extensions will need to be added to nginx configuration, and uncomment the provided
"other files" section which includes an example configuration for .txt files to match this default config.
mime types and file extension does not always correspond exactly this cant be done automatically. */
otherMimeTypes: [
'text/plain',
'application/pdf'
],
//check the real mime type of uploaded files
checkRealMimeTypes: false,
//if checking real mime types, and the real type is unknown, allow it anyway
allowMimeNoMatch: false,
//default ban duration in ms if ban duration field is left blank (default value is 1 year)
defaultBanDuration: 31536000000,
//max number of quotes that will be linked in a post. 0 for unlimited (not recommended)
quoteLimit: 25,
//apply global filters more aggressively, trying against extra text that strips diacritics and some ZWS chars
strictFiltering: false,
//how many replies to show on index pages under each OP
previewReplies: 5,
stickyPreviewReplies: 5, //choose a different amount for sticky posts if desired
/* the fraction of threadLimit beyond which early404 prunes posts
e.g. 3 means after the first third, so if you had 6 pages,
anything after page 2 with less than early404Replies gets pruned */
early404Fraction: 3,
//how many replies a thread needs to not get removed by early404
early404Replies: 5,
//how many of the most recent newsposts to show on the homepage
maxRecentNews: 3,
/* filter filenames on posts and banners
false=no filtering
true=allow only A-Za-z0-9_-
regex=custom regex of what to replace e.g. /[^\w\s-]+/g */
filterFileNames: false,
/* replace spaces and multiple spaces with some character default _ for better filenames
(spaces dont belong in filenames) */
spaceFileNameReplacement: '_',
//options for code block highlighting in posts
highlightOptions: {
//subset of languages to allow.
languageSubset: [
'javascript',
'typescript',
'perl',
'js',
'c++',
'c',
'java',
'kotlin',
'php',
'h',
'csharp',
'bash',
'sh',
'zsh',
'python',
'ruby',
'css',
'html',
'json',
'golang',
'rust'
],
//threshold below which auto language is ignored
threshold: 5
},
//uses names of css in gulp/res/css. if blank, all themes are enabled.
themes: [],
codeThemes: [],
//global limits for board settings
globalLimits: {
threadLimit: { //number of threads, 10 per page
min: 10,
max: 200
},
replyLimit: { //number of replies to a thread, thread is locked after this limit is reached
min: 10,
max: 500
},
bumpLimit: { //number of replies to a thread before it wont get bumped anymore
min: 10,
max: 500
},
postFiles: { //number of files in a post
max: 3
},
postFilesSize: { //in bytes, 10MB default
max: 10485760
},
bannerFiles: {
width: 300, //banner image max width in px
height: 100, //banner image max height in px
forceAspectRatio: true, //enforce 3:1 aspect ratio
max: 10, //max number of banners uploadable at once
total: 100, //max number of banners for a board in total
},
bannerFilesSize: { //in bytes, 10MB default
max: 10485760
},
/* NOTE: postFilesSize and bannerFilesSize counts in bytes the amount of total data in form submission including
other fields like message, name, etc. Therefore a very long message would reduce the space left for files very slightly.
To counteract this, consider increasing postFilesSize and bannerFilesSize beyond your desired max filesize by a small margin */
fieldLength: { //max length of fields in some forms
//post form
name: 100,
email: 100,
subject: 100,
postpassword: 100,
message: 4000,
//reports/post actions
report_reason: 100,
ban_reason: 100,
log_message: 100,
//board creation
uri: 50,
boardname: 50,
description: 100,
},
multiInputs: {
//limits on certain requests that have multi-select. set any to 0 for unlimited
posts: { //post actions (report, delete, spoiler, ban, etc).
anon: 20, //separate for non-staff to prevent performance issues or abuse e.g. user mass self-deleting or reporting posts with single captcha
staff: 100, //but to still allow mass moderation for staff
},
//note: room for more limits here if they are needed for other checkbox forms in future
},
customCss: {
enabled: true, //allow custom css by board owners
max: 10000, //max number of characters to allow
strict: true, //enables filters to block certain strings in custom css
filters: [
'@',
'url(',
]
},
customPages: {
max: 5, //max number of custom pages per board
maxLength: 10000, //max number of characters to allow per page
}
},
//default frontend script settings
frontendScriptDefault: {
heightUnlimit: false, //allow images to expand taller than window height
hideRecursive: true, //hide replies to hidden OPs
crispImages: false, //use crisp/pixelated image rendering
hideThumbnails: false, //hide thumbnails
nonColorIds: false, //dont color ids
alwaysShowSpoilers: false , //always reveal spoiler text
hidePostStubs: false, //hide hidden posts completely, dont even show it minimized
smoothScrolling: false, //smooth scrolling. annoying for chrome users on long threads
defaultVolume: 100, //default video/audio volume
loop: true, //looping video/audio
imageLoadingBars: true, //show loading bar for images, changes behaviour of right click save/open
live: true, //update threads automatically
scrollToPosts: false, //scroll to new posts
localTime: true, //show local time for posts
hour24Time: false, //show 24 hour time for posts
relativeTime: true, //show relative time i.e. "5 minutes ago" for posts
//note: relative time overrides other time options, they show on hover in the tooltip/"title" property
notificationsEnabled: false, //show notifications for new posts in a thread
notificationsYousOnly: true, //only show notifications for posts that quote you
showYous: true, //show (You) next to name on your posts, and quotes linking to your post
},
//default board settings when a board is created
boardDefaults: {
theme: 'lain',
codeTheme: 'ir-black',
sfw: false, //safe for work board
lockMode: 0, //board lock mode
fileR9KMode: 0, //enfore unique files, 0=off, 1=per thread, 2=whole board
messageR9KMode: 0, //enforce unique message, 0=off, 1=per thread, 2=whole board
unlistedLocal: false, //board hidden from on-site board list and frontpage
unlistedWebring: false, //board hidden from webring
captchaMode: 0, //0=disabled, 1=for threads, 2=for all posts
tphTrigger: 10, //number of threads in an hour before trigger action is activated
pphTrigger: 50, //number of posts in an hour before ^
//0=none, 1=captcha enable for threads, 2=captcha enable for all posts, 3=lock board
tphTriggerAction: 1,
pphTriggerAction: 2,
//0=dont change, 1=unlock board/disable captcha, 2=lock thread creation/enable captcha for thread creation
captchaReset: 0,
lockReset: 0,
forceAnon: false, //disable name and subject, only allow sage email
sageOnlyEmail: false, //only allow sage email
early404: true, //delete threads beyond the first 1/3 of pages with less than 5 replies
ids: false, //show per thread poster ID based on ip
flags: false, //show geo flags, requires nginx setup
userPostDelete: true, //allow users to delete their posts
userPostSpoiler: true, //allow user to spoiler their post files
userPostUnlink: true, //allow user to unlink files from their post
threadLimit: 200,
replyLimit: 500,
bumpLimit: 500,
maxFiles: 1,
forceReplyMessage: false,
forceReplyFile: false,
forceThreadMessage: false,
forceThreadFile: false,
forceThreadSubject: false,
disableReplySubject: false,
minThreadMessageLength: 0,
minReplyMessageLength: 0,
maxThreadMessageLength: 4000,
maxReplyMessageLength: 4000,
defaultName: 'Anon',
customCSS: null,
blockedCountries: [], //2 char ISO country codes to block
disableOnionFilePosting: false,
filters: [], //words/phrases to block
filterMode: 0, //0=nothing, 1=prevent post, 2=auto ban
filterBanDuration: 0, //duration (in ms) to ban if filter mode=2
strictFiltering: false,
announcement: {
raw: null,
markdown: null
},
allowedFileTypes: { //enable different types of files to be posted
animatedImage: true,
image: true,
video: true,
audio: true,
other: false
}
},
};