settings.defaults.js 34 KB

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