Skip to content

Commit

Permalink
fix: signal sqlite that db is read-only
Browse files Browse the repository at this point in the history
Firefox locks the database when the browser is opened. This will allow
us to open the database even if it's locked.

fixes: #5
requires: kkharji/sqlite.lua@56c5aac
  • Loading branch information
dhruvmanila committed Jul 24, 2022
1 parent c0c277c commit 3cb5b6a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Using [packer.nvim](https://github.com/wbthomason/packer.nvim)
```lua
use {
'dhruvmanila/telescope-bookmarks.nvim',
-- Uncomment if the selected browser is Firefox
-- Uncomment if the selected browser is Firefox or buku
-- requires = {
-- 'tami5/sqlite.lua',
-- }
Expand All @@ -123,7 +123,7 @@ Using [vim-plug](https://github.com/junegunn/vim-plug)

```vim
Plug 'dhruvmanila/telescope-bookmarks.nvim'
" Uncomment if the selected browser is Firefox
" Uncomment if the selected browser is Firefox or buku
" Plug 'tami5/sqlite.lua'
```

Expand Down
5 changes: 4 additions & 1 deletion lua/telescope/_extensions/bookmarks/firefox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ function firefox.collect_bookmarks(state, config)
return nil
end

local db = sqlite.new(utils.join_path(profile_dir, "places.sqlite")):open()
local uri = "file:"
.. utils.join_path(profile_dir, "places.sqlite")
.. "?immutable=1"
local db = sqlite.new(uri, { open_mode = "ro" }):open()
local rows = db:select("moz_bookmarks", {
keys = { "fk", "parent", "title" },
where = { type = 1 },
Expand Down

0 comments on commit 3cb5b6a

Please sign in to comment.