mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
[SpellingAPIManager] get the list of ignored misspellings from settings
The settings will allow overrides via the environment variable `IGNORED_MISSPELLINGS`.
This commit is contained in:
parent
e1212db196
commit
033af5091f
3 changed files with 7 additions and 1 deletions
|
@ -10,12 +10,13 @@ const ASpell = require('./ASpell')
|
||||||
const LearnedWordsManager = require('./LearnedWordsManager')
|
const LearnedWordsManager = require('./LearnedWordsManager')
|
||||||
const { callbackify } = require('util')
|
const { callbackify } = require('util')
|
||||||
const OError = require('@overleaf/o-error')
|
const OError = require('@overleaf/o-error')
|
||||||
|
const Settings = require('settings-sharelatex')
|
||||||
|
|
||||||
// The max number of words checked in a single request
|
// The max number of words checked in a single request
|
||||||
const REQUEST_LIMIT = 10000
|
const REQUEST_LIMIT = 10000
|
||||||
|
|
||||||
const SpellingAPIManager = {
|
const SpellingAPIManager = {
|
||||||
whitelist: ['ShareLaTeX', 'sharelatex', 'LaTeX', 'http', 'https', 'www'],
|
whitelist: Settings.ignoredMisspellings,
|
||||||
|
|
||||||
learnWord(token, request, callback) {
|
learnWord(token, request, callback) {
|
||||||
if (callback == null) {
|
if (callback == null) {
|
||||||
|
|
|
@ -22,6 +22,10 @@ module.exports = {
|
||||||
|
|
||||||
healthCheckUserId: '53c64d2fd68c8d000010bb5f',
|
healthCheckUserId: '53c64d2fd68c8d000010bb5f',
|
||||||
|
|
||||||
|
ignoredMisspellings: process.env.IGNORED_MISSPELLINGS
|
||||||
|
? process.env.IGNORED_MISSPELLINGS.split(',')
|
||||||
|
: ['ShareLaTeX', 'sharelatex', 'LaTeX', 'http', 'https', 'www'],
|
||||||
|
|
||||||
sentry: {
|
sentry: {
|
||||||
dsn: process.env.SENTRY_DSN
|
dsn: process.env.SENTRY_DSN
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ describe('SpellingAPIManager', function () {
|
||||||
this.SpellingAPIManager = SandboxedModule.require(modulePath, {
|
this.SpellingAPIManager = SandboxedModule.require(modulePath, {
|
||||||
requires: {
|
requires: {
|
||||||
'./ASpell': this.ASpell,
|
'./ASpell': this.ASpell,
|
||||||
|
'settings-sharelatex': { ignoredMisspellings: ['ShareLaTeX'] },
|
||||||
'./LearnedWordsManager': this.LearnedWordsManager
|
'./LearnedWordsManager': this.LearnedWordsManager
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue