proxly 0.1.0 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43d5f0b42ee8fc59cb01c6837d00fa4906e9a9b3e21e52c54aecb6f95d0b597c
4
- data.tar.gz: 67c485e36e867a9c6d3b713191112bce499e74fa9f96ffa24dbc2301721b233f
3
+ metadata.gz: 964e24eec8aee2ecd3157f44421999ae06c6dd02be14d6c8f01e0180b626442c
4
+ data.tar.gz: 241253f43a76f7d5e753e027d3f603391009838eea61fb7a2cdc9d39bad0d62a
5
5
  SHA512:
6
- metadata.gz: ae2b667b4603079ff72b861ede64d6e48b7bf33858b1adb22b514b55280444ccacf88e6c537f5af6e4f9ae4b7aa597cd92aaac768537e557115ac6cbcd325e62
7
- data.tar.gz: 1614686610a48c828c623c554758cca2c0cf0d20ae2170be313c2451b3d5ee61641fe368a52999d15cb0cef5b4acef50d39c1920d0f4e11e7f25ce51863718cc
6
+ metadata.gz: c855defbf141a1436e6df1400e1d62217dc3f5bb3bbfaa55b46a323391bedb5bd4604075bdd0ac215f5e628795023c8ef2d1e64ebd516f5bd9bfb0619bb7e4a0
7
+ data.tar.gz: 44ac58bc96ceae1c35b8eb9e3634f24b4e68a75637eb5f5555a8bd9178fc396331f4bd4b14975ad6ca70c5ef04690e86de1582ca06c1a013bd8f26c2b236ec60
@@ -0,0 +1,11 @@
1
+ module Proxly
2
+ module HostRouter
3
+ extend ActiveSupport::Concern
4
+
5
+ included { before_action :set_asset_host }
6
+
7
+ def set_asset_host
8
+ self.asset_host = Proxly.host unless request.local?
9
+ end
10
+ end
11
+ end
@@ -1,4 +1,26 @@
1
+ # require_relative "./tunnels/cloudflare"
2
+
3
+ # TODO:
4
+ # - Try to implement auto-start stop in the gem
5
+
1
6
  module Proxly
2
7
  class Railtie < ::Rails::Railtie
8
+ initializer "proxly.host_router", after: :load_config_initializers do
9
+ unless Rails.env.production?
10
+ ActiveSupport.on_load(:action_controller_base) do
11
+ include Proxly::HostRouter
12
+ end
13
+
14
+ # at_exit do
15
+ # begin
16
+ # Tunnels::Cloudflare.stop
17
+ # rescue => e
18
+ # puts "There was an #{e} while stopping cloudflare tunnel..."
19
+ # ensure
20
+ # puts "Tunnel shutdown"
21
+ # end
22
+ # end
23
+ end
24
+ end
3
25
  end
4
26
  end
@@ -1,3 +1,3 @@
1
1
  module Proxly
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/proxly.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "proxly/version"
2
2
  require "proxly/railtie"
3
- require "proxly/tag_helper"
3
+ require "proxly/host_router"
4
4
 
5
5
  module Proxly
6
6
  mattr_accessor :host
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mason Stallmo
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-03-19 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -124,8 +124,8 @@ files:
124
124
  - README.md
125
125
  - Rakefile
126
126
  - lib/proxly.rb
127
+ - lib/proxly/host_router.rb
127
128
  - lib/proxly/railtie.rb
128
- - lib/proxly/tag_helper.rb
129
129
  - lib/proxly/version.rb
130
130
  - lib/tasks/proxly_tasks.rake
131
131
  homepage: https://github.com/mstallmo/proxly
@@ -135,7 +135,7 @@ metadata:
135
135
  homepage_uri: https://github.com/mstallmo/proxly
136
136
  source_code_uri: https://github.com/mstallmo/proxly
137
137
  changelog_uri: https://github.com/mstallmo/proxly/blob/main/CHANGELOG.md
138
- post_install_message:
138
+ post_install_message:
139
139
  rdoc_options: []
140
140
  require_paths:
141
141
  - lib
@@ -151,7 +151,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  requirements: []
153
153
  rubygems_version: 3.3.3
154
- signing_key:
154
+ signing_key:
155
155
  specification_version: 4
156
156
  summary: Serve your JS and CSS from a local server over a proxied connection
157
157
  test_files: []
@@ -1,23 +0,0 @@
1
- module Proxly
2
- class TagHelper
3
- extend ActionView::Helpers::AssetTagHelper
4
-
5
- def self.javascript_include_tag(*sources)
6
- if Proxly.host
7
- sources.last[:host] = Proxly.host
8
- sources.last[:protocol] = Proxly.protocol
9
- end
10
-
11
- super(*sources)
12
- end
13
-
14
- def self.stylesheet_link_tag(*sources)
15
- if Proxly.host
16
- sources.last[:host] = Proxly.host
17
- sources.last[:protocol] = Proxly.protocol
18
- end
19
-
20
- super(*sources)
21
- end
22
- end
23
- end