darjeelink 0.11.5 → 0.11.10
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 +35 -15
- data/app/assets/javascripts/darjeelink/tracking_link_generator.js +7 -2
- data/app/controllers/darjeelink/short_links_controller.rb +26 -13
- data/app/controllers/darjeelink/tracking_links_controller.rb +1 -0
- data/app/models/darjeelink/short_link.rb +5 -7
- data/app/views/darjeelink/short_links/_short_link_form.erb +16 -13
- data/app/views/darjeelink/short_links/edit.html.erb +2 -9
- data/app/views/darjeelink/short_links/new.html.erb +6 -1
- data/app/views/darjeelink/tracking_links/new.erb +32 -21
- data/config/brakeman.ignore +26 -0
- data/config/initializers/darjeelink.rb +8 -6
- data/lib/darjeelink/configuration.rb +1 -5
- data/lib/darjeelink/version.rb +1 -1
- metadata +31 -17
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 0bb8e036f92bfb2145607b781537440e1dab86664c300e8313881e4d73f07940
         | 
| 4 | 
            +
              data.tar.gz: 7b8653822b7c206acc6ce03b4d0ccfad2d7ae7732b08ee597c458440ec4ba255
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 8c64837b6368ac6f72fab25cd3f17bc0f794e74a4bd60cfe9f323dc2785624a82fc107472702ca8b6898e423c64d9ede7f3c7e5ef2a667faf07fe5ae3494b12d
         | 
| 7 | 
            +
              data.tar.gz: 541fa60fc561f4de4e476673884d9571bc8ccffaecee9b8b73b7696495ec50881da0b2807c5e0b07a32507020b62273c2141b4a84168cf0a75ff30071051f1f8
         | 
    
        data/README.md
    CHANGED
    
    | @@ -19,21 +19,13 @@ There is a UTM generator, where you can provide: | |
| 19 19 | 
             
            - a campaign identifier
         | 
| 20 20 | 
             
            And you can get a link with UTM params all filled in, and shortern it with one click.
         | 
| 21 21 |  | 
| 22 | 
            -
            ## Development
         | 
| 23 | 
            -
            The recommended approach is to use Vagrant. `vagrant up` will create an isolated darjeelink instance
         | 
| 24 | 
            -
             | 
| 25 | 
            -
            ### Setup development environment
         | 
| 26 | 
            -
            Run `cp .env.sample spec/dummy/.env.development`
         | 
| 27 | 
            -
            Nothing else required
         | 
| 28 | 
            -
             | 
| 29 | 
            -
            ### Setup test environment
         | 
| 30 | 
            -
            Run `cp .env.sample spec/dummy/.env.test`
         | 
| 31 | 
            -
            Change the database url to be different to the development one i.e. `postgres://darjeelink_dbuser:password@localhost/darjeelink-test`
         | 
| 32 | 
            -
             | 
| 33 22 | 
             
            ## Installation
         | 
| 34 | 
            -
            ###  | 
| 35 | 
            -
             | 
| 36 | 
            -
             | 
| 23 | 
            +
            ### Gemfile
         | 
| 24 | 
            +
            Add these lines to your app's Gemfile
         | 
| 25 | 
            +
            ```
         | 
| 26 | 
            +
            gem 'darjeelink'
         | 
| 27 | 
            +
            gem 'repost' # Shouldn't be required, but it is.  Investigate why
         | 
| 28 | 
            +
            ```
         | 
| 37 29 |  | 
| 38 30 | 
             
            ### Mounting the engine
         | 
| 39 31 | 
             
            Add these lines to your app's routes.rb
         | 
| @@ -64,7 +56,35 @@ In `config/initializers/darjeelink.rb` edit the `config.source_mediums` hash. | |
| 64 56 |  | 
| 65 57 | 
             
            Each key is a hyphenated source-medium.  If you just want the source then omit the hyphen and medium.
         | 
| 66 58 |  | 
| 67 | 
            -
            Each value is a slightly more readable version for display
         | 
| 59 | 
            +
            Each value is a slightly more readable version for display.
         | 
| 60 | 
            +
             | 
| 61 | 
            +
            ## Development
         | 
| 62 | 
            +
            The recommended approach is to use Vagrant. `vagrant up` will create an isolated darjeelink instance.
         | 
