diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-06 13:05:45 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-05-06 13:05:45 +0300 |
commit | f130d4eaf10a3ef92208bddcddbceec651fdbd6d (patch) | |
tree | 3cec719cccbff49fceafbd8cae2ac83822e78b6c | |
parent | ab70c91fcdb26b6ea0f851af7d975fa4c938dbe1 (diff) |
Gempub: Decode URLs, only load cover image
-rw-r--r-- | src/gempub.c | 6 | ||||
-rw-r--r-- | src/gempub.h | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 3 |
3 files changed, 8 insertions, 2 deletions
diff --git a/src/gempub.c b/src/gempub.c index 0f0345dc..aa03d835 100644 --- a/src/gempub.c +++ b/src/gempub.c | |||
@@ -206,13 +206,17 @@ void close_Gempub(iGempub *d) { | |||
206 | } | 206 | } |
207 | 207 | ||
208 | void setBaseUrl_Gempub(iGempub *d, const iString *url) { | 208 | void setBaseUrl_Gempub(iGempub *d, const iString *url) { |
209 | set_String(&d->baseUrl, url); | 209 | set_String(&d->baseUrl, collect_String(urlDecodeExclude_String(url, "/:"))); |
210 | } | 210 | } |
211 | 211 | ||
212 | iBool isOpen_Gempub(const iGempub *d) { | 212 | iBool isOpen_Gempub(const iGempub *d) { |
213 | return d->arch != NULL; | 213 | return d->arch != NULL; |
214 | } | 214 | } |
215 | 215 | ||
216 | const iString *coverPageUrl_Gempub(const iGempub *d) { | ||
217 | return &d->baseUrl; | ||
218 | } | ||
219 | |||
216 | const iString *indexPageUrl_Gempub(const iGempub *d) { | 220 | const iString *indexPageUrl_Gempub(const iGempub *d) { |
217 | iAssert(!isEmpty_String(&d->baseUrl)); | 221 | iAssert(!isEmpty_String(&d->baseUrl)); |
218 | iString *dir = collect_String(copy_String(&d->baseUrl)); | 222 | iString *dir = collect_String(copy_String(&d->baseUrl)); |
diff --git a/src/gempub.h b/src/gempub.h index fb3c510b..6912bcc9 100644 --- a/src/gempub.h +++ b/src/gempub.h | |||
@@ -57,6 +57,7 @@ iString * coverPageSource_Gempub (const iGempub *); | |||
57 | iBool preloadCoverImage_Gempub(const iGempub *, iGmDocument *doc); | 57 | iBool preloadCoverImage_Gempub(const iGempub *, iGmDocument *doc); |
58 | 58 | ||
59 | const iString * property_Gempub (const iGempub *, enum iGempubProperty); | 59 | const iString * property_Gempub (const iGempub *, enum iGempubProperty); |
60 | const iString * coverPageUrl_Gempub (const iGempub *); | ||
60 | const iString * indexPageUrl_Gempub (const iGempub *); | 61 | const iString * indexPageUrl_Gempub (const iGempub *); |
61 | const iString * navStartLinkUrl_Gempub (const iGempub *); /* for convenience */ | 62 | const iString * navStartLinkUrl_Gempub (const iGempub *); /* for convenience */ |
62 | 63 | ||
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index 5a5a4f84..5d449851 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1137,7 +1137,8 @@ static void postProcessRequestContent_DocumentWidget_(iDocumentWidget *d) { | |||
1137 | } | 1137 | } |
1138 | } | 1138 | } |
1139 | if (d->sourceGempub) { | 1139 | if (d->sourceGempub) { |
1140 | if (preloadCoverImage_Gempub(d->sourceGempub, d->doc)) { | 1140 | if (equal_String(d->mod.url, coverPageUrl_Gempub(d->sourceGempub)) && |
1141 | preloadCoverImage_Gempub(d->sourceGempub, d->doc)) { | ||
1141 | redoLayout_GmDocument(d->doc); | 1142 | redoLayout_GmDocument(d->doc); |
1142 | updateVisible_DocumentWidget_(d); | 1143 | updateVisible_DocumentWidget_(d); |
1143 | invalidate_DocumentWidget_(d); | 1144 | invalidate_DocumentWidget_(d); |