Acidham / chromium-hist-bookmarks

Search in Chromium History and Bookmarks
136 stars 17 forks source link

[Bug]: Adding Safari in addition to Google chrome and Brave and it no longer works #38

Closed spiritualgeek closed 7 months ago

spiritualgeek commented 7 months ago

When Google Chrome and Brave are the chosen browsers, the operation runs smoothly. However, incorporating Safari as a third include results in failure

[18:43:20.699] Chromium Bookmarks and History Search[Script Filter] Queuing argument ''
[18:43:20.883] Chromium Bookmarks and History Search[Script Filter] Script with argv '' finished
[18:43:20.885] ERROR: Chromium Bookmarks and History Search[Script Filter] Code 1: Cache Dir: /Users/xxxxxxxxx/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/com.apple.alfred.workflow.chromium-hist
Data Dir: /Users/xxxxxxxxx/Library/Application Support/Alfred/Workflow Data/com.apple.alfred.workflow.chromium-hist
PYTHON VERSION: 3.9.6 (default, Feb  3 2024, 15:58:27) 
[Clang 15.0.0 (clang-1500.3.9.4)]
/Users/xxxxxxxxx/Library/Application Support/BraveSoftware/Brave-Browser/Default/History → found
/Users/xxxxxxxxx/Library/Application Support/Google/Chrome/Default/History → found
/Users/xxxxxxxxx/Library/Safari/History.db → found

                    SELECT DISTINCT urls.url, urls.title, urls.visit_count, (urls.last_visit_time/1000000 + (strftime('%s', '1601-01-01')))
                    FROM urls, visits
                    WHERE urls.id = visits.url AND
                    urls.title IS NOT NULL AND
                    urls.title != '' order by last_visit_time DESC; 

                    SELECT DISTINCT urls.url, urls.title, urls.visit_count, (urls.last_visit_time/1000000 + (strftime('%s', '1601-01-01')))
                    FROM urls, visits
                    WHERE urls.id = visits.url AND
                    urls.title IS NOT NULL AND
                    urls.title != '' order by last_visit_time DESC; 
Traceback (most recent call last):
  File "/Users/xxxxxxxxx/Documents/__app-configs/alfred-config/Alfred.alfredpreferences/workflows/user.workflow.ED1EA319-4D86-4336-960C-9DDA4184A32C/chrom_history.py", line 342, in <module>
    main()
  File "/Users/xxxxxxxxx/Documents/__app-configs/alfred-config/Alfred.alfredpreferences/workflows/user.workflow.ED1EA319-4D86-4336-960C-9DDA4184A32C/chrom_history.py", line 295, in main
    results = get_histories(locked_history_dbs, search_term)
  File "/Users/xxxxxxxxx/Documents/__app-configs/alfred-config/Alfred.alfredpreferences/workflows/user.workflow.ED1EA319-4D86-4336-960C-9DDA4184A32C/chrom_history.py", line 84, in get_histories
    results = p.map(sql, [db for db in dbs])
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 364, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 771, in get
    raise self._value
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/Users/xxxxxxxxx/Documents/__app-configs/alfred-config/Alfred.alfredpreferences/workflows/user.workflow.ED1EA319-4D86-4336-960C-9DDA4184A32C/chrom_history.py", line 142, in sql
    shutil.copy2(db, history_db)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/shutil.py", line 435, in copy2
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/shutil.py", line 264, in copyfile
    with open(src, 'rb') as fsrc, open(dst, 'wb') as fdst:
PermissionError: [Errno 1] Operation not permitted: '/Users/xxxxxxxxx/Library/Safari/History.db'
Acidham commented 7 months ago

This is not a bug. It is related to missing permissions.

Please follow the Getting Started setup guide: https://www.alfredapp.com/help/getting-started/permissions/

spiritualgeek commented 7 months ago

For some reason, full-disk access had been switched off. Thanks 👍🏼️