2020-11-20 05:27:38 +00:00
const mixin = require ( "mixin-deep" )
2021-02-27 02:48:35 +00:00
// Configuration is in the following block.
2020-11-20 05:27:38 +00:00
let constants = {
2021-02-27 02:48:35 +00:00
// The default user settings. Should be self-explanatory.
2020-08-31 13:22:16 +00:00
user _settings : {
instance : {
type : "string" ,
2021-04-25 12:02:59 +00:00
default : "http://localhost:3000"
2020-08-31 13:22:16 +00:00
} ,
2021-12-28 03:32:11 +00:00
theme : {
type : "integer" ,
default : 0
} ,
2020-08-31 13:22:16 +00:00
save _history : {
type : "boolean" ,
default : false
2020-10-26 07:29:05 +00:00
} ,
local : {
2024-07-25 08:21:15 +00:00
type : "integer" ,
default : 0
2021-04-04 04:51:39 +00:00
} ,
quality : {
type : "integer" ,
default : 0
2021-08-16 10:37:12 +00:00
} ,
recommended _mode : {
type : "integer" ,
default : 0
2020-08-31 13:22:16 +00:00
}
} ,
2021-02-27 02:48:35 +00:00
// Settings for the server to use internally.
2021-01-21 00:33:46 +00:00
server _setup : {
2021-02-27 02:48:35 +00:00
// The URL of the local NewLeaf instance, which is always used for subscription updates.
2021-05-11 12:29:44 +00:00
local _instance _origin : "http://localhost:3000" ,
// Whether users may filter videos by regular expressions. Unlike square patterns, regular expressions are _not_ bounded in complexity, so this can be used for denial of service attacks. Only enable if this is a private instance and you trust all the members.
2021-08-20 08:45:36 +00:00
allow _regexp _filters : false ,
// Audio narration on the "can't think" page. `null` to disable narration, or a URL to enable with that audio file.
cant _think _narration _url : null
2021-01-21 00:33:46 +00:00
} ,
2021-02-27 02:48:35 +00:00
// *** ***
// *** You shouldn't change anything below this point. ***
// *** ***
// Various caching timers.
2020-08-30 13:54:59 +00:00
caching : {
2020-09-23 11:45:02 +00:00
csrf _time : 4 * 60 * 60 * 1000 ,
seen _token _subscriptions _eligible : 40 * 60 * 60 * 1000 ,
subscriptions _refresh _loop _min : 5 * 60 * 1000 ,
2022-01-10 01:18:45 +00:00
subscriptions _refesh _fake _not _found _cooldown : 10 * 60 * 1000 ,
2020-08-30 13:54:59 +00:00
} ,
2021-02-27 02:48:35 +00:00
// Pattern matching.
2020-08-30 13:54:59 +00:00
regex : {
ucid : "[A-Za-z0-9-_]+" ,
2021-02-03 07:49:21 +00:00
video _id : "[A-Za-z0-9-_]{11,}"
2020-10-02 12:32:22 +00:00
} ,
2021-02-27 02:48:35 +00:00
// State symbols.
2020-10-02 12:32:22 +00:00
symbols : {
refresher : {
ACTIVE : Symbol ( "ACTIVE" ) ,
WAITING : Symbol ( "WAITING" ) ,
EMPTY : Symbol ( "EMPTY" )
}
2020-08-30 13:54:59 +00:00
}
}
2020-11-20 05:27:38 +00:00
try {
const overrides = require ( "../config/config.js" )
constants = mixin ( constants , overrides )
} catch ( e ) {
2021-04-04 04:51:39 +00:00
console . error ( "Missing config file /config/config.js\nDocumentation: https://git.sr.ht/~cadence/tube-docs/tree/main/item/docs" )
process . exit ( 1 )
2020-11-20 05:27:38 +00:00
}
2020-08-30 13:54:59 +00:00
module . exports = constants