1
0
Fork 0
mirror of synced 2024-06-02 02:25:20 +12:00

Merge pull request #1152 from jess-sol/patch-1

This commit is contained in:
Nick Sweeting 2023-05-26 21:34:15 -07:00 committed by GitHub
commit dbe1cd8dc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,24 @@ if [[ "$1" == "--firefox" ]]; then
fi
sqlite3 "$OUTPUT_DIR/firefox_history.db.tmp" "SELECT \"[\" || group_concat(json_object('timestamp', last_visit_date, 'description', title, 'href', url)) || \"]\" FROM moz_places;" > "$OUTPUT_DIR/firefox_history.json"
sqlite3 "$OUTPUT_DIR/firefox_history.db.tmp" "SELECT \"[\" || group_concat(json_object('timestamp', b.dateAdded, 'description', b.title, 'href', f.url)) || \"]\" FROM moz_bookmarks AS b JOIN moz_places AS f ON f.id = b.fk" > "$OUTPUT_DIR/firefox_bookmarks.json"
sqlite3 "$OUTPUT_DIR/firefox_history.db.tmp" "
with recursive tags AS (
select id, title, '' AS tags
FROM moz_bookmarks
where parent == 0
UNION ALL
select c.id, p.title, c.title || ',' || tags AS tags
from moz_bookmarks AS c
JOIN tags AS p
ON c.parent = p.id
)
SELECT '[' || group_concat(json_object('timestamp', b.dateAdded, 'description', b.title, 'href', f.url, 'tags', tags.tags)) || ']'
FROM moz_bookmarks AS b
JOIN moz_places AS f ON f.id = b.fk
JOIN tags ON tags.id = b.parent
WHERE f.url LIKE '%://%';" > "$OUTPUT_DIR/firefox_bookmarks.json"
rm "$OUTPUT_DIR"/firefox_history.db.*
echo "Firefox history exported to:"