added option to disable ssl verification for LanguageTool

this patch relies on core change
https://gerrit.libreoffice.org/c/core/+/136811

Signed-off-by: Mert Tumer <mert.tumer@collabora.com>
Change-Id: Id9fa7273631f93914afa870e2c1148a9aa01c2e7
pull/4984/head
Mert Tumer 2022-07-04 20:35:07 +03:00 committed by Andras Timar
parent 3667fbc2d8
commit e834d65c73
2 changed files with 6 additions and 2 deletions

View File

@ -15,10 +15,11 @@
However, your data in the document e.g. the text part of it will be sent to the cloud API. Please read the privacy policy: https://languagetool.org/legal/privacy
-->
<languagetool desc="LanguageTool Remote API settings for grammar checking">
<enabled desc="Enable LanguageTool Remote Grammar Checker" type="bool" default="false">false</enabled>
<enabled desc="Enable LanguageTool Remote Grammar Checker" type="bool" default="false"></enabled>
<base_url desc="Http endpoint for the LanguageTool API server, without /check or /languages postfix at the end." type="string" default=""></base_url>
<user_name desc="LangueTool account username for premium usage." type="string" default=""></user_name>
<api_key desc="Api key provided by LanguageTool account for premium usage." type="string" default=""></api_key>
<ssl_verification desc="Enable or disable SSL verification" type="string" default="true"></ssl_verification>
</languagetool>
<sys_template_path desc="Path to a template tree with shared libraries etc to be used as source for chroot jails for child processes." type="path" relative="true" default="systemplate"></sys_template_path>

View File

@ -1865,7 +1865,8 @@ void COOLWSD::innerInitialize(Application& self)
{ "languagetool.base_url", ""},
{ "languagetool.api_key", ""},
{ "languagetool.user_name", ""},
{ "languagetool.enabled", "false"}
{ "languagetool.enabled", "false"},
{ "languagetool.ssl_verification", "true"},
};
// Set default values, in case they are missing from the config file.
@ -2267,6 +2268,8 @@ void COOLWSD::innerInitialize(Application& self)
setenv("LANGUAGETOOL_USERNAME", userName.c_str(), 1);
const std::string apiKey = getConfigValue<std::string>(conf, "languagetool.api_key", "");
setenv("LANGUAGETOOL_APIKEY", apiKey.c_str(), 1);
bool sslVerification = getConfigValue<bool>(conf, "languagetool.ssl_verification", "");
setenv("LANGUAGETOOL_SSL_VERIFICATION", sslVerification ? "true" : "false", 1);
#if ENABLE_SUPPORT_KEY
const std::string supportKeyString = getConfigValue<std::string>(conf, "support_key", "");