From 6e9e4e91969b6bded27562c3f7b60b20e4def872 Mon Sep 17 00:00:00 2001 From: b-solution Date: Mon, 26 Apr 2021 11:51:09 +0500 Subject: [PATCH 1/3] Fixed build in dev mode --- .gitignore | 22 ++ .ruby-version | 1 + Gemfile | 4 +- Gemfile.lock | 289 +++++++++--------- app/assets/javascripts/visitors.coffee | 3 - .../stylesheets/admin/font-awesome.scss | 6 +- app/controllers/devise/sessions_controller.rb | 34 +-- app/views/layouts/base.html.erb | 2 +- app/views/shared/_head.html.erb | 44 ++- app/views/visitor_log/index.html.erb | 3 +- .../partials/_filter_form.html.erb | 2 +- config/database.yml | 4 +- config/environments/development.rb | 3 +- config/initializers/assets.rb | 4 +- db/schema.rb | 34 ++- .../dataTables.responsive.min.js | 1 - yarn.lock | 4 + 17 files changed, 254 insertions(+), 206 deletions(-) create mode 100644 .ruby-version delete mode 100644 app/assets/javascripts/visitors.coffee delete mode 100644 vendor/assets/javascripts/plugin/datatable-responsive/dataTables.responsive.min.js create mode 100644 yarn.lock diff --git a/.gitignore b/.gitignore index dcc5b36..f1bed20 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,29 @@ !/log/.keep !/tmp/.keep +# Ignore uploaded files in development +/storage/* +!/storage/.keep + /node_modules /yarn-error.log +/public/assets .byebug_history + +# Ignore master key for decrypting credentials and more. +/config/master.key + +/public/packs +/public/packs-test +/node_modules +/yarn-error.log +yarn-debug.log* +.yarn-integrity + +# Ignore env files +.env + +# Ignore mac .DS_Store files +.DS_Store +*/.DS_Store diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..aedc15b --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.5.3 diff --git a/Gemfile b/Gemfile index 900a104..798a150 100644 --- a/Gemfile +++ b/Gemfile @@ -88,7 +88,7 @@ gem 'prawn-print' # Environment variables gem 'figaro' gem 'elastic-apm' - gem 'letter_opener' +gem 'letter_opener' gem 'pry-rails' gem 'rails-pry' -gem "jquery-fileupload-rails" \ No newline at end of file +gem "jquery-fileupload-rails" diff --git a/Gemfile.lock b/Gemfile.lock index 33812b8..e42161e 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -16,62 +16,63 @@ GIT GEM remote: https://rubygems.org/ specs: - actioncable (5.2.3) - actionpack (= 5.2.3) + actioncable (5.2.5) + actionpack (= 5.2.5) nio4r (~> 2.0) websocket-driver (>= 0.6.1) - actionmailer (5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) + actionmailer (5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) mail (~> 2.5, >= 2.5.4) rails-dom-testing (~> 2.0) - actionpack (5.2.3) - actionview (= 5.2.3) - activesupport (= 5.2.3) - rack (~> 2.0) + actionpack (5.2.5) + actionview (= 5.2.5) + activesupport (= 5.2.5) + rack (~> 2.0, >= 2.0.8) rack-test (>= 0.6.3) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.2) - actionview (5.2.3) - activesupport (= 5.2.3) + actionview (5.2.5) + activesupport (= 5.2.5) builder (~> 3.1) erubi (~> 1.4) rails-dom-testing (~> 2.0) rails-html-sanitizer (~> 1.0, >= 1.0.3) - activejob (5.2.3) - activesupport (= 5.2.3) + activejob (5.2.5) + activesupport (= 5.2.5) globalid (>= 0.3.6) - activemodel (5.2.3) - activesupport (= 5.2.3) - activerecord (5.2.3) - activemodel (= 5.2.3) - activesupport (= 5.2.3) + activemodel (5.2.5) + activesupport (= 5.2.5) + activerecord (5.2.5) + activemodel (= 5.2.5) + activesupport (= 5.2.5) arel (>= 9.0) - activestorage (5.2.3) - actionpack (= 5.2.3) - activerecord (= 5.2.3) - marcel (~> 0.3.1) - activesupport (5.2.3) + activestorage (5.2.5) + actionpack (= 5.2.5) + activerecord (= 5.2.5) + marcel (~> 1.0.0) + activesupport (5.2.5) concurrent-ruby (~> 1.0, >= 1.0.2) i18n (>= 0.7, < 2) minitest (~> 5.1) tzinfo (~> 1.1) addressable (2.7.0) public_suffix (>= 2.0.2, < 5.0) - ajax-datatables-rails (1.0.0) - railties (>= 4.2) - annotate (2.7.5) + ajax-datatables-rails (1.3.1) + zeitwerk + annotate (3.1.1) activerecord (>= 3.2, < 7.0) - rake (>= 10.4, < 13.0) + rake (>= 10.4, < 14.0) arel (9.0.0) - bcrypt (3.1.13) + bcrypt (3.1.16) bindex (0.8.1) bootstrap3-datetimepicker-rails (4.17.47) momentjs-rails (>= 2.8.1) - breadcrumbs_on_rails (3.0.1) - builder (3.2.3) - byebug (11.0.1) + breadcrumbs_on_rails (4.1.0) + railties (>= 5.0) + builder (3.2.4) + byebug (11.1.3) capybara (2.18.0) addressable mini_mime (>= 0.1.3) @@ -79,16 +80,16 @@ GEM rack (>= 1.0.0) rack-test (>= 0.5.4) xpath (>= 2.0, < 4.0) - carrierwave (2.0.1) + carrierwave (2.2.1) activemodel (>= 5.0.0) activesupport (>= 5.0.0) addressable (~> 2.6) image_processing (~> 1.1) - mimemagic (>= 0.3.0) + marcel (~> 1.0.0) mini_mime (>= 0.1.3) - childprocess (2.0.0) - rake (< 13.0) - coderay (1.1.2) + ssrf_filter (~> 1.0) + childprocess (3.0.0) + coderay (1.1.3) coffee-rails (5.0.0) coffee-script (>= 2.2.0) railties (>= 5.2.0) @@ -96,9 +97,9 @@ GEM coffee-script-source execjs coffee-script-source (1.12.2) - concurrent-ruby (1.1.5) - crass (1.0.5) - devise (4.7.1) + concurrent-ruby (1.1.8) + crass (1.0.6) + devise (4.7.3) bcrypt (~> 3.0) orm_adapter (~> 0.1) railties (>= 4.1.0) @@ -106,36 +107,47 @@ GEM warden (~> 1.2.3) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) - elastic-apm (2.10.1) + elastic-apm (3.15.1) concurrent-ruby (~> 1.0) http (>= 3.0) - erubi (1.8.0) + erubi (1.10.0) execjs (2.7.0) - faraday (0.15.4) + faraday (1.4.1) + faraday-excon (~> 1.1) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.1) multipart-post (>= 1.2, < 3) - ffi (1.11.1) - figaro (1.1.1) - thor (~> 0.14) + ruby2_keywords (>= 0.0.4) + faraday-excon (1.1.0) + faraday-net_http (1.0.1) + faraday-net_http_persistent (1.1.0) + ffi (1.15.0) + ffi-compiler (1.0.1) + ffi (>= 1.0.0) + rake + figaro (1.2.0) + thor (>= 0.14.0, < 2) globalid (0.4.2) activesupport (>= 4.2.0) - hashie (3.6.0) - http (4.1.1) + hashie (4.1.0) + http (4.4.1) addressable (~> 2.3) http-cookie (~> 1.0) - http-form_data (~> 2.0) - http_parser.rb (~> 0.6.0) + http-form_data (~> 2.2) + http-parser (~> 1.2.0) http-cookie (1.0.3) domain_name (~> 0.5) - http-form_data (2.1.1) - http_parser.rb (0.6.0) - i18n (1.6.0) + http-form_data (2.3.0) + http-parser (1.2.3) + ffi-compiler (>= 1.0, < 2.0) + i18n (1.8.10) concurrent-ruby (~> 1.0) - image_processing (1.9.3) + image_processing (1.12.1) mini_magick (>= 4.9.5, < 5) - ruby-vips (>= 2.0.13, < 3) + ruby-vips (>= 2.0.17, < 3) jSignature (0.0.6) - jbuilder (2.9.1) - activesupport (>= 4.2.0) + jbuilder (2.11.2) + activesupport (>= 5.0.0) jpeg_camera (1.3.2) railties (>= 3.1) jquery-datatables-rails (3.4.0) @@ -147,50 +159,47 @@ GEM actionpack (>= 3.1) railties (>= 3.1) sassc - jquery-rails (4.3.5) + jquery-rails (4.4.0) rails-dom-testing (>= 1, < 3) railties (>= 4.2.0) thor (>= 0.14, < 2.0) jwt (1.5.6) - launchy (2.4.3) - addressable (~> 2.3) + launchy (2.5.0) + addressable (~> 2.7) letter_opener (1.7.0) launchy (~> 2.2) listen (3.1.5) rb-fsevent (~> 0.9, >= 0.9.4) rb-inotify (~> 0.9, >= 0.9.7) ruby_dep (~> 1.2) - loofah (2.3.1) + loofah (2.9.1) crass (~> 1.0.2) nokogiri (>= 1.5.9) mail (2.7.1) mini_mime (>= 0.1.1) - marcel (0.3.3) - mimemagic (~> 0.3.2) - method_source (0.9.2) - mimemagic (0.3.3) - mini_magick (4.9.5) - mini_mime (1.0.2) - mini_portile2 (2.4.0) - minitest (5.11.3) + marcel (1.0.1) + method_source (1.0.0) + mini_magick (4.11.0) + mini_mime (1.1.0) + minitest (5.14.4) momentjs-rails (2.20.1) railties (>= 3.1) - multi_json (1.13.1) + multi_json (1.15.0) multi_xml (0.6.0) multipart-post (2.1.1) - mysql2 (0.5.2) - nio4r (2.5.2) - nokogiri (1.10.8) - mini_portile2 (~> 2.4.0) - oauth (0.5.4) - oauth2 (1.4.1) - faraday (>= 0.8, < 0.16.0) + mysql2 (0.5.3) + nio4r (2.5.7) + nokogiri (1.11.3-x86_64-darwin) + racc (~> 1.4) + oauth (0.5.6) + oauth2 (1.4.7) + faraday (>= 0.8, < 2.0) jwt (>= 1.0, < 3.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) - omniauth (1.9.0) - hashie (>= 3.4.6, < 3.7.0) + omniauth (1.9.1) + hashie (>= 3.4.6) rack (>= 1.6.2, < 3) omniauth-facebook (4.0.0) omniauth-oauth2 (~> 1.2) @@ -204,9 +213,9 @@ GEM omniauth-oauth2 (>= 1.3.1) omniauth-linkedin-oauth2 (1.0.0) omniauth-oauth2 - omniauth-oauth (1.1.0) + omniauth-oauth (1.2.0) oauth - omniauth (~> 1.0) + omniauth (>= 1.0, < 3) omniauth-oauth2 (1.3.1) oauth2 (~> 1.0) omniauth (~> 1.2) @@ -214,71 +223,73 @@ GEM omniauth-oauth (~> 1.1) rack orm_adapter (0.5.0) - pdf-core (0.7.0) - prawn (2.2.2) - pdf-core (~> 0.7.0) - ttfunk (~> 1.5) + pdf-core (0.9.0) + prawn (2.4.0) + pdf-core (~> 0.9.0) + ttfunk (~> 1.7) prawn-print (0.0.3) prawn (>= 0.12.0) - prawn-rails (1.3.0) + prawn-rails (1.4.0) prawn prawn-table - rails (>= 3.1.0) + railties (>= 3.1.0) prawn-table (0.2.2) prawn (>= 1.3.0, < 3.0.0) - pry (0.12.2) - coderay (~> 1.1.0) - method_source (~> 0.9.0) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) pry-rails (0.3.9) pry (>= 0.10.4) - public_suffix (4.0.1) - puma (4.3.3) + public_suffix (4.0.6) + puma (5.2.2) nio4r (~> 2.0) - rack (2.0.8) + racc (1.5.2) + rack (2.2.3) rack-test (1.1.0) rack (>= 1.0, < 3) - rails (5.2.3) - actioncable (= 5.2.3) - actionmailer (= 5.2.3) - actionpack (= 5.2.3) - actionview (= 5.2.3) - activejob (= 5.2.3) - activemodel (= 5.2.3) - activerecord (= 5.2.3) - activestorage (= 5.2.3) - activesupport (= 5.2.3) + rails (5.2.5) + actioncable (= 5.2.5) + actionmailer (= 5.2.5) + actionpack (= 5.2.5) + actionview (= 5.2.5) + activejob (= 5.2.5) + activemodel (= 5.2.5) + activerecord (= 5.2.5) + activestorage (= 5.2.5) + activesupport (= 5.2.5) bundler (>= 1.3.0) - railties (= 5.2.3) + railties (= 5.2.5) sprockets-rails (>= 2.0.0) rails-dom-testing (2.0.3) activesupport (>= 4.2.0) nokogiri (>= 1.6) - rails-html-sanitizer (1.2.0) - loofah (~> 2.2, >= 2.2.2) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) rails-pry (0.0.1) - railties (5.2.3) - actionpack (= 5.2.3) - activesupport (= 5.2.3) + railties (5.2.5) + actionpack (= 5.2.5) + activesupport (= 5.2.5) method_source rake (>= 0.8.7) thor (>= 0.19.0, < 2.0) - rake (12.3.3) - rb-fsevent (0.10.3) - rb-inotify (0.10.0) + rake (13.0.3) + rb-fsevent (0.10.4) + rb-inotify (0.10.1) ffi (~> 1.0) - redis (4.1.3) - request_store (1.4.1) + redis (4.2.5) + request_store (1.5.0) rack (>= 1.4) - responders (3.0.0) + responders (3.0.1) actionpack (>= 5.0) railties (>= 5.0) - ruby-vips (2.0.15) - ffi (~> 1.9) + ruby-vips (2.1.0) + ffi (~> 1.12) + ruby2_keywords (0.0.4) ruby_dep (1.5.0) - rubyzip (1.3.0) + rubyzip (2.3.0) sass-rails (6.0.0) sassc-rails (~> 2.1, >= 2.1.1) - sassc (2.2.1) + sassc (2.4.0) ffi (~> 1.9) sassc-rails (2.1.2) railties (>= 4.0.0) @@ -286,52 +297,54 @@ GEM sprockets (> 3.0) sprockets-rails tilt - selenium-webdriver (3.142.4) - childprocess (>= 0.5, < 3.0) - rubyzip (~> 1.2, >= 1.2.2) - spring (2.1.0) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + spring (2.1.1) spring-watcher-listen (2.0.1) listen (>= 2.7, < 4.0) spring (>= 1.2, < 3.0) - sprockets (3.7.2) + sprockets (4.0.2) concurrent-ruby (~> 1.0) rack (> 1, < 3) - sprockets-rails (3.2.1) + sprockets-rails (3.2.2) actionpack (>= 4.0) activesupport (>= 4.0) sprockets (>= 3.0.0) - thor (0.20.3) + ssrf_filter (1.0.7) + thor (1.1.0) thread_safe (0.3.6) - tilt (2.0.9) - ttfunk (1.5.1) + tilt (2.0.10) + ttfunk (1.7.0) turbolinks (5.2.1) turbolinks-source (~> 5.2) turbolinks-source (5.2.0) - tzinfo (1.2.5) + tzinfo (1.2.9) thread_safe (~> 0.1) - uglifier (4.1.20) + uglifier (4.2.0) execjs (>= 0.3.0, < 3) unf (0.1.4) unf_ext - unf_ext (0.0.7.6) - warden (1.2.8) - rack (>= 2.0.6) + unf_ext (0.0.7.7) + warden (1.2.9) + rack (>= 2.0.9) web-console (3.7.0) actionview (>= 5.0) activemodel (>= 5.0) bindex (>= 0.4.0) railties (>= 5.0) - websocket-driver (0.7.1) + websocket-driver (0.7.3) websocket-extensions (>= 0.1.0) - websocket-extensions (0.1.4) - will_paginate (3.1.8) + websocket-extensions (0.1.5) + will_paginate (3.3.0) will_paginate-bootstrap (1.0.2) will_paginate (>= 3.0.3) xpath (3.2.0) nokogiri (~> 1.8) + zeitwerk (2.4.2) PLATFORMS - ruby + x86_64-darwin-20 DEPENDENCIES ajax-datatables-rails @@ -387,4 +400,4 @@ RUBY VERSION ruby 2.5.3p105 BUNDLED WITH - 2.0.1 + 2.2.16 diff --git a/app/assets/javascripts/visitors.coffee b/app/assets/javascripts/visitors.coffee deleted file mode 100644 index 24f83d1..0000000 --- a/app/assets/javascripts/visitors.coffee +++ /dev/null @@ -1,3 +0,0 @@ -# Place all the behaviors and hooks related to the matching controller here. -# All this logic will automatically be available in application.js. -# You can use CoffeeScript in this file: http://coffeescript.org/ diff --git a/app/assets/stylesheets/admin/font-awesome.scss b/app/assets/stylesheets/admin/font-awesome.scss index f7e1447..afd73e1 100644 --- a/app/assets/stylesheets/admin/font-awesome.scss +++ b/app/assets/stylesheets/admin/font-awesome.scss @@ -1,6 +1,6 @@ /*! * SmartAdmin v1.8.2 () - * Copyright 2011-2016 + * Copyright 2011-2016 */ /*! * Font Awesome 4.2.0 by @davegandy - http://fontawesome.io - @fontawesome @@ -8,8 +8,8 @@ */ @font-face { font-family: 'FontAwesome'; - src: asset-url('font-awesome/fontawesome-webfont.eot?v=4.5.0'); - src: asset-url('font-awesome/fontawesome-webfont.eot?v=4.5.0#iefix') format('embedded-opentype'), asset-url('font-awesome/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), asset-url('font-awesome/fontawesome-webfont.woff?v=4.5.0') format('woff'), asset-url('font-awesome/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), asset-url('font-awesome/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); + src: font-url('font-awesome/fontawesome-webfont.eot?v=4.5.0'); + src: font-url('font-awesome/fontawesome-webfont.eot?v=4.5.0#iefix') format('embedded-opentype'), font-url('font-awesome/fontawesome-webfont.woff2?v=4.5.0') format('woff2'), font-url('font-awesome/fontawesome-webfont.woff?v=4.5.0') format('woff'), font-url('font-awesome/fontawesome-webfont.ttf?v=4.5.0') format('truetype'), font-url('font-awesome/fontawesome-webfont.svg?v=4.5.0#fontawesomeregular') format('svg'); font-weight: normal; font-style: normal; } diff --git a/app/controllers/devise/sessions_controller.rb b/app/controllers/devise/sessions_controller.rb index d65e468..2c73084 100644 --- a/app/controllers/devise/sessions_controller.rb +++ b/app/controllers/devise/sessions_controller.rb @@ -6,19 +6,19 @@ class Devise::SessionsController < DeviseController prepend_before_action :verify_signed_out_user, only: :destroy prepend_before_action(only: [:create, :destroy]) { request.env["devise.skip_timeout"] = true } # prepend_before_action :check_captcha, only: [:create] if ENV['RECAPTCHA_PUBLIC_KEY'].present? - prepend_before_action :check_whitelists, only: [:create] - prepend_before_action :check_blacklists, only: [:create] + # prepend_before_action :check_whitelists, only: [:create] + # prepend_before_action :check_blacklists, only: [:create] # GET /resource/sign_in def new @page_content = AdminLoginPage.first - + self.resource = resource_class.new(sign_in_params) clean_up_passwords(resource) yield resource if block_given? respond_with(resource, serialize_options(resource)) end - + # POST /resource/sign_in def create self.resource = warden.authenticate!(auth_options) @@ -27,7 +27,7 @@ def create yield resource if block_given? respond_with resource, location: after_sign_in_path_for(resource) end - + # DELETE /resource/sign_out def destroy signed_out = (Devise.sign_out_all_scopes ? sign_out : sign_out(resource_name)) @@ -35,30 +35,30 @@ def destroy yield if block_given? respond_to_on_destroy end - + protected - + def sign_in_params devise_parameter_sanitizer.sanitize(:sign_in) end - + def serialize_options(resource) methods = resource_class.authentication_keys.dup methods = methods.keys if methods.is_a?(Hash) methods << :password if resource.respond_to?(:password) { methods: methods, only: [:password] } end - + def auth_options { scope: resource_name, recall: "#{controller_path}#new" } end - + def translation_scope 'devise.sessions' end - + private - + # Check if there is no signed in user before doing the sign out. # # If there is no signed in user, it will set the flash message and redirect @@ -66,17 +66,17 @@ def translation_scope def verify_signed_out_user if all_signed_out? set_flash_message! :notice, :already_signed_out - + respond_to_on_destroy end end - + def all_signed_out? users = Devise.mappings.keys.map { |s| warden.user(scope: s, run_callbacks: false) } - + users.all?(&:blank?) end - + def respond_to_on_destroy # We actually need to hardcode this as Rails default responder doesn't # support returning empty response on GET request @@ -115,4 +115,4 @@ def regexp_match?(list, remote_ip, b = true) end false end -end \ No newline at end of file +end diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 417c654..5700e89 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -57,7 +57,7 @@ <%= render partial: 'shared/footer' %> -<%= javascript_include_tag 'admin/smart_admin' %> +<%#= javascript_include_tag 'admin/smart_admin' %> + diff --git a/config/database.yml b/config/database.yml index 437bc13..7dfdd83 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,7 +3,7 @@ production: database: mvms_prod host: localhost username: root - password: admin + password: encoding: utf8 development: @@ -11,7 +11,7 @@ development: database: mvms_dev host: localhost username: root - password: admin + password: encoding: utf8 pool: 25 diff --git a/config/environments/development.rb b/config/environments/development.rb index e8c685e..d26eb1d 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -40,7 +40,8 @@ # Debug mode disables concatenation and preprocessing of assets. # This option may cause significant delays in view rendering with a large # number of complex assets. - config.assets.debug = true + config.assets.debug = false + config.assets.check_precompiled_asset = false # Suppress logger output for asset requests. config.assets.quiet = true diff --git a/config/initializers/assets.rb b/config/initializers/assets.rb index d5b0dc1..4611f51 100644 --- a/config/initializers/assets.rb +++ b/config/initializers/assets.rb @@ -11,6 +11,6 @@ # Precompile additional assets. # application.js, application.css, and all non-JS/CSS in the app/assets # folder are already added. -Rails.application.config.assets.precompile += %w( signature.js admin/*) -Rails.application.config.assets.precompile += %w( lightbox/* ) +Rails.application.config.assets.precompile += %w(signature.js admin/*) +Rails.application.config.assets.precompile += %w(lightbox/*) Rails.application.config.assets.precompile += %w(jquery.tagsinput.css jquery.tagsinput.js ) diff --git a/db/schema.rb b/db/schema.rb index 3fb5479..ec42b75 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,9 +10,9 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20190326063445) do +ActiveRecord::Schema.define(version: 2020_01_15_104348) do - create_table "admin_login_pages", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "admin_login_pages", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "section_1_image" t.text "section_1_body" t.string "section_1_file" @@ -25,25 +25,29 @@ t.datetime "updated_at", null: false end - create_table "companies", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "companies", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "people", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "images", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| + end + + create_table "people", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false + t.string "email" end - create_table "reasons", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "reasons", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name" t.datetime "created_at", null: false t.datetime "updated_at", null: false end - create_table "settings", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "settings", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name" t.text "value" t.datetime "created_at", null: false @@ -51,7 +55,7 @@ t.string "setting_type" end - create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "users", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "email", default: "", null: false t.string "encrypted_password", default: "", null: false t.string "reset_password_token" @@ -70,12 +74,15 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "avatar" + t.string "provider", limit: 50, default: "", null: false + t.string "uid", limit: 500, default: "", null: false + t.boolean "state", default: false t.index ["email"], name: "index_users_on_email", unique: true t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true t.index ["unlock_token"], name: "index_users_on_unlock_token", unique: true end - create_table "visitor_visit_informations", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "visitor_visit_informations", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.integer "visitor_id" t.datetime "date" t.string "visit_reason" @@ -87,10 +94,16 @@ t.datetime "sign_in_date" t.datetime "sign_out_date" t.string "recorded_by" + t.string "name" + t.string "phone" + t.string "company" + t.boolean "updated", default: false + t.boolean "info_updated", default: false + t.boolean "first_visit", default: true t.index ["visitor_id"], name: "index_visitor_visit_informations_on_visitor_id" end - create_table "visitors", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t| + create_table "visitors", options: "ENGINE=InnoDB DEFAULT CHARSET=utf8", force: :cascade do |t| t.string "name" t.string "company" t.string "phone" @@ -98,8 +111,9 @@ t.datetime "created_at", null: false t.datetime "updated_at", null: false t.string "us_citizen" - t.text "avatar" + t.binary "avatar" t.text "person_signature" + t.boolean "info_updated", default: false end end diff --git a/vendor/assets/javascripts/plugin/datatable-responsive/dataTables.responsive.min.js b/vendor/assets/javascripts/plugin/datatable-responsive/dataTables.responsive.min.js deleted file mode 100644 index 87caf8c..0000000 --- a/vendor/assets/javascripts/plugin/datatable-responsive/dataTables.responsive.min.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";function ResponsiveDatatablesHelper(a,b,c){"string"==typeof a?this.tableElement=$(a):this.tableElement=a,this.api=this.tableElement.dataTable().api(),this.columnIndexes=[],this.columnsShownIndexes=[],this.columnsHiddenIndexes=[],this.currentBreakpoint="",this.lastBreakpoint="",this.lastColumnsHiddenIndexes=[];var d=window.location.pathname.split("/").pop(),e=this.api.settings().context[0];this.tableId=e.sTableId,this.saveState=e.oInit.bStateSave,this.cookieName="DataTablesResponsiveHelper_"+this.tableId+(d?"_"+d:""),this.lastStateExists=!1,this.expandColumn=void 0,this.origBreakpointsDefs=void 0,this.breakpoints={},this.options={"hideEmptyColumnsInRowDetail":!1,"clickOn":"icon","showDetail":null,"hideDetail":null},this.expandIconTemplate='',this.rowTemplate='',this.rowLiTemplate='
  • :
  • ',this.disabled=!0,this.skipNextWindowsWidthChange=!1,this.init(b,c)}ResponsiveDatatablesHelper.prototype.init=function(a,b){this.origBreakpointsDefs=a,this.initBreakpoints(),this.disable(!1),$.extend(this.options,b)},ResponsiveDatatablesHelper.prototype.initBreakpoints=function(){if(this.saveState&&this.getState(),!this.lastStateExists){var a=[];for(var b in this.origBreakpointsDefs)a.push({"name":b,"upperLimit":this.origBreakpointsDefs[b],"columnsToHide":[]});a.sort(function(a,b){return a.upperLimit-b.upperLimit});for(var c=0,d=0;dd;d++)this.breakpoints[a[d].name]=a[d];var f=this.api.columns().header(),g=[];for(d=0,e=f.length;e>d;d++)this.api.column(d).visible()&&(this.columnIndexes.push(d),g.push(f[d]));for(var h=0;he.lowerLimit)&&(!e.upperLimit||b<=e.upperLimit)&&(this.currentBreakpoint=e.name,c=e.columnsToHide)}var f=!1;if(!this.skipNextWindowsWidthChange)if(0===this.lastBreakpoint.length&&c.length)f=!0;else if(this.lastBreakpoint!=this.currentBreakpoint)f=!0;else if(this.columnsHiddenIndexes.length!==c.length)f=!0;else{var g=this.difference(this.columnsHiddenIndexes,c).length,h=this.difference(c,this.columnsHiddenIndexes).length;f=g+h>0}f&&(this.skipNextWindowsWidthChange=!0,this.columnsHiddenIndexes=c,this.columnsShownIndexes=this.difference(this.columnIndexes,this.columnsHiddenIndexes),this.showHideColumns(),this.lastBreakpoint=this.currentBreakpoint,this.setState(),this.skipNextWindowsWidthChange=!1),this.columnsHiddenIndexes.length?(this.tableElement.addClass("has-columns-hidden"),$("tr.detail-show",this.tableElement).each(function(b,c){var d=$(c);0===d.next(".row-detail").length&&ResponsiveDatatablesHelper.prototype.showRowDetail(a,d)})):(this.tableElement.removeClass("has-columns-hidden"),$("tr.row-detail",this.tableElement).each(function(b){ResponsiveDatatablesHelper.prototype.hideRowDetail(a,$(this).prev())}))}},ResponsiveDatatablesHelper.prototype.showHideColumns=function(){for(var a=0,b=this.columnsShownIndexes.length;b>a;a++)this.api.column(this.columnsShownIndexes[a]).visible(!0);for(var a=0,b=this.columnsHiddenIndexes.length;b>a;a++)this.api.column(this.columnsHiddenIndexes[a]).visible(!1);var c=this;$("tr.row-detail",this.tableElement).each(function(){ResponsiveDatatablesHelper.prototype.hideRowDetail(c,$(this).prev())}),this.tableElement.hasClass("has-columns-hidden")&&$("tr.detail-show",this.tableElement).each(function(a,b){ResponsiveDatatablesHelper.prototype.showRowDetail(c,$(b))})},ResponsiveDatatablesHelper.prototype.createExpandIcon=function(a){if(!this.disabled)for(var b=$("td",a),c=0,d=b.length;d>c;c++){var e=b[c],f=this.api.cell(e).index().column;if(e=$(e),f===this.expandColumn){if(0==$("span.responsiveExpander",e).length)switch(e.prepend(this.expandIconTemplate),this.options.clickOn){case"cell":e.on("click",{"responsiveDatatablesHelperInstance":this},this.showRowDetailEventHandler);break;case"row":$(a).on("click",{"responsiveDatatablesHelperInstance":this},this.showRowDetailEventHandler);break;default:e.on("click","span.responsiveExpander",{"responsiveDatatablesHelperInstance":this},this.showRowDetailEventHandler)}break}}},ResponsiveDatatablesHelper.prototype.showRowDetailEventHandler=function(a){var b=a.data.responsiveDatatablesHelperInstance;if(!b.disabled){var c=$(this);if(c.closest("table").hasClass("has-columns-hidden")){var d=c.closest("tr");d.hasClass("detail-show")?ResponsiveDatatablesHelper.prototype.hideRowDetail(b,d):ResponsiveDatatablesHelper.prototype.showRowDetail(b,d),d.toggleClass("detail-show"),a.stopPropagation()}}},ResponsiveDatatablesHelper.prototype.showRowDetail=function(a,b){for(var c=a.api,d=c.columns().header(),e=$(a.rowTemplate),f=$("ul",e),g=0;go;o++){var q=m[o];q.nodeType===Node.ELEMENT_NODE&&"SELECT"===q.tagName&&(n[o].selectedIndex=q.selectedIndex)}$(".columnValue",k).append(n).data("originalTdSource",j),k.attr("data-column",h);var r=$(j).attr("class");"undefined"!==r&&r!==!1&&""!==r&&k.addClass(r),f.append(k)}}var s=a.columnIndexes.length-a.columnsHiddenIndexes.length;e.find("> td").attr("colspan",s),b.after(e),a.options.showDetail&&a.options.showDetail(e)},ResponsiveDatatablesHelper.prototype.hideRowDetail=function(a,b){var c=b.next(".row-detail");a.options.hideDetail&&a.options.hideDetail(c),c.find("li").each(function(){var a=$(this).find("span.columnValue"),b=a.contents(),c=a.data("originalTdSource");$(c).empty().append(b)}),c.remove()},ResponsiveDatatablesHelper.prototype.disable=function(a){this.disabled=void 0===a||a,this.disabled?(this.setWindowsResizeHandler(!1),$("tbody tr.row-detail",this.tableElement).remove(),$("tbody tr",this.tableElement).removeClass("detail-show"),$("tbody tr span.responsiveExpander",this.tableElement).remove(),this.columnsHiddenIndexes=[],this.columnsShownIndexes=this.columnIndexes,this.showHideColumns(),this.tableElement.removeClass("has-columns-hidden"),this.tableElement.off("click","span.responsiveExpander",this.showRowDetailEventHandler)):this.setWindowsResizeHandler()},ResponsiveDatatablesHelper.prototype.getState=function(){var a=JSON.parse(localStorage.getItem(this.cookieName));a&&(this.columnIndexes=a.columnIndexes,this.breakpoints=a.breakpoints,this.expandColumn=a.expandColumn,this.lastBreakpoint=a.lastBreakpoint,this.lastStateExists=!0)},ResponsiveDatatablesHelper.prototype.setState=function(){var a=this.difference(this.lastColumnsHiddenIndexes,this.columnsHiddenIndexes).length,b=this.difference(this.columnsHiddenIndexes,this.lastColumnsHiddenIndexes).length;if(a+b>0){var c={"columnIndexes":this.columnIndexes,"columnsHiddenIndexes":this.columnsHiddenIndexes,"breakpoints":this.breakpoints,"expandColumn":this.expandColumn,"lastBreakpoint":this.lastBreakpoint};localStorage.setItem(this.cookieName,JSON.stringify(c)),this.lastColumnsHiddenIndexes=this.columnsHiddenIndexes.slice(0)}},ResponsiveDatatablesHelper.prototype.difference=function(a,b){var c,d=[],e={};for(c=b.length-1;c>=0;c--)e[b[c]]=!0;for(c=a.length-1;c>=0;c--)e[a[c]]!==!0&&d.push(a[c]);return d}; \ No newline at end of file diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..fb57ccd --- /dev/null +++ b/yarn.lock @@ -0,0 +1,4 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + From 33903a08e79602fb65c796134c76038541a1bb5b Mon Sep 17 00:00:00 2001 From: b-solution Date: Sat, 1 May 2021 08:03:55 +0500 Subject: [PATCH 2/3] Added Luxand cloud api for face recognition --- .gitignore | 2 + Gemfile | 1 + Gemfile.lock | 5 ++ app/controllers/welcome_controller.rb | 27 +++++++ app/models/visitor.rb | 6 ++ .../luxand_cloud_face_recognition_service.rb | 67 +++++++++++++++++ .../partials/_capture_picture.html.erb | 68 ++++++++++++----- app/views/welcome/visitor_signout.html.erb | 75 ++++++++++++------- config/routes.rb | 3 +- ...1_add_luxand_cloud_person_id_to_visitor.rb | 5 ++ db/schema.rb | 3 +- 11 files changed, 215 insertions(+), 47 deletions(-) create mode 100644 app/services/luxand_cloud_face_recognition_service.rb create mode 100644 db/migrate/20210430124531_add_luxand_cloud_person_id_to_visitor.rb diff --git a/.gitignore b/.gitignore index f1bed20..1765970 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ /yarn-error.log /public/assets +/public/visitors +/public/temp/ .byebug_history # Ignore master key for decrypting credentials and more. diff --git a/Gemfile b/Gemfile index 798a150..6463d63 100644 --- a/Gemfile +++ b/Gemfile @@ -43,6 +43,7 @@ group :development, :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '~> 2.13' gem 'selenium-webdriver' + gem 'dotenv-rails' end group :development do diff --git a/Gemfile.lock b/Gemfile.lock index e42161e..29c4c37 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -107,6 +107,10 @@ GEM warden (~> 1.2.3) domain_name (0.5.20190701) unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.6) + dotenv-rails (2.7.6) + dotenv (= 2.7.6) + railties (>= 3.2) elastic-apm (3.15.1) concurrent-ruby (~> 1.0) http (>= 3.0) @@ -357,6 +361,7 @@ DEPENDENCIES coffee-rails devise devise_security_extension! + dotenv-rails elastic-apm figaro jSignature diff --git a/app/controllers/welcome_controller.rb b/app/controllers/welcome_controller.rb index b820eb1..efb15be 100644 --- a/app/controllers/welcome_controller.rb +++ b/app/controllers/welcome_controller.rb @@ -250,4 +250,31 @@ def check_email } end end + + def recognize_visitor + save_temp_image + result = LuxandCloudFaceRecognitionService.new.recognize("#{ENV["BASE_URL"]}/temp/temp_img.jpg") + File.delete(File.join(Rails.root, 'public', 'temp', "temp_img.jpg")) + if result.present? + visitor = Visitor.find_by(luxand_cloud_person_id: result[0]["id"]) + render json: {success: true, visitor: visitor } + else + render json: {success: false, errors: 'Visitor Not found or no missed visit found' } + end + end + + private + + def save_temp_image + storage_path = File.join(Rails.root, "public") + path = storage_path + "/temp" + FileUtils.mkdir_p(path) unless File.directory?(path) + image = path + "/temp_img.jpg" + unless FileTest.exist?(image) + if params["person_image_url"] + data = StringIO.new( Base64.decode64(params["person_image_url"].sub('data:image/jpeg;base64', '') )) + File.open(File.join(Rails.root, 'public', 'temp', "temp_img.jpg"), 'wb') { |f| f.write data.read } + end + end + end end diff --git a/app/models/visitor.rb b/app/models/visitor.rb index 9d40b59..cfe6bcf 100644 --- a/app/models/visitor.rb +++ b/app/models/visitor.rb @@ -75,6 +75,7 @@ class Visitor < ApplicationRecord after_create do save_image_avatar + create_luxand_cloud_person end def name @@ -203,4 +204,9 @@ def save_image_avatar end end + def create_luxand_cloud_person + person = LuxandCloudFaceRecognitionService.new.create_person(self.name) + self.update(luxand_cloud_person_id: person["id"]) + face_details = LuxandCloudFaceRecognitionService.new.add_face_to_person(self.luxand_cloud_person_id, "#{ENV["BASE_URL"]}/visitors/visitor_#{self.id}.jpg") + end end diff --git a/app/services/luxand_cloud_face_recognition_service.rb b/app/services/luxand_cloud_face_recognition_service.rb new file mode 100644 index 0000000..465fad8 --- /dev/null +++ b/app/services/luxand_cloud_face_recognition_service.rb @@ -0,0 +1,67 @@ +require 'uri' +require 'net/http' +require 'openssl' + +class LuxandCloudFaceRecognitionService + + def initialize + end + + def recognize(image_url) + begin + url = URI("https://luxand-cloud-face-recognition.p.rapidapi.com/photo/search") + + http = Net::HTTP.new(url.host, url.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_NONE + + request = Net::HTTP::Post.new(url) + request["content-type"] = 'application/x-www-form-urlencoded' + request["x-rapidapi-key"] = ENV['RAPID_API_KEY'] + request["x-rapidapi-host"] = 'luxand-cloud-face-recognition.p.rapidapi.com' + request.body = "photo=#{image_url}" + + response = http.request(request) + puts response.read_body + JSON.parse(response.read_body) + rescue StandardError => e + puts e + end + end + + def create_person(name) + url = URI("https://luxand-cloud-face-recognition.p.rapidapi.com/subject") + + http = Net::HTTP.new(url.host, url.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_NONE + + request = Net::HTTP::Post.new(url) + request["content-type"] = 'application/x-www-form-urlencoded' + request["x-rapidapi-key"] = ENV['RAPID_API_KEY'] + request["x-rapidapi-host"] = 'luxand-cloud-face-recognition.p.rapidapi.com' + request.body = "name=#{name}" + + response = http.request(request) + puts response.read_body + JSON.parse(response.read_body) + end + + def add_face_to_person(person_id, image_url) + url = URI("https://luxand-cloud-face-recognition.p.rapidapi.com/subject/#{person_id}") + + http = Net::HTTP.new(url.host, url.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_NONE + + request = Net::HTTP::Post.new(url) + request["content-type"] = 'application/x-www-form-urlencoded' + request["x-rapidapi-key"] = ENV['RAPID_API_KEY'] + request["x-rapidapi-host"] = 'luxand-cloud-face-recognition.p.rapidapi.com' + request.body = "photo=#{image_url}" + + response = http.request(request) + puts response.read_body + JSON.parse(response.read_body) + end +end diff --git a/app/views/welcome/partials/_capture_picture.html.erb b/app/views/welcome/partials/_capture_picture.html.erb index 19b2e68..1308988 100644 --- a/app/views/welcome/partials/_capture_picture.html.erb +++ b/app/views/welcome/partials/_capture_picture.html.erb @@ -170,24 +170,56 @@ console.log('time = '+ (new Date().getTime() / 1000)) canvas = $('#overlay').get(0); console.log('time = '+ (new Date().getTime() / 1000)) - results = await faceapi.detectAllFaces($('#inputImg').get(0), getFaceDetectorOptions()).withFaceLandmarks().withFaceDescriptors(); - if(results.length > 0) - { - console.log('time = '+ (new Date().getTime() / 1000)) - resizedResults = resizeCanvasAndResults($('#inputImg').get(0), canvas, results) - descriptor = resizedResults[0].descriptor; - console.log('time = '+ (new Date().getTime() / 1000)) - if (faceMatchers) { await fetch_matcher(results); } - else{ await populate_and_fetch_matcher(results); } - } - else - { - alert('We did not detect your face. please try again') - $( '#person_image' ).hide() - $('#person_image_camera').show(); - $('#email_row').show(); - $('.webcamjs-ios-placeholder').css('background-image', "url('/images/camera.png')") - } + + var params = { + person_image_url: $('#inputImg')[0]['src'] + }; + + $.ajax({ + contentType: "application/json; charset=utf-8", + url: "/recognize_visitor.json", + type: "POST", + data: JSON.stringify(params), + dataType: "json", + success: function(result){ + console.log(result); + if(result['success']){ + $('#camera_msg').hide() + $('#msg_welcome').show(); + $('#email_row').show() + $('#visitor_firstname').html(result.visitor.name) + $('#capture_person_email').val(result.visitor.email) + } + else + { + alert('Your face was not recognized. Please enter your email in the box below.') + $('#email_row').show() + $('#capture_next_btn').show() + } + } + }) + + + + + // results = await faceapi.detectAllFaces($('#inputImg').get(0), getFaceDetectorOptions()).withFaceLandmarks().withFaceDescriptors(); + // if(results.length > 0) + // { + // console.log('time = '+ (new Date().getTime() / 1000)) + // resizedResults = resizeCanvasAndResults($('#inputImg').get(0), canvas, results) + // descriptor = resizedResults[0].descriptor; + // console.log('time = '+ (new Date().getTime() / 1000)) + // if (faceMatchers) { await fetch_matcher(results); } + // else{ await populate_and_fetch_matcher(results); } + // } + // else + // { + // alert('We did not detect your face. please try again') + // $( '#person_image' ).hide() + // $('#person_image_camera').show(); + // $('#email_row').show(); + // $('.webcamjs-ios-placeholder').css('background-image', "url('/images/camera.png')") + // } $('#loading').hide() console.log('time = '+ (new Date().getTime() / 1000)) } diff --git a/app/views/welcome/visitor_signout.html.erb b/app/views/welcome/visitor_signout.html.erb index 070d23a..69a765e 100644 --- a/app/views/welcome/visitor_signout.html.erb +++ b/app/views/welcome/visitor_signout.html.erb @@ -162,34 +162,55 @@ var retries = 0; /* TODO add processing */ async function updateQueryImageResults() { - retries++; - $('#loading').show() - canvas = $('#overlay').get(0); - results = await faceapi.detectAllFaces($('#inputImgq').get(0), getFaceDetectorOptions()).withFaceLandmarks().withFaceDescriptors(); - if(results.length > 0) - { - resizedResults = resizeCanvasAndResults($('#inputImgq').get(0), canvas, results) - descriptor = resizedResults[0].descriptor; - if (faceMatchers) { await fetch_matcher(); } - else{ await populate_and_fetch_matcher(); } - } - else - { - if( retries < 3) - { - alert('We did not detect your face. please try again') - $( '#person_image' ).hide() - $('#person_image_camera').show(); - } - else - { - alert('Your face was not recognized. Please enter your email in the box below.') - $('#email_row').show() - $('#capture_next_btn').show() - } + $('#loading').show() + console.log('time = '+ (new Date().getTime() / 1000)) + canvas = $('#overlay').get(0); + console.log('time = '+ (new Date().getTime() / 1000)) + var params = { + person_image_url: $('#inputImg')[0]['src'] + }; + $.ajax({ + contentType: "application/json; charset=utf-8", + url: "/recognize_visitor.json", + type: "POST", + data: JSON.stringify(params), + dataType: "json", + success: function(result){ + console.log(result); + if(result['success']){ + $('#capture_person_name').val(result.visitor.email) + $('#email_row').show().val(result.visitor.email); + $('#capture_next_btn').show(); + } + else + { + alert('Your face was not recognized. Please enter your email in the box below.') + $('#email_row').show() + $('#capture_next_btn').show() + } } - $('#loading').hide() - } + }) + // results = await faceapi.detectAllFaces($('#inputImg').get(0), getFaceDetectorOptions()).withFaceLandmarks().withFaceDescriptors(); + // if(results.length > 0) + // { + // console.log('time = '+ (new Date().getTime() / 1000)) + // resizedResults = resizeCanvasAndResults($('#inputImg').get(0), canvas, results) + // descriptor = resizedResults[0].descriptor; + // console.log('time = '+ (new Date().getTime() / 1000)) + // if (faceMatchers) { await fetch_matcher(results); } + // else{ await populate_and_fetch_matcher(results); } + // } + // else + // { + // alert('We did not detect your face. please try again') + // $( '#person_image' ).hide() + // $('#person_image_camera').show(); + // $('#email_row').show(); + // $('.webcamjs-ios-placeholder').css('background-image', "url('/images/camera.png')") + // } + $('#loading').hide() + console.log('time = '+ (new Date().getTime() / 1000)) + } async function fetch_matcher(){ found = false; for(i=0; i Date: Sat, 1 May 2021 18:27:41 +0500 Subject: [PATCH 3/3] Fixed build for production --- app/controllers/devise/sessions_controller.rb | 4 ++-- app/views/layouts/base.html.erb | 2 +- app/views/visitor_log/index.html.erb | 2 +- app/views/visitor_log/partials/_filter_form.html.erb | 2 +- config/database.yml | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/controllers/devise/sessions_controller.rb b/app/controllers/devise/sessions_controller.rb index 2c73084..79bef82 100644 --- a/app/controllers/devise/sessions_controller.rb +++ b/app/controllers/devise/sessions_controller.rb @@ -6,8 +6,8 @@ class Devise::SessionsController < DeviseController prepend_before_action :verify_signed_out_user, only: :destroy prepend_before_action(only: [:create, :destroy]) { request.env["devise.skip_timeout"] = true } # prepend_before_action :check_captcha, only: [:create] if ENV['RECAPTCHA_PUBLIC_KEY'].present? - # prepend_before_action :check_whitelists, only: [:create] - # prepend_before_action :check_blacklists, only: [:create] + prepend_before_action :check_whitelists, only: [:create] + prepend_before_action :check_blacklists, only: [:create] # GET /resource/sign_in def new diff --git a/app/views/layouts/base.html.erb b/app/views/layouts/base.html.erb index 5700e89..417c654 100644 --- a/app/views/layouts/base.html.erb +++ b/app/views/layouts/base.html.erb @@ -57,7 +57,7 @@ <%= render partial: 'shared/footer' %> -<%#= javascript_include_tag 'admin/smart_admin' %> +<%= javascript_include_tag 'admin/smart_admin' %> diff --git a/config/database.yml b/config/database.yml index 7dfdd83..437bc13 100644 --- a/config/database.yml +++ b/config/database.yml @@ -3,7 +3,7 @@ production: database: mvms_prod host: localhost username: root - password: + password: admin encoding: utf8 development: @@ -11,7 +11,7 @@ development: database: mvms_dev host: localhost username: root - password: + password: admin encoding: utf8 pool: 25