2020-01-28 03:14:21 +00:00
/ *
Welcome to the constants file !
Copy a key and provide a new value in / c o n f i g . j s t o o v e r r i d e t h e v a l u e h e r e .
Please read the comments above every section !
* /
2020-01-12 12:50:21 +00:00
2020-01-28 03:14:21 +00:00
let constants = {
// Things that server owners _should_ change!
2020-03-24 03:15:04 +00:00
// Protocol and domain that the website can be accessed on. Images and links in RSS feeds start with this URL.
// Do NOT include a trailing slash. If you leave this as localhost, Bibliogram will not work correctly when accessed from any other device.
// If you are using nginx to make Bibliogram accessible on port 80/443, do NOT write a port here.
// For example, "https://bibliogram.art"
website _origin : "http://localhost:10407" ,
2020-04-17 12:18:58 +00:00
// IP address to bind to.
// "0.0.0.0" will make the server reachable on all IPv4 interfaces.
// "::" will make the server reachable on all IPv6 interfaces, and maybe also IPv4. (https://nodejs.org/api/net.html#net_server_listen_port_host_backlog_callback)
// If you run nginx, you must change the nginx config instead.
bind _ip : "0.0.0.0" ,
2020-03-24 03:15:04 +00:00
// Port to actually run the webserver on.
port : 10407 ,
// You MUST read /src/site/pug/privacy.pug.template before changing has_privacy_policy!
has _privacy _policy : false ,
2020-01-28 03:14:21 +00:00
// Things that server owners _could_ change if they want to.
2020-02-02 13:24:14 +00:00
tor : {
enabled : false , // If false, everything else in this block has no effect.
password : null , // If `null`, Bibliogram will run its own Tor process instead.
for : {
user _html : false , // User HTML page seems to have less forgiving rates, and Tor always fails, so it's disabled by default.
timeline _graphql : true ,
post _graphql : true ,
reel _graphql : true
}
} ,
2020-03-15 06:50:29 +00:00
request _backend : "node-fetch" , // one of: "node-fetch", "got"
2020-03-03 12:32:09 +00:00
// After setting your privacy policy, I suggest you read src/site/html/.well-known/dnt-policy.txt. If you comply with it,
// change this to `true` to serve it, which will make extensions like Privacy Badger automatically whitelist the domain.
does _not _track : false ,
2020-02-02 13:24:14 +00:00
2020-02-18 04:06:11 +00:00
allow _user _from _reel : "preferForRSS" , // one of: "never", "fallback", "prefer", "onlyPreferSaved", "preferForRSS"
2020-02-02 13:24:14 +00:00
2020-04-22 11:59:45 +00:00
feeds : {
// Whether feeds are enabled.
enabled : true ,
// Whether to display links to feeds on pages.
display _links : true ,
// Whether to display the `v!` link to validate a feed.
display _validation _links : false ,
// This feed message field allows you to insert a custom message into all RSS feeds to inform users of important changes,
// such as feeds being disabled forever on that instance.
feed _message : {
enabled : false ,
// If the feed message is enabled, then `id` MUST be supplied.
// Please set it to `bibliogram:feed_announcement/your.domain/1`
// replacing `your.domain` with the address of your own domain,
// and incrementing `1` every time you make a new announcement (to make sure the IDs are unique).
id : "" ,
// The timestamp that you disabled feeds at. For example, if you disabled feeds forever starting at 2020-04-01T12:00:00 UTC,
// you should set this to 1585742400000.
timestamp : 0 ,
// The title of the feed item.
title : "Important message from Bibliogram" ,
// The text of the message.
message : "There is an important message about feeds on this Bibliogram instance. Please visit this link to read the message: " ,
// The link address.
link : "https://your.domain/feedannouncement"
} ,
feed _disabled _max _age : 2 * 24 * 60 * 60 // 2 days
} ,
2020-05-04 15:06:07 +00:00
user _settings : [
{
name : "language" ,
2020-05-05 13:50:01 +00:00
default : "en" ,
2020-05-04 15:06:07 +00:00
boolean : false ,
replaceEmptyWithDefault : true // set this to false if the control is a checkbox and is not disabled
} , {
name : "show_comments" ,
default : "" ,
boolean : true ,
replaceEmptyWithDefault : true
} , {
name : "link_hashtags" ,
default : "" ,
boolean : true ,
replaceEmptyWithDefault : true
} , {
name : "spa" ,
default : "on" ,
boolean : true ,
2020-05-05 14:14:11 +00:00
replaceEmptyWithDefault : false
2020-05-04 15:06:07 +00:00
} , {
name : "theme" ,
2020-05-05 13:50:01 +00:00
default : "classic" ,
2020-05-04 15:06:07 +00:00
boolean : false ,
replaceEmptyWithDefault : true
} , {
name : "caption_side" ,
2020-05-05 13:50:01 +00:00
default : "left" ,
2020-05-04 15:06:07 +00:00
boolean : false ,
replaceEmptyWithDefault : true
} , {
name : "display_alt" ,
default : "" ,
boolean : true ,
replaceEmptyWithDefault : true
2020-05-05 15:35:18 +00:00
} , {
name : "timeline_columns" ,
default : "dynamic" ,
boolean : false ,
replaceEmptyWithDefault : true
} , {
name : "display_top_nav" ,
default : "" ,
boolean : true ,
replaceEmptyWithDefault : true
2020-05-04 15:06:07 +00:00
}
] ,
2020-02-01 03:15:12 +00:00
settings : {
2020-02-22 10:44:17 +00:00
enable _updater _page : false
2020-02-01 03:15:12 +00:00
} ,
2020-04-12 14:52:04 +00:00
use _assistant : {
2020-04-07 06:30:00 +00:00
enabled : false ,
2020-04-12 14:52:04 +00:00
// Read the docs.
assistants : [
2020-04-07 06:30:00 +00:00
] ,
offline _request _cooldown : 20 * 60 * 1000 ,
blocked _request _cooldown : 2 * 60 * 60 * 1000 ,
} ,
2020-04-12 14:52:04 +00:00
as _assistant : {
enabled : false , // You can still start just the assistant with npm run assistant.
require _key : false ,
// List of keys that are allowed access. You can use any string.
// Try `crypto.randomBytes(20).toString("hex")` to get some randomness.
keys : [ ]
} ,
2020-01-28 03:14:21 +00:00
caching : {
image _cache _control : ` public, max-age= ${ 7 * 24 * 60 * 60 } ` ,
2020-01-28 11:38:05 +00:00
resource _cache _time : 30 * 60 * 1000 ,
2020-02-01 04:44:40 +00:00
instance _list _cache _time : 3 * 60 * 1000 ,
2020-02-22 10:44:17 +00:00
updater _cache _time : 2 * 60 * 1000 ,
2020-03-18 08:14:12 +00:00
cache _sweep _interval : 3 * 60 * 1000 ,
2020-04-16 13:40:20 +00:00
self _blocked _status : {
2020-05-05 16:00:53 +00:00
enabled : true ,
2020-04-16 13:40:20 +00:00
time : 2 * 60 * 60 * 1000 ,
} ,
2020-02-01 04:44:40 +00:00
db _user _id : true ,
2020-04-16 13:14:27 +00:00
db _post _n3 : true ,
db _request _history : false
2020-01-28 03:14:21 +00:00
} ,
// Instagram uses this stuff. This shouldn't be changed, except to fix a bug that hasn't yet been fixed upstream.
2020-01-12 12:50:21 +00:00
external : {
2020-02-02 13:24:14 +00:00
reel _query _hash : "c9100bf9110dd6361671f113dd02e7d6" ,
2020-01-12 12:50:21 +00:00
timeline _query _hash : "e769aa130647d2354c40ea6a439bfc08" ,
2020-02-02 11:43:56 +00:00
timeline _query _hash _2 : "42323d64886122307be10013ad2dcc44" , // https://github.com/rarcega/instagram-scraper/blob/dc022081dbefc81500c5f70cce5c70cfd2816e3c/instagram_scraper/constants.py#L30
2020-01-18 15:38:14 +00:00
shortcode _query _hash : "2b0673e0dc4580674a88d426fe00ea90" ,
2020-01-14 14:38:33 +00:00
timeline _fetch _first : 12 ,
2020-02-21 12:32:57 +00:00
username _regex : "[\\w.]*[\\w]" ,
2020-02-03 14:30:19 +00:00
shortcode _regex : "[\\w-]+" ,
2020-04-12 14:52:04 +00:00
hashtag _regex : "[^ \\n`~!@#\\$%^&*()\\-=+[\\]{};:\"',<.>/?\\\\]+" ,
reserved _paths : [ // https://github.com/cloudrac3r/bibliogram/wiki/Reserved-URLs
// Redirects
"about" , "explore" , "support" , "press" , "api" , "privacy" , "safety" , "admin" ,
// Content
"embed.js" ,
// Not found, but likely reserved
"graphql" , "accounts" , "p" , "help" , "terms" , "contact" , "blog" , "igtv"
]
2020-01-12 12:50:21 +00:00
} ,
2020-01-28 11:38:05 +00:00
resources : {
instances _wiki _raw : "https://raw.githubusercontent.com/wiki/cloudrac3r/bibliogram/Instances.md"
} ,
2020-01-28 03:14:21 +00:00
// My code uses this stuff. Server owners have no reason to change it.
2020-01-12 12:50:21 +00:00
symbols : {
2020-01-26 14:56:59 +00:00
NO _MORE _PAGES : Symbol ( "NO_MORE_PAGES" ) ,
TYPE _IMAGE : Symbol ( "TYPE_IMAGE" ) ,
TYPE _VIDEO : Symbol ( "TYPE_VIDEO" ) ,
TYPE _GALLERY : Symbol ( "TYPE_GALLERY" ) ,
TYPE _GALLERY _IMAGE : Symbol ( "TYPE_GALLERY_IMAGE" ) ,
2020-01-27 06:03:28 +00:00
TYPE _GALLERY _VIDEO : Symbol ( "TYPE_GALLERY_VIDEO" ) ,
NOT _FOUND : Symbol ( "NOT_FOUND" ) ,
2020-02-02 11:43:56 +00:00
INSTAGRAM _DEMANDS _LOGIN : Symbol ( "INSTAGRAM_DEMANDS_LOGIN" ) ,
2020-02-05 12:32:51 +00:00
RATE _LIMITED : Symbol ( "RATE_LIMITED" ) ,
2020-04-07 06:30:00 +00:00
ENDPOINT _OVERRIDDEN : Symbol ( "ENDPOINT_OVERRIDDEN" ) ,
NO _ASSISTANTS _AVAILABLE : Symbol ( "NO_ASSISTANTS_AVAILABLE" ) ,
2020-04-13 15:46:23 +00:00
extractor _results : {
SUCCESS : Symbol ( "SUCCESS" ) ,
AGE _RESTRICTED : Symbol ( "AGE_RESTRICTED" ) ,
NO _SHARED _DATA : Symbol ( "NO_SHARED_DATA" )
} ,
2020-04-07 06:30:00 +00:00
assistant _statuses : {
OFFLINE : Symbol ( "OFFLINE" ) ,
BLOCKED : Symbol ( "BLOCKED" ) ,
OK : Symbol ( "OK" ) ,
2020-04-12 14:52:04 +00:00
NONE : Symbol ( "NONE" ) ,
NOT _AUTHENTICATED : Symbol ( "NOT_AUTHENTICATED" )
} ,
fetch _context : {
RSS : Symbol ( "RSS" ) ,
ASSISTANT : Symbol ( "ASSISTANT" )
2020-04-07 06:30:00 +00:00
}
2020-02-01 04:44:40 +00:00
} ,
2020-04-22 11:59:45 +00:00
additional _routes : [ ] ,
2020-05-05 15:35:18 +00:00
database _version : 5
2020-01-12 12:50:21 +00:00
}
2020-01-28 03:14:21 +00:00
// Override values from config and export the result
const md = require ( "mixin-deep" )
2020-04-14 14:03:38 +00:00
if ( process . env . BIBLIOGRAM _CONFIG ) { // presence of environment variable BIBLIOGRAM_CONFIG overrides /config.js
const config = JSON . parse ( process . env . BIBLIOGRAM _CONFIG )
constants = md ( constants , config )
} else {
const config = require ( "../../config" )
constants = md ( constants , config )
}
2020-01-28 03:14:21 +00:00
module . exports = constants