settings.defaults.js 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. const { merge } = require('@overleaf/settings/merge')
  2. let defaultFeatures, siteUrl
  3. // Make time interval config easier.
  4. const seconds = 1000
  5. const minutes = 60 * seconds
  6. // These credentials are used for authenticating api requests
  7. // between services that may need to go over public channels
  8. const httpAuthUser = process.env.WEB_API_USER
  9. const httpAuthPass = process.env.WEB_API_PASSWORD
  10. const httpAuthUsers = {}
  11. if (httpAuthUser && httpAuthPass) {
  12. httpAuthUsers[httpAuthUser] = httpAuthPass
  13. }
  14. const sessionSecret = process.env.SESSION_SECRET || 'secret-please-change'
  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. 'latexmkrc',
  41. 'lbx',
  42. 'bbx',
  43. 'cbx',
  44. 'm',
  45. 'lco',
  46. 'dtx',
  47. 'ins',
  48. 'ist',
  49. 'def',
  50. 'clo',
  51. 'ldf',
  52. 'rmd',
  53. 'lua',
  54. 'gv',
  55. 'mf',
  56. 'yml',
  57. 'yaml',
  58. ]
  59. const parseTextExtensions = function (extensions) {
  60. if (extensions) {
  61. return extensions.split(',').map(ext => ext.trim())
  62. } else {
  63. return []
  64. }
  65. }
  66. module.exports = {
  67. env: 'server-ce',
  68. limits: {
  69. httpGlobalAgentMaxSockets: 300,
  70. httpsGlobalAgentMaxSockets: 300,
  71. },
  72. allowAnonymousReadAndWriteSharing:
  73. process.env.SHARELATEX_ALLOW_ANONYMOUS_READ_AND_WRITE_SHARING === 'true',
  74. // Databases
  75. // ---------
  76. mongo: {
  77. options: {
  78. appname: 'web',
  79. useUnifiedTopology:
  80. (process.env.MONGO_USE_UNIFIED_TOPOLOGY || 'true') === 'true',
  81. poolSize: parseInt(process.env.MONGO_POOL_SIZE, 10) || 10,
  82. serverSelectionTimeoutMS:
  83. parseInt(process.env.MONGO_SERVER_SELECTION_TIMEOUT, 10) || 60000,
  84. socketTimeoutMS: parseInt(process.env.MONGO_SOCKET_TIMEOUT, 10) || 30000,
  85. },
  86. url:
  87. process.env.MONGO_CONNECTION_STRING ||
  88. process.env.MONGO_URL ||
  89. `mongodb://${process.env.MONGO_HOST || '127.0.0.1'}/sharelatex`,
  90. },
  91. redis: {
  92. web: {
  93. host: process.env.REDIS_HOST || 'localhost',
  94. port: process.env.REDIS_PORT || '6379',
  95. password: process.env.REDIS_PASSWORD || '',
  96. maxRetriesPerRequest: parseInt(
  97. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  98. ),
  99. },
  100. // websessions:
  101. // cluster: [
  102. // {host: 'localhost', port: 7000}
  103. // {host: 'localhost', port: 7001}
  104. // {host: 'localhost', port: 7002}
  105. // {host: 'localhost', port: 7003}
  106. // {host: 'localhost', port: 7004}
  107. // {host: 'localhost', port: 7005}
  108. // ]
  109. // ratelimiter:
  110. // cluster: [
  111. // {host: 'localhost', port: 7000}
  112. // {host: 'localhost', port: 7001}
  113. // {host: 'localhost', port: 7002}
  114. // {host: 'localhost', port: 7003}
  115. // {host: 'localhost', port: 7004}
  116. // {host: 'localhost', port: 7005}
  117. // ]
  118. // cooldown:
  119. // cluster: [
  120. // {host: 'localhost', port: 7000}
  121. // {host: 'localhost', port: 7001}
  122. // {host: 'localhost', port: 7002}
  123. // {host: 'localhost', port: 7003}
  124. // {host: 'localhost', port: 7004}
  125. // {host: 'localhost', port: 7005}
  126. // ]
  127. api: {
  128. host: process.env.REDIS_HOST || 'localhost',
  129. port: process.env.REDIS_PORT || '6379',
  130. password: process.env.REDIS_PASSWORD || '',
  131. maxRetriesPerRequest: parseInt(
  132. process.env.REDIS_MAX_RETRIES_PER_REQUEST || '20'
  133. ),
  134. },
  135. },
  136. // Service locations
  137. // -----------------
  138. // Configure which ports to run each service on. Generally you
  139. // can leave these as they are unless you have some other services
  140. // running which conflict, or want to run the web process on port 80.
  141. internal: {
  142. web: {
  143. port: process.env.WEB_PORT || 3000,
  144. host: process.env.LISTEN_ADDRESS || 'localhost',
  145. },
  146. },
  147. // Tell each service where to find the other services. If everything
  148. // is running locally then this is easy, but they exist as separate config
  149. // options incase you want to run some services on remote hosts.
  150. apis: {
  151. web: {
  152. url: `http://${
  153. process.env.WEB_API_HOST || process.env.WEB_HOST || 'localhost'
  154. }:${process.env.WEB_API_PORT || process.env.WEB_PORT || 3000}`,
  155. user: httpAuthUser,
  156. pass: httpAuthPass,
  157. },
  158. documentupdater: {
  159. url: `http://${
  160. process.env.DOCUPDATER_HOST ||
  161. process.env.DOCUMENT_UPDATER_HOST ||
  162. 'localhost'
  163. }:3003`,
  164. },
  165. spelling: {
  166. url: `http://${process.env.SPELLING_HOST || 'localhost'}:3005`,
  167. host: process.env.SPELLING_HOST,
  168. },
  169. trackchanges: {
  170. url: `http://${process.env.TRACK_CHANGES_HOST || 'localhost'}:3015`,
  171. },
  172. docstore: {
  173. url: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
  174. pubUrl: `http://${process.env.DOCSTORE_HOST || 'localhost'}:3016`,
  175. },
  176. chat: {
  177. internal_url: `http://${process.env.CHAT_HOST || 'localhost'}:3010`,
  178. },
  179. filestore: {
  180. url: `http://${process.env.FILESTORE_HOST || 'localhost'}:3009`,
  181. },
  182. clsi: {
  183. url: `http://${process.env.CLSI_HOST || 'localhost'}:3013`,
  184. // url: "http://#{process.env['CLSI_LB_HOST']}:3014"
  185. backendGroupName: undefined,
  186. },
  187. realTime: {
  188. url: `http://${process.env.REALTIME_HOST || 'localhost'}:3026`,
  189. },
  190. contacts: {
  191. url: `http://${process.env.CONTACTS_HOST || 'localhost'}:3036`,
  192. },
  193. notifications: {
  194. url: `http://${process.env.NOTIFICATIONS_HOST || 'localhost'}:3042`,
  195. },
  196. // For legacy reasons, we need to populate the below objects.
  197. v1: {},
  198. recurly: {},
  199. },
  200. splitTests: [],
  201. // Where your instance of ShareLaTeX can be found publically. Used in emails
  202. // that are sent out, generated links, etc.
  203. siteUrl: (siteUrl = process.env.PUBLIC_URL || 'http://localhost:3000'),
  204. lockManager: {
  205. lockTestInterval: intFromEnv('LOCK_MANAGER_LOCK_TEST_INTERVAL', 50),
  206. maxTestInterval: intFromEnv('LOCK_MANAGER_MAX_TEST_INTERVAL', 1000),
  207. maxLockWaitTime: intFromEnv('LOCK_MANAGER_MAX_LOCK_WAIT_TIME', 10000),
  208. redisLockExpiry: intFromEnv('LOCK_MANAGER_REDIS_LOCK_EXPIRY', 30),
  209. slowExecutionThreshold: intFromEnv(
  210. 'LOCK_MANAGER_SLOW_EXECUTION_THRESHOLD',
  211. 5000
  212. ),
  213. },
  214. // Optional separate location for websocket connections, if unset defaults to siteUrl.
  215. wsUrl: process.env.WEBSOCKET_URL,
  216. wsUrlV2: process.env.WEBSOCKET_URL_V2,
  217. wsUrlBeta: process.env.WEBSOCKET_URL_BETA,
  218. wsUrlV2Percentage: parseInt(
  219. process.env.WEBSOCKET_URL_V2_PERCENTAGE || '0',
  220. 10
  221. ),
  222. wsRetryHandshake: parseInt(process.env.WEBSOCKET_RETRY_HANDSHAKE || '5', 10),
  223. // cookie domain
  224. // use full domain for cookies to only be accessible from that domain,
  225. // replace subdomain with dot to have them accessible on all subdomains
  226. cookieDomain: process.env.COOKIE_DOMAIN,
  227. cookieName: process.env.COOKIE_NAME || 'sharelatex.sid',
  228. // this is only used if cookies are used for clsi backend
  229. // clsiCookieKey: "clsiserver"
  230. robotsNoindex: process.env.ROBOTS_NOINDEX === 'true' || false,
  231. maxEntitiesPerProject: 2000,
  232. maxUploadSize: 50 * 1024 * 1024, // 50 MB
  233. // start failing the health check if active handles exceeds this limit
  234. maxActiveHandles: process.env.MAX_ACTIVE_HANDLES
  235. ? parseInt(process.env.MAX_ACTIVE_HANDLES, 10)
  236. : undefined,
  237. // Security
  238. // --------
  239. security: {
  240. sessionSecret,
  241. bcryptRounds: parseInt(process.env.BCRYPT_ROUNDS, 10) || 12,
  242. }, // number of rounds used to hash user passwords (raised to power 2)
  243. httpAuthUsers,
  244. // Default features
  245. // ----------------
  246. //
  247. // You can select the features that are enabled by default for new
  248. // new users.
  249. defaultFeatures: (defaultFeatures = {
  250. collaborators: -1,
  251. dropbox: true,
  252. github: true,
  253. gitBridge: true,
  254. versioning: true,
  255. compileTimeout: 180,
  256. compileGroup: 'standard',
  257. references: true,
  258. templates: true,
  259. trackChanges: true,
  260. }),
  261. features: {
  262. personal: defaultFeatures,
  263. },
  264. plans: [
  265. {
  266. planCode: 'personal',
  267. name: 'Personal',
  268. price: 0,
  269. features: defaultFeatures,
  270. },
  271. ],
  272. enableSubscriptions: false,
  273. enabledLinkedFileTypes: (process.env.ENABLED_LINKED_FILE_TYPES || '').split(
  274. ','
  275. ),
  276. // i18n
  277. // ------
  278. //
  279. i18n: {
  280. checkForHTMLInVars: process.env.I18N_CHECK_FOR_HTML_IN_VARS === 'true',
  281. escapeHTMLInVars: process.env.I18N_ESCAPE_HTML_IN_VARS === 'true',
  282. subdomainLang: {
  283. www: { lngCode: 'en', url: siteUrl },
  284. },
  285. defaultLng: 'en',
  286. },
  287. // Spelling languages
  288. // ------------------
  289. //
  290. // You must have the corresponding aspell package installed to
  291. // be able to use a language.
  292. languages: [
  293. { code: 'en', name: 'English' },
  294. { code: 'en_US', name: 'English (American)' },
  295. { code: 'en_GB', name: 'English (British)' },
  296. { code: 'en_CA', name: 'English (Canadian)' },
  297. { code: 'af', name: 'Afrikaans' },
  298. { code: 'ar', name: 'Arabic' },
  299. { code: 'gl', name: 'Galician' },
  300. { code: 'eu', name: 'Basque' },
  301. { code: 'br', name: 'Breton' },
  302. { code: 'bg', name: 'Bulgarian' },
  303. { code: 'ca', name: 'Catalan' },
  304. { code: 'hr', name: 'Croatian' },
  305. { code: 'cs', name: 'Czech' },
  306. { code: 'da', name: 'Danish' },
  307. { code: 'nl', name: 'Dutch' },
  308. { code: 'eo', name: 'Esperanto' },
  309. { code: 'et', name: 'Estonian' },
  310. { code: 'fo', name: 'Faroese' },
  311. { code: 'fr', name: 'French' },
  312. { code: 'de', name: 'German' },
  313. { code: 'el', name: 'Greek' },
  314. { code: 'id', name: 'Indonesian' },
  315. { code: 'ga', name: 'Irish' },
  316. { code: 'it', name: 'Italian' },
  317. { code: 'kk', name: 'Kazakh' },
  318. { code: 'ku', name: 'Kurdish' },
  319. { code: 'lv', name: 'Latvian' },
  320. { code: 'lt', name: 'Lithuanian' },
  321. { code: 'nr', name: 'Ndebele' },
  322. { code: 'ns', name: 'Northern Sotho' },
  323. { code: 'no', name: 'Norwegian' },
  324. { code: 'fa', name: 'Persian' },
  325. { code: 'pl', name: 'Polish' },
  326. { code: 'pt_BR', name: 'Portuguese (Brazilian)' },
  327. { code: 'pt_PT', name: 'Portuguese (European)' },
  328. { code: 'pa', name: 'Punjabi' },
  329. { code: 'ro', name: 'Romanian' },
  330. { code: 'ru', name: 'Russian' },
  331. { code: 'sk', name: 'Slovak' },
  332. { code: 'sl', name: 'Slovenian' },
  333. { code: 'st', name: 'Southern Sotho' },
  334. { code: 'es', name: 'Spanish' },
  335. { code: 'sv', name: 'Swedish' },
  336. { code: 'tl', name: 'Tagalog' },
  337. { code: 'ts', name: 'Tsonga' },
  338. { code: 'tn', name: 'Tswana' },
  339. { code: 'hsb', name: 'Upper Sorbian' },
  340. { code: 'cy', name: 'Welsh' },
  341. { code: 'xh', name: 'Xhosa' },
  342. ],
  343. // Password Settings
  344. // -----------
  345. // These restrict the passwords users can use when registering
  346. // opts are from http://antelle.github.io/passfield
  347. // passwordStrengthOptions:
  348. // pattern: "aA$3"
  349. // length:
  350. // min: 6
  351. // max: 128
  352. // Email support
  353. // -------------
  354. //
  355. // ShareLaTeX uses nodemailer (http://www.nodemailer.com/) to send transactional emails.
  356. // To see the range of transport and options they support, see http://www.nodemailer.com/docs/transports
  357. // email:
  358. // fromAddress: ""
  359. // replyTo: ""
  360. // lifecycle: false
  361. // # Example transport and parameter settings for Amazon SES
  362. // transport: "SES"
  363. // parameters:
  364. // AWSAccessKeyID: ""
  365. // AWSSecretKey: ""
  366. // For legacy reasons, we need to populate this object.
  367. sentry: {},
  368. // Production Settings
  369. // -------------------
  370. debugPugTemplates: process.env.DEBUG_PUG_TEMPLATES === 'true',
  371. precompilePugTemplatesAtBootTime: process.env
  372. .PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME
  373. ? process.env.PRECOMPILE_PUG_TEMPLATES_AT_BOOT_TIME === 'true'
  374. : process.env.NODE_ENV === 'production',
  375. // Should javascript assets be served minified or not. Note that you will
  376. // need to run `grunt compile:minify` within the web-sharelatex directory
  377. // to generate these.
  378. useMinifiedJs: process.env.MINIFIED_JS === 'true' || false,
  379. // Should static assets be sent with a header to tell the browser to cache
  380. // them.
  381. cacheStaticAssets: false,
  382. // If you are running ShareLaTeX over https, set this to true to send the
  383. // cookie with a secure flag (recommended).
  384. secureCookie: false,
  385. // 'SameSite' cookie setting. Can be set to 'lax', 'none' or 'strict'
  386. // 'lax' is recommended, as 'strict' will prevent people linking to projects
  387. // https://tools.ietf.org/html/draft-ietf-httpbis-rfc6265bis-03#section-4.1.2.7
  388. sameSiteCookie: 'lax',
  389. // If you are running ShareLaTeX behind a proxy (like Apache, Nginx, etc)
  390. // then set this to true to allow it to correctly detect the forwarded IP
  391. // address and http/https protocol information.
  392. behindProxy: false,
  393. // Expose the hostname in the `X-Served-By` response header
  394. exposeHostname: process.env.EXPOSE_HOSTNAME === 'true',
  395. // Cookie max age (in milliseconds). Set to false for a browser session.
  396. cookieSessionLength: 5 * 24 * 60 * 60 * 1000, // 5 days
  397. // When true, only allow invites to be sent to email addresses that
  398. // already have user accounts
  399. restrictInvitesToExistingAccounts: false,
  400. // Should we allow access to any page without logging in? This includes
  401. // public projects, /learn, /templates, about pages, etc.
  402. allowPublicAccess: process.env.SHARELATEX_ALLOW_PUBLIC_ACCESS === 'true',
  403. // editor should be open by default
  404. editorIsOpen: process.env.EDITOR_OPEN !== 'false',
  405. // site should be open by default
  406. siteIsOpen: process.env.SITE_OPEN !== 'false',
  407. // Use a single compile directory for all users in a project
  408. // (otherwise each user has their own directory)
  409. // disablePerUserCompiles: true
  410. // Domain the client (pdfjs) should download the compiled pdf from
  411. pdfDownloadDomain: process.env.PDF_DOWNLOAD_DOMAIN, // "http://clsi-lb:3014"
  412. // By default turn on feature flag, can be overridden per request.
  413. enablePdfCaching: process.env.ENABLE_PDF_CACHING === 'true',
  414. // Whether to disable any existing service worker on the next load of the editor
  415. resetServiceWorker: process.env.RESET_SERVICE_WORKER === 'true',
  416. // Maximum size of text documents in the real-time editing system.
  417. max_doc_length: 2 * 1024 * 1024, // 2mb
  418. // Maximum JSON size in HTTP requests
  419. // We should be able to process twice the max doc length, to allow for
  420. // - the doc content
  421. // - text ranges spanning the whole doc
  422. //
  423. // There's also overhead required for the JSON encoding and the UTF-8 encoding,
  424. // theoretically up to 3 times the max doc length. On the other hand, we don't
  425. // want to block the event loop with JSON parsing, so we try to find a
  426. // practical compromise.
  427. max_json_request_size:
  428. parseInt(process.env.MAX_JSON_REQUEST_SIZE) || 6 * 1024 * 1024, // 6 MB
  429. // Internal configs
  430. // ----------------
  431. path: {
  432. // If we ever need to write something to disk (e.g. incoming requests
  433. // that need processing but may be too big for memory, then write
  434. // them to disk here).
  435. dumpFolder: './data/dumpFolder',
  436. uploadFolder: './data/uploads',
  437. },
  438. // Automatic Snapshots
  439. // -------------------
  440. automaticSnapshots: {
  441. // How long should we wait after the user last edited to
  442. // take a snapshot?
  443. waitTimeAfterLastEdit: 5 * minutes,
  444. // Even if edits are still taking place, this is maximum
  445. // time to wait before taking another snapshot.
  446. maxTimeBetweenSnapshots: 30 * minutes,
  447. },
  448. // Smoke test
  449. // ----------
  450. // Provide log in credentials and a project to be able to run
  451. // some basic smoke tests to check the core functionality.
  452. //
  453. smokeTest: {
  454. user: process.env.SMOKE_TEST_USER,
  455. userId: process.env.SMOKE_TEST_USER_ID,
  456. password: process.env.SMOKE_TEST_PASSWORD,
  457. projectId: process.env.SMOKE_TEST_PROJECT_ID,
  458. rateLimitSubject: process.env.SMOKE_TEST_RATE_LIMIT_SUBJECT || '127.0.0.1',
  459. stepTimeout: parseInt(process.env.SMOKE_TEST_STEP_TIMEOUT || '10000', 10),
  460. },
  461. appName: process.env.APP_NAME || 'ShareLaTeX (Community Edition)',
  462. adminEmail: process.env.ADMIN_EMAIL || 'placeholder@example.com',
  463. adminDomains: process.env.ADMIN_DOMAINS
  464. ? JSON.parse(process.env.ADMIN_DOMAINS)
  465. : undefined,
  466. nav: {
  467. title: 'ShareLaTeX Community Edition',
  468. left_footer: [
  469. {
  470. text:
  471. "Powered by <a href='https://www.sharelatex.com'>ShareLaTeX</a> © 2016",
  472. },
  473. ],
  474. right_footer: [
  475. {
  476. text: "<i class='fa fa-github-square'></i> Fork on Github!",
  477. url: 'https://github.com/sharelatex/sharelatex',
  478. },
  479. ],
  480. showSubscriptionLink: false,
  481. header_extras: [],
  482. },
  483. // Example:
  484. // header_extras: [{text: "Some Page", url: "http://example.com/some/page", class: "subdued"}]
  485. recaptcha: {
  486. disabled: {
  487. invite: true,
  488. login: true,
  489. passwordReset: true,
  490. register: true,
  491. },
  492. },
  493. customisation: {},
  494. redirects: {
  495. '/templates/index': '/templates/',
  496. },
  497. reloadModuleViewsOnEachRequest: process.env.NODE_ENV === 'development',
  498. rateLimit: {
  499. autoCompile: {
  500. everyone: process.env.RATE_LIMIT_AUTO_COMPILE_EVERYONE || 100,
  501. standard: process.env.RATE_LIMIT_AUTO_COMPILE_STANDARD || 25,
  502. },
  503. },
  504. analytics: {
  505. enabled: false,
  506. },
  507. compileBodySizeLimitMb: process.env.COMPILE_BODY_SIZE_LIMIT_MB || 5,
  508. textExtensions: defaultTextExtensions.concat(
  509. parseTextExtensions(process.env.ADDITIONAL_TEXT_EXTENSIONS)
  510. ),
  511. validRootDocExtensions: ['tex', 'Rtex', 'ltx'],
  512. emailConfirmationDisabled:
  513. process.env.EMAIL_CONFIRMATION_DISABLED === 'true' || false,
  514. enabledServices: (process.env.ENABLED_SERVICES || 'web,api')
  515. .split(',')
  516. .map(s => s.trim()),
  517. // module options
  518. // ----------
  519. modules: {
  520. sanitize: {
  521. options: {
  522. allowedTags: [
  523. 'h1',
  524. 'h2',
  525. 'h3',
  526. 'h4',
  527. 'h5',
  528. 'h6',
  529. 'blockquote',
  530. 'p',
  531. 'a',
  532. 'ul',
  533. 'ol',
  534. 'nl',
  535. 'li',
  536. 'b',
  537. 'i',
  538. 'strong',
  539. 'em',
  540. 'strike',
  541. 'code',
  542. 'hr',
  543. 'br',
  544. 'div',
  545. 'table',
  546. 'thead',
  547. 'col',
  548. 'caption',
  549. 'tbody',
  550. 'tr',
  551. 'th',
  552. 'td',
  553. 'tfoot',
  554. 'pre',
  555. 'iframe',
  556. 'img',
  557. 'figure',
  558. 'figcaption',
  559. 'span',
  560. 'source',
  561. 'video',
  562. 'del',
  563. ],
  564. allowedAttributes: {
  565. a: [
  566. 'href',
  567. 'name',
  568. 'target',
  569. 'class',
  570. 'event-tracking',
  571. 'event-tracking-ga',
  572. 'event-tracking-label',
  573. 'event-tracking-trigger',
  574. ],
  575. div: ['class', 'id', 'style'],
  576. h1: ['class', 'id'],
  577. h2: ['class', 'id'],
  578. h3: ['class', 'id'],
  579. h4: ['class', 'id'],
  580. h5: ['class', 'id'],
  581. h6: ['class', 'id'],
  582. col: ['width'],
  583. figure: ['class', 'id', 'style'],
  584. figcaption: ['class', 'id', 'style'],
  585. i: ['aria-hidden', 'aria-label', 'class', 'id'],
  586. iframe: [
  587. 'allowfullscreen',
  588. 'frameborder',
  589. 'height',
  590. 'src',
  591. 'style',
  592. 'width',
  593. ],
  594. img: ['alt', 'class', 'src', 'style'],
  595. source: ['src', 'type'],
  596. span: ['class', 'id', 'style'],
  597. strong: ['style'],
  598. table: ['border', 'class', 'id', 'style'],
  599. td: ['colspan', 'rowspan', 'headers', 'style'],
  600. th: [
  601. 'abbr',
  602. 'headers',
  603. 'colspan',
  604. 'rowspan',
  605. 'scope',
  606. 'sorted',
  607. 'style',
  608. ],
  609. tr: ['class'],
  610. video: ['alt', 'class', 'controls', 'height', 'width'],
  611. },
  612. },
  613. },
  614. },
  615. overleafModuleImports: {
  616. // modules to import (an empty array for each set of modules)
  617. createFileModes: [],
  618. gitBridge: [],
  619. publishModal: [],
  620. tprLinkedFileInfo: [],
  621. tprLinkedFileRefreshError: [],
  622. },
  623. moduleImportSequence: ['launchpad', 'server-ce-scripts', 'user-activate'],
  624. csp: {
  625. percentage: parseFloat(process.env.CSP_PERCENTAGE) || 0,
  626. enabled: process.env.CSP_ENABLED === 'true',
  627. reportOnly: process.env.CSP_REPORT_ONLY === 'true',
  628. reportPercentage: parseFloat(process.env.CSP_REPORT_PERCENTAGE) || 0,
  629. reportUri: process.env.CSP_REPORT_URI,
  630. exclude: ['app/views/project/editor', 'app/views/project/list'],
  631. },
  632. unsupportedBrowsers: {
  633. ie: '<=11',
  634. },
  635. }
  636. module.exports.mergeWith = function (overrides) {
  637. return merge(overrides, module.exports)
  638. }