From f797d135d56d7f250f0e612543ed3c0aed4795d5 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Sun, 24 Nov 2024 02:05:16 +0600 Subject: [PATCH 01/16] add: zen browser --- SettingsTemplate.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SettingsTemplate.yaml b/SettingsTemplate.yaml index fffdb39..479bd87 100644 --- a/SettingsTemplate.yaml +++ b/SettingsTemplate.yaml @@ -11,4 +11,5 @@ body: - Brave - Opera - Vivaldi - - Arc \ No newline at end of file + - Arc + - Zen \ No newline at end of file From 7dd667308b0d1ffba514f4356c06491d85019067 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Sun, 24 Nov 2024 02:05:42 +0600 Subject: [PATCH 02/16] add: zen browser --- plugin/browsers.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugin/browsers.py b/plugin/browsers.py index 64d71fb..a660c54 100644 --- a/plugin/browsers.py +++ b/plugin/browsers.py @@ -17,6 +17,7 @@ OPERA_DIR = Path(ROAMING, 'Opera Software', 'Opera Stable', 'Default', 'History') VIVALDI_DIR = Path(LOCAL_DATA, 'Vivaldi', 'User Data', 'Default', 'History') ARC_DIR = Path(LOCAL_DATA, 'Packages', 'TheBrowserCompany.Arc_ttt1ap7aakyb4', 'LocalCache', 'Local', 'Arc', 'User Data', 'Default', 'History') +ZEN_DIR = Path(ROAMING, 'zen', 'Profiles') def get(browser_name): if browser_name == 'chrome': @@ -33,6 +34,8 @@ def get(browser_name): return Vivaldi() elif browser_name == 'arc': return Arc() + elif browser_name == 'zen': + return Zen() else: raise ValueError('Invalid browser name') @@ -174,6 +177,23 @@ def history(self, limit=10): """ recents = self.query_history(self.database_path, 'SELECT url, title, last_visit_time FROM urls ORDER BY last_visit_time DESC', limit) return self.get_history_items(recents) + +class Zen(Base): + """Zen Browser History""" + + def __init__(self, database_path=ZEN_DIR): + # Zen database is not in a static location, so we need to find it + self.database_path = self.find_database(database_path) + + def find_database(self, path): + """Find database in path""" + release_folder = Path(path).glob('*.Default (alpha)').__next__() + return Path(path, release_folder, 'places.sqlite') + + def history(self, limit=10): + """Most recent Zen history""" + recents = self.query_history(self.database_path, 'SELECT url, title, visit_date FROM moz_places INNER JOIN moz_historyvisits on moz_historyvisits.place_id = moz_places.id ORDER BY visit_date DESC', limit) + return self.get_history_items(recents) class HistoryItem(object): """Representation of a history item""" @@ -202,3 +222,5 @@ def timestamp(self): return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') elif isinstance(self.browser, (Vivaldi)): return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') + elif isinstance(self.browser, (Zen)): + return datetime.fromtimestamp(self.last_visit_time / 1000000.0) \ No newline at end of file From f1cd75f98375e5ca8d49588f0ccbeb9d3b842798 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Sun, 24 Nov 2024 07:03:46 +0600 Subject: [PATCH 03/16] version bump to 0.8.0 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index 16e9fb4..5bd809a 100644 --- a/plugin.json +++ b/plugin.json @@ -4,7 +4,7 @@ "Name": "Browser History", "Description": "Search your Web Browser history", "Author": "Garulf", - "Version": "0.6.0", + "Version": "0.8.0", "Language": "python", "Website": "https://github.com/Garulf/browser-history", "IcoPath": "./icon.png", From fc4a76fee3ef91d11a2c5513a2f489ed0415bb84 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Sun, 24 Nov 2024 07:05:05 +0600 Subject: [PATCH 04/16] add pyperclip for copy --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 151f5b3..07a519c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ flox-lib==0.10.4 +pyperclip==1.9.0 From 5ef15d2bb7da2441018827badc31effebb39b27c Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Sun, 24 Nov 2024 07:06:10 +0600 Subject: [PATCH 05/16] add link copy support --- plugin/main.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/plugin/main.py b/plugin/main.py index 5450565..cde7a4f 100644 --- a/plugin/main.py +++ b/plugin/main.py @@ -1,5 +1,6 @@ -from flox import Flox, ICON_HISTORY, ICON_BROWSER +from flox import Flox, ICON_HISTORY, ICON_BROWSER, ICON_FILE +import pyperclip import browsers HISTORY_GLYPH = '' @@ -53,6 +54,18 @@ def context_menu(self, data): parameters=[data[1]], ) + self.add_item( + title='Copy to clipboard', + subtitle=data[1], + icon=ICON_FILE, + method=self.copy_to_clipboard, + parameters=[data[1]], + + ) + + def copy_to_clipboard(self, data): + pyperclip.copy(data) + self.show_msg("Copied!", f"{data}") if __name__ == "__main__": BrowserHistory() From 0ffa81915d8d34dfa100ffcbe8dc71b8463f4ab3 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 06:48:04 +0600 Subject: [PATCH 06/16] Floorp added --- SettingsTemplate.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SettingsTemplate.yaml b/SettingsTemplate.yaml index 479bd87..ff8b818 100644 --- a/SettingsTemplate.yaml +++ b/SettingsTemplate.yaml @@ -12,4 +12,5 @@ body: - Opera - Vivaldi - Arc - - Zen \ No newline at end of file + - Zen + - Floorp \ No newline at end of file From 8c8b440f5c05900ddd315801d7e00e9a847c8492 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 06:51:18 +0600 Subject: [PATCH 07/16] Floorp added --- plugin/browsers.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/plugin/browsers.py b/plugin/browsers.py index a660c54..61e492a 100644 --- a/plugin/browsers.py +++ b/plugin/browsers.py @@ -18,6 +18,7 @@ VIVALDI_DIR = Path(LOCAL_DATA, 'Vivaldi', 'User Data', 'Default', 'History') ARC_DIR = Path(LOCAL_DATA, 'Packages', 'TheBrowserCompany.Arc_ttt1ap7aakyb4', 'LocalCache', 'Local', 'Arc', 'User Data', 'Default', 'History') ZEN_DIR = Path(ROAMING, 'zen', 'Profiles') +Floorp_DIR = Path(ROAMING, 'Floorp', 'Profiles') def get(browser_name): if browser_name == 'chrome': @@ -36,6 +37,8 @@ def get(browser_name): return Arc() elif browser_name == 'zen': return Zen() + elif browser_name == 'floorp': + return Floorp() else: raise ValueError('Invalid browser name') @@ -195,6 +198,23 @@ def history(self, limit=10): recents = self.query_history(self.database_path, 'SELECT url, title, visit_date FROM moz_places INNER JOIN moz_historyvisits on moz_historyvisits.place_id = moz_places.id ORDER BY visit_date DESC', limit) return self.get_history_items(recents) +class Floorp(Base): + """Floorp Browser History""" + + def __init__(self, database_path=Floorp_DIR): + # Floorp database is not in a static location, so we need to find it + self.database_path = self.find_database(database_path) + + def find_database(self, path): + """Find database in path""" + release_folder = Path(path).glob('*.default-release').__next__() + return Path(path, release_folder, 'places.sqlite') + + def history(self, limit=10): + """Most recent Firefox history""" + recents = self.query_history(self.database_path, 'SELECT url, title, visit_date FROM moz_places INNER JOIN moz_historyvisits on moz_historyvisits.place_id = moz_places.id ORDER BY visit_date DESC', limit) + return self.get_history_items(recents) + class HistoryItem(object): """Representation of a history item""" @@ -223,4 +243,6 @@ def timestamp(self): elif isinstance(self.browser, (Vivaldi)): return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') elif isinstance(self.browser, (Zen)): + return datetime.fromtimestamp(self.last_visit_time / 1000000.0) + elif isinstance(self.browser, (Firefox)): return datetime.fromtimestamp(self.last_visit_time / 1000000.0) \ No newline at end of file From 868f4370df6c272301f0de5e47bfb036ce10f08a Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 06:56:10 +0600 Subject: [PATCH 08/16] version bump to 0.8.1 --- plugin.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin.json b/plugin.json index 5bd809a..3006b03 100644 --- a/plugin.json +++ b/plugin.json @@ -4,7 +4,7 @@ "Name": "Browser History", "Description": "Search your Web Browser history", "Author": "Garulf", - "Version": "0.8.0", + "Version": "0.8.1", "Language": "python", "Website": "https://github.com/Garulf/browser-history", "IcoPath": "./icon.png", From 958c922aca41db64f92fcd56e924f888b9c9c52e Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 07:04:48 +0600 Subject: [PATCH 09/16] checkout, setup-python, cache, upload-artifact version bump to v5 --- .github/workflows/pr-packager.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pr-packager.yml b/.github/workflows/pr-packager.yml index 921a2c2..499daf1 100644 --- a/.github/workflows/pr-packager.yml +++ b/.github/workflows/pr-packager.yml @@ -10,12 +10,12 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v5 - name: Set up Python ${{ env.PYTHON_VER }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VER }} - - uses: actions/cache@v2 + - uses: actions/cache@v5 with: path: ~\AppData\Local\pip\Cache key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -27,7 +27,7 @@ jobs: pip install wheel pip install -r ./requirements.txt -t ./lib - name: Upload - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v5 with: name: artifact path: | From 786cf3e810cec4dca6499e2a92a5ec2c31b60076 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 07:07:32 +0600 Subject: [PATCH 10/16] checkout, setup-python, cache version bump to v5 --- .github/workflows/release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9904519..8785a6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,14 +18,14 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v5 with: fetch-depth: 0 - name: Set up Python ${{ env.PYTHON_VER }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VER }} - - uses: actions/cache@v2 + - uses: actions/cache@v5 if: startsWith(runner.os, 'Windows') with: path: ~\AppData\Local\pip\Cache From 500800c85e397f99780f150fe3657e106c5201bb Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 07:11:32 +0600 Subject: [PATCH 11/16] checkout, setup-python, cache version bump to v5 --- .github/workflows/test-plugin.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index ec00b73..bcf6fb1 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -22,7 +22,7 @@ jobs: python_ver: ['3.8'] steps: - name: Checkout Plugin Repo - uses: actions/checkout@v2 + uses: actions/checkout@v5 with: path: ${{github.event.repository.name}} - name: Get Plugin's version @@ -66,7 +66,7 @@ jobs: echo "FILE_NAME=$file_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append echo "TAG_NAME=$tag_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - name: Flow Launcher Cache - uses: actions/cache@v2 + uses: actions/cache@v5 id: flow_cache with: path: | @@ -95,10 +95,10 @@ jobs: New-Item -ItemType SymbolicLink -Path $plugin_path -Target $repo_path echo "PLUGIN_PATH=$plugin_path" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_ver }} - - uses: actions/cache@v2 + - uses: actions/cache@v5 with: path: ~\AppData\Local\pip\Cache key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} From b02ac1856a3edb71e9441d51a563ffb66fbc702b Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 07:17:35 +0600 Subject: [PATCH 12/16] downgrade actions/checkout, actions/cache, and actions/setup-python to v4 --- .github/workflows/test-plugin.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-plugin.yml b/.github/workflows/test-plugin.yml index bcf6fb1..38ceccd 100644 --- a/.github/workflows/test-plugin.yml +++ b/.github/workflows/test-plugin.yml @@ -22,7 +22,7 @@ jobs: python_ver: ['3.8'] steps: - name: Checkout Plugin Repo - uses: actions/checkout@v5 + uses: actions/checkout@v4 with: path: ${{github.event.repository.name}} - name: Get Plugin's version @@ -66,7 +66,7 @@ jobs: echo "FILE_NAME=$file_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append echo "TAG_NAME=$tag_name" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append - name: Flow Launcher Cache - uses: actions/cache@v5 + uses: actions/cache@v4 id: flow_cache with: path: | @@ -98,7 +98,7 @@ jobs: uses: actions/setup-python@v5 with: python-version: ${{ matrix.python_ver }} - - uses: actions/cache@v5 + - uses: actions/cache@v4 with: path: ~\AppData\Local\pip\Cache key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} From f7b8abd491cc04286d33e93cff21375d4fc4be31 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 07:18:14 +0600 Subject: [PATCH 13/16] downgrade actions/checkout and actions/cache to v4 --- .github/workflows/release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8785a6f..1bb01a1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,14 +18,14 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python ${{ env.PYTHON_VER }} uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VER }} - - uses: actions/cache@v5 + - uses: actions/cache@v4 if: startsWith(runner.os, 'Windows') with: path: ~\AppData\Local\pip\Cache From 3c6a2b772ce66809e8d973e0731a2fb181f096dc Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Thu, 6 Feb 2025 07:18:54 +0600 Subject: [PATCH 14/16] downgrade actions/checkout, actions/cache, and actions/upload-artifact to v4 --- .github/workflows/pr-packager.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-packager.yml b/.github/workflows/pr-packager.yml index 499daf1..d968a10 100644 --- a/.github/workflows/pr-packager.yml +++ b/.github/workflows/pr-packager.yml @@ -10,12 +10,12 @@ jobs: runs-on: windows-latest steps: - name: Checkout - uses: actions/checkout@v5 + uses: actions/checkout@v4 - name: Set up Python ${{ env.PYTHON_VER }} uses: actions/setup-python@v5 with: python-version: ${{ env.PYTHON_VER }} - - uses: actions/cache@v5 + - uses: actions/cache@v4 with: path: ~\AppData\Local\pip\Cache key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -27,7 +27,7 @@ jobs: pip install wheel pip install -r ./requirements.txt -t ./lib - name: Upload - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v4 with: name: artifact path: | From 3bc1d9fc62e74f53c2e431280cecfd00d42c18b2 Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Tue, 25 Mar 2025 15:13:41 +0600 Subject: [PATCH 15/16] Add Brave Nightly to supported browsers in SettingsTemplate.yaml --- SettingsTemplate.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/SettingsTemplate.yaml b/SettingsTemplate.yaml index ff8b818..ec3f5df 100644 --- a/SettingsTemplate.yaml +++ b/SettingsTemplate.yaml @@ -9,6 +9,7 @@ body: - Firefox - Edge - Brave + - Brave Nightly - Opera - Vivaldi - Arc From c40b4cfd68a4ab38c16facd1a3554167a6c1030a Mon Sep 17 00:00:00 2001 From: Fahim Ahmed Date: Tue, 25 Mar 2025 15:25:18 +0600 Subject: [PATCH 16/16] Add support for Brave Nightly browser in history tracking --- plugin/browsers.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plugin/browsers.py b/plugin/browsers.py index 61e492a..c6b10cb 100644 --- a/plugin/browsers.py +++ b/plugin/browsers.py @@ -14,6 +14,7 @@ FIREFOX_DIR = Path(ROAMING, 'Mozilla', 'Firefox', 'Profiles') EDGE_DIR = Path(LOCAL_DATA, 'Microsoft', 'Edge', 'User Data', 'Default', 'History') BRAVE_DIR = Path(LOCAL_DATA, 'BraveSoftware', 'Brave-Browser', 'User Data', 'Default', 'History') +BRAVE_NIGHTLY_DIR = Path(LOCAL_DATA, 'BraveSoftware', 'Brave-Browser-Nightly', 'User Data', 'Default', 'History') OPERA_DIR = Path(ROAMING, 'Opera Software', 'Opera Stable', 'Default', 'History') VIVALDI_DIR = Path(LOCAL_DATA, 'Vivaldi', 'User Data', 'Default', 'History') ARC_DIR = Path(LOCAL_DATA, 'Packages', 'TheBrowserCompany.Arc_ttt1ap7aakyb4', 'LocalCache', 'Local', 'Arc', 'User Data', 'Default', 'History') @@ -29,6 +30,8 @@ def get(browser_name): return Edge() elif browser_name == 'brave': return Brave() + elif browser_name == 'brave nightly': + return BraveNightly() elif browser_name == 'opera': return Opera() elif browser_name == 'vivaldi': @@ -141,6 +144,19 @@ def history(self, limit=10): """ recents = self.query_history(self.database_path, 'SELECT url, title, last_visit_time FROM urls ORDER BY last_visit_time DESC', limit) return self.get_history_items(recents) + +class BraveNightly(Base): + """Brave Nightly Browser History""" + + def __init__(self, database_path=BRAVE_NIGHTLY_DIR): + self.database_path = database_path + + def history(self, limit=10): + """ + Returns a list of the most recently visited sites in Brave's history. + """ + recents = self.query_history(self.database_path, 'SELECT url, title, last_visit_time FROM urls ORDER BY last_visit_time DESC', limit) + return self.get_history_items(recents) class Opera(Base): """Opera Browser History""" @@ -238,6 +254,8 @@ def timestamp(self): return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') elif isinstance(self.browser, (Brave)): return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') + elif isinstance(self.browser, (BraveNightly)): + return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') elif isinstance(self.browser, (Opera)): return datetime((self.last_visit_time/1000000)-11644473600, 'unixepoch', 'localtime') elif isinstance(self.browser, (Vivaldi)):