settings.defaults.js 20 KB

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