settings.defaults.js 20 KB

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