settings.defaults.js 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113
  1. const Path = require('node:path')
  2. const { merge } = require('@overleaf/settings/merge')
  3. let defaultFeatures, siteUrl
  4. // Make time interval config easier.
  5. const seconds = 1000
  6. const minutes = 60 * seconds
  7. // These credentials are used for authenticating api requests
  8. // between services that may need to go over public channels
  9. const httpAuthUser = process.env.WEB_API_USER
  10. const httpAuthPass = process.env.WEB_API_PASSWORD
  11. const httpAuthUsers = {}
  12. if (httpAuthUser && httpAuthPass) {
  13. httpAuthUsers[httpAuthUser] = httpAuthPass
  14. }
  15. const intFromEnv = function (name, defaultValue) {
  16. if (
  17. [null, undefined].includes(defaultValue) ||
  18. typeof defaultValue !== 'number'
  19. ) {
  20. throw new Error(
  21. `Bad default integer value for setting: ${name}, ${defaultValue}`
  22. )
  23. }
  24. return parseInt(process.env[name], 10) || defaultValue
  25. }
  26. const defaultTextExtensions = [
  27. 'tex',
  28. 'latex',
  29. 'sty',
  30. 'cls',
  31. 'bst',
  32. 'bib',
  33. 'bibtex',
  34. 'txt',
  35. 'tikz',
  36. 'mtx',
  37. 'rtex',
  38. 'md',
  39. 'asy',
  40. 'lbx',
  41. 'bbx',
  42. 'cbx',
  43. 'm',
  44. 'lco',
  45. 'dtx',
  46. 'ins',
  47. 'ist',
  48. 'def',
  49. 'clo',
  50. 'ldf',
  51. 'rmd',
  52. 'lua',
  53. 'gv',
  54. 'mf',
  55. 'yml',
  56. 'yaml',
  57. 'lhs',
  58. 'lean',
  59. 'lean4',
  60. 'hs',
  61. 'mk',
  62. 'xmpdata',
  63. 'cfg',
  64. 'rnw',
  65. 'ltx',
  66. 'inc',
  67. ]
  68. const parseTextExtensions = function (extensions) {
  69. if (extensions) {
  70. return extensions.split(',').map(ext => ext.trim())
  71. } else {
  72. return []
  73. }
  74. }
  75. const httpPermissionsPolicy = {
  76. blocked: [
  77. 'accelerometer',
  78. 'attribution-reporting',
  79. 'browsing-topics',
  80. 'camera',
  81. 'display-capture',
  82. 'encrypted-media',
  83. 'gamepad',
  84. 'geolocation',
  85. 'gyroscope',
  86. 'hid',
  87. 'identity-credentials-get',
  88. 'idle-detection',
  89. 'local-fonts',
  90. 'magnetometer',
  91. 'midi',
  92. 'otp-credentials',
  93. 'payment',
  94. 'picture-in-picture',
  95. 'screen-wake-lock',
  96. 'serial',
  97. 'storage-access',
  98. 'usb',
  99. 'window-management',
  100. 'xr-spatial-tracking',
  101. ],
  102. allowed: {
  103. autoplay: 'self "https://videos.ctfassets.net"',
  104. fullscreen: 'self',
  105. 'on-device-speech-recognition': 'self',
  106. },
  107. }
  108. module.exports = {
  109. env: 'server-ce',
  110. limits: {
  111. httpGlobalAgentMaxSockets: 300,
  112. httpsGlobalAgentMaxSockets: 300,
  113. },
  114. allowAnonymousReadAndWriteSharing:
  115. process.env.OVERLEAF_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING === 'true',
  116. // Databases
  117. // ---------
  118. mongo: {
  119. options: {
  120. appname: 'web',
  121. maxPoolSize: parseInt(process.env.MONGO_POOL_SIZE, 10) || 100,
  122. serverSelectionTimeoutMS:
  123. parseInt(process.env.MONGO_SERVER_SELECTION_TIMEOUT, 10) || 60000,
  124. // Setting socketTimeoutMS to 0 means no timeout
  125. socketTimeoutMS: parseInt(
  126. process.env.MONGO_SOCKET_TIMEOUT ?? '60000',
  127. 10
  128. ),
  129. monitorCommands: true,
  130. },
  131. url:
  132. process.env.MONGO_CONNECTION_STRING ||
  133. process.env.MONGO_URL ||
  134. `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
  135. hasSecondaries: process.env.MONGO_HAS_SECONDARIES === 'true',
  136. },
  137. redis: {
  138. web: {
  139. host: process.env.REDIS_HOST || '127.0.0.1',
  140. port: process.env.REDIS_PORT || '6379',
  141. password: process.env.REDIS_PASSWORD || '',
  142. db: process.env.REDIS_DB,
  143. maxRetriesPerRequest: parseInt(
  144. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  145. ),
  146. },
  147. // websessions:
  148. // cluster: [
  149. // {host: '127.0.0.1', port: 7000}
  150. // {host: '127.0.0.1', port: 7001}
  151. // {host: '127.0.0.1', port: 7002}
  152. // {host: '127.0.0.1', port: 7003}
  153. // {host: '127.0.0.1', port: 7004}
  154. // {host: '127.0.0.1', port: 7005}
  155. // ]
  156. // ratelimiter:
  157. // cluster: [
  158. // {host: '127.0.0.1', port: 7000}
  159. // {host: '127.0.0.1', port: 7001}
  160. // {host: '127.0.0.1', port: 7002}
  161. // {host: '127.0.0.1', port: 7003}
  162. // {host: '127.0.0.1', port: 7004}
  163. // {host: '127.0.0.1', port: 7005}
  164. // ]
  165. // cooldown:
  166. // cluster: [
  167. // {host: '127.0.0.1', port: 7000}
  168. // {host: '127.0.0.1', port: 7001}
  169. // {host: '127.0.0.1', port: 7002}
  170. // {host: '127.0.0.1', port: 7003}
  171. // {host: '127.0.0.1', port: 7004}
  172. // {host: '127.0.0.1', port: 7005}
  173. // ]
  174. api: {
  175. host: process.env.REDIS_HOST || '127.0.0.1',
  176. port: process.env.REDIS_PORT || '6379',
  177. password: process.env.REDIS_PASSWORD || '',
  178. maxRetriesPerRequest: parseInt(
  179. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  180. ),
  181. },
  182. },
  183. // Service locations
  184. // -----------------
  185. // Configure which ports to run each service on. Generally you
  186. // can leave these as they are unless you have some other services
  187. // running which conflict, or want to run the web process on port 80.
  188. internal: {
  189. web: {
  190. port: process.env.WEB_PORT || 3000,
  191. host: process.env.LISTEN_ADDRESS || '127.0.0.1',
  192. },
  193. },
  194. // Tell each service where to find the other services. If everything
  195. // is running locally then this is easy, but they exist as separate config
  196. // options incase you want to run some services on remote hosts.
  197. apis: {
  198. web: {
  199. url: `http://${
  200. process.env.WEB_API_HOST || process.env.WEB_HOST || '127.0.0.1'
  201. }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
  202. user: httpAuthUser,
  203. pass: httpAuthPass,
  204. },
  205. documentupdater: {
  206. url: `http://${
  207. process.env.DOCUPDATER_HOST ||
  208. process.env.DOCUMENT_UPDATER_HOST ||
  209. '127.0.0.1'
  210. }:3003`,
  211. },
  212. docstore: {
  213. url: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
  214. pubUrl: `http://${process.env.DOCSTORE_HOST || '127.0.0.1'}:3016`,
  215. },
  216. chat: {
  217. internal_url: `http://${process.env.CHAT_HOST || '127.0.0.1'}:3010`,
  218. },
  219. filestore: {
  220. url: `http://${process.env.FILESTORE_HOST || '127.0.0.1'}:3009`,
  221. },
  222. clsi: {
  223. url: `http://${process.env.CLSI_HOST || '127.0.0.1'}:3013`,
  224. downloadHost: process.env.CLSI_LB_IP
  225. ? `http://${process.env.CLSI_LB_IP}:80`
  226. : `http://${process.env.DOWNLOAD_HOST || '127.0.0.1'}:8080`,
  227. backendGroupName: undefined,
  228. submissionBackendClass:
  229. process.env.CLSI_SUBMISSION_BACKEND_CLASS || 'c3d',
  230. },
  231. clsiCache: {
  232. instances: JSON.parse(process.env.CLSI_CACHE_INSTANCES || '[]'),
  233. },
  234. project_history: {
  235. sendProjectStructureOps: true,
  236. url: `http://${process.env.PROJECT_HISTORY_HOST || '127.0.0.1'}:3054`,
  237. },
  238. historyBackupDeletion: {
  239. enabled: false,
  240. url: `http://${process.env.HISTORY_BACKUP_DELETION_HOST || '127.0.0.1'}:3101`,
  241. user: process.env.HISTORY_BACKUP_DELETION_USER || 'staging',
  242. pass: process.env.HISTORY_BACKUP_DELETION_PASS,
  243. },
  244. realTime: {
  245. url: `http://${process.env.REALTIME_HOST || '127.0.0.1'}:3026`,
  246. },
  247. contacts: {
  248. url: `http://${process.env.CONTACTS_HOST || '127.0.0.1'}:3036`,
  249. },
  250. notifications: {
  251. url: `http://${process.env.NOTIFICATIONS_HOST || '127.0.0.1'}:3042`,
  252. },
  253. webpack: {
  254. url: `http://${process.env.WEBPACK_HOST || '127.0.0.1'}:3808`,
  255. },
  256. wiki: {
  257. url: process.env.WIKI_URL || 'https://learnwiki.overleaf.com',
  258. maxCacheAge: parseInt(process.env.WIKI_MAX_CACHE_AGE || 5 * minutes, 10),
  259. },
  260. haveIBeenPwned: {
  261. enabled: process.env.HAVE_I_BEEN_PWNED_ENABLED === 'true',
  262. url:
  263. process.env.HAVE_I_BEEN_PWNED_URL || 'https://api.pwnedpasswords.com',
  264. timeout: parseInt(process.env.HAVE_I_BEEN_PWNED_TIMEOUT, 10) || 5 * 1000,
  265. },
  266. v1_history: {
  267. url:
  268. process.env.V1_HISTORY_URL ||
  269. `http://${process.env.V1_HISTORY_HOST || '127.0.0.1'}:${
  270. process.env.V1_HISTORY_PORT || '3100'
  271. }/api`,
  272. urlForGitBridge: process.env.V1_HISTORY_URL_FOR_GIT_BRIDGE,
  273. user: process.env.V1_HISTORY_USER || 'staging',
  274. pass:
  275. process.env.V1_HISTORY_PASS ||
  276. process.env.V1_HISTORY_PASSWORD ||
  277. 'password',
  278. buckets: {
  279. globalBlobs: process.env.OVERLEAF_EDITOR_BLOBS_BUCKET,
  280. projectBlobs: process.env.OVERLEAF_EDITOR_PROJECT_BLOBS_BUCKET,
  281. },
  282. },
  283. // For legacy reasons, we need to populate the below objects.
  284. v1: {},
  285. recurly: {},
  286. },
  287. // Defines which features are allowed in the
  288. // Permissions-Policy HTTP header
  289. httpPermissions: httpPermissionsPolicy,
  290. useHttpPermissionsPolicy: true,
  291. jwt: {
  292. key: process.env.OT_JWT_AUTH_KEY,
  293. algorithm: process.env.OT_JWT_AUTH_ALG || 'HS256',
  294. },
  295. devToolbar: {
  296. enabled: false,
  297. },
  298. splitTests: [],
  299. // Where your instance of Overleaf Community Edition/Server Pro can be found publicly. Used in emails
  300. // that are sent out, generated links, etc.
  301. siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://127.0.0.1:3000'),
  302. lockManager: {
  303. lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),
  304. maxTestInterval: intFromEnv('LOCK_MANAGER_MAX_TEST_INTERVAL', 1000),
  305. maxLockWaitTime: intFromEnv('LOCK_MANAGER_MAX_LOCK_WAIT_TIME', 10000),
  306. redisLockExpiry: intFromEnv('LOCK_MANAGER_REDIS_LOCK_EXPIRY', 30),
  307. slowExecutionThreshold: intFromEnv(
  308. 'LOCK_MANAGER_SLOW_EXECUTION_THRESHOLD',
  309. 5000
  310. ),
  311. },
  312. // Optional separate location for websocket connections, if unset defaults to siteUrl.
  313. wsUrl: process.env.WEBSOCKET_URL,
  314. wsUrlV2: process.env.WEBSOCKET_URL_V2,
  315. wsUrlBeta: process.env.WEBSOCKET_URL_BETA,
  316. wsUrlV2Percentage: parseInt(
  317. process.env.WEBSOCKET_URL_V2_PERCENTAGE || '0',
  318. 10
  319. ),
  320. wsRetryHandshake: parseInt(process.env.WEBSOCKET_RETRY_HANDSHAKE || '5', 10),
  321. // cookie domain
  322. // use full domain for cookies to only be accessible from that domain,
  323. // replace subdomain with dot to have them accessible on all subdomains
  324. cookieDomain: process.env.COOKIE_DOMAIN,
  325. cookieName: process.env.COOKIE_NAME || 'overleaf.sid',
  326. cookieRollingSession: true,
  327. // this is only used if cookies are used for clsi backend
  328. // clsiCookieKey: "clsiserver"
  329. robotsNoindex: process.env.ROBOTS_NOINDEX === 'true' || false,
  330. maxEntitiesPerProject: parseInt(
  331. process.env.MAX_ENTITIES_PER_PROJECT || '2000',
  332. 10
  333. ),
  334. projectUploadTimeout: parseInt(
  335. process.env.PROJECT_UPLOAD_TIMEOUT || '120000',
  336. 10
  337. ),
  338. maxUploadSize: 50 * 1024 * 1024, // 50 MB
  339. multerOptions: {
  340. preservePath: process.env.MULTER_PRESERVE_PATH,
  341. },
  342. notifyOnSystemMessageChanges:
  343. process.env.NOTIFY_ON_SYSTEM_MESSAGE_CHANGES === 'true',
  344. // start failing the health check if active handles exceeds this limit
  345. maxActiveHandles: process.env.MAX_ACTIVE_HANDLES
  346. ? parseInt(process.env.MAX_ACTIVE_HANDLES, 10)
  347. : undefined,
  348. // Security
  349. // --------
  350. security: {
  351. sessionSecret: process.env.SESSION_SECRET,
  352. sessionSecretUpcoming: process.env.SESSION_SECRET_UPCOMING,
  353. sessionSecretFallback: process.env.SESSION_SECRET_FALLBACK,
  354. bcryptRounds: parseInt(process.env.BCRYPT_ROUNDS, 10) || 12,
  355. }, // number of rounds used to hash user passwords (raised to power 2)
  356. adminUrl: process.env.ADMIN_URL,
  357. adminOnlyLogin: process.env.ADMIN_ONLY_LOGIN === 'true',
  358. adminPrivilegeAvailable: process.env.ADMIN_PRIVILEGE_AVAILABLE === 'true',
  359. adminRolesEnabled: false,
  360. blockCrossOriginRequests: process.env.BLOCK_CROSS_ORIGIN_REQUESTS === 'true',
  361. allowedOrigins: (process.env.ALLOWED_ORIGINS || siteUrl).split(','),
  362. httpAuthUsers,
  363. // Default features
  364. // ----------------
  365. //
  366. // You can select the features that are enabled by default for new
  367. // new users.
  368. defaultFeatures: (defaultFeatures = {
  369. collaborators: -1,
  370. dropbox: true,
  371. github: true,
  372. gitBridge: true,
  373. versioning: true,
  374. compileTimeout: 180,
  375. compileGroup: 'standard',
  376. references: true,
  377. trackChanges: true,
  378. }),
  379. // featuresEpoch: 'YYYY-MM-DD',
  380. features: {
  381. personal: defaultFeatures,
  382. },
  383. aiFeatures: {
  384. freeQuota: 'free',
  385. standardQuota: 'standard',
  386. basicQuota: 'basic',
  387. unlimitedQuota: 'unlimited',
  388. },
  389. quotaGrants: {
  390. ai: {
  391. free: 0,
  392. basic: 0,
  393. standard: 0,
  394. unlimited: 0,
  395. },
  396. },
  397. groupPlanModalOptions: {
  398. plan_codes: [],
  399. currencies: [],
  400. sizes: [],
  401. usages: [],
  402. },
  403. plans: [
  404. {
  405. planCode: 'personal',
  406. name: 'Personal',
  407. price_in_cents: 0,
  408. features: defaultFeatures,
  409. },
  410. ],
  411. disableChat: process.env.OVERLEAF_DISABLE_CHAT === 'true',
  412. disableLinkSharing: process.env.OVERLEAF_DISABLE_LINK_SHARING === 'true',
  413. enableSubscriptions: false,
  414. restrictedCountries: [],
  415. enableOnboardingEmails: process.env.ENABLE_ONBOARDING_EMAILS === 'true',
  416. enabledLinkedFileTypes: (process.env.ENABLED_LINKED_FILE_TYPES || '').split(
  417. ','
  418. ),
  419. // i18n
  420. // ------
  421. //
  422. i18n: {
  423. checkForHTMLInVars: process.env.I18N_CHECK_FOR_HTML_IN_VARS === 'true',
  424. escapeHTMLInVars: process.env.I18N_ESCAPE_HTML_IN_VARS === 'true',
  425. subdomainLang: {
  426. www: { lngCode: 'en', url: siteUrl },
  427. },
  428. defaultLng: 'en',
  429. },
  430. // Spelling languages
  431. // dic = available in client
  432. // server: false = not available on server
  433. // ------------------
  434. languages: [
  435. { code: 'en', name: 'English' },
  436. { code: 'en_US', dic: 'en_US', name: 'English (American)' },
  437. { code: 'en_GB', dic: 'en_GB', name: 'English (British)' },
  438. { code: 'en_CA', dic: 'en_CA', name: 'English (Canadian)' },
  439. {
  440. code: 'en_AU',
  441. dic: 'en_AU',
  442. name: 'English (Australian)',
  443. server: false,
  444. },
  445. {
  446. code: 'en_ZA',
  447. dic: 'en_ZA',
  448. name: 'English (South African)',
  449. server: false,
  450. },
  451. { code: 'af', dic: 'af_ZA', name: 'Afrikaans' },
  452. { code: 'an', dic: 'an_ES', name: 'Aragonese', server: false },
  453. { code: 'ar', dic: 'ar', name: 'Arabic' },
  454. { code: 'be_BY', dic: 'be_BY', name: 'Belarusian', server: false },
  455. { code: 'eu', dic: 'eu', name: 'Basque' },
  456. { code: 'bn_BD', dic: 'bn_BD', name: 'Bengali', server: false },
  457. { code: 'bs_BA', dic: 'bs_BA', name: 'Bosnian', server: false },
  458. { code: 'br', dic: 'br_FR', name: 'Breton' },
  459. { code: 'bg', dic: 'bg_BG', name: 'Bulgarian' },
  460. { code: 'ca', dic: 'ca', name: 'Catalan' },
  461. { code: 'hr', dic: 'hr_HR', name: 'Croatian' },
  462. { code: 'cs', dic: 'cs_CZ', name: 'Czech' },
  463. { code: 'da', dic: 'da_DK', name: 'Danish' },
  464. { code: 'nl', dic: 'nl', name: 'Dutch' },
  465. { code: 'dz', dic: 'dz', name: 'Dzongkha', server: false },
  466. { code: 'eo', dic: 'eo', name: 'Esperanto' },
  467. { code: 'et', dic: 'et_EE', name: 'Estonian' },
  468. { code: 'fo', dic: 'fo', name: 'Faroese' },
  469. { code: 'fr', dic: 'fr', name: 'French' },
  470. { code: 'gl', dic: 'gl_ES', name: 'Galician' },
  471. { code: 'de', dic: 'de_DE', name: 'German' },
  472. { code: 'de_AT', dic: 'de_AT', name: 'German (Austria)', server: false },
  473. {
  474. code: 'de_CH',
  475. dic: 'de_CH',
  476. name: 'German (Switzerland)',
  477. server: false,
  478. },
  479. { code: 'el', dic: 'el_GR', name: 'Greek' },
  480. { code: 'gug_PY', dic: 'gug_PY', name: 'Guarani', server: false },
  481. { code: 'gu_IN', dic: 'gu_IN', name: 'Gujarati', server: false },
  482. { code: 'he_IL', dic: 'he_IL', name: 'Hebrew', server: false },
  483. { code: 'hi_IN', dic: 'hi_IN', name: 'Hindi', server: false },
  484. { code: 'hu_HU', dic: 'hu_HU', name: 'Hungarian', server: false },
  485. { code: 'is_IS', dic: 'is_IS', name: 'Icelandic', server: false },
  486. { code: 'id', dic: 'id_ID', name: 'Indonesian' },
  487. { code: 'ga', dic: 'ga_IE', name: 'Irish' },
  488. { code: 'it', dic: 'it_IT', name: 'Italian' },
  489. { code: 'kk', dic: 'kk_KZ', name: 'Kazakh' },
  490. { code: 'ko', dic: 'ko', name: 'Korean', server: false },
  491. { code: 'ku', name: 'Kurdish' },
  492. { code: 'kmr', dic: 'kmr_Latn', name: 'Kurmanji', server: false },
  493. { code: 'lv', dic: 'lv_LV', name: 'Latvian' },
  494. { code: 'lt', dic: 'lt_LT', name: 'Lithuanian' },
  495. { code: 'lo_LA', dic: 'lo_LA', name: 'Laotian', server: false },
  496. { code: 'ml_IN', dic: 'ml_IN', name: 'Malayalam', server: false },
  497. { code: 'mn_MN', dic: 'mn_MN', name: 'Mongolian', server: false },
  498. { code: 'nr', name: 'Ndebele' },
  499. { code: 'ne_NP', dic: 'ne_NP', name: 'Nepali', server: false },
  500. { code: 'ns', name: 'Northern Sotho' },
  501. { code: 'no', name: 'Norwegian' },
  502. { code: 'nb_NO', dic: 'nb_NO', name: 'Norwegian (Bokmål)', server: false },
  503. { code: 'nn_NO', dic: 'nn_NO', name: 'Norwegian (Nynorsk)', server: false },
  504. { code: 'oc_FR', dic: 'oc_FR', name: 'Occitan', server: false },
  505. { code: 'fa', dic: 'fa_IR', name: 'Persian' },
  506. { code: 'pl', dic: 'pl_PL', name: 'Polish' },
  507. { code: 'pt_BR', dic: 'pt_BR', name: 'Portuguese (Brazilian)' },
  508. {
  509. code: 'pt_PT',
  510. dic: 'pt_PT',
  511. name: 'Portuguese (European)',
  512. },
  513. { code: 'pa', name: 'Punjabi' },
  514. { code: 'ro', dic: 'ro_RO', name: 'Romanian' },
  515. { code: 'ru', dic: 'ru_RU', name: 'Russian' },
  516. { code: 'gd_GB', dic: 'gd_GB', name: 'Scottish Gaelic', server: false },
  517. { code: 'sr_RS', dic: 'sr_RS', name: 'Serbian', server: false },
  518. { code: 'si_LK', dic: 'si_LK', name: 'Sinhala', server: false },
  519. { code: 'sk', dic: 'sk_SK', name: 'Slovak' },
  520. { code: 'sl', dic: 'sl_SI', name: 'Slovenian' },
  521. { code: 'st', name: 'Southern Sotho' },
  522. { code: 'es', dic: 'es_ES', name: 'Spanish' },
  523. { code: 'sw_TZ', dic: 'sw_TZ', name: 'Swahili', server: false },
  524. { code: 'sv', dic: 'sv_SE', name: 'Swedish' },
  525. { code: 'tl', dic: 'tl', name: 'Tagalog' },
  526. { code: 'te_IN', dic: 'te_IN', name: 'Telugu', server: false },
  527. { code: 'th_TH', dic: 'th_TH', name: 'Thai', server: false },
  528. { code: 'bo', dic: 'bo', name: 'Tibetan', server: false },
  529. { code: 'ts', name: 'Tsonga' },
  530. { code: 'tn', name: 'Tswana' },
  531. { code: 'tr_TR', dic: 'tr_TR', name: 'Turkish', server: false },
  532. { code: 'uk_UA', dic: 'uk_UA', name: 'Ukrainian', server: false },
  533. { code: 'hsb', name: 'Upper Sorbian' },
  534. { code: 'uz_UZ', dic: 'uz_UZ', name: 'Uzbek', server: false },
  535. { code: 'vi_VN', dic: 'vi_VN', name: 'Vietnamese', server: false },
  536. { code: 'cy', name: 'Welsh' },
  537. { code: 'xh', name: 'Xhosa' },
  538. ],
  539. translatedLanguages: {
  540. cn: '简体中文',
  541. cs: 'Čeština',
  542. da: 'Dansk',
  543. de: 'Deutsch',
  544. en: 'English',
  545. es: 'Español',
  546. fi: 'Suomi',
  547. fr: 'Français',
  548. it: 'Italiano',
  549. ja: '日本語',
  550. ko: '한국어',
  551. nl: 'Nederlands',
  552. no: 'Norsk',
  553. pl: 'Polski',
  554. pt: 'Português',
  555. ro: 'Română',
  556. ru: 'Русский',
  557. sv: 'Svenska',
  558. tr: 'Türkçe',
  559. uk: 'Українська',
  560. 'zh-CN': '简体中文',
  561. },
  562. maxDictionarySize: 1024 * 1024, // 1 MB
  563. // Password Settings
  564. // -----------
  565. // These restrict the passwords users can use when registering
  566. // opts are from http://antelle.github.io/passfield
  567. passwordStrengthOptions: {
  568. length: {
  569. min: 8,
  570. // Bcrypt does not support longer passwords than that.
  571. max: 72,
  572. },
  573. },
  574. elevateAccountSecurityAfterFailedLogin:
  575. parseInt(process.env.ELEVATED_ACCOUNT_SECURITY_AFTER_FAILED_LOGIN_MS, 10) ||
  576. 24 * 60 * 60 * 1000,
  577. deviceHistory: {
  578. cookieName: process.env.DEVICE_HISTORY_COOKIE_NAME || 'deviceHistory',
  579. entryExpiry:
  580. parseInt(process.env.DEVICE_HISTORY_ENTRY_EXPIRY_MS, 10) ||
  581. 90 * 24 * 60 * 60 * 1000,
  582. maxEntries: parseInt(process.env.DEVICE_HISTORY_MAX_ENTRIES, 10) || 10,
  583. secret: process.env.DEVICE_HISTORY_SECRET,
  584. },
  585. // Email support
  586. // -------------
  587. //
  588. // Overleaf uses nodemailer (http://www.nodemailer.com/) to send transactional emails.
  589. // To see the range of transport and options they support, see http://www.nodemailer.com/docs/transports
  590. // email:
  591. // fromAddress: ""
  592. // replyTo: ""
  593. // lifecycle: false
  594. // # Example transport and parameter settings for Amazon SES
  595. // transport: "SES"
  596. // parameters:
  597. // AWSAccessKeyID: ""
  598. // AWSSecretKey: ""
  599. // For legacy reasons, we need to populate this object.
  600. sentry: {},
  601. // Production Settings
  602. // -------------------
  603. debugPugTemplates: process.env.DEBUG_PUG_TEMPLATES === 'true',
  604. precompilePugTemplatesAtBootTime: process.env
  605. .PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME
  606. ? process.env.PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME === 'true'
  607. : process.env.NODE_ENV === 'production',
  608. // Should javascript assets be served minified or not.
  609. useMinifiedJs: process.env.MINIFIED_JS === 'true' || false,
  610. // Should static assets be sent with a header to tell the browser to cache
  611. // them.
  612. cacheStaticAssets: false,
  613. // If you are running Overleaf over https, set this to true to send the
  614. // cookie with a secure flag (recommended).
  615. secureCookie: false,
  616. // 'SameSite' cookie setting. Can be set to 'lax', 'none' or 'strict'
  617. // 'lax' is recommended, as 'strict' will prevent people linking to projects
  618. // https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
  619. sameSiteCookie: 'lax',
  620. // If you are running Overleaf behind a proxy (like Apache, Nginx, etc)
  621. // then set this to true to allow it to correctly detect the forwarded IP
  622. // address and http/https protocol information.
  623. behindProxy: true,
  624. trustedProxyIps: process.env.TRUSTED_PROXY_IPS || 'loopback',
  625. // Delay before closing the http server upon receiving a SIGTERM process signal.
  626. gracefulShutdownDelayInMs:
  627. parseInt(process.env.GRACEFUL_SHUTDOWN_DELAY_SECONDS ?? '5', 10) * seconds,
  628. maxReconnectGracefullyIntervalMs: parseInt(
  629. process.env.MAX_RECONNECT_GRACEFULLY_INTERVAL_MS ?? '30000',
  630. 10
  631. ),
  632. // Expose the hostname in the `X-Served-By` response header
  633. exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
  634. // Cookie max age (in milliseconds). Set to false for a browser session.
  635. cookieSessionLength: 5 * 24 * 60 * 60 * 1000, // 5 days
  636. // When true, only allow invites to be sent to email addresses that
  637. // already have user accounts
  638. restrictInvitesToExistingAccounts: false,
  639. // Should we allow access to any page without logging in? This includes
  640. // public projects, /learn, /templates, about pages, etc.
  641. allowPublicAccess: process.env.OVERLEAF_ALLOW_PUBLIC_ACCESS === 'true',
  642. // editor should be open by default
  643. editorIsOpen: process.env.EDITOR_OPEN !== 'false',
  644. // site should be open by default
  645. siteIsOpen: process.env.SITE_OPEN !== 'false',
  646. // status file for closing/opening the site at run-time, polled every 5s
  647. siteMaintenanceFile: process.env.SITE_MAINTENANCE_FILE,
  648. // Use a single compile directory for all users in a project
  649. // (otherwise each user has their own directory)
  650. // disablePerUserCompiles: true
  651. // Domain the client (pdfjs) should download the compiled pdf from
  652. pdfDownloadDomain: process.env.COMPILES_USER_CONTENT_DOMAIN, // "http://clsi-lb:3014"
  653. // By default turn on feature flag, can be overridden per request.
  654. enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
  655. // Maximum size of text documents in the real-time editing system.
  656. max_doc_length: 2 * 1024 * 1024, // 2mb
  657. primary_email_check_expiration: 1000 * 60 * 60 * 24 * 90, // 90 days
  658. userHardDeletionDelay:
  659. parseInt(process.env.OVERLEAF_USER_HARD_DELETION_DELAY, 10) ||
  660. 1000 * 60 * 60 * 24 * 90, // 90 days
  661. projectHardDeletionDelay:
  662. parseInt(process.env.OVERLEAF_PROJECT_HARD_DELETION_DELAY, 10) ||
  663. 1000 * 60 * 60 * 24 * 90, // 90 days
  664. // Maximum Delay before sending comment mention notifications
  665. notificationMaxDelay:
  666. parseInt(process.env.COMMENT_MENTION_DELAY_MINUTES) || 30 * 60 * 1000, // 30 minutes
  667. // Comment mention notifications will wait at least this long before being sent
  668. notificationMinDelay:
  669. parseInt(process.env.COMMENT_MENTION_DELAY_MINUTES) || 10 * 60 * 1000, // 10 minutes
  670. // Maximum JSON size in HTTP requests
  671. // We should be able to process twice the max doc length, to allow for
  672. // - the doc content
  673. // - text ranges spanning the whole doc
  674. //
  675. // There's also overhead required for the JSON encoding and the UTF-8
  676. // encoding, theoretically up to 6 times the max doc length (e.g. a document
  677. // entirely filled with "\u0011" characters). On the other hand, we don't want
  678. // to block the event loop with JSON parsing, so we try to find a practical
  679. // compromise.
  680. max_json_request_size:
  681. parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 12 * 1024 * 1024, // 12 MB
  682. // Internal configs
  683. // ----------------
  684. path: {
  685. // If we ever need to write something to disk (e.g. incoming requests
  686. // that need processing but may be too big for memory, then write
  687. // them to disk here).
  688. dumpFolder: Path.resolve(__dirname, '../data/dumpFolder'),
  689. uploadFolder: Path.resolve(__dirname, '../data/uploads'),
  690. },
  691. // Automatic Snapshots
  692. // -------------------
  693. automaticSnapshots: {
  694. // How long should we wait after the user last edited to
  695. // take a snapshot?
  696. waitTimeAfterLastEdit: 5 * minutes,
  697. // Even if edits are still taking place, this is maximum
  698. // time to wait before taking another snapshot.
  699. maxTimeBetweenSnapshots: 30 * minutes,
  700. },
  701. // Smoke test
  702. // ----------
  703. // Provide log in credentials and a project to be able to run
  704. // some basic smoke tests to check the core functionality.
  705. //
  706. smokeTest: {
  707. userId: process.env.SMOKE_TEST_USER_ID,
  708. },
  709. appName: process.env.APP_NAME || 'Overleaf (Community Edition)',
  710. adminEmail: process.env.ADMIN_EMAIL || 'placeholder@example.com',
  711. adminDomains: process.env.ADMIN_DOMAINS
  712. ? JSON.parse(process.env.ADMIN_DOMAINS)
  713. : undefined,
  714. nav: {
  715. title: process.env.APP_NAME || 'Overleaf Community Edition',
  716. hide_powered_by: process.env.NAV_HIDE_POWERED_BY === 'true',
  717. left_footer: [],
  718. right_footer: [
  719. {
  720. text: '<a href="https://github.com/overleaf/overleaf">Fork on GitHub!</a>',
  721. },
  722. ],
  723. showSubscriptionLink: false,
  724. header_extras: [],
  725. },
  726. // Example:
  727. // header_extras: [{text: "Some Page", url: "http://example.com/some/page", class: "subdued"}]
  728. recaptcha: {
  729. endpoint:
  730. process.env.RECAPTCHA_ENDPOINT ||
  731. 'https://www.google.com/recaptcha/api/siteverify',
  732. trustedUsers: (process.env.CAPTCHA_TRUSTED_USERS || '')
  733. .split(',')
  734. .map(x => x.trim())
  735. .filter(x => x !== ''),
  736. trustedUsersRegex: process.env.CAPTCHA_TRUSTED_USERS_REGEX
  737. ? // Enforce matching of the entire input.
  738. new RegExp(`^${process.env.CAPTCHA_TRUSTED_USERS_REGEX}$`)
  739. : null,
  740. disabled: {
  741. invite: true,
  742. login: true,
  743. passwordReset: true,
  744. register: true,
  745. addEmail: true,
  746. },
  747. },
  748. customisation: {},
  749. redirects: {
  750. '/templates/index': '/templates/',
  751. },
  752. enablePugCache: process.env.ENABLE_PUG_CACHE === 'true',
  753. reloadModuleViewsOnEachRequest:
  754. process.env.ENABLE_PUG_CACHE !== 'true' &&
  755. process.env.NODE_ENV === 'development',
  756. rateLimit: {
  757. subnetRateLimiterDisabled:
  758. process.env.SUBNET_RATE_LIMITER_DISABLED === 'true',
  759. autoCompile: {
  760. everyone: process.env.RATE_LIMIT_AUTO_COMPILE_EVERYONE || 100,
  761. standard: process.env.RATE_LIMIT_AUTO_COMPILE_STANDARD || 25,
  762. },
  763. login: {
  764. ip: { points: 20, subnetPoints: 200, duration: 60 },
  765. email: { points: 10, duration: 120 },
  766. },
  767. },
  768. analytics: {
  769. enabled: false,
  770. },
  771. compileBodySizeLimitMb: process.env.COMPILE_BODY_SIZE_LIMIT_MB || 7,
  772. textExtensions: defaultTextExtensions.concat(
  773. parseTextExtensions(process.env.ADDITIONAL_TEXT_EXTENSIONS)
  774. ),
  775. // case-insensitive file names that is editable (doc) in the editor
  776. editableFilenames: ['latexmkrc', '.latexmkrc', 'makefile', 'gnumakefile'],
  777. fileIgnorePattern:
  778. process.env.FILE_IGNORE_PATTERN ||
  779. '**/{{__MACOSX,.git,.texpadtmp,.R}{,/**},.!(latexmkrc),*.{dvi,aux,log,toc,out,pdfsync,synctex,synctex(busy),fdb_latexmk,fls,nlo,ind,glo,gls,glg,bbl,blg,doc,docx,gz,swp}}',
  780. validRootDocExtensions: ['tex', 'Rtex', 'ltx', 'Rnw'],
  781. emailConfirmationDisabled:
  782. process.env.EMAIL_CONFIRMATION_DISABLED === 'true' || false,
  783. emailAddressLimit: intFromEnv('EMAIL_ADDRESS_LIMIT', 10),
  784. enabledServices: (process.env.ENABLED_SERVICES || 'web,api')
  785. .split(',')
  786. .map(s => s.trim()),
  787. // module options
  788. // ----------
  789. modules: {
  790. sanitize: {
  791. options: {
  792. allowedTags: [
  793. 'h1',
  794. 'h2',
  795. 'h3',
  796. 'h4',
  797. 'h5',
  798. 'h6',
  799. 'blockquote',
  800. 'p',
  801. 'a',
  802. 'ul',
  803. 'ol',
  804. 'nl',
  805. 'li',
  806. 'b',
  807. 'i',
  808. 'strong',
  809. 'em',
  810. 'strike',
  811. 'code',
  812. 'hr',
  813. 'br',
  814. 'div',
  815. 'table',
  816. 'thead',
  817. 'col',
  818. 'caption',
  819. 'tbody',
  820. 'tr',
  821. 'th',
  822. 'td',
  823. 'tfoot',
  824. 'pre',
  825. 'iframe',
  826. 'img',
  827. 'figure',
  828. 'figcaption',
  829. 'span',
  830. 'source',
  831. 'track',
  832. 'video',
  833. 'del',
  834. ],
  835. allowedAttributes: {
  836. a: [
  837. 'href',
  838. 'name',
  839. 'target',
  840. 'class',
  841. 'event-tracking',
  842. 'event-tracking-ga',
  843. 'event-tracking-label',
  844. 'event-tracking-trigger',
  845. ],
  846. div: ['class', 'id', 'style'],
  847. h1: ['class', 'id'],
  848. h2: ['class', 'id'],
  849. h3: ['class', 'id'],
  850. h4: ['class', 'id'],
  851. h5: ['class', 'id'],
  852. h6: ['class', 'id'],
  853. p: ['class'],
  854. col: ['width'],
  855. figure: ['class', 'id', 'style'],
  856. figcaption: ['class', 'id', 'style'],
  857. i: ['aria-hidden', 'aria-label', 'class', 'id', 'translate'],
  858. iframe: [
  859. 'allowfullscreen',
  860. 'frameborder',
  861. 'height',
  862. 'src',
  863. 'style',
  864. 'width',
  865. ],
  866. img: ['alt', 'class', 'src', 'style'],
  867. source: ['src', 'type'],
  868. span: ['class', 'id', 'style'],
  869. strong: ['style'],
  870. table: ['border', 'class', 'id', 'style'],
  871. td: ['colspan', 'rowspan', 'headers', 'style'],
  872. th: [
  873. 'abbr',
  874. 'headers',
  875. 'colspan',
  876. 'rowspan',
  877. 'scope',
  878. 'sorted',
  879. 'style',
  880. ],
  881. tr: ['class'],
  882. track: ['src', 'kind', 'srcLang', 'label'],
  883. video: ['alt', 'class', 'controls', 'height', 'width'],
  884. },
  885. },
  886. },
  887. },
  888. overleafModuleImports: {
  889. // modules to import (an empty array for each set of modules)
  890. //
  891. // Restart webpack after making changes.
  892. //
  893. createFileModes: [],
  894. devToolbar: [],
  895. gitBridge: [],
  896. publishModal: [],
  897. tprFileViewInfo: [],
  898. tprFileViewRefreshError: [],
  899. tprFileViewRefreshButton: [],
  900. tprFileViewNotOriginalImporter: [],
  901. contactUsModal: [],
  902. sourceEditorExtensions: [],
  903. sourceEditorComponents: [],
  904. pdfLogEntryHeaderActionComponents: [],
  905. pdfLogEntryComponents: [],
  906. pdfLogEntriesComponents: [],
  907. pdfPreviewPromotions: [],
  908. diagnosticActions: [],
  909. sourceEditorCompletionSources: [],
  910. sourceEditorSymbolPalette: [],
  911. sourceEditorToolbarComponents: [],
  912. sourceEditorToolbarEndButtons: [],
  913. rootContextProviders: [],
  914. mainEditorLayoutModals: [],
  915. mainEditorLayoutPanels: [],
  916. langFeedbackLinkingWidgets: [],
  917. labsExperiments: [],
  918. integrationLinkingWidgets: [],
  919. referenceLinkingWidgets: [],
  920. importProjectFromGithubModalWrapper: [],
  921. importProjectFromGithubMenu: [],
  922. editorLeftMenuSync: [],
  923. editorLeftMenuManageTemplate: [],
  924. menubarExtraComponents: [],
  925. oauth2Server: [],
  926. managedGroupSubscriptionEnrollmentNotification: [],
  927. managedGroupEnrollmentInvite: [],
  928. ssoCertificateInfo: [],
  929. v1ImportDataScreen: [],
  930. snapshotUtils: [],
  931. visualEditorProviders: [],
  932. usGovBanner: [],
  933. rollingBuildsUpdatedAlert: [],
  934. offlineModeToolbarButtons: [],
  935. settingsEntries: [],
  936. autoCompleteExtensions: [],
  937. sectionTitleGenerators: [],
  938. toastGenerators: [
  939. Path.resolve(
  940. __dirname,
  941. '../frontend/js/features/pdf-preview/components/synctex-toasts'
  942. ),
  943. ],
  944. editorSidebarComponents: [
  945. Path.resolve(
  946. __dirname,
  947. '../modules/full-project-search/frontend/js/components/full-project-search.tsx'
  948. ),
  949. ],
  950. fileTreeToolbarComponents: [
  951. Path.resolve(
  952. __dirname,
  953. '../modules/full-project-search/frontend/js/components/full-project-search-button.tsx'
  954. ),
  955. ],
  956. fullProjectSearchPanel: [
  957. Path.resolve(
  958. __dirname,
  959. '../modules/full-project-search/frontend/js/components/full-project-search.tsx'
  960. ),
  961. ],
  962. integrationPanelComponents: [],
  963. referenceSearchSetting: [],
  964. errorLogsComponents: [],
  965. referenceIndices: [],
  966. railEntries: [],
  967. railPopovers: [],
  968. },
  969. moduleImportSequence: [
  970. 'history-v1',
  971. 'launchpad',
  972. 'server-ce-scripts',
  973. 'user-activate',
  974. ],
  975. viewIncludes: {},
  976. csp: {
  977. enabled: process.env.CSP_ENABLED === 'true',
  978. reportOnly: process.env.CSP_REPORT_ONLY === 'true',
  979. reportPercentage: parseFloat(process.env.CSP_REPORT_PERCENTAGE) || 0,
  980. reportUri: process.env.CSP_REPORT_URI,
  981. exclude: [],
  982. viewDirectives: {
  983. 'app/views/project/ide-react': [`img-src 'self' data: blob:`],
  984. },
  985. },
  986. unsupportedBrowsers: {
  987. ie: '<=11',
  988. safari: '<=14',
  989. firefox: '<=78',
  990. },
  991. // ID of the IEEE brand in the rails app
  992. ieeeBrandId: intFromEnv('IEEE_BRAND_ID', 15),
  993. managedUsers: {
  994. enabled: false,
  995. },
  996. enablePandocConversions: process.env.ENABLE_PANDOC_CONVERSIONS === 'true',
  997. }
  998. module.exports.mergeWith = function (overrides) {
  999. return merge(overrides, module.exports)
  1000. }