=> a50a01da45a8fb6a4d6ee419fc1ad240b1f0dee5
[1mdiff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c[m [1mindex 3fc7e841..40f34db4 100644[m [1m--- a/src/ui/documentwidget.c[m [1m+++ b/src/ui/documentwidget.c[m [36m@@ -41,6 +41,7 @@[m [mSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */[m #include "scrollwidget.h"[m #include "util.h"[m #include "visbuf.h"[m [32m+[m[32m#include "visited.h"[m [m #include[m #include [m [36m@@ -1051,6 +1052,7 @@[m [mstatic void checkResponse_DocumentWidget_(iDocumentWidget *d) {[m else if (equalCase_Rangecc(urlScheme_String(dstUrl),[m cstr_Rangecc(urlScheme_String(d->mod.url)))) {[m /* Redirects with the same scheme are automatic. */[m [32m+[m[32m visitUrl_Visited(visited_App(), d->mod.url, transient_VisitedUrlFlag);[m postCommandf_App([m "open redirect:%d url:%s", d->redirectCount + 1, cstr_String(dstUrl));[m }[m [1mdiff --git a/src/ui/window.c b/src/ui/window.c[m [1mindex a69dd7db..ba6ee869 100644[m [1m--- a/src/ui/window.c[m [1m+++ b/src/ui/window.c[m [36m@@ -254,7 +254,7 @@[m [mstatic iBool handleNavBarCommands_(iWidget *navBar, const char *cmd) {[m if (equal_Command(cmd, "document.changed")) {[m iInputWidget *url = findWidget_App("url");[m const iString *urlStr = collect_String(suffix_Command(cmd, "url"));[m [31m- visitUrl_Visited(visited_App(), urlStr);[m [32m+[m[32m visitUrl_Visited(visited_App(), urlStr, 0);[m postCommand_App("visited.changed"); /* sidebar will update */[m setText_InputWidget(url, urlStr);[m updateTextCStr_LabelWidget(reloadButton, reloadCStr_);[m [1mdiff --git a/src/visited.c b/src/visited.c[m [1mindex e9dc9b94..b339198e 100644[m [1m--- a/src/visited.c[m [1m+++ b/src/visited.c[m [36m@@ -34,6 +34,7 @@[m [mstatic const size_t maxAgeVisited_Visited_ = 3600 * 24 * 30; /* one month */[m void init_VisitedUrl(iVisitedUrl *d) {[m initCurrent_Time(&d->when);[m init_String(&d->url);[m [32m+[m[32m d->flags = 0;[m }[m [m void deinit_VisitedUrl(iVisitedUrl *d) {[m [36m@@ -81,13 +82,14 @@[m [mvoid save_Visited(const iVisited *d, const char *dirPath) {[m iDate date;[m init_Date(&date, &item->when);[m format_String(line,[m [31m- "%04d-%02d-%02dT%02d:%02d:%02d %s\n",[m [32m+[m[32m "%04d-%02d-%02dT%02d:%02d:%02d %04x %s\n",[m date.year,[m date.month,[m date.day,[m date.hour,[m date.minute,[m date.second,[m [32m+[m[32m item->flags,[m cstr_String(&item->url));[m writeData_File(f, cstr_String(line), size_String(line));[m }[m [36m@@ -106,11 +108,16 @@[m [mvoid load_Visited(iVisited *d, const char *dirPath) {[m iTime now;[m initCurrent_Time(&now);[m while (nextSplit_Rangecc(src, "\n", &line)) {[m [31m- if (isEmpty_Range(&line)) continue;[m [32m+[m[32m if (size_Range(&line) < 22) continue;[m int y, m, D, H, M, S;[m sscanf(line.start, "%04d-%02d-%02dT%02d:%02d:%02d ", &y, &m, &D, &H, &M, &S);[m if (!y) break;[m iVisitedUrl item;[m [32m+[m[32m const char *urlStart = line.start + 20;[m [32m+[m[32m if (*urlStart == '0' && size_Range(&line) >= 25) {[m [32m+[m[32m item.flags = strtoul(line.start + 20, NULL, 16);[m [32m+[m[32m urlStart += 5;[m [32m+[m[32m }[m init_VisitedUrl(&item);[m init_Time([m &item.when,[m [36m@@ -118,7 +125,7 @@[m [mvoid load_Visited(iVisited *d, const char *dirPath) {[m if (secondsSince_Time(&now, &item.when) > maxAgeVisited_Visited_) {[m continue; /* Too old. */[m }[m [31m- initRange_String(&item.url, (iRangecc){ line.start + 20, line.end });[m [32m+[m[32m initRange_String(&item.url, (iRangecc){ urlStart, line.end });[m insert_SortedArray(&d->visited, &item);[m }[m unlock_Mutex(d->mtx);[m [36m@@ -147,10 +154,11 @@[m [mstatic size_t find_Visited_(const iVisited *d, const iString *url) {[m return pos;[m }[m [m [31m-void visitUrl_Visited(iVisited *d, const iString *url) {[m [32m+[m[32mvoid visitUrl_Visited(iVisited *d, const iString *url, uint16_t visitFlags) {[m if (isEmpty_String(url)) return;[m iVisitedUrl visit;[m init_VisitedUrl(&visit);[m [32m+[m[32m visit.flags = visitFlags;[m set_String(&visit.url, url);[m size_t pos;[m lock_Mutex(d->mtx);[m [36m@@ -158,6 +166,7 @@[m [mvoid visitUrl_Visited(iVisited *d, const iString *url) {[m iVisitedUrl *old = at_SortedArray(&d->visited, pos);[m if (cmpNewer_VisitedUrl_(&visit, old)) {[m old->when = visit.when;[m [32m+[m[32m old->flags = visitFlags;[m unlock_Mutex(d->mtx);[m deinit_VisitedUrl(&visit);[m return;[m [36m@@ -200,7 +209,10 @@[m [mconst iArray *list_Visited(const iVisited *d, size_t count) {[m iPtrArray *urls = collectNew_PtrArray();[m iGuardMutex(d->mtx, {[m iConstForEach(Array, i, &d->visited.values) {[m [31m- pushBack_PtrArray(urls, i.value);[m [32m+[m[32m const iVisitedUrl *vis = i.value;[m [32m+[m[32m if (~vis->flags & transient_VisitedUrlFlag) {[m [32m+[m[32m pushBack_PtrArray(urls, vis);[m [32m+[m[32m }[m }[m });[m sort_Array(urls, cmpWhenDescending_VisitedUrlPtr_);[m [1mdiff --git a/src/visited.h b/src/visited.h[m [1mindex 5a34d008..d9eb02b6 100644[m [1m--- a/src/visited.h[m [1m+++ b/src/visited.h[m [36m@@ -32,8 +32,13 @@[m [miDeclareType(VisitedUrl)[m iDeclareTypeConstruction(VisitedUrl)[m [m struct Impl_VisitedUrl {[m [31m- iString url;[m [31m- iTime when;[m [32m+[m[32m iString url;[m [32m+[m[32m iTime when;[m [32m+[m[32m uint16_t flags;[m [32m+[m[32m};[m [32m+[m [32m+[m[32menum iVisitedUrlFlag {[m [32m+[m[32m transient_VisitedUrlFlag = 0x1, /* redirected; don't show in history */[m };[m [m iDeclareType(Visited)[m [36m@@ -44,7 +49,7 @@[m [mvoid load_Visited (iVisited *, const char *dirPath);[m void save_Visited (const iVisited *, const char *dirPath);[m [m iTime urlVisitTime_Visited (const iVisited *, const iString *url);[m [31m-void visitUrl_Visited (iVisited *, const iString *url); /* adds URL to the visited URLs set */[m [32m+[m[32mvoid visitUrl_Visited (iVisited *, const iString *url, uint16_t visitFlags); /* adds URL to the visited URLs set */[m void removeUrl_Visited (iVisited *, const iString *url);[m [m const iPtrArray * list_Visited (const iVisited *, size_t count); /* returns collected */[m
text/gemini; charset=utf-8
This content has been proxied by September (ba2dc).