Email service handles errors in try/catch more reliably.

Epub reader seems stable and working.
This commit is contained in:
Joseph Milazzo 2025-07-06 09:56:04 -05:00
parent 0206f376bc
commit f27308190d
4 changed files with 30 additions and 12 deletions

View File

@ -430,6 +430,23 @@ public class BookService : IBookService
}
private static void InjectImages(HtmlDocument doc, EpubBookRef book, string apiBase)
{
var images = doc.DocumentNode.SelectNodes("//img")
?? doc.DocumentNode.SelectNodes("//image") ?? doc.DocumentNode.SelectNodes("//svg");
if (images == null) return;
var parent = images[0].ParentNode;
foreach (var image in images)
{
// TODO: How do I make images clickable with state?
//image.AddClass("kavita-scale-width");
}
}
/// <summary>
/// Returns the image key associated with the file. Contains some basic fallback logic.
/// </summary>
@ -1092,6 +1109,8 @@ public class BookService : IBookService
ScopeImages(doc, book, apiBase);
InjectImages(doc, book, apiBase);
// Inject PTOC Bookmark Icons
InjectPTOCBookmarks(doc, book, ptocBookmarks);

View File

@ -423,11 +423,7 @@ public class EmailService : IEmailService
smtpClient.Timeout = 20000;
var ssl = smtpConfig.EnableSsl ? SecureSocketOptions.Auto : SecureSocketOptions.None;
await smtpClient.ConnectAsync(smtpConfig.Host, smtpConfig.Port, ssl);
if (!string.IsNullOrEmpty(smtpConfig.UserName) && !string.IsNullOrEmpty(smtpConfig.Password))
{
await smtpClient.AuthenticateAsync(smtpConfig.UserName, smtpConfig.Password);
}
ServicePointManager.SecurityProtocol = SecurityProtocolType.SystemDefault;
@ -445,6 +441,12 @@ public class EmailService : IEmailService
try
{
await smtpClient.ConnectAsync(smtpConfig.Host, smtpConfig.Port, ssl);
if (!string.IsNullOrEmpty(smtpConfig.UserName) && !string.IsNullOrEmpty(smtpConfig.Password))
{
await smtpClient.AuthenticateAsync(smtpConfig.UserName, smtpConfig.Password);
}
await smtpClient.SendAsync(email);
if (user != null)
{

View File

@ -124,9 +124,7 @@
<div class="book-title col-2 d-none d-sm-block">
@if(isLoading) {
<div class="spinner-border spinner-border-sm text-primary" style="border-radius: 50%;" role="status">
<span class="visually-hidden">{{t('loading-book')}}</span>
</div>
<!--Just render a blank div here-->
} @else {
<span class="me-1">

View File

@ -182,10 +182,6 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
* The current page only contains an image. This is used to determine if we should show the image in the center of the screen.
*/
isSingleImagePage = false;
/**
* Belongs to drawer component
*/
//drawerOpen = false;
/**
* If the word/line overlay is open
*/
@ -1191,6 +1187,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
return of(null);
})).subscribe(res => {
this.nextChapterPrefetched = true;
this.cdRef.markForCheck();
});
}
} else if (this.pageNum() <= 10) {
@ -1202,6 +1199,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
return of(null);
})).subscribe(res => {
this.prevChapterPrefetched = true;
this.cdRef.markForCheck();
});
}
}
@ -1468,6 +1466,7 @@ export class BookReaderComponent implements OnInit, AfterViewInit, OnDestroy {
}
handleReaderSettingsUpdate(res: ReaderSettingUpdate) {
console.log('Handling ', res.setting, ' setting update to ', res.object);
switch (res.setting) {
case "pageStyle":
this.applyPageStyles(res.object as PageStyle);