settings.defaults.js 34 KB

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