solid_litequeen 0.4.3 → 0.4.4

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: d1c6bcc2a70af068acb685dab8e79b066d64b01b9f7e54bab03f1795be655d07
4
- data.tar.gz: d9d685c019cfa91e2e2f588938064c64e4b76024c23f020d03e0f8e17e1c0cd3
3
+ metadata.gz: f9ea219d6e8a41230ac06a3cfbbd7bc15e4005c8e0744a329bed82dc01e2d252
4
+ data.tar.gz: 9650a0ddd050018b17a044e3c8320b367d8fdc054e4ebe1ca0dc99453651239d
5
5
  SHA512:
6
- metadata.gz: fd19e4e09f35d7d47c2746827208e35bf63491bf459a3aa53f0505efa3c1053c4645f28db3cb4c668f992b6e77528b624ce30bc9474ec02bba1aebcb642ae48f
7
- data.tar.gz: 62c69b58509289ba6d2aa9b5634d71338cb24f1ed07abb1381ccc962465cdc7186a137cad159a3a415bcff487fad69c7d9bb7cc13e821daeddcdc0a6c60a0df5
6
+ metadata.gz: fa23b13e73d5fb47a9b569b1b222fc0614bbe10c19d0a0b98a996e32cdc519f76ad84f5ca32b2df9d97fd5009f6c158061d3c253979e1c96b2e1f6b1757c0d13
7
+ data.tar.gz: ccf90477b30454b6836011ff25cb5b619627afb0b3010c8c5bea95844ca456a6cbe075153819fcfbb7ffb08258fb7d3214b580cf50774ad936c9ec6d4cd2a16b
@@ -41,5 +41,25 @@ module SolidLitequeen
41
41
 
42
42
  @data = DynamicDatabase.connection.select_all("SELECT * FROM #{@table_name} LIMIT 50")
43
43
  end
44
+
45
+ def download
46
+ database_id = params.expect(:id)
47
+ database_location = Base64.urlsafe_decode64(database_id)
48
+
49
+ # Verify the file exists
50
+ unless File.exist?(database_location)
51
+ flash[:error] = "Database file not found"
52
+ redirect_to databases_path and return
53
+ end
54
+
55
+ # Get the filename from the path
56
+ filename = File.basename(database_location)
57
+
58
+ # Send the file as a download
59
+ send_file database_location,
60
+ filename: filename,
61
+ type: "application/x-sqlite3",
62
+ disposition: "attachment"
63
+ end
44
64
  end
45
65
  end
@@ -35,4 +35,5 @@
35
35
  </tbody>
36
36
  </table>
37
37
  </div>
38
+ <%= link_to "Download Database", database_download_path(@database_id), class: "btn btn-primary text-xs mt-4" %>
38
39
  </div>
data/config/routes.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  SolidLitequeen::Engine.routes.draw do
2
2
  resources :databases, only: [ :index, :show ] do
3
3
  get "/tables/:table", to: "databases#table_rows", as: :table_rows
4
+ get "databases/:id/download", to: "databases#download", as: "download"
4
5
  end
5
6
  root to: "databases#index"
6
7
  end
@@ -1,3 +1,3 @@
1
1
  module SolidLitequeen
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solid_litequeen
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vik Borges
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-02-26 00:00:00.000000000 Z
11
+ date: 2025-02-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails