settings.defaults.js 33 KB

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