hiiro 0.1.324 → 0.1.325

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d7b8a9088b7ae585db2f967e3f7d367c0688572813a11d808e02e84342a9941
4
- data.tar.gz: d1d081a1bc46a10ea66e05c218d0565fa371329059201da4d0186c068dd42b88
3
+ metadata.gz: a61e29cf5753cc2154058877c0d6a4a5c5abff6a09ba8933ba25011dcbc580f4
4
+ data.tar.gz: ac848fa9c6d775348d4c52d6a015e14415029e115bc29db01c9f8134dcbdb4fc
5
5
  SHA512:
6
- metadata.gz: d43cbe1509a538af912d16e0bb80a9ce157d6596e6c2cfd8fffdf2b1366efa17957e8400d73867fe7b4f8af9b15b08fc0eeba61927f9a17fd4edb9c4d4a5f9f1
7
- data.tar.gz: 4b0975a073a1cbe785ca3ea18df72afb7488168b33c430b28393d52c9d4ef1d90540f5da6dd6bf94900fb6c3c822cbbb737f446f9169297257abbd996b61cc65
6
+ metadata.gz: b3625f77565d8090239e7dc71d90b8b55f1f844e9020c3f180238410a3a17a443fc2481adf89875ab2b960f79e9f8223b8e6651a7af58ee21b1d3640c4d0ce5f
7
+ data.tar.gz: 606b45991e1ecda0a01c634483d9064ae85e912c97e7386c793e7580bf92eaaf52387e00aa23ea330cd3b2af8e4d9843e7308ad299c64dc2af3dbf2c35a4fac7
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.1.325] - 2026-04-02
4
+
5
+ ### Fixed
6
+ - Allow custom primary keys in `Hiiro::Invocation` model via `unrestrict_primary_key` for SQLite compatibility
7
+
3
8
  ## [0.1.324] - 2026-04-02
4
9
 
5
10
  ### Added
data/bin/h-img ADDED
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'hiiro'
4
+ require 'base64'
5
+ require 'tempfile'
6
+
7
+ MIME_TYPES = {
8
+ 'jpg' => 'image/jpeg',
9
+ 'jpeg' => 'image/jpeg',
10
+ 'gif' => 'image/gif',
11
+ 'webp' => 'image/webp',
12
+ 'png' => 'image/png',
13
+ }.freeze
14
+
15
+ def mime_for(path)
16
+ MIME_TYPES.fetch(File.extname(path).downcase.delete('.'), 'image/png')
17
+ end
18
+
19
+ def clipboard_image_to_tempfile
20
+ tmp = Tempfile.new(['h-img-', '.png'])
21
+ tmp.close
22
+ unless system('pngpaste', tmp.path, out: File::NULL, err: File::NULL)
23
+ tmp.unlink
24
+ return nil
25
+ end
26
+ tmp
27
+ end
28
+
29
+ Hiiro.run(*ARGV) {
30
+ add_subcmd(:save) { |outpath=nil|
31
+ unless outpath
32
+ puts "Usage: h img save <outpath>"
33
+ exit 1
34
+ end
35
+
36
+ tmp = clipboard_image_to_tempfile
37
+ unless tmp
38
+ puts "No image in clipboard (pngpaste failed)"
39
+ exit 1
40
+ end
41
+
42
+ FileUtils.mv(tmp.path, outpath)
43
+ puts "Saved to #{outpath}"
44
+ }
45
+
46
+ add_subcmd(:b64) { |path=nil|
47
+ if path
48
+ unless File.exist?(path)
49
+ puts "File not found: #{path}"
50
+ exit 1
51
+ end
52
+ data = File.binread(path)
53
+ mime = mime_for(path)
54
+ else
55
+ tmp = clipboard_image_to_tempfile
56
+ unless tmp
57
+ puts "No image in clipboard (pngpaste failed)"
58
+ exit 1
59
+ end
60
+ data = File.binread(tmp.path)
61
+ mime = 'image/png'
62
+ tmp.unlink
63
+ end
64
+
65
+ puts "data:#{mime};base64,#{Base64.strict_encode64(data)}"
66
+ }
67
+ }
@@ -4,6 +4,7 @@ require 'securerandom'
4
4
  class Hiiro
5
5
  class Invocation < Sequel::Model(:invocations)
6
6
  Hiiro::DB.register(self)
7
+ unrestrict_primary_key
7
8
 
8
9
  def self.create_table!(db)
9
10
  db.create_table?(:invocations) do
data/lib/hiiro/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hiiro
2
- VERSION = "0.1.324"
2
+ VERSION = "0.1.325"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiiro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.324
4
+ version: 0.1.325
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joshua Toyota
@@ -135,6 +135,7 @@ files:
135
135
  - bin/h-config
136
136
  - bin/h-cpr
137
137
  - bin/h-db
138
+ - bin/h-img
138
139
  - bin/h-jumplist
139
140
  - bin/h-link
140
141
  - bin/h-misc