| 63 | 
            +
            Before you run `vagrant up`, make sure to create `.env.development` & `.env.test` files as detailed below.
         | 
| 64 | 
            +
             | 
| 65 | 
            +
            ### Setup development environment
         | 
| 66 | 
            +
            Run `cp .env.sample spec/dummy/.env.development`
         | 
| 67 | 
            +
             | 
| 68 | 
            +
            Nothing else required
         | 
| 69 | 
            +
             | 
| 70 | 
            +
            ### Setup test environment
         | 
| 71 | 
            +
            Run `cp .env.sample spec/dummy/.env.test`
         | 
| 72 | 
            +
             | 
| 73 | 
            +
            Change the database url to be different to the development one i.e. `postgres://darjeelink_dbuser:password@localhost/darjeelink-test`
         | 
| 74 | 
            +
             | 
| 75 | 
            +
            ## Releasing
         | 
| 76 | 
            +
            Darjeelink follows [Semantic Versioning](https://semver.org)
         | 
| 77 | 
            +
             | 
| 78 | 
            +
            Once all necessary changes have made it in to master and you are ready to do a release you need to do these steps.
         | 
| 79 | 
            +
             | 
| 80 | 
            +
            Note that if you are running in a vagrant VM, most of these steps can be done from within the VM.
         | 
| 81 | 
            +
             | 
| 82 | 
            +
            - Update `lib/darjeelink/version.rb` to the new version
         | 
| 83 | 
            +
            - Run `bundle install` to pick up the change in Gemfile.lock
         | 
| 84 | 
            +
            - Commit the changes to `lib/darjeelink/version.rb` and `Gemfile.lock`, and push them to GitHub
         | 
| 85 | 
            +
            - Go to `https://github.com/38degrees/darjeelink/releases` and create a release tag in GitHub
         | 
| 86 | 
            +
            - Run `gem build darjeelink.gemspec` this will output a file `darjeelink-X.X.X.gem` the version should match what version.rb and github.
         | 
| 87 | 
            +
            - Run `gem push darjeelink-X.X.X.gem`
         | 
| 68 88 |  | 
| 69 89 | 
             
            ## GDPR
         | 
| 70 90 | 
             
            No personally identifiable data is stored about the public by this gem.
         | 
| @@ -1,5 +1,10 @@ | |
| 1 1 | 
             
            function generateTrackingLink(){
         | 
| 2 | 
            -
              var url = $('#url').val();
         | 
| 2 | 
            +
              var url = $('#base-url').val();
         | 
| 3 | 
            +
              if (!url) {
         | 
| 4 | 
            +
                document.getElementById("long_url").value = "";
         | 
| 5 | 
            +
                return;
         | 
| 6 | 
            +
              }
         | 
| 7 | 
            +
             | 
| 3 8 | 
             
              var sourceMedium = $('#source-medium').val();
         | 
| 4 9 | 
             
              var source = sourceMedium.split('-')[0];
         | 
| 5 10 | 
             
              var medium = sourceMedium.split('-')[1];
         | 
| @@ -28,7 +33,7 @@ $(document).ready(function(){ | |
| 28 33 | 
             
                generateTrackingLink();
         | 
| 29 34 | 
             
              });
         | 
| 30 35 |  | 
| 31 | 
            -
              $("#tracking"). | 
| 36 | 
            +
              $("#tracking").keyup(function(){
         | 
| 32 37 | 
             
                generateTrackingLink();
         | 
| 33 38 | 
             
              });
         | 
| 34 39 |  | 
| @@ -5,8 +5,8 @@ module Darjeelink | |
| 5 5 | 
             
                skip_before_action :check_ip_whitelist, only: :show
         | 
| 6 6 | 
             
                skip_before_action :authenticate, only: :show
         | 
| 7 7 |  | 
| 8 | 
            -
                before_action :check_url_present, only:  | 
| 9 | 
            -
                before_action :check_url_valid, only:  | 
| 8 | 
            +
                before_action :check_url_present, only: %i[create update]
         | 
| 9 | 
            +
                before_action :check_url_valid, only: %i[create update]
         | 
| 10 10 |  | 
| 11 11 | 
             
                class ShortLinkNotFoundError < StandardError
         | 
| 12 12 | 
             
                end
         | 
| @@ -18,17 +18,13 @@ module Darjeelink | |
| 18 18 | 
             
                end
         | 
| 19 19 |  | 
| 20 20 | 
             
                def new
         | 
| 21 | 
            +
                  @short_link = Darjeelink::ShortLink.new
         | 
| 21 22 | 
             
                end
         | 
| 22 23 |  | 
| 23 24 | 
             
                def create
         | 
| 24 | 
            -
                   | 
| 25 | 
            -
                    Darjeelink::ShortLink.create!( | 
| 26 | 
            -
                  rescue ActiveRecord::RecordNotUnique
         | 
| 27 | 
            -
                    flash[:error] = "#{params[:shortened_path]} already used! Choose a different custom path"
         | 
| 28 | 
            -
                    return redirect_to(darjeelink.new_short_link_path)
         | 
| 25 | 
            +
                  handle_create_or_update(error_redirect_path: darjeelink.new_short_link_path) do
         | 
| 26 | 
            +
                    Darjeelink::ShortLink.create!(short_link_params)
         | 
| 29 27 | 
             
                  end
         | 
| 30 | 
            -
             | 
| 31 | 
            -
                  redirect_to(darjeelink.short_links_path)
         | 
| 32 28 | 
             
                end
         | 
| 33 29 |  | 
| 34 30 | 
             
                def edit
         | 
| @@ -37,9 +33,10 @@ module Darjeelink | |
| 37 33 |  | 
| 38 34 | 
             
                def update
         | 
| 39 35 | 
             
                  @short_link = Darjeelink::ShortLink.find(params[:id])
         | 
| 40 | 
            -
                  @short_link.update!(short_link_params)
         | 
| 41 36 |  | 
| 42 | 
            -
                   | 
| 37 | 
            +
                  handle_create_or_update(error_redirect_path: darjeelink.edit_short_link_path(@short_link)) do
         | 
| 38 | 
            +
                    @short_link.update!(short_link_params)
         | 
| 39 | 
            +
                  end
         | 
| 43 40 | 
             
                end
         | 
| 44 41 |  | 
| 45 42 | 
             
                def show
         | 
| @@ -57,6 +54,22 @@ module Darjeelink | |
| 57 54 |  | 
| 58 55 | 
             
                private
         | 
| 59 56 |  | 
| 57 | 
            +
                def handle_create_or_update(error_redirect_path:)
         | 
| 58 | 
            +
                  return unless block_given?
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                  begin
         | 
| 61 | 
            +
                    yield
         | 
| 62 | 
            +
                  rescue ActiveRecord::RecordNotUnique
         | 
| 63 | 
            +
                    flash[:error] = "#{params[:shortened_path]} already used! Choose a different custom path"
         | 
| 64 | 
            +
                    return redirect_to(error_redirect_path)
         | 
| 65 | 
            +
                  rescue ActiveRecord::RecordInvalid => e
         | 
| 66 | 
            +
                    flash[:error] = e.message.to_s
         | 
| 67 | 
            +
                    return redirect_to(error_redirect_path)
         | 
| 68 | 
            +
                  end
         | 
| 69 | 
            +
             | 
| 70 | 
            +
                  redirect_to(darjeelink.short_links_path)
         | 
| 71 | 
            +
                end
         | 
| 72 | 
            +
             | 
| 60 73 | 
             
                def log_missing_shortlink(shortened_path)
         | 
| 61 74 | 
             
                  Rails.logger.warn("ShortLink not found: #{shortened_path}")
         | 
| 62 75 | 
             
                end
         | 
| @@ -95,14 +108,14 @@ module Darjeelink | |
| 95 108 | 
             
                end
         | 
| 96 109 |  | 
| 97 110 | 
             
                def check_url_present
         | 
| 98 | 
            -
                  return if params[:url].present?
         | 
| 111 | 
            +
                  return if params[:short_link].present? && params[:short_link][:url].present?
         | 
| 99 112 |  | 
| 100 113 | 
             
                  flash[:error] = 'URL cannot be blank'
         | 
| 101 114 | 
             
                  redirect_to(darjeelink.new_short_link_path)
         | 
| 102 115 | 
             
                end
         | 
| 103 116 |  | 
| 104 117 | 
             
                def check_url_valid
         | 
| 105 | 
            -
                  return if params[:url] =~ URI::DEFAULT_PARSER.make_regexp
         | 
| 118 | 
            +
                  return if params[:short_link].present? && params[:short_link][:url] =~ URI::DEFAULT_PARSER.make_regexp
         | 
| 106 119 |  | 
| 107 120 | 
             
                  flash[:error] = 'URL is not valid.  Does it have https:// and are there any spaces?'
         | 
| 108 121 | 
             
                  redirect_to(darjeelink.new_short_link_path)
         | 
| @@ -3,9 +3,12 @@ | |
| 3 3 | 
             
            module Darjeelink
         | 
| 4 4 | 
             
              class ShortLink < ApplicationRecord
         | 
| 5 5 | 
             
                after_save :generate_short_link
         | 
| 6 | 
            -
                before_validation :strip_white_space
         | 
| 7 6 |  | 
| 8 7 | 
             
                validates_presence_of :url
         | 
| 8 | 
            +
                validates :url, :shortened_path, format: {
         | 
| 9 | 
            +
                  without: /\s/,
         | 
| 10 | 
            +
                  message: 'must not contain any whitespace (spaces, tabs, etc)'
         | 
| 11 | 
            +
                }
         | 
| 9 12 |  | 
| 10 13 | 
             
                class << self
         | 
| 11 14 | 
             
                  def search(query)
         | 
| @@ -47,12 +50,7 @@ module Darjeelink | |
| 47 50 | 
             
                    i /= base
         | 
| 48 51 | 
             
                  end
         | 
| 49 52 |  | 
| 50 | 
            -
                  generated_path.join | 
| 51 | 
            -
                end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                def strip_white_space
         | 
| 54 | 
            -
                  url&.strip!
         | 
| 55 | 
            -
                  shortened_path&.strip!
         | 
| 53 | 
            +
                  generated_path.join.reverse
         | 
| 56 54 | 
             
                end
         | 
| 57 55 | 
             
              end
         | 
| 58 56 | 
             
            end
         | 
| @@ -7,18 +7,21 @@ | |
| 7 7 | 
             
                  </div>
         | 
| 8 8 | 
             
                <% end %>
         | 
| 9 9 |  | 
| 10 | 
            -
                 | 
| 11 | 
            -
                   | 
| 12 | 
            -
             | 
| 13 | 
            -
                     | 
| 14 | 
            -
             | 
| 15 | 
            -
             | 
| 16 | 
            -
             | 
| 17 | 
            -
             | 
| 18 | 
            -
             | 
| 19 | 
            -
             | 
| 20 | 
            -
             | 
| 21 | 
            -
                   | 
| 22 | 
            -
             | 
| 10 | 
            +
                <div class="form-group">
         | 
| 11 | 
            +
                  <%= f.label :url %>
         | 
| 12 | 
            +
                  <%= f.url_field :url,
         | 
| 13 | 
            +
                    class: "form-control", id: 'long_url', value: short_link.url, required: true,
         | 
| 14 | 
            +
                    pattern: 'https?://[^\s]+', placeholder: 'https://www.example.com',
         | 
| 15 | 
            +
                    title: 'URL, starting http:// or https:// - no whitespace (space, tab, etc) allowed'
         | 
| 16 | 
            +
                  %>
         | 
| 17 | 
            +
                </div>
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                <div class="form-group">
         | 
| 20 | 
            +
                  <%= f.label :custom_path %>
         | 
| 21 | 
            +
                  <%= f.text_field :shortened_path,
         | 
| 22 | 
            +
                    class: "form-control", id: 'shortened_path', value: short_link.shortened_path,
         | 
| 23 | 
            +
                    pattern: '[^\s]*', title: 'Short path - no whitespace (space, tab, etc) allowed'
         | 
| 24 | 
            +
                  %>
         | 
| 25 | 
            +
                </div>
         | 
| 23 26 | 
             
              </div>
         | 
| 24 27 | 
             
            </div>
         | 
| @@ -13,16 +13,9 @@ | |
| 13 13 | 
             
            <div class="row">
         | 
| 14 14 | 
             
              <div class="col-md-12">
         | 
| 15 15 | 
             
                <%= form_for @short_link, url: darjeelink.short_link_path do |f| %>
         | 
| 16 | 
            -
                   | 
| 17 | 
            -
                    <%= f.label :url %>
         | 
| 18 | 
            -
                    <%= f.url_field :url, class: "form-control", value: @short_link.url %>
         | 
| 19 | 
            -
                  </div>
         | 
| 20 | 
            -
                  <div class="form-group">
         | 
| 21 | 
            -
                    <%= f.label :custom_path %>
         | 
| 22 | 
            -
                    <%= f.text_field :shortened_path, class: "form-control", value: @short_link.shortened_path %>
         | 
| 23 | 
            -
                  </div>
         | 
| 16 | 
            +
                  <%= render partial: 'short_link_form', locals: { f: f, short_link: @short_link } %>
         | 
| 24 17 | 
             
                  <div>
         | 
| 25 | 
            -
                     | 
| 18 | 
            +
                    <%= f.submit "Update Shortlink", class: "btn btn-primary" %>
         | 
| 26 19 | 
             
                  </div>
         | 
| 27 20 | 
             
                <% end %>
         | 
| 28 21 | 
             
              </div>
         | 
| @@ -9,4 +9,9 @@ | |
| 9 9 | 
             
                <h1>New Short Link</h1>
         | 
| 10 10 | 
             
              </div>
         | 
| 11 11 | 
             
            </div>
         | 
| 12 | 
            -
            <%=  | 
| 12 | 
            +
            <%= form_for @short_link, url: darjeelink.short_links_path, local: true do |f| %>
         | 
| 13 | 
            +
              <%= render partial: 'short_link_form', locals: { f: f, short_link: @short_link } %>
         | 
| 14 | 
            +
              <div>
         | 
| 15 | 
            +
                <%= f.submit "Create Shortlink", class: "btn btn-primary" %>
         | 
| 16 | 
            +
              </div>
         | 
| 17 | 
            +
            <% end %>
         | 
| @@ -14,35 +14,46 @@ | |
| 14 14 | 
             
              </div>
         | 
| 15 15 | 
             
            </div>
         | 
| 16 16 |  | 
| 17 | 
            -
             | 
| 18 | 
            -
              <div class=" | 
| 19 | 
            -
                < | 
| 17 | 
            +
            <%= form_for @short_link, url: darjeelink.short_links_path, local: true do |f| %>
         | 
| 18 | 
            +
              <div class="row" id="tracking">
         | 
| 19 | 
            +
                <div class="col-md-12">
         | 
| 20 20 | 
             
                  <div class="form-group">
         | 
| 21 | 
            -
                    <label for="url">URL</label>
         | 
| 22 | 
            -
                    <input | 
| 23 | 
            -
             | 
| 24 | 
            -
             | 
| 25 | 
            -
                       | 
| 26 | 
            -
             | 
| 27 | 
            -
             | 
| 21 | 
            +
                    <label for="base-url">URL</label>
         | 
| 22 | 
            +
                    <input
         | 
| 23 | 
            +
                      type="text" class="form-control" id="base-url" name="base-url" required=true
         | 
| 24 | 
            +
                      pattern="https?://[^\s]+" placeholder="https://www.example.com"
         | 
| 25 | 
            +
                      title="URL, starting http:// or https:// - no whitespace (space, tab, etc) allowed"
         | 
| 26 | 
            +
                    >
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                    <label for="source-medium">Source - Medium</label>
         | 
| 29 | 
            +
                    <select class="form-control" id="source-medium" name="source-medium">
         | 
| 30 | 
            +
                      <%= options_for_select(Darjeelink.source_mediums.map { |k,v| [v,k] }) %>
         | 
| 28 31 | 
             
                    </select>
         | 
| 32 | 
            +
             | 
| 29 33 | 
             
                    <label for="campaign">ID / Identifier (lower-case, underscores only)</label>
         | 
| 30 | 
            -
                    <input | 
| 34 | 
            +
                    <input
         | 
| 35 | 
            +
                      type="text" class="form-control" id="campaign" name="campaign" pattern="[^\s]*"
         | 
| 36 | 
            +
                      title="ID for the campaign - no whitespace (space, tab, etc) allowed"
         | 
| 37 | 
            +
                    >
         | 
| 31 38 | 
             
                  </div>
         | 
| 32 | 
            -
                </ | 
| 39 | 
            +
                </div>
         | 
| 33 40 | 
             
              </div>
         | 
| 34 | 
            -
            </div>
         | 
| 35 41 |  | 
| 36 | 
            -
            <div class="row">
         | 
| 37 | 
            -
             | 
| 38 | 
            -
             | 
| 39 | 
            -
             | 
| 40 | 
            -
             | 
| 41 | 
            -
             | 
| 42 | 
            +
              <div class="row">
         | 
| 43 | 
            +
                <div class="col-md-12">
         | 
| 44 | 
            +
                  <h2>Your tracking link</h2>
         | 
| 45 | 
            +
                  <button id="copy-btn" class="btn btn-info btn-sm" data-clipboard-target="#long_url">
         | 
| 46 | 
            +
                    <span class="glyphicon glyphicon-copy"></span>
         | 
| 47 | 
            +
                  </button>
         | 
| 48 | 
            +
                </div>
         | 
| 42 49 | 
             
              </div>
         | 
| 43 | 
            -
            </div>
         | 
| 44 50 |  | 
| 45 | 
            -
            <%= render partial: 'darjeelink/short_links/short_link_form' %>
         | 
| 51 | 
            +
              <%= render partial: 'darjeelink/short_links/short_link_form', locals: { f: f, short_link: @short_link } %>
         | 
| 52 | 
            +
             | 
| 53 | 
            +
              <div>
         | 
| 54 | 
            +
                <%= f.submit "Create Tracking Link", class: "btn btn-primary" %>
         | 
| 55 | 
            +
              </div>
         | 
| 56 | 
            +
            <% end %>
         | 
| 46 57 |  | 
| 47 58 | 
             
            <script>
         | 
| 48 59 | 
             
              new ClipboardJS('#copy-btn');
         | 
| @@ -0,0 +1,26 @@ | |
| 1 | 
            +
            {
         | 
| 2 | 
            +
              "ignored_warnings": [
         | 
| 3 | 
            +
                {
         | 
| 4 | 
            +
                  "warning_type": "Mass Assignment",
         | 
| 5 | 
            +
                  "warning_code": 70,
         | 
| 6 | 
            +
                  "fingerprint": "4c710243b0d9f3f174b1b0b465dcd19aca14b1f1a9658572b13a1172855b6ed7",
         | 
| 7 | 
            +
                  "check_name": "MassAssignment",
         | 
| 8 | 
            +
                  "message": "Parameters should be whitelisted for mass assignment",
         | 
| 9 | 
            +
                  "file": "app/controllers/darjeelink/short_links_controller.rb",
         | 
| 10 | 
            +
                  "line": 83,
         | 
| 11 | 
            +
                  "link": "https://brakemanscanner.org/docs/warning_types/mass_assignment/",
         | 
| 12 | 
            +
                  "code": "params.permit!",
         | 
| 13 | 
            +
                  "render_path": null,
         | 
| 14 | 
            +
                  "location": {
         | 
| 15 | 
            +
                    "type": "method",
         | 
| 16 | 
            +
                    "class": "Darjeelink::ShortLinksController",
         | 
| 17 | 
            +
                    "method": "build_url"
         | 
| 18 | 
            +
                  },
         | 
| 19 | 
            +
                  "user_input": null,
         | 
| 20 | 
            +
                  "confidence": "Medium",
         | 
| 21 | 
            +
                  "note": "The params aren't being use to create a record, we just use it to merge params that might be present on the shortened url and the source url"
         | 
| 22 | 
            +
                }
         | 
| 23 | 
            +
              ],
         | 
| 24 | 
            +
              "updated": "2020-07-23 16:52:33 +0000",
         | 
| 25 | 
            +
              "brakeman_version": "4.8.2"
         | 
| 26 | 
            +
            }
         | 
| @@ -14,13 +14,15 @@ Darjeelink.configure do |config| | |
| 14 14 | 
             
                'sms-blast': 'SMS Blast',
         | 
| 15 15 | 
             
                'google-advert': 'Google advert',
         | 
| 16 16 | 
             
                'instagram-advert': 'Instagram Advert',
         | 
| 17 | 
            -
                 | 
| 18 | 
            -
                 | 
| 19 | 
            -
                 | 
| 20 | 
            -
                 | 
| 21 | 
            -
                 | 
| 17 | 
            +
                chatbot: 'Chatbot',
         | 
| 18 | 
            +
                template: 'Template',
         | 
| 19 | 
            +
                other: 'Other',
         | 
| 20 | 
            +
                spotify: 'Spotify',
         | 
| 21 | 
            +
                youtube: 'Youtube',
         | 
| 22 22 | 
             
                'google-search': 'Google search',
         | 
| 23 | 
            -
                'google-display': 'Google display'
         | 
| 23 | 
            +
                'google-display': 'Google display',
         | 
| 24 | 
            +
                'snapchat-advert': 'Snapchat Advert',
         | 
| 25 | 
            +
                'digitalorganiser-share': 'Digital Organiser'
         | 
| 24 26 | 
             
              }
         | 
| 25 27 |  | 
| 26 28 | 
             
              config.auth_domain = ENV['AUTH_DOMAIN']
         | 
| @@ -2,11 +2,7 @@ | |
| 2 2 |  | 
| 3 3 | 
             
            module Darjeelink
         | 
| 4 4 | 
             
              class Configuration
         | 
| 5 | 
            -
                attr_accessor :domain
         | 
| 6 | 
            -
                attr_accessor :source_mediums
         | 
| 7 | 
            -
                attr_accessor :auth_domain
         | 
| 8 | 
            -
                attr_accessor :rebrandly_api_key
         | 
| 9 | 
            -
                attr_accessor :fallback_url
         | 
| 5 | 
            +
                attr_accessor :domain, :source_mediums, :auth_domain, :rebrandly_api_key, :fallback_url
         | 
| 10 6 |  | 
| 11 7 | 
             
                def initialize
         | 
| 12 8 | 
             
                  @domain = nil
         | 
    
        data/lib/darjeelink/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,29 +1,29 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: darjeelink
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0.11. | 
| 4 | 
            +
              version: 0.11.10
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - James Hulme
         | 
| 8 | 
            -
            autorequire: | 
| 8 | 
            +
            autorequire:
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-02-24 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 | 
            -
              name:  | 
| 14 | 
            +
              name: omniauth
         | 
| 15 15 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 16 16 | 
             
                requirements:
         | 
| 17 | 
            -
                - - " | 
| 17 | 
            +
                - - "~>"
         | 
| 18 18 | 
             
                  - !ruby/object:Gem::Version
         | 
| 19 | 
            -
                    version: ' | 
| 19 | 
            +
                    version: '1.9'
         | 
| 20 20 | 
             
              type: :runtime
         | 
| 21 21 | 
             
              prerelease: false
         | 
| 22 22 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 23 23 | 
             
                requirements:
         | 
| 24 | 
            -
                - - " | 
| 24 | 
            +
                - - "~>"
         | 
| 25 25 | 
             
                  - !ruby/object:Gem::Version
         | 
| 26 | 
            -
                    version: ' | 
| 26 | 
            +
                    version: '1.9'
         | 
| 27 27 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 28 28 | 
             
              name: omniauth-google-oauth2
         | 
| 29 29 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -58,14 +58,14 @@ dependencies: | |
| 58 58 | 
             
                requirements:
         | 
| 59 59 | 
             
                - - "~>"
         | 
| 60 60 | 
             
                  - !ruby/object:Gem::Version
         | 
| 61 | 
            -
                    version: 5 | 
| 61 | 
            +
                    version: '5'
         | 
| 62 62 | 
             
              type: :runtime
         | 
| 63 63 | 
             
              prerelease: false
         | 
| 64 64 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 65 65 | 
             
                requirements:
         | 
| 66 66 | 
             
                - - "~>"
         | 
| 67 67 | 
             
                  - !ruby/object:Gem::Version
         | 
| 68 | 
            -
                    version: 5 | 
| 68 | 
            +
                    version: '5'
         | 
| 69 69 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 70 70 | 
             
              name: rebrandly
         | 
| 71 71 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -122,6 +122,20 @@ dependencies: | |
| 122 122 | 
             
                - - ">="
         | 
| 123 123 | 
             
                  - !ruby/object:Gem::Version
         | 
| 124 124 | 
             
                    version: '0'
         | 
| 125 | 
            +
            - !ruby/object:Gem::Dependency
         | 
| 126 | 
            +
              name: brakeman
         | 
| 127 | 
            +
              requirement: !ruby/object:Gem::Requirement
         | 
| 128 | 
            +
                requirements:
         | 
| 129 | 
            +
                - - ">="
         | 
| 130 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 131 | 
            +
                    version: '0'
         | 
| 132 | 
            +
              type: :development
         | 
| 133 | 
            +
              prerelease: false
         | 
| 134 | 
            +
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 135 | 
            +
                requirements:
         | 
| 136 | 
            +
                - - ">="
         | 
| 137 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 138 | 
            +
                    version: '0'
         | 
| 125 139 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 126 140 | 
             
              name: bundler-audit
         | 
| 127 141 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -178,7 +192,7 @@ dependencies: | |
| 178 192 | 
             
                - - ">="
         | 
| 179 193 | 
             
                  - !ruby/object:Gem::Version
         | 
| 180 194 | 
             
                    version: '0'
         | 
| 181 | 
            -
            description: | 
| 195 | 
            +
            description:
         | 
| 182 196 | 
             
            email:
         | 
| 183 197 | 
             
            - james@38degrees.org.uk
         | 
| 184 198 | 
             
            executables: []
         | 
| @@ -210,6 +224,7 @@ files: | |
| 210 224 | 
             
            - app/views/darjeelink/short_links/new.html.erb
         | 
| 211 225 | 
             
            - app/views/darjeelink/tracking_links/new.erb
         | 
| 212 226 | 
             
            - app/views/layouts/darjeelink/application.html.erb
         | 
| 227 | 
            +
            - config/brakeman.ignore
         | 
| 213 228 | 
             
            - config/initializers/darjeelink.rb
         | 
| 214 229 | 
             
            - config/initializers/omniauth.rb
         | 
| 215 230 | 
             
            - config/initializers/rebrandly.rb
         | 
| @@ -223,11 +238,11 @@ files: | |
| 223 238 | 
             
            - lib/darjeelink/engine.rb
         | 
| 224 239 | 
             
            - lib/darjeelink/version.rb
         | 
| 225 240 | 
             
            - lib/tasks/darjeelink.rake
         | 
| 226 | 
            -
            homepage: https:// | 
| 241 | 
            +
            homepage: https://github.com/38degrees/darjeelink
         | 
| 227 242 | 
             
            licenses:
         | 
| 228 243 | 
             
            - MIT
         | 
| 229 244 | 
             
            metadata: {}
         | 
| 230 | 
            -
            post_install_message: | 
| 245 | 
            +
            post_install_message:
         | 
| 231 246 | 
             
            rdoc_options: []
         | 
| 232 247 | 
             
            require_paths:
         | 
| 233 248 | 
             
            - lib
         | 
| @@ -235,16 +250,15 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 235 250 | 
             
              requirements:
         | 
| 236 251 | 
             
              - - ">="
         | 
| 237 252 | 
             
                - !ruby/object:Gem::Version
         | 
| 238 | 
            -
                  version: ' | 
| 253 | 
            +
                  version: '2.6'
         | 
| 239 254 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 240 255 | 
             
              requirements:
         | 
| 241 256 | 
             
              - - ">="
         | 
| 242 257 | 
             
                - !ruby/object:Gem::Version
         | 
| 243 258 | 
             
                  version: '0'
         | 
| 244 259 | 
             
            requirements: []
         | 
| 245 | 
            -
             | 
| 246 | 
            -
             | 
| 247 | 
            -
            signing_key: 
         | 
| 260 | 
            +
            rubygems_version: 3.0.8
         | 
| 261 | 
            +
            signing_key:
         | 
| 248 262 | 
             
            specification_version: 4
         | 
| 249 263 | 
             
            summary: URL Shortener
         | 
| 250 264 | 
             
            test_files: []
         |