settings.defaults.js 33 KB

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