mirror of
https://github.com/fergalmoran/Readarr.git
synced 2026-02-08 17:06:38 +00:00
New: Warn if user tries to connect to a calibre-web server
This commit is contained in:
@@ -103,14 +103,28 @@ function EditRootFolderModalContent(props) {
|
||||
</FormGroup>
|
||||
|
||||
<FormGroup>
|
||||
<FormLabel>Use Calibre</FormLabel>
|
||||
<FormLabel>
|
||||
Use Calibre
|
||||
<Popover
|
||||
anchor={
|
||||
<Icon
|
||||
className={styles.labelIcon}
|
||||
name={icons.INFO}
|
||||
/>
|
||||
}
|
||||
title="Calibre content server"
|
||||
body={'Using a Calibre content server allows Readarr to add books to your Calibre library and trigger conversions between formats'}
|
||||
position={tooltipPositions.RIGHT}
|
||||
/>
|
||||
</FormLabel>
|
||||
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="isCalibreLibrary"
|
||||
helpText="Use calibre content server to manipulate library"
|
||||
helpText="Use Calibre content server to manipulate library"
|
||||
{...isCalibreLibrary}
|
||||
onChange={onInputChange}
|
||||
helpLink={'https://manual.calibre-ebook.com/server.html'}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
@@ -150,7 +164,7 @@ function EditRootFolderModalContent(props) {
|
||||
<FormInputGroup
|
||||
type={inputTypes.TEXT}
|
||||
name="urlBase"
|
||||
helpText="Adds a prefix to the calibre url, e.g. http://[host]:[port]/[urlBase]"
|
||||
helpText="Adds a prefix to the Calibre url, e.g. http://[host]:[port]/[urlBase]"
|
||||
{...urlBase}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
@@ -211,7 +225,7 @@ function EditRootFolderModalContent(props) {
|
||||
<FormInputGroup
|
||||
type={inputTypes.TEXT}
|
||||
name="outputFormat"
|
||||
helpText="Optionally ask calibre to convert to other formats on import. Comma separated list."
|
||||
helpText="Optionally ask Calibre to convert to other formats on import. Comma separated list."
|
||||
{...outputFormat}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
@@ -228,7 +242,7 @@ function EditRootFolderModalContent(props) {
|
||||
/>
|
||||
}
|
||||
title="Calibre output profile"
|
||||
body={'Specify the output profile. The output profile tells the calibre conversion system how to optimize the created document for the specified device (such as by resizing images for the device screen size). In some cases, an output profile can be used to optimize the output for a particular device, but this is rarely necessary.'}
|
||||
body={'Specify the output profile. The output profile tells the Calibre conversion system how to optimize the created document for the specified device (such as by resizing images for the device screen size). In some cases, an output profile can be used to optimize the output for a particular device, but this is rarely necessary.'}
|
||||
position={tooltipPositions.RIGHT}
|
||||
/>
|
||||
</FormLabel>
|
||||
@@ -249,7 +263,7 @@ function EditRootFolderModalContent(props) {
|
||||
<FormInputGroup
|
||||
type={inputTypes.CHECK}
|
||||
name="useSsl"
|
||||
helpText="Use SSL to connect to calibre content server"
|
||||
helpText="Use SSL to connect to Calibre content server"
|
||||
{...useSsl}
|
||||
onChange={onInputChange}
|
||||
/>
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
throw new CalibreException("Unable to add file to calibre library: {0}", ex, ex.Message);
|
||||
throw new CalibreException("Unable to add file to Calibre library: {0}", ex, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,7 +220,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
throw new CalibreException("Unable to add file to calibre library: {0}", ex, ex.Message);
|
||||
throw new CalibreException("Unable to add file to Calibre library: {0}", ex, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
throw new CalibreException("Unable to start calibre conversion: {0}", ex, ex.Message);
|
||||
throw new CalibreException("Unable to start Calibre conversion: {0}", ex, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -264,7 +264,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
throw new CalibreException("Unable to connect to calibre library: {0}", ex, ex.Message);
|
||||
throw new CalibreException("Unable to connect to Calibre library: {0}", ex, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
throw new CalibreException("Unable to connect to calibre library: {0}", ex, ex.Message);
|
||||
throw new CalibreException("Unable to connect to Calibre library: {0}", ex, ex.Message);
|
||||
}
|
||||
|
||||
offset += PAGE_SIZE;
|
||||
@@ -349,7 +349,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (HttpException ex)
|
||||
{
|
||||
throw new CalibreException("Unable to connect to calibre library: {0}", ex, ex.Message);
|
||||
throw new CalibreException("Unable to connect to Calibre library: {0}", ex, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -421,6 +421,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
var builder = GetBuilder("", settings);
|
||||
builder.Accept(HttpAccept.Html);
|
||||
builder.SuppressHttpError = true;
|
||||
builder.AllowAutoRedirect = true;
|
||||
|
||||
var request = builder.Build();
|
||||
request.LogResponseContent = false;
|
||||
@@ -432,7 +433,7 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
}
|
||||
catch (WebException ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to connect to calibre");
|
||||
_logger.Error(ex, "Unable to connect to Calibre");
|
||||
if (ex.Status == WebExceptionStatus.ConnectFailure)
|
||||
{
|
||||
return new NzbDroneValidationFailure("Host", "Unable to connect")
|
||||
@@ -451,12 +452,17 @@ namespace NzbDrone.Core.Books.Calibre
|
||||
|
||||
if (response.Content.Contains(@"guac-login"))
|
||||
{
|
||||
return new ValidationFailure("Port", "Bad port. This is the container's remote calibre GUI, not the calibre content server. Try mapping port 8081.");
|
||||
return new ValidationFailure("Port", "Bad port. This is the container's remote Calibre GUI, not the Calibre content server. Try mapping port 8081.");
|
||||
}
|
||||
|
||||
if (response.Content.Contains("Calibre-Web"))
|
||||
{
|
||||
return new ValidationFailure("Port", "This is a Calibre-Web server, not the required Calibre content server. See https://manual.calibre-ebook.com/server.html");
|
||||
}
|
||||
|
||||
if (!response.Content.Contains(@"<title>calibre</title>"))
|
||||
{
|
||||
return new ValidationFailure("Port", "Not a valid calibre content server");
|
||||
return new ValidationFailure("Port", "Not a valid Calibre content server. See https://manual.calibre-ebook.com/server.html");
|
||||
}
|
||||
|
||||
CalibreLibraryInfo libraryInfo;
|
||||
|
||||
Reference in New Issue
Block a user