charles-l / tabman

self-hosted tab sync for your browsers
MIT License
0 stars 0 forks source link

store browser history #4

Open charles-l opened 1 year ago

charles-l commented 1 year ago

Soooo there are going to be some pain points with the browser.history API.

First off, browser.history.search returns in reverse chronological order, so exporting history starting from a specific date is going to be hacky. You could of course iterate through backwards using the last date as the endTime for the query and set the startTime to something like 10-30 min before, with a maxResults of 1000 or something (nobody is going to hit 1000 pages in 30 min, right?). This might be slow, but it's doable.

The bigger problem is that browser.history.search doesn't return records with a timestamp. It just has a lastVisit time. It's possible to reconstruct the original results with browser.history.getVisits, but will be annoying.

I'll have to do some testing to determine the performance of this, but as long as the number of results is capped at some reasonable amount, I think it should be doable. I'll probably cap the initial history load, and add a limit when syncing hasn't happened in a while.