summaryrefslogtreecommitdiff
path: root/src/gmrequest.c
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2020-12-17 21:46:24 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2020-12-17 21:46:24 +0200
commit0081bb4511d8799fa46639877b57a6f2cbf38925 (patch)
treebde59d5b0ac103fc7bf97f2f72d955388322c64d /src/gmrequest.c
parent34e397e76a0903675b223f638989703009ac5646 (diff)
Listing bookmarks by tag and creation time
Diffstat (limited to 'src/gmrequest.c')
-rw-r--r--src/gmrequest.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gmrequest.c b/src/gmrequest.c
index 97634bd4..3eb57cec 100644
--- a/src/gmrequest.c
+++ b/src/gmrequest.c
@@ -279,7 +279,7 @@ static void requestFinished_GmRequest_(iGmRequest *d, iTlsRequest *req) {
279 iNotifyAudience(d, finished, GmRequestFinished); 279 iNotifyAudience(d, finished, GmRequestFinished);
280} 280}
281 281
282static const iBlock *aboutPageSource_(iRangecc path) { 282static const iBlock *aboutPageSource_(iRangecc path, iRangecc query) {
283 const iBlock *src = NULL; 283 const iBlock *src = NULL;
284 if (equalCase_Rangecc(path, "lagrange")) { 284 if (equalCase_Rangecc(path, "lagrange")) {
285 return &blobLagrange_Embedded; 285 return &blobLagrange_Embedded;
@@ -300,7 +300,11 @@ static const iBlock *aboutPageSource_(iRangecc path) {
300 return utf8_String(entryListPage_Feeds()); 300 return utf8_String(entryListPage_Feeds());
301 } 301 }
302 if (equalCase_Rangecc(path, "bookmarks")) { 302 if (equalCase_Rangecc(path, "bookmarks")) {
303 return utf8_String(bookmarkListPage_Bookmarks(bookmarks_App())); 303 return utf8_String(bookmarkListPage_Bookmarks(
304 bookmarks_App(),
305 equal_Rangecc(query, "?tags") ? listByTag_BookmarkListType
306 : equal_Rangecc(query, "?created") ? listByCreationTime_BookmarkListType
307 : listByFolder_BookmarkListType));
304 } 308 }
305 if (equalCase_Rangecc(path, "blank")) { 309 if (equalCase_Rangecc(path, "blank")) {
306 return utf8_String(collectNewCStr_String("\n")); 310 return utf8_String(collectNewCStr_String("\n"));
@@ -520,7 +524,7 @@ void submit_GmRequest(iGmRequest *d) {
520 const iString *host = collect_String(newRange_String(url.host)); 524 const iString *host = collect_String(newRange_String(url.host));
521 uint16_t port = toInt_String(collect_String(newRange_String(url.port))); 525 uint16_t port = toInt_String(collect_String(newRange_String(url.port)));
522 if (equalCase_Rangecc(url.scheme, "about")) { 526 if (equalCase_Rangecc(url.scheme, "about")) {
523 const iBlock *src = aboutPageSource_(url.path); 527 const iBlock *src = aboutPageSource_(url.path, url.query);
524 if (src) { 528 if (src) {
525 resp->statusCode = success_GmStatusCode; 529 resp->statusCode = success_GmStatusCode;
526 setCStr_String(&resp->meta, "text/gemini; charset=utf-8"); 530 setCStr_String(&resp->meta, "text/gemini; charset=utf-8");