joelshepherd / tabliss

A beautiful, customisable New Tab page for Firefox, Chrome, and Edge.
https://tabliss.io
GNU General Public License v3.0
2.23k stars 294 forks source link

[Question] How does Tabliss store user settings? #496

Closed Kruziikrel13 closed 10 months ago

Kruziikrel13 commented 2 years ago

How does tabliss store it's user settings? I am looking through the code but its going a bit over my head with where or how tabliss is storing user settings (i.e. the user's name, city and weather info, what widgets they have active on the screen etc.) Is it being stored through JSONS? If so where are the jsons then stored? Are they written to a file locally on the users computer? How do settings carry across when I log in and import my firefox settings?

ghost commented 2 years ago

I'm not a developer on this project but I took a quick look in the code.

Let's look at the method called handleImport in the file src\views\settings\Settings.tsx (we can find this location by looking for where the export function is as we can assume the import function is nearby - to do this we look for the string tabliss.json in the whole project using an IDE like Visual Studio Code; the reason we look for that filename is because that is what the extension spits out when clicking on export), it parses the input JSON to a variable called state and passes it through to the method importState(state);

Let's head over to where this function is then. It's located in src\db\action.ts (this directory contains a clue as to where your data is stored internally). There are some calls to DB.put which stores your information in a local database in the browser.

If we head over to src\db\state.ts (we get here by finding where the variable db is delcared - control + click in VS Code), we can see what storage methods are being used. If the app is being built for the web(/chrome I assume) then we will use the indexedDB storage method, but it it's being built for Firefox then we are saving to the extension db service with a syncable flag (not sure how it works further than this since I'm not familiar with Firefox extensions, but i assume Firefox provides an internal separate extension storage system).

Hopefully this makes sense, and it's quite a surface level investigation, but maybe this will give you some fuel to launch your own investigation.

Live step-by-step of my investigation: https://user-images.githubusercontent.com/20884861/175783040-7ec35855-f3df-4290-9bc0-1d6be4d44a88.mp4

sonofevil commented 1 year ago

It's stored in storage-sync-v2.sqlite-wal in my profile's root directory.

I simply added an unusual word to my Tabliss greeting and then did a file search in my profile folder for files containing the word.

The settings string has the form extension@tabliss.io{...}