summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-03-09 08:38:01 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-03-09 08:38:33 +0200
commit3b45540312489043c2a0654aea488e3cf1c17728 (patch)
tree8f4b82b1ae713f10fdb6c12f39b0b95c397b17c2 /src
parentd17dba488c5e1218ddff2d7a7d138a28ce25f1e2 (diff)
App: Initial bookmarks
Don't automatically make "Getting Started" a remote bookmark source. 1) Rather not DDOS my server. Remote sources are not cached currently. 2) While it's a nice demo of the feature, it's not essential. 3) Avoid appearance of a "call home" default that one needs to opt out of.
Diffstat (limited to 'src')
-rw-r--r--src/app.c2
-rw-r--r--src/bookmarks.c10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/app.c b/src/app.c
index 53799ce8..9f5eef09 100644
--- a/src/app.c
+++ b/src/app.c
@@ -632,7 +632,7 @@ static void init_App_(iApp *d, int argc, char **argv) {
632 add_Bookmarks(d->bookmarks, 632 add_Bookmarks(d->bookmarks,
633 collectNewCStr_String("gemini://skyjake.fi/lagrange/getting_started.gmi"), 633 collectNewCStr_String("gemini://skyjake.fi/lagrange/getting_started.gmi"),
634 collectNewCStr_String("Getting Started"), 634 collectNewCStr_String("Getting Started"),
635 collectNewCStr_String("remotesource"), 635 NULL,
636 0x1f306); 636 0x1f306);
637 } 637 }
638 init_Feeds(dataDir_App_()); 638 init_Feeds(dataDir_App_());
diff --git a/src/bookmarks.c b/src/bookmarks.c
index cf29fc69..026b80d6 100644
--- a/src/bookmarks.c
+++ b/src/bookmarks.c
@@ -197,13 +197,15 @@ void save_Bookmarks(const iBookmarks *d, const char *dirPath) {
197 unlock_Mutex(d->mtx); 197 unlock_Mutex(d->mtx);
198} 198}
199 199
200uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title, 200uint32_t add_Bookmarks(iBookmarks *d, const iString *url, const iString *title, const iString *tags,
201 const iString *tags, iChar icon) { 201 iChar icon) {
202 lock_Mutex(d->mtx); 202 lock_Mutex(d->mtx);
203 iBookmark *bm = new_Bookmark(); 203 iBookmark *bm = new_Bookmark();
204 set_String(&bm->url, url); 204 set_String(&bm->url, url);
205 set_String(&bm->title, title); 205 set_String(&bm->title, title);
206 if (tags) set_String(&bm->tags, tags); 206 if (tags) {
207 set_String(&bm->tags, tags);
208 }
207 bm->icon = icon; 209 bm->icon = icon;
208 initCurrent_Time(&bm->when); 210 initCurrent_Time(&bm->when);
209 insert_Bookmarks_(d, bm); 211 insert_Bookmarks_(d, bm);
@@ -441,7 +443,7 @@ void requestFinished_Bookmarks(iBookmarks *d, iGmRequest *req) {
441 iRangecc line = srcLine; 443 iRangecc line = srcLine;
442 trimEnd_Rangecc(&line); 444 trimEnd_Rangecc(&line);
443 iRegExpMatch m; 445 iRegExpMatch m;
444 init_RegExpMatch(&m); 446 init_RegExpMatch(&m);
445 if (matchRange_RegExp(linkPattern, line, &m)) { 447 if (matchRange_RegExp(linkPattern, line, &m)) {
446 const iRangecc url = capturedRange_RegExpMatch(&m, 1); 448 const iRangecc url = capturedRange_RegExpMatch(&m, 1);
447 const iRangecc title = capturedRange_RegExpMatch(&m, 3); 449 const iRangecc title = capturedRange_RegExpMatch(&m, 3);