imsg-grep 0.1.2-darwin → 0.1.4-darwin
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/bin/imsg-grep +10 -0
- data/lib/imsg-grep/VERSION +1 -1
- data/lib/imsg-grep/images/imaginator.rb +0 -1
- data/lib/imsg-grep/messages.rb +22 -15
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0e9003c398da31639dbfde03aaec593b2f165940563851b5e6941d4a55a3ac7d
|
|
4
|
+
data.tar.gz: 98155da94f986fc1a3455f368d40c2b418d2e077980d9fbb536d375f1e3fffd4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4992137950786e7a8e3040f50378a8d8b285d6894913ae7aa8ec6c7b539048bf11be519cd5db8f3cd10fd888438a2707d1ba2b77f2de5ed387c788b317c76a4e
|
|
7
|
+
data.tar.gz: 319ef0da83aa8c21b8bc71f934744604def1b6b8e28b2ff361cdb34710e4d8a04787f9cc14a63fa1270fda60bc0f30adfbc96fef2fe2e489da5b8b3f0c64e5cf
|
data/README.md
CHANGED
|
@@ -17,7 +17,11 @@ Search iMessage history with regex patterns, date ranges, and participant filter
|
|
|
17
17
|
|
|
18
18
|
macOS, ruby 3.4+, SQLite.
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
Full Disk Access must be enabled for terminal.
|
|
21
|
+
|
|
22
|
+
iTerm or Ghostty (or other kitty) for image support.
|
|
23
|
+
|
|
24
|
+
swiftc for development. (run `rake build:lib`)
|
|
21
25
|
|
|
22
26
|
## Installing
|
|
23
27
|
|
data/bin/imsg-grep
CHANGED
|
@@ -371,6 +371,16 @@ begin
|
|
|
371
371
|
sorted_singles = keyed_singles.sort_by{|k,| filter_order.index(k) || Float::INFINITY }.map(&:last)
|
|
372
372
|
groups = sorted_singles + grouped # put it back together
|
|
373
373
|
|
|
374
|
+
begin
|
|
375
|
+
Messages.init_fs
|
|
376
|
+
rescue Errno::EPERM, Errno::EACCES
|
|
377
|
+
$stderr.print "You must grant #{ENV['TERM_PROGRAM']} Full Disk Access so #{PROG} can access the chat database. Open System Settings pane? [y/N] "
|
|
378
|
+
$stdin.gets.to_s.strip.downcase == "y" and system 'open "x-apple.systempreferences:com.apple.preference.security?Privacy_AllFiles"'
|
|
379
|
+
exit 1
|
|
380
|
+
rescue => e
|
|
381
|
+
err! e.message
|
|
382
|
+
exit 1
|
|
383
|
+
end
|
|
374
384
|
Messages.init
|
|
375
385
|
|
|
376
386
|
@file_filters = []
|
data/lib/imsg-grep/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.4
|
data/lib/imsg-grep/messages.rb
CHANGED
|
@@ -10,29 +10,36 @@ require_relative 'apple/attr_str'
|
|
|
10
10
|
module Messages
|
|
11
11
|
APPLE_EPOCH = 978307200
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
IMSG_DB = File.expand_path("~/Library/Messages/chat.db")
|
|
15
|
-
CACHE_DB = File.expand_path("~/.cache/imsg-grep/cache.db")
|
|
16
|
-
|
|
17
|
-
def self.reset_cache = FileUtils.rm_f(CACHE_DB)
|
|
13
|
+
def self.reset_cache = FileUtils.rm_f(@cache_db)
|
|
18
14
|
def self.db = @db
|
|
19
15
|
|
|
20
|
-
def self.
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
def self.init_fs
|
|
17
|
+
return if @addy_db # already ran
|
|
18
|
+
@addy_db = Dir[File.expand_path("~/Library/Application Support/AddressBook/Sources/*/AddressBook-*.abcddb")][0]
|
|
19
|
+
@imsg_db = File.expand_path("~/Library/Messages/chat.db")
|
|
20
|
+
@cache_db = File.expand_path("~/.cache/imsg-grep/cache.db")
|
|
21
|
+
|
|
22
|
+
raise "Contacts database not found" unless @addy_db
|
|
23
|
+
|
|
24
|
+
FileUtils.mkdir_p File.dirname(@cache_db)
|
|
25
|
+
FileUtils.touch(@cache_db)
|
|
26
26
|
|
|
27
|
-
[
|
|
27
|
+
[@addy_db, @imsg_db, @cache_db].each do |db|
|
|
28
28
|
raise "Database not found: #{db}" unless File.exist?(db)
|
|
29
29
|
raise "Database not readable: #{db}" unless File.readable?(db)
|
|
30
30
|
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def self.init
|
|
34
|
+
################################################################################
|
|
35
|
+
### DB Setup ###################################################################
|
|
36
|
+
################################################################################
|
|
31
37
|
|
|
38
|
+
init_fs
|
|
32
39
|
@db = SQLite3::Database.new(":memory:")
|
|
33
|
-
@db.execute "ATTACH DATABASE '#{
|
|
34
|
-
@db.execute "ATTACH DATABASE '#{
|
|
35
|
-
@db.execute "ATTACH DATABASE '#{
|
|
40
|
+
@db.execute "ATTACH DATABASE '#{@addy_db}' AS _addy"
|
|
41
|
+
@db.execute "ATTACH DATABASE '#{@imsg_db}' AS _imsg"
|
|
42
|
+
@db.execute "ATTACH DATABASE '#{@cache_db}' AS _cache"
|
|
36
43
|
|
|
37
44
|
def @db.select_hashes(sql) = prepare(sql).execute.enum_for(:each_hash).map{ it.transform_keys(&:to_sym) }
|
|
38
45
|
def @db.ƒ(f, &) = define_function_with_flags(f.to_s, SQLite3::Constants::TextRep::UTF8 | SQLite3::Constants::TextRep::DETERMINISTIC, &)
|