settings.defaults.js 34 KB

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