proxly 0.1.2 → 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: 5529fa2be5b7497384cad4475bc76f5e4ce8284597283b945915d46b759a45a5
4
- data.tar.gz: 6a19f9b92e0e9b5689afa060b601261337398e29a40a1c51450f78128f1228d4
3
+ metadata.gz: 964e24eec8aee2ecd3157f44421999ae06c6dd02be14d6c8f01e0180b626442c
4
+ data.tar.gz: 241253f43a76f7d5e753e027d3f603391009838eea61fb7a2cdc9d39bad0d62a
5
5
  SHA512:
6
- metadata.gz: f6dbcfb9c3de5dbaae50017038529e76e7c874f50c7154d1656850404a010d39cf4776a7abe625c9434a6653776585bd853d963f5f0a004c105682155d318a01
7
- data.tar.gz: ac83f6a01fb6dd5f778ada69a4eaf72f007eaef88d8fc1254d2f1b0cf6a731051d4b1b5d6464ce8827b6c0b88b69ea3e721dc75e3260cff288cdf6e589a4f2f6
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,7 +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
3
- initializer "proxly.tag_helper" do
4
- ActiveSupport.on_load(:action_view) { include Proxly::TagHelper }
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
5
24
  end
6
25
  end
7
26
  end
@@ -1,3 +1,3 @@
1
1
  module Proxly
2
- VERSION = "0.1.2"
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.2
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
- module 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