We're contacting you to notify you that your password has been changed.
4 |
--------------------------------------------------------------------------------
/app/views/relationships/create.js.erb:
--------------------------------------------------------------------------------
1 | $("#follow_form").html("<%= escape_javascript(render('actors/unfollow')) %>");
2 | $("#followers").html('<%= @actor.followers %>');
3 |
--------------------------------------------------------------------------------
/app/views/relationships/destroy.js.erb:
--------------------------------------------------------------------------------
1 | $("#follow_form").html("<%= escape_javascript(render('actors/follow')) %>");
2 | $("#followers").html('<%= @actor.followers %>');
3 |
--------------------------------------------------------------------------------
/config/cable.yml:
--------------------------------------------------------------------------------
1 | development:
2 | adapter: async
3 |
4 | test:
5 | adapter: async
6 |
7 | production:
8 | adapter: redis
9 | url: redis://localhost:6379/1
10 |
--------------------------------------------------------------------------------
/db/migrate/20170928121704_add_img_to_actors.rb:
--------------------------------------------------------------------------------
1 | class AddImgToActors < ActiveRecord::Migration[5.0]
2 | def change
3 | add_column :actors, :img, :string
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20170928122658_remove_img_from_actors.rb:
--------------------------------------------------------------------------------
1 | class RemoveImgFromActors < ActiveRecord::Migration[5.0]
2 | def change
3 | remove_column :actors, :img
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20170923031648_rename_actor_type.rb:
--------------------------------------------------------------------------------
1 | class RenameActorType < ActiveRecord::Migration[5.0]
2 | def change
3 | rename_column :actors, :type, :actor_type
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/db/migrate/20171106072830_add_username_to_users.rb:
--------------------------------------------------------------------------------
1 | class AddUsernameToUsers < ActiveRecord::Migration[5.0]
2 | def change
3 | add_column :users, :username, :string
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/config/initializers/session_store.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | Rails.application.config.session_store :cookie_store, key: '_jav-library-rails_session'
4 |
--------------------------------------------------------------------------------
/config/initializers/mime_types.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new mime types for use in respond_to blocks:
4 | # Mime::Type.register "text/richtext", :rtf
5 |
--------------------------------------------------------------------------------
/db/migrate/20170928122204_add_javbus_label_to_actors.rb:
--------------------------------------------------------------------------------
1 | class AddJavbusLabelToActors < ActiveRecord::Migration[5.0]
2 | def change
3 | add_column :actors, :javbus_label, :string
4 | end
5 | end
6 |
--------------------------------------------------------------------------------
/test/controllers/actors_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class ActorsControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/controllers/news_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class NewsControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/controllers/stars_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class StarsControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/controllers/users_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class UsersControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/test/controllers/videos_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class VideosControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/app/controllers/news_controller.rb:
--------------------------------------------------------------------------------
1 | class NewsController < ApplicationController
2 | def show
3 |
4 | end
5 |
6 | def create
7 |
8 | end
9 |
10 | def destroy
11 |
12 | end
13 | end
14 |
--------------------------------------------------------------------------------
/test/controllers/welcome_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class WelcomeControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/news.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the news controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/stars.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the stars controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/users.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the users controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/videos.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the videos controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/test/controllers/relationships_controller_test.rb:
--------------------------------------------------------------------------------
1 | require 'test_helper'
2 |
3 | class RelationshipsControllerTest < ActionDispatch::IntegrationTest
4 | # test "the truth" do
5 | # assert true
6 | # end
7 | end
8 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/welcome.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the welcome controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/app/controllers/stars_controller.rb:
--------------------------------------------------------------------------------
1 | class StarsController < ApplicationController
2 | def index
3 | @stars = Star.all
4 | end
5 |
6 | def show
7 | @star = Star.find(params[:id])
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/db/migrate/20170923022344_create_genres.rb:
--------------------------------------------------------------------------------
1 | class CreateGenres < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :genres do |t|
4 | t.string :name
5 | t.timestamps
6 | end
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/app/controllers/welcome_controller.rb:
--------------------------------------------------------------------------------
1 | class WelcomeController < ApplicationController
2 | def index
3 | # flash[:notice] = "早安!你好!"
4 | end
5 |
6 | def rss
7 | # Add rss controller here
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/relationships.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the Relationships controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # See http://www.robotstxt.org/robotstxt.html for documentation on how to use the robots.txt file
2 | #
3 | # To ban all spiders from the entire site uncomment the next two lines:
4 | # User-agent: *
5 | # Disallow: /
6 |
--------------------------------------------------------------------------------
/app/assets/javascripts/news.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/stars.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/users.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/config/initializers/filter_parameter_logging.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Configure sensitive parameters which will be filtered from the log file.
4 | Rails.application.config.filter_parameters += [:password]
5 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | # Add your own tasks in files placed in lib/tasks ending in .rake,
2 | # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3 |
4 | require_relative 'config/application'
5 |
6 | Rails.application.load_tasks
7 |
--------------------------------------------------------------------------------
/app/assets/javascripts/actors.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/videos.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/welcome.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/app/assets/javascripts/relationships.coffee:
--------------------------------------------------------------------------------
1 | # Place all the behaviors and hooks related to the matching controller here.
2 | # All this logic will automatically be available in application.js.
3 | # You can use CoffeeScript in this file: http://coffeescript.org/
4 |
--------------------------------------------------------------------------------
/bin/rake:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | require_relative '../config/boot'
8 | require 'rake'
9 | Rake.application.run
10 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/confirmation_instructions.html.erb:
--------------------------------------------------------------------------------
1 |
Welcome <%= @email %>!
2 |
3 |
You can confirm your account email through the link below:
4 |
5 |
<%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %>
6 |
--------------------------------------------------------------------------------
/db/migrate/20170922091734_create_labels.rb:
--------------------------------------------------------------------------------
1 | class CreateLabels < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :labels do |t|
4 | t.string :video_label
5 | t.boolean :downloaded
6 | t.timestamps
7 | end
8 | end
9 | end
10 |
--------------------------------------------------------------------------------
/db/migrate/20170922124028_create_actors.rb:
--------------------------------------------------------------------------------
1 | class CreateActors < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :actors do |t|
4 | t.string :name
5 | t.string :actor_label
6 | t.string :type
7 | t.timestamps
8 | end
9 | end
10 | end
11 |
--------------------------------------------------------------------------------
/db/migrate/20171120130511_create_news.rb:
--------------------------------------------------------------------------------
1 | class CreateNews < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :news do |t|
4 | t.string :title
5 | t.text :content
6 | t.string :publisher
7 |
8 | t.timestamps
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/config/initializers/application_controller_renderer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # ActiveSupport::Reloader.to_prepare do
4 | # ApplicationController.renderer.defaults.merge!(
5 | # http_host: 'example.org',
6 | # https: false
7 | # )
8 | # end
9 |
--------------------------------------------------------------------------------
/db/migrate/20170923053510_add_videos_actors_table.rb:
--------------------------------------------------------------------------------
1 | class AddVideosActorsTable < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :actors_videos, id: false do |t|
4 | t.belongs_to :video, index: true
5 | t.belongs_to :actor, index: true
6 | end
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/db/migrate/20170923053646_add_videos_genres_table.rb:
--------------------------------------------------------------------------------
1 | class AddVideosGenresTable < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :genres_videos, id: false do |t|
4 | t.belongs_to :video, index: true
5 | t.belongs_to :genre, index: true
6 | end
7 | end
8 | end
9 |
--------------------------------------------------------------------------------
/config/initializers/cookies_serializer.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Specify a serializer for the signed and encrypted cookie jars.
4 | # Valid options are :json, :marshal, and :hybrid.
5 | Rails.application.config.action_dispatch.cookies_serializer = :json
6 |
--------------------------------------------------------------------------------
/db/migrate/20170924132742_create_stars.rb:
--------------------------------------------------------------------------------
1 | class CreateStars < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :stars do |t|
4 | t.string :name
5 | t.string :rank
6 | t.string :img
7 | t.string :actor_label
8 | t.timestamps
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/actors.scss:
--------------------------------------------------------------------------------
1 | // Place all the styles related to the actors controller here.
2 | // They will automatically be included in application.css.
3 | // You can use Sass (SCSS) here: http://sass-lang.com/
4 | #chart-wrapper {
5 | position: relative;
6 | width: 800px;
7 | height: 400px;
8 | }
9 |
--------------------------------------------------------------------------------
/bin/rails:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | begin
3 | load File.expand_path('../spring', __FILE__)
4 | rescue LoadError => e
5 | raise unless e.message.include?('spring')
6 | end
7 | APP_PATH = File.expand_path('../config/application', __dir__)
8 | require_relative '../config/boot'
9 | require 'rails/commands'
10 |
--------------------------------------------------------------------------------
/app/views/common/_flashes.html.erb:
--------------------------------------------------------------------------------
1 | <% if flash.any? %>
2 | <% user_facing_flashes.each do |key, value| %>
3 |
11 |
--------------------------------------------------------------------------------
/db/migrate/20171109091006_add_actors_and_users_table.rb:
--------------------------------------------------------------------------------
1 | class AddActorsAndUsersTable < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :actors_users do |t|
4 | t.belongs_to :actor, index: true
5 | t.belongs_to :user, index: true
6 |
7 | t.timestamps
8 | end
9 |
10 | add_index :actors_users, [:actor_id, :user_id], unique: true
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/db/seeds.rb:
--------------------------------------------------------------------------------
1 | # This file should contain all the record creation needed to seed the database with its default values.
2 | # The data can then be loaded with the rails db:seed command (or created alongside the database with db:setup).
3 | #
4 | # Examples:
5 | #
6 | # movies = Movie.create([{ name: 'Star Wars' }, { name: 'Lord of the Rings' }])
7 | # Character.create(name: 'Luke', movie: movies.first)
8 |
--------------------------------------------------------------------------------
/test/fixtures/actors.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/fixtures/genres.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/fixtures/labels.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/fixtures/news.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/fixtures/stars.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/fixtures/users.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/test/fixtures/videos.yml:
--------------------------------------------------------------------------------
1 | # Read about fixtures at http://api.rubyonrails.org/classes/ActiveRecord/FixtureSet.html
2 |
3 | # This model initially had no columns defined. If you add columns to the
4 | # model remove the '{}' from the fixture names and add the columns immediately
5 | # below each fixture, per the syntax in the comments below
6 | #
7 | one: {}
8 | # column: value
9 | #
10 | two: {}
11 | # column: value
12 |
--------------------------------------------------------------------------------
/app/assets/javascripts/cable.js:
--------------------------------------------------------------------------------
1 | // Action Cable provides the framework to deal with WebSockets in Rails.
2 | // You can generate new channels where WebSocket features live using the rails generate channel command.
3 | //
4 | //= require action_cable
5 | //= require_self
6 | //= require_tree ./channels
7 |
8 | (function() {
9 | this.App || (this.App = {});
10 |
11 | App.cable = ActionCable.createConsumer();
12 |
13 | }).call(this);
14 |
--------------------------------------------------------------------------------
/app/models/video.rb:
--------------------------------------------------------------------------------
1 | class Video < ApplicationRecord
2 | validates :video_id, uniqueness: true
3 |
4 | has_and_belongs_to_many :genres
5 | has_and_belongs_to_many :actors
6 |
7 | has_and_belongs_to_many :users, -> { distinct }
8 |
9 |
10 | def actors_string
11 | result = String.new
12 | self.actors.each do |actor|
13 | result << actor.name << " "
14 | end
15 |
16 | result.strip
17 | end
18 |
19 | end
20 |
--------------------------------------------------------------------------------
/db/migrate/20170922124434_create_videos.rb:
--------------------------------------------------------------------------------
1 | class CreateVideos < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :videos do |t|
4 | t.string :video_id
5 | t.string :video_name
6 | t.string :release_date
7 | t.string :length
8 | t.string :director
9 | t.string :maker
10 | t.string :label
11 | t.string :rating
12 | t.string :img
13 | t.timestamps
14 | end
15 | end
16 | end
17 |
--------------------------------------------------------------------------------
/config/initializers/backtrace_silencers.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4 | # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5 |
6 | # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7 | # Rails.backtrace_cleaner.remove_silencers!
8 |
--------------------------------------------------------------------------------
/app/views/devise/mailer/reset_password_instructions.html.erb:
--------------------------------------------------------------------------------
1 |
Hello <%= @resource.email %>!
2 |
3 |
Someone has requested a link to change your password. You can do this through the link below.
4 |
5 |
<%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %>
6 |
7 |
If you didn't request this, please ignore this email.
8 |
Your password won't change until you access the link above and create a new one.
23 |
--------------------------------------------------------------------------------
/config/initializers/inflections.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Add new inflection rules using the following format. Inflections
4 | # are locale specific, and you may define rules for as many different
5 | # locales as you wish. All of these examples are active by default:
6 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
7 | # inflect.plural /^(ox)$/i, '\1en'
8 | # inflect.singular /^(ox)en/i, '\1'
9 | # inflect.irregular 'person', 'people'
10 | # inflect.uncountable %w( fish sheep )
11 | # end
12 |
13 | # These inflection rules are supported but not enabled by default:
14 | # ActiveSupport::Inflector.inflections(:en) do |inflect|
15 | # inflect.acronym 'RESTful'
16 | # end
17 |
--------------------------------------------------------------------------------
/config/locales/en.yml:
--------------------------------------------------------------------------------
1 | # Files in the config/locales directory are used for internationalization
2 | # and are automatically loaded by Rails. If you want to use locales other
3 | # than English, add the necessary files in this directory.
4 | #
5 | # To use the locales, use `I18n.t`:
6 | #
7 | # I18n.t 'hello'
8 | #
9 | # In views, this is aliased to just `t`:
10 | #
11 | # <%= t('hello') %>
12 | #
13 | # To use a different locale, set it with `I18n.locale`:
14 | #
15 | # I18n.locale = :es
16 | #
17 | # This would use the information in config/locales/es.yml.
18 | #
19 | # To learn more, please read the Rails Internationalization guide
20 | # available at http://guides.rubyonrails.org/i18n.html.
21 |
22 | en:
23 | hello: "Hello world"
24 |
--------------------------------------------------------------------------------
/app/views/common/_search.html.erb:
--------------------------------------------------------------------------------
1 |
7 |
15 |
--------------------------------------------------------------------------------
/app/views/layouts/application.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | AVDICT
5 |
6 | <%= csrf_meta_tags %>
7 | <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8 | <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9 |
10 |
11 |
30 |
--------------------------------------------------------------------------------
/config/secrets.yml:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 |
3 | # Your secret key is used for verifying the integrity of signed cookies.
4 | # If you change this key, all old signed cookies will become invalid!
5 |
6 | # Make sure the secret is at least 30 characters and all random,
7 | # no regular words or you'll be exposed to dictionary attacks.
8 | # You can use `rails secret` to generate a secure secret key.
9 |
10 | # Make sure the secrets in this file are kept private
11 | # if you're sharing your code publicly.
12 |
13 | development:
14 | secret_key_base: a83225bcf5e1c46a0cb428827280d913274d7ec9e4a903f73081a60218ddd617595acb0f3604c93ea8a6a94a0164ef5a40c4d56b1386794efd9f800062a0879b
15 |
16 | test:
17 | secret_key_base: 198475e27dd4212af6dcce8fab2ebe74489c678de2767618a6c98c61579e82d65f9c1344dfba9f37217caca9e762729321de818dbc1c83fa70551d8dfe478149
18 |
19 | # Do not keep production secrets in the repository,
20 | # instead read values from the environment.
21 | production:
22 | secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
23 |
--------------------------------------------------------------------------------
/bin/setup:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 | require 'pathname'
3 | require 'fileutils'
4 | include FileUtils
5 |
6 | # path to your application root.
7 | APP_ROOT = Pathname.new File.expand_path('../../', __FILE__)
8 |
9 | def system!(*args)
10 | system(*args) || abort("\n== Command #{args} failed ==")
11 | end
12 |
13 | chdir APP_ROOT do
14 | # This script is a starting point to setup your application.
15 | # Add necessary setup steps to this file.
16 |
17 | puts '== Installing dependencies =='
18 | system! 'gem install bundler --conservative'
19 | system('bundle check') || system!('bundle install')
20 |
21 | # puts "\n== Copying sample files =="
22 | # unless File.exist?('config/database.yml')
23 | # cp 'config/database.yml.sample', 'config/database.yml'
24 | # end
25 |
26 | puts "\n== Preparing database =="
27 | system! 'bin/rails db:setup'
28 |
29 | puts "\n== Removing old logs and tempfiles =="
30 | system! 'bin/rails log:clear tmp:clear'
31 |
32 | puts "\n== Restarting application server =="
33 | system! 'bin/rails restart'
34 | end
35 |
--------------------------------------------------------------------------------
/lib/tasks/star_crawler.rake:
--------------------------------------------------------------------------------
1 | namespace :crawler do
2 | desc 'Download all stars'
3 | task :star => :environment do
4 | Star.delete_all
5 | get_all_stars()
6 | end
7 | end
8 |
9 | # --- Method ---
10 | def get_all_stars
11 | url = "#{$JAVLIBRARY_URL}/cn/star_mostfav.php"
12 |
13 | response = Mechanize.new do |agent|
14 | # Set timeout preference here
15 | agent.open_timeout = 5
16 | agent.read_timeout = 5
17 | end
18 | response.get url
19 |
20 | doc = Nokogiri::HTML(response.page.body.gsub(/( |\s)+/, " "))
21 | doc.search("//div[@class='starbox']/div[@class='searchitem']").each do |item|
22 | star = Star.new
23 | star.id = item.search("./h3").text[1..2].to_i
24 | star.rank = item.search("./h3").text[1..2].to_i
25 | star.img = item.search("./table/tr/td/img")[0].attributes['src'].value
26 | star.name = item.search("./table/tr/td/img")[0].attributes['title'].value
27 | star.actor_label = item.search("./a")[0].attributes['href'].value.split('=')[-1]
28 | star.save
29 | end
30 | end
31 |
--------------------------------------------------------------------------------
/app/views/actors/_genres.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
Genres Statistics
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
42 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 BronyS
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/app/controllers/videos_controller.rb:
--------------------------------------------------------------------------------
1 | class VideosController < ApplicationController
2 | before_action :validate_search_key, only: [:index, :search]
3 | def index
4 | @videos = Video.paginate(:page => params[:page], :per_page => 30)
5 | end
6 |
7 | def show
8 | @video = Video.find(params[:id])
9 | end
10 |
11 | def search
12 | if @query_string.present?
13 | @videos = search_params
14 | end
15 | end
16 |
17 | def fave
18 | @video = Video.find(params[:video_id])
19 | current_user.fave_video(@video.id)
20 | respond_to do |format|
21 | format.html { redirect_to @video }
22 | format.js
23 | end
24 | end
25 |
26 | def unfave
27 | @video = Video.find(params[:video_id])
28 | current_user.unfave_video(@video.id)
29 | respond_to do |format|
30 | format.html { redirect_to @video }
31 | format.js
32 | end
33 | end
34 |
35 | protected
36 | def validate_search_key
37 | @query_string = params[:q].gsub(/\\|\'|\/|\?/, "") if params[:q].present?
38 | end
39 |
40 | def search_params
41 | Video.ransack({:video_id_cont => @query_string}).result(distinct: true)
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/app/views/common/_footer.html.erb:
--------------------------------------------------------------------------------
1 |
19 |
--------------------------------------------------------------------------------
/app/views/actors/_chart.html.erb:
--------------------------------------------------------------------------------
1 |
37 |
--------------------------------------------------------------------------------
/config/initializers/new_framework_defaults.rb:
--------------------------------------------------------------------------------
1 | # Be sure to restart your server when you modify this file.
2 | #
3 | # This file contains migration options to ease your Rails 5.0 upgrade.
4 | #
5 | # Read the Guide for Upgrading Ruby on Rails for more info on each option.
6 |
7 | Rails.application.config.action_controller.raise_on_unfiltered_parameters = true
8 |
9 | # Enable per-form CSRF tokens. Previous versions had false.
10 | Rails.application.config.action_controller.per_form_csrf_tokens = true
11 |
12 | # Enable origin-checking CSRF mitigation. Previous versions had false.
13 | Rails.application.config.action_controller.forgery_protection_origin_check = true
14 |
15 | # Make Ruby 2.4 preserve the timezone of the receiver when calling `to_time`.
16 | # Previous versions had false.
17 | ActiveSupport.to_time_preserves_timezone = true
18 |
19 | # Require `belongs_to` associations by default. Previous versions had false.
20 | Rails.application.config.active_record.belongs_to_required_by_default = true
21 |
22 | # Do not halt callback chains when a callback returns false. Previous versions had true.
23 | ActiveSupport.halt_callback_chains_on_return_false = false
24 |
25 | # Configure SSL options to enable HSTS with subdomains. Previous versions had false.
26 | Rails.application.config.ssl_options = { hsts: { subdomains: true } }
27 |
--------------------------------------------------------------------------------
/app/assets/stylesheets/application.scss:
--------------------------------------------------------------------------------
1 | /*
2 | * This is a manifest file that'll be compiled into application.css, which will include all the files
3 | * listed below.
4 | *
5 | * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6 | * or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
7 | *
8 | * You're free to add application-wide styles to this file and they'll appear at the bottom of the
9 | * compiled file so the styles you add here take precedence over styles defined in any other CSS/SCSS
10 | * files in this directory. Styles in this file should be added after the last require_* statement.
11 | * It is generally better to create a new file per style scope.
12 | *
13 | *= require_tree .
14 | *= require_self
15 | */
16 |
17 | // Example using 'Cerulean' bootswatch
18 |
19 | //Import bootstrap-sprockets
20 | @import "bootstrap-sprockets";
21 |
22 | // Import cerulean variables
23 | @import "bootswatch/flatly/variables";
24 |
25 | // Then bootstrap itself
26 | @import "bootstrap";
27 |
28 | // Bootstrap body padding for fixed navbar
29 | body { padding-top: 70px; }
30 |
31 | // And finally bootswatch style itself
32 | @import "bootswatch/flatly/bootswatch";
33 |
34 | // Whatever application styles you have go last
35 | @import "base";
36 |
37 | // Add font-awesome-rails
38 | @import "font-awesome";
39 |
--------------------------------------------------------------------------------
/app/models/actor.rb:
--------------------------------------------------------------------------------
1 | class Actor < ApplicationRecord
2 | # Actor: actor_label should be unique
3 | validates :actor_label, uniqueness: true
4 |
5 | has_and_belongs_to_many :videos
6 | has_and_belongs_to_many :users, -> { distinct }
7 |
8 | def followers
9 | self.users.size
10 | end
11 |
12 | def first_year
13 | Time.new(self.videos.sort_by(&:release_date).first.release_date).year
14 | end
15 |
16 | def annual
17 | last_time = Time.new.year; annual_info = Hash.new
18 | self.first_year.upto(last_time) do |year|
19 | count = 0
20 | self.videos.map do |video|
21 | count += 1 if video.release_date[0..3] == year.to_s
22 | end
23 | annual_info[year] = count
24 | end
25 |
26 | annual_info
27 | end
28 |
29 | def videos_dataset
30 | info = self.annual; index_result = []; result = {}
31 | info.each { |index, value| index_result << index }
32 | result['labels'] = index_result; result['values'] = info.values
33 | result
34 | end
35 |
36 | def genres_dataset
37 | result = Hash.new; name = Array.new; json = Hash.new
38 |
39 | self.videos.each do |video|
40 | video.genres.each do |genre|
41 | result[genre.name] = 1 if result[genre.name] == nil
42 | result[genre.name] += 1
43 | end
44 | end
45 |
46 | result.each { |index, value| name << index }
47 | json['genres'] = name; json['values'] = result.values
48 | json
49 | end
50 |
51 | end
52 |
--------------------------------------------------------------------------------
/config/database.yml:
--------------------------------------------------------------------------------
1 | default: &default
2 | adapter: mysql2
3 | encoding: utf8
4 | pool: 5
5 | username: root
6 | password: grys003
7 | socket: /var/run/mysqld/mysqld.sock
8 |
9 | development:
10 | <<: *default
11 | database: jav_development
12 |
13 | # Warning: The database defined as "test" will be erased and
14 | # re-generated from your development database when you run "rake".
15 | # Do not set this db to the same as development or production.
16 | test:
17 | <<: *default
18 | database: jav_test
19 |
20 | # As with config/secrets.yml, you never want to store sensitive information,
21 | # like your database password, in your source code. If your source code is
22 | # ever seen by anyone, they now have access to your database.
23 | #
24 | # Instead, provide the password as a unix environment variable when you boot
25 | # the app. Read http://guides.rubyonrails.org/configuring.html#configuring-a-database
26 | # for a full rundown on how to provide these environment variables in a
27 | # production deployment.
28 | #
29 | # On Heroku and other platform providers, you may have a full connection URL
30 | # available as an environment variable. For example:
31 | #
32 | # DATABASE_URL="mysql2://myuser:mypass@localhost/somedatabase"
33 | #
34 | # You can use this database configuration with:
35 | #
36 | # production:
37 | # url: <%= ENV['DATABASE_URL'] %>
38 | #
39 | production:
40 | <<: *default
41 | database: jav_production
42 | username: syhsyh9696
43 | password: <%= ENV['UJN-WECHAT-API_DATABASE_PASSWORD'] %>
44 |
--------------------------------------------------------------------------------
/app/views/devise/shared/_links.html.erb:
--------------------------------------------------------------------------------
1 | <%- if controller_name != 'sessions' %>
2 |
3 | <% end -%>
4 |
5 | <%- if devise_mapping.registerable? && controller_name != 'registrations' %>
6 |
7 | <% end -%>
8 |
9 | <%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
10 |
11 | <% end -%>
12 |
13 | <%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
14 |
15 | <% end -%>
16 |
17 | <%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
18 |
19 | <% end -%>
20 |
21 | <%- if devise_mapping.omniauthable? %>
22 | <%- resource_class.omniauth_providers.each do |provider| %>
23 |
24 | <% end -%>
25 | <% end -%>
26 |
--------------------------------------------------------------------------------
/db/migrate/20171030103803_devise_create_users.rb:
--------------------------------------------------------------------------------
1 | class DeviseCreateUsers < ActiveRecord::Migration[5.0]
2 | def change
3 | create_table :users do |t|
4 | ## Database authenticatable
5 | t.string :email, null: false, default: ""
6 | t.string :encrypted_password, null: false, default: ""
7 |
8 | ## Recoverable
9 | t.string :reset_password_token
10 | t.datetime :reset_password_sent_at
11 |
12 | ## Rememberable
13 | t.datetime :remember_created_at
14 |
15 | ## Trackable
16 | t.integer :sign_in_count, default: 0, null: false
17 | t.datetime :current_sign_in_at
18 | t.datetime :last_sign_in_at
19 | t.string :current_sign_in_ip
20 | t.string :last_sign_in_ip
21 |
22 | ## Confirmable
23 | # t.string :confirmation_token
24 | # t.datetime :confirmed_at
25 | # t.datetime :confirmation_sent_at
26 | # t.string :unconfirmed_email # Only if using reconfirmable
27 |
28 | ## Lockable
29 | # t.integer :failed_attempts, default: 0, null: false # Only if lock strategy is :failed_attempts
30 | # t.string :unlock_token # Only if unlock strategy is :email or :both
31 | # t.datetime :locked_at
32 |
33 |
34 | t.timestamps null: false
35 | end
36 |
37 | add_index :users, :email, unique: true
38 | add_index :users, :reset_password_token, unique: true
39 | # add_index :users, :confirmation_token, unique: true
40 | # add_index :users, :unlock_token, unique: true
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/app/views/welcome/rss.html.erb:
--------------------------------------------------------------------------------
1 |
2 |
AVDICT RSS SUPPORT PAGE
3 |
4 |
5 |
6 |
7 |
8 | Avdict provides RSS service(Avdict RSS) to save your time.
9 |
10 |
11 | AVDICT RSS feeds can, for example, allow you to keep track of many different actors in a single RSS aggregator.
12 | AVDICT use RSS feeds to publish frequently updated information, such as new release videos or the actor who were newly added in the actor list.
13 |
14 |
15 | You can also customize your own RSS feeds by Follow some actors in AVDICT. The customized feeds publish your following's recent published videos.
16 |
If you are the application owner check the logs for more information.
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/config/environments/test.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # The test environment is used exclusively to run your application's
5 | # test suite. You never need to work with it otherwise. Remember that
6 | # your test database is "scratch space" for the test suite and is wiped
7 | # and recreated between test runs. Don't rely on the data there!
8 | config.cache_classes = true
9 |
10 | # Do not eager load code on boot. This avoids loading your whole application
11 | # just for the purpose of running a single test. If you are using a tool that
12 | # preloads Rails for running tests, you may have to set it to true.
13 | config.eager_load = false
14 |
15 | # Configure public file server for tests with Cache-Control for performance.
16 | config.public_file_server.enabled = true
17 | config.public_file_server.headers = {
18 | 'Cache-Control' => 'public, max-age=3600'
19 | }
20 |
21 | # Show full error reports and disable caching.
22 | config.consider_all_requests_local = true
23 | config.action_controller.perform_caching = false
24 |
25 | # Raise exceptions instead of rendering exception templates.
26 | config.action_dispatch.show_exceptions = false
27 |
28 | # Disable request forgery protection in test environment.
29 | config.action_controller.allow_forgery_protection = false
30 | config.action_mailer.perform_caching = false
31 |
32 | # Tell Action Mailer not to deliver emails to the real world.
33 | # The :test delivery method accumulates sent emails in the
34 | # ActionMailer::Base.deliveries array.
35 | config.action_mailer.delivery_method = :test
36 |
37 | # Print deprecation notices to the stderr.
38 | config.active_support.deprecation = :stderr
39 |
40 | # Raises error for missing translations
41 | # config.action_view.raise_on_missing_translations = true
42 | end
43 |
--------------------------------------------------------------------------------
/public/422.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The change you wanted was rejected (422)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The change you wanted was rejected.
62 |
Maybe you tried to change something you didn't have access to.
63 |
64 |
If you are the application owner check the logs for more information.
Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete, class: "form-control" %>
44 |
45 | <%= link_to "Back", :back %>
46 |
47 |
48 |
--------------------------------------------------------------------------------
/public/404.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | The page you were looking for doesn't exist (404)
5 |
6 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
The page you were looking for doesn't exist.
62 |
You may have mistyped the address or the page may have moved.
63 |
64 |
If you are the application owner check the logs for more information.
65 |
66 |
67 |
68 |
--------------------------------------------------------------------------------
/config/puma.rb:
--------------------------------------------------------------------------------
1 | # Puma can serve each request in a thread from an internal thread pool.
2 | # The `threads` method setting takes two numbers a minimum and maximum.
3 | # Any libraries that use thread pools should be configured to match
4 | # the maximum value specified for Puma. Default is set to 5 threads for minimum
5 | # and maximum, this matches the default thread size of Active Record.
6 | #
7 | threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }.to_i
8 | threads threads_count, threads_count
9 |
10 | # Specifies the `port` that Puma will listen on to receive requests, default is 3000.
11 | #
12 | port ENV.fetch("PORT") { 3000 }
13 |
14 | # Specifies the `environment` that Puma will run in.
15 | #
16 | environment ENV.fetch("RAILS_ENV") { "development" }
17 |
18 | # Specifies the number of `workers` to boot in clustered mode.
19 | # Workers are forked webserver processes. If using threads and workers together
20 | # the concurrency of the application would be max `threads` * `workers`.
21 | # Workers do not work on JRuby or Windows (both of which do not support
22 | # processes).
23 | #
24 | # workers ENV.fetch("WEB_CONCURRENCY") { 2 }
25 |
26 | # Use the `preload_app!` method when specifying a `workers` number.
27 | # This directive tells Puma to first boot the application and load code
28 | # before forking the application. This takes advantage of Copy On Write
29 | # process behavior so workers use less memory. If you use this option
30 | # you need to make sure to reconnect any threads in the `on_worker_boot`
31 | # block.
32 | #
33 | # preload_app!
34 |
35 | # The code in the `on_worker_boot` will be called if you are using
36 | # clustered mode by specifying a number of `workers`. After each worker
37 | # process is booted this block will be run, if you are using `preload_app!`
38 | # option you will want to use this block to reconnect to any threads
39 | # or connections that may have been created at application boot, Ruby
40 | # cannot share connections between processes.
41 | #
42 | # on_worker_boot do
43 | # ActiveRecord::Base.establish_connection if defined?(ActiveRecord)
44 | # end
45 |
46 | # Allow puma to be restarted by `rails restart` command.
47 | plugin :tmp_restart
48 |
--------------------------------------------------------------------------------
/app/views/users/show.html.erb:
--------------------------------------------------------------------------------
1 |
Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin. Cred vinyl keffiyeh DIY salvia PBR, banh mi before they sold out farm-to-table VHS viral locavore cosby sweater.
81 |
82 |
83 |
84 |
85 |
--------------------------------------------------------------------------------
/lib/tasks/label_crawler.rake:
--------------------------------------------------------------------------------
1 | namespace :crawler do
2 | desc 'Download all video labels'
3 | task :label => :environment do
4 | create()
5 | end
6 |
7 | desc 'Update all video labels'
8 | task :label_update => :environment do
9 | update()
10 | end
11 |
12 | desc 'Update all new release labels'
13 | task :labels_update_release => :environment do
14 | update_new_release()
15 | end
16 | end
17 |
18 | # --- Method ---
19 | def download_actor_videos_label(actor_id, method)
20 | firsturl = "#{$JAVLIBRARY_URL}/cn/vl_star.php?s=#{actor_id}"
21 | baseurl = "#{$JAVLIBRARY_URL}/cn/vl_star.php?list&mode=2&s=#{actor_id}&page="
22 | response = Mechanize.new do |agent|
23 | # Set timeout preference here
24 | agent.open_timeout = 3
25 | agent.read_timeout = 3
26 | end
27 |
28 | begin
29 | response.get firsturl
30 | rescue
31 | return nil
32 | end
33 |
34 | doc = Nokogiri::HTML(response.page.body)
35 |
36 | # Judge method here(:update, :create)
37 | last_page = 1
38 | last_page = 1 if method == :update
39 | if method == :create
40 | doc.search('//div[@class="page_selector"]/a[@class="page last"]').each do |row|
41 | last_page = row['href'].split("=")[-1].to_i
42 | end
43 | end
44 |
45 | 1.upto(last_page) do |page|
46 | tempurl = baseurl + page.to_s
47 | begin
48 | response.get tempurl
49 | rescue
50 | next
51 | end
52 |
53 | Nokogiri::HTML(response.page.body).search('//div[@class="video"]/a').each do |row|
54 | # Data:
55 | # Video_label: row['href'].split("=")[-1]
56 | # Video_title: row['title']
57 |
58 | label = Label.new
59 | label.video_label = row['href'].split("=")[-1]
60 | label.downloaded = false
61 | label.save
62 | end
63 | end
64 |
65 | end
66 |
67 | def create
68 | actors = Actor.all
69 | actors.each do |actor|
70 | download_actor_videos_label(actor.actor_label, :create)
71 | end
72 | end
73 |
74 | def update
75 | actors = Actor.all
76 | actors.each do |actor|
77 | download_actor_videos_label(actor.actor_label, :update)
78 | end
79 | end
80 |
81 | def update_new_release
82 | baseurl = "#{$JAVLIBRARY_URL}/cn/vl_newrelease.php?list&mode=2&page="
83 | response = Mechanize.new do |agent|
84 | # Set timeout preference here
85 | agent.open_timeout = 3
86 | agent.read_timeout = 3
87 | end
88 |
89 | 1.upto(new_release_max_page()).each do |page|
90 | begin
91 | response.get(baseurl + page.to_s)
92 | rescue
93 | retry
94 | end
95 |
96 | Nokogiri::HTML(response.page.body).search('//div[@class="video"]/a').each do |row|
97 | # Data:
98 | # Video_label: row['href'].split("=")[-1]
99 | # Video_title: row['title']
100 |
101 | label = Label.new
102 | label.video_label = row['href'].split("=")[-1]
103 | label.downloaded = false
104 | label.save
105 | end
106 | end
107 |
108 | end
109 |
110 | def new_release_max_page
111 | baseurl = "#{$JAVLIBRARY_URL}/cn/vl_newrelease.php?list&mode=2&page="
112 | response = Mechanize.new do |agent|
113 | # Set timeout preference here
114 | agent.open_timeout = 3
115 | agent.read_timeout = 3
116 | end
117 |
118 | 1.upto(20).each do |page|
119 | begin
120 | response.get(baseurl + page.to_s)
121 | rescue
122 | retry
123 | end
124 | doc = Nokogiri::HTML(response.page.body)
125 | label = doc.search('//div[@class="video"]/a')[0]['href'].split("=")[-1]
126 |
127 | return page - 1 if Label.where("video_label = ?", label).first != nil
128 | end # Upto page end
129 | end # Method end
130 |
--------------------------------------------------------------------------------
/config/environments/production.rb:
--------------------------------------------------------------------------------
1 | Rails.application.configure do
2 | # Settings specified here will take precedence over those in config/application.rb.
3 |
4 | # Code is not reloaded between requests.
5 | config.cache_classes = true
6 |
7 | # Eager load code on boot. This eager loads most of Rails and
8 | # your application in memory, allowing both threaded web servers
9 | # and those relying on copy on write to perform better.
10 | # Rake tasks automatically ignore this option for performance.
11 | config.eager_load = true
12 |
13 | # Full error reports are disabled and caching is turned on.
14 | config.consider_all_requests_local = false
15 | config.action_controller.perform_caching = true
16 |
17 | # Disable serving static files from the `/public` folder by default since
18 | # Apache or NGINX already handles this.
19 | config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
20 |
21 | # Compress JavaScripts and CSS.
22 | config.assets.js_compressor = :uglifier
23 | # config.assets.css_compressor = :sass
24 |
25 | # Do not fallback to assets pipeline if a precompiled asset is missed.
26 | config.assets.compile = false
27 |
28 | # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb
29 |
30 | # Enable serving of images, stylesheets, and JavaScripts from an asset server.
31 | # config.action_controller.asset_host = 'http://assets.example.com'
32 |
33 | # Specifies the header that your server uses for sending files.
34 | # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache
35 | # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX
36 |
37 | # Mount Action Cable outside main process or domain
38 | # config.action_cable.mount_path = nil
39 | # config.action_cable.url = 'wss://example.com/cable'
40 | # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
41 |
42 | # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43 | # config.force_ssl = true
44 |
45 | # Use the lowest log level to ensure availability of diagnostic information
46 | # when problems arise.
47 | config.log_level = :debug
48 |
49 | # Prepend all log lines with the following tags.
50 | config.log_tags = [ :request_id ]
51 |
52 | # Use a different cache store in production.
53 | # config.cache_store = :mem_cache_store
54 |
55 | # Use a real queuing backend for Active Job (and separate queues per environment)
56 | # config.active_job.queue_adapter = :resque
57 | # config.active_job.queue_name_prefix = "jav-library-rails_#{Rails.env}"
58 | config.action_mailer.perform_caching = false
59 |
60 | # Ignore bad email addresses and do not raise email delivery errors.
61 | # Set this to true and configure the email server for immediate delivery to raise delivery errors.
62 | # config.action_mailer.raise_delivery_errors = false
63 |
64 | # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
65 | # the I18n.default_locale when a translation cannot be found).
66 | config.i18n.fallbacks = true
67 |
68 | # Send deprecation notices to registered listeners.
69 | config.active_support.deprecation = :notify
70 |
71 | # Use default logging formatter so that PID and timestamp are not suppressed.
72 | config.log_formatter = ::Logger::Formatter.new
73 |
74 | # Use a different logger for distributed setups.
75 | # require 'syslog/logger'
76 | # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name')
77 |
78 | if ENV["RAILS_LOG_TO_STDOUT"].present?
79 | logger = ActiveSupport::Logger.new(STDOUT)
80 | logger.formatter = config.log_formatter
81 | config.logger = ActiveSupport::TaggedLogging.new(logger)
82 | end
83 |
84 | # Do not dump schema after migrations.
85 | config.active_record.dump_schema_after_migration = false
86 | end
87 |
--------------------------------------------------------------------------------
/lib/tasks/video_crawler.rake:
--------------------------------------------------------------------------------
1 | namespace :crawler do
2 | desc 'Download all videos'
3 | task :video => :environment do
4 | Label.where('downloaded = ?', 0).each do |label|
5 | next if label.downloaded?
6 | sign = video_downloader(label.video_label, label.id)
7 |
8 | next if sign == 0
9 |
10 | if sign
11 | label.downloaded = true
12 | label.save
13 | else
14 | label.destroy
15 | end
16 | end
17 | end
18 |
19 | desc "Download test"
20 | task :video_test do
21 | download_test("javli4qw7m")
22 | end
23 |
24 | end
25 |
26 | # --- Method ---
27 | def video_downloader(identifer, vid)
28 | video = Video.new; video.id = vid
29 | baseurl = "#{$JAVLIBRARY_URL}/cn/?v=#{identifer}"
30 | response = Mechanize.new do |agent|
31 | agent.read_timeout = 2
32 | agent.open_timeout = 2
33 | # agent.user_agent = Mechanize::AGENT_ALIASES.values[rand(21)]
34 | end
35 |
36 | begin
37 | response.get baseurl
38 | # rescue Timeout::Error
39 | # retry
40 | rescue
41 | return 0
42 | end
43 |
44 | doc = Nokogiri::HTML(response.page.body.gsub!(/( |\s)+/, " "))
45 |
46 | casts, genres = [], []
47 |
48 | video.video_name = doc.search('div[@id="video_title"]/h3/a').children.text.strip
49 |
50 | video.video_id = doc.search('//div[@id="video_info"]/div[@id="video_id"]/table/tr/td[@class="text"]').children.text.strip
51 |
52 | video.release_date = doc.search('//div[@id="video_info"]/div[@id="video_date"]/table/tr/td[@class="text"]').children.text.strip
53 |
54 | video.length = doc.search('//div[@id="video_info"]/div[@id="video_length"]/table/tr/td[2]/span').children.text.strip
55 |
56 | video.director = doc.search('//div[@id="video_info"]/div[@id="video_director"]/table/tr/td[@class="text"]').children.text.strip
57 |
58 | video.maker = doc.search('//div[@id="video_info"]/div[@id="video_maker"]/table/tr/td[@class="text"]').children.text.strip
59 |
60 | video.label = doc.search('//div[@id="video_info"]/div[@id="video_label"]/table/tr/td[@class="text"]').children.text.strip
61 |
62 | video.rating = doc.search('//div[@id="video_info"]/div[@id="video_review"]/table/tr/td[@class="text"]/span[@class="score"]').children.text.strip.gsub('(', '').gsub(')', '')
63 |
64 | doc.search('//img[@id="video_jacket_img"]').each do |row|
65 | video.img = 'http:' + row['src']
66 | end
67 |
68 | doc.search('//span[@class="star"]/a').each do |row|
69 | casts << row.attributes['href'].value.split('=')[-1]
70 | end
71 |
72 | doc.search('//div[@id="video_genres"]/table/tr/td[@class="text"]/span[@class="genre"]/a').each do |row|
73 | genres << row.children.text
74 | end
75 |
76 | casts.each do |cast|
77 | begin
78 | video.actors << Actor.where("actor_label = ?", cast).first
79 | rescue
80 | next
81 | end
82 | end
83 |
84 | genres.each do |genre|
85 | begin
86 | video.genres << Genre.where("name = ?", genre).first
87 | rescue
88 | next
89 | end
90 | end
91 |
92 | return video.save
93 | end
94 |
95 | def download_test(identifer)
96 | baseurl = "#{$JAVLIBRARY_URL}/cn/?v=#{identifer}"
97 | response = Mechanize.new do |agent|
98 | agent.read_timeout = 2
99 | agent.open_timeout = 2
100 | # agent.user_agent = Mechanize::AGENT_ALIASES.values[rand(21)]
101 | end
102 |
103 | begin
104 | response.get baseurl
105 | # rescue Timeout::Error
106 | # retry
107 | rescue
108 | return 0
109 | end
110 |
111 | doc = Nokogiri::HTML(response.page.body.gsub!(/( |\s)+/, " "))
112 | casts = []
113 |
114 | doc.search('//span[@class="star"]/a').each do |row|
115 | casts << row
116 | pp row.attributes['href'].value.split('=')[-1]
117 | end
118 |
119 | end
120 |
--------------------------------------------------------------------------------
/config/locales/devise.en.yml:
--------------------------------------------------------------------------------
1 | # Additional translations at https://github.com/plataformatec/devise/wiki/I18n
2 |
3 | en:
4 | devise:
5 | confirmations:
6 | confirmed: "Your email address has been successfully confirmed."
7 | send_instructions: "You will receive an email with instructions for how to confirm your email address in a few minutes."
8 | send_paranoid_instructions: "If your email address exists in our database, you will receive an email with instructions for how to confirm your email address in a few minutes."
9 | failure:
10 | already_authenticated: "You are already signed in."
11 | inactive: "Your account is not activated yet."
12 | invalid: "Invalid %{authentication_keys} or password."
13 | locked: "Your account is locked."
14 | last_attempt: "You have one more attempt before your account is locked."
15 | not_found_in_database: "Invalid %{authentication_keys} or password."
16 | timeout: "Your session expired. Please sign in again to continue."
17 | unauthenticated: "You need to sign in or sign up before continuing."
18 | unconfirmed: "You have to confirm your email address before continuing."
19 | mailer:
20 | confirmation_instructions:
21 | subject: "Confirmation instructions"
22 | reset_password_instructions:
23 | subject: "Reset password instructions"
24 | unlock_instructions:
25 | subject: "Unlock instructions"
26 | email_changed:
27 | subject: "Email Changed"
28 | password_change:
29 | subject: "Password Changed"
30 | omniauth_callbacks:
31 | failure: "Could not authenticate you from %{kind} because \"%{reason}\"."
32 | success: "Successfully authenticated from %{kind} account."
33 | passwords:
34 | no_token: "You can't access this page without coming from a password reset email. If you do come from a password reset email, please make sure you used the full URL provided."
35 | send_instructions: "You will receive an email with instructions on how to reset your password in a few minutes."
36 | send_paranoid_instructions: "If your email address exists in our database, you will receive a password recovery link at your email address in a few minutes."
37 | updated: "Your password has been changed successfully. You are now signed in."
38 | updated_not_active: "Your password has been changed successfully."
39 | registrations:
40 | destroyed: "Bye! Your account has been successfully cancelled. We hope to see you again soon."
41 | signed_up: "Welcome! You have signed up successfully."
42 | signed_up_but_inactive: "You have signed up successfully. However, we could not sign you in because your account is not yet activated."
43 | signed_up_but_locked: "You have signed up successfully. However, we could not sign you in because your account is locked."
44 | signed_up_but_unconfirmed: "A message with a confirmation link has been sent to your email address. Please follow the link to activate your account."
45 | update_needs_confirmation: "You updated your account successfully, but we need to verify your new email address. Please check your email and follow the confirm link to confirm your new email address."
46 | updated: "Your account has been updated successfully."
47 | sessions:
48 | signed_in: "Signed in successfully."
49 | signed_out: "Signed out successfully."
50 | already_signed_out: "Signed out successfully."
51 | unlocks:
52 | send_instructions: "You will receive an email with instructions for how to unlock your account in a few minutes."
53 | send_paranoid_instructions: "If your account exists, you will receive an email with instructions for how to unlock it in a few minutes."
54 | unlocked: "Your account has been unlocked successfully. Please sign in to continue."
55 | errors:
56 | messages:
57 | already_confirmed: "was already confirmed, please try signing in"
58 | confirmation_period_expired: "needs to be confirmed within %{period}, please request a new one"
59 | expired: "has expired, please request a new one"
60 | not_found: "not found"
61 | not_locked: "was not locked"
62 | not_saved:
63 | one: "1 error prohibited this %{resource} from being saved:"
64 | other: "%{count} errors prohibited this %{resource} from being saved:"
65 |
--------------------------------------------------------------------------------
/db/schema.rb:
--------------------------------------------------------------------------------
1 | # This file is auto-generated from the current state of the database. Instead
2 | # of editing this file, please use the migrations feature of Active Record to
3 | # incrementally modify your database, and then regenerate this schema definition.
4 | #
5 | # Note that this schema.rb definition is the authoritative source for your
6 | # database schema. If you need to create the application database on another
7 | # system, you should be using db:schema:load, not running all the migrations
8 | # from scratch. The latter is a flawed and unsustainable approach (the more migrations
9 | # you'll amass, the slower it'll run and the greater likelihood for issues).
10 | #
11 | # It's strongly recommended that you check this file into your version control system.
12 |
13 | ActiveRecord::Schema.define(version: 20171120130511) do
14 |
15 | create_table "actors", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
16 | t.string "name"
17 | t.string "actor_label"
18 | t.string "actor_type"
19 | t.datetime "created_at", null: false
20 | t.datetime "updated_at", null: false
21 | t.string "javbus_label"
22 | end
23 |
24 | create_table "actors_users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
25 | t.integer "actor_id"
26 | t.integer "user_id"
27 | t.datetime "created_at", null: false
28 | t.datetime "updated_at", null: false
29 | t.index ["actor_id", "user_id"], name: "index_actors_users_on_actor_id_and_user_id", unique: true, using: :btree
30 | t.index ["actor_id"], name: "index_actors_users_on_actor_id", using: :btree
31 | t.index ["user_id"], name: "index_actors_users_on_user_id", using: :btree
32 | end
33 |
34 | create_table "actors_videos", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
35 | t.integer "video_id"
36 | t.integer "actor_id"
37 | t.index ["actor_id"], name: "index_actors_videos_on_actor_id", using: :btree
38 | t.index ["video_id"], name: "index_actors_videos_on_video_id", using: :btree
39 | end
40 |
41 | create_table "genres", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
42 | t.string "name"
43 | t.datetime "created_at", null: false
44 | t.datetime "updated_at", null: false
45 | end
46 |
47 | create_table "genres_videos", id: false, force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
48 | t.integer "video_id"
49 | t.integer "genre_id"
50 | t.index ["genre_id"], name: "index_genres_videos_on_genre_id", using: :btree
51 | t.index ["video_id"], name: "index_genres_videos_on_video_id", using: :btree
52 | end
53 |
54 | create_table "labels", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
55 | t.string "video_label"
56 | t.boolean "downloaded"
57 | t.datetime "created_at", null: false
58 | t.datetime "updated_at", null: false
59 | end
60 |
61 | create_table "news", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
62 | t.string "title"
63 | t.text "content", limit: 65535
64 | t.string "publisher"
65 | t.datetime "created_at", null: false
66 | t.datetime "updated_at", null: false
67 | end
68 |
69 | create_table "relationships", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
70 | t.integer "follower_id"
71 | t.integer "followed_id"
72 | t.datetime "created_at", null: false
73 | t.datetime "updated_at", null: false
74 | t.index ["followed_id"], name: "index_relationships_on_followed_id", using: :btree
75 | t.index ["follower_id", "followed_id"], name: "index_relationships_on_follower_id_and_followed_id", unique: true, using: :btree
76 | t.index ["follower_id"], name: "index_relationships_on_follower_id", using: :btree
77 | end
78 |
79 | create_table "stars", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
80 | t.string "name"
81 | t.string "rank"
82 | t.string "img"
83 | t.string "actor_label"
84 | t.datetime "created_at", null: false
85 | t.datetime "updated_at", null: false
86 | end
87 |
88 | create_table "users", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
89 | t.string "email", default: "", null: false
90 | t.string "encrypted_password", default: "", null: false
91 | t.string "reset_password_token"
92 | t.datetime "reset_password_sent_at"
93 | t.datetime "remember_created_at"
94 | t.integer "sign_in_count", default: 0, null: false
95 | t.datetime "current_sign_in_at"
96 | t.datetime "last_sign_in_at"
97 | t.string "current_sign_in_ip"
98 | t.string "last_sign_in_ip"
99 | t.datetime "created_at", null: false
100 | t.datetime "updated_at", null: false
101 | t.string "username"
102 | t.index ["email"], name: "index_users_on_email", unique: true, using: :btree
103 | t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true, using: :btree
104 | end
105 |
106 | create_table "users_videos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
107 | t.integer "user_id"
108 | t.integer "video_id"
109 | t.index ["user_id", "video_id"], name: "index_users_videos_on_user_id_and_video_id", unique: true, using: :btree
110 | t.index ["user_id"], name: "index_users_videos_on_user_id", using: :btree
111 | t.index ["video_id"], name: "index_users_videos_on_video_id", using: :btree
112 | end
113 |
114 | create_table "videos", force: :cascade, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8" do |t|
115 | t.string "video_id"
116 | t.string "video_name"
117 | t.string "release_date"
118 | t.string "length"
119 | t.string "director"
120 | t.string "maker"
121 | t.string "label"
122 | t.string "rating"
123 | t.string "img"
124 | t.datetime "created_at", null: false
125 | t.datetime "updated_at", null: false
126 | end
127 |
128 | end
129 |
--------------------------------------------------------------------------------
/Gemfile.lock:
--------------------------------------------------------------------------------
1 | GEM
2 | remote: https://rubygems.org/
3 | specs:
4 | actioncable (5.0.6)
5 | actionpack (= 5.0.6)
6 | nio4r (>= 1.2, < 3.0)
7 | websocket-driver (~> 0.6.1)
8 | actionmailer (5.0.6)
9 | actionpack (= 5.0.6)
10 | actionview (= 5.0.6)
11 | activejob (= 5.0.6)
12 | mail (~> 2.5, >= 2.5.4)
13 | rails-dom-testing (~> 2.0)
14 | actionpack (5.0.6)
15 | actionview (= 5.0.6)
16 | activesupport (= 5.0.6)
17 | rack (~> 2.0)
18 | rack-test (~> 0.6.3)
19 | rails-dom-testing (~> 2.0)
20 | rails-html-sanitizer (~> 1.0, >= 1.0.2)
21 | actionview (5.0.6)
22 | activesupport (= 5.0.6)
23 | builder (~> 3.1)
24 | erubis (~> 2.7.0)
25 | rails-dom-testing (~> 2.0)
26 | rails-html-sanitizer (~> 1.0, >= 1.0.3)
27 | activejob (5.0.6)
28 | activesupport (= 5.0.6)
29 | globalid (>= 0.3.6)
30 | activemodel (5.0.6)
31 | activesupport (= 5.0.6)
32 | activerecord (5.0.6)
33 | activemodel (= 5.0.6)
34 | activesupport (= 5.0.6)
35 | arel (~> 7.0)
36 | activesupport (5.0.6)
37 | concurrent-ruby (~> 1.0, >= 1.0.2)
38 | i18n (~> 0.7)
39 | minitest (~> 5.1)
40 | tzinfo (~> 1.1)
41 | arel (7.1.4)
42 | autoprefixer-rails (7.1.0)
43 | execjs
44 | axiom-types (0.1.1)
45 | descendants_tracker (~> 0.0.4)
46 | ice_nine (~> 0.11.0)
47 | thread_safe (~> 0.3, >= 0.3.1)
48 | bcrypt (3.1.11)
49 | bindex (0.5.0)
50 | bootstrap-sass (3.3.7)
51 | autoprefixer-rails (>= 5.2.1)
52 | sass (>= 3.3.4)
53 | bootswatch-rails (3.3.5)
54 | railties (>= 3.1)
55 | builder (3.2.3)
56 | byebug (9.1.0)
57 | chart-js-rails (0.1.3)
58 | railties (> 3.1)
59 | chronic (0.10.2)
60 | coercible (1.0.0)
61 | descendants_tracker (~> 0.0.1)
62 | coffee-rails (4.2.2)
63 | coffee-script (>= 2.2.0)
64 | railties (>= 4.0.0)
65 | coffee-script (2.4.1)
66 | coffee-script-source
67 | execjs
68 | coffee-script-source (1.12.2)
69 | concurrent-ruby (1.0.5)
70 | descendants_tracker (0.0.4)
71 | thread_safe (~> 0.3, >= 0.3.1)
72 | devise (4.2.1)
73 | bcrypt (~> 3.0)
74 | orm_adapter (~> 0.1)
75 | railties (>= 4.1.0, < 5.1)
76 | responders
77 | warden (~> 1.2.3)
78 | domain_name (0.5.20170404)
79 | unf (>= 0.0.5, < 1.0.0)
80 | equalizer (0.0.11)
81 | erubis (2.7.0)
82 | execjs (2.7.0)
83 | ffi (1.9.18)
84 | font-awesome-rails (4.7.0.1)
85 | railties (>= 3.2, < 5.1)
86 | globalid (0.4.0)
87 | activesupport (>= 4.2.0)
88 | grape (1.0.1)
89 | activesupport
90 | builder
91 | mustermann-grape (~> 1.0.0)
92 | rack (>= 1.3.0)
93 | rack-accept
94 | virtus (>= 1.0.0)
95 | grape-entity (0.6.1)
96 | activesupport (>= 5.0.0)
97 | multi_json (>= 1.3.2)
98 | http-cookie (1.0.3)
99 | domain_name (~> 0.5)
100 | i18n (0.8.6)
101 | ice_nine (0.11.2)
102 | jbuilder (2.7.0)
103 | activesupport (>= 4.2.0)
104 | multi_json (>= 1.2)
105 | jquery-rails (4.3.1)
106 | rails-dom-testing (>= 1, < 3)
107 | railties (>= 4.2.0)
108 | thor (>= 0.14, < 2.0)
109 | listen (3.0.8)
110 | rb-fsevent (~> 0.9, >= 0.9.4)
111 | rb-inotify (~> 0.9, >= 0.9.7)
112 | loofah (2.0.3)
113 | nokogiri (>= 1.5.9)
114 | mail (2.6.6)
115 | mime-types (>= 1.16, < 4)
116 | mechanize (2.7.5)
117 | domain_name (~> 0.5, >= 0.5.1)
118 | http-cookie (~> 1.0)
119 | mime-types (>= 1.17.2)
120 | net-http-digest_auth (~> 1.1, >= 1.1.1)
121 | net-http-persistent (~> 2.5, >= 2.5.2)
122 | nokogiri (~> 1.6)
123 | ntlm-http (~> 0.1, >= 0.1.1)
124 | webrobots (>= 0.0.9, < 0.2)
125 | method_source (0.8.2)
126 | mime-types (3.1)
127 | mime-types-data (~> 3.2015)
128 | mime-types-data (3.2016.0521)
129 | mini_portile2 (2.3.0)
130 | minitest (5.10.3)
131 | multi_json (1.12.2)
132 | mustermann (1.0.1)
133 | mustermann-grape (1.0.0)
134 | mustermann (~> 1.0.0)
135 | mysql2 (0.4.9)
136 | net-http-digest_auth (1.4.1)
137 | net-http-persistent (2.9.4)
138 | nio4r (2.1.0)
139 | nokogiri (1.8.1)
140 | mini_portile2 (~> 2.3.0)
141 | ntlm-http (0.1.1)
142 | orm_adapter (0.5.0)
143 | polyamorous (1.3.1)
144 | activerecord (>= 3.0)
145 | puma (3.10.0)
146 | rack (2.0.3)
147 | rack-accept (0.4.5)
148 | rack (>= 0.4)
149 | rack-test (0.6.3)
150 | rack (>= 1.0)
151 | rails (5.0.6)
152 | actioncable (= 5.0.6)
153 | actionmailer (= 5.0.6)
154 | actionpack (= 5.0.6)
155 | actionview (= 5.0.6)
156 | activejob (= 5.0.6)
157 | activemodel (= 5.0.6)
158 | activerecord (= 5.0.6)
159 | activesupport (= 5.0.6)
160 | bundler (>= 1.3.0)
161 | railties (= 5.0.6)
162 | sprockets-rails (>= 2.0.0)
163 | rails-dom-testing (2.0.3)
164 | activesupport (>= 4.2.0)
165 | nokogiri (>= 1.6)
166 | rails-html-sanitizer (1.0.3)
167 | loofah (~> 2.0)
168 | railties (5.0.6)
169 | actionpack (= 5.0.6)
170 | activesupport (= 5.0.6)
171 | method_source
172 | rake (>= 0.8.7)
173 | thor (>= 0.18.1, < 2.0)
174 | rake (12.1.0)
175 | ransack (1.8.3)
176 | actionpack (>= 3.0)
177 | activerecord (>= 3.0)
178 | activesupport (>= 3.0)
179 | i18n
180 | polyamorous (~> 1.3)
181 | rb-fsevent (0.10.2)
182 | rb-inotify (0.9.10)
183 | ffi (>= 0.5.0, < 2)
184 | responders (2.4.0)
185 | actionpack (>= 4.2.0, < 5.3)
186 | railties (>= 4.2.0, < 5.3)
187 | sass (3.5.1)
188 | sass-listen (~> 4.0.0)
189 | sass-listen (4.0.0)
190 | rb-fsevent (~> 0.9, >= 0.9.4)
191 | rb-inotify (~> 0.9, >= 0.9.7)
192 | sass-rails (5.0.6)
193 | railties (>= 4.0.0, < 6)
194 | sass (~> 3.1)
195 | sprockets (>= 2.8, < 4.0)
196 | sprockets-rails (>= 2.0, < 4.0)
197 | tilt (>= 1.1, < 3)
198 | spring (2.0.2)
199 | activesupport (>= 4.2)
200 | spring-watcher-listen (2.0.1)
201 | listen (>= 2.7, < 4.0)
202 | spring (>= 1.2, < 3.0)
203 | sprockets (3.7.1)
204 | concurrent-ruby (~> 1.0)
205 | rack (> 1, < 3)
206 | sprockets-rails (3.2.1)
207 | actionpack (>= 4.0)
208 | activesupport (>= 4.0)
209 | sprockets (>= 3.0.0)
210 | thor (0.20.0)
211 | thread_safe (0.3.6)
212 | tilt (2.0.8)
213 | turbolinks (5.0.1)
214 | turbolinks-source (~> 5)
215 | turbolinks-source (5.0.3)
216 | tzinfo (1.2.3)
217 | thread_safe (~> 0.1)
218 | uglifier (3.2.0)
219 | execjs (>= 0.3.0, < 3)
220 | unf (0.1.4)
221 | unf_ext
222 | unf_ext (0.0.7.4)
223 | virtus (1.0.5)
224 | axiom-types (~> 0.1)
225 | coercible (~> 1.0)
226 | descendants_tracker (~> 0.0, >= 0.0.3)
227 | equalizer (~> 0.0, >= 0.0.9)
228 | warden (1.2.7)
229 | rack (>= 1.0)
230 | web-console (3.5.1)
231 | actionview (>= 5.0)
232 | activemodel (>= 5.0)
233 | bindex (>= 0.4.0)
234 | railties (>= 5.0)
235 | webrobots (0.1.2)
236 | websocket-driver (0.6.5)
237 | websocket-extensions (>= 0.1.0)
238 | websocket-extensions (0.1.2)
239 | whenever (0.9.7)
240 | chronic (>= 0.6.3)
241 | will_paginate (3.1.6)
242 | will_paginate-bootstrap (1.0.1)
243 | will_paginate (>= 3.0.3)
244 |
245 | PLATFORMS
246 | ruby
247 |
248 | DEPENDENCIES
249 | bootstrap-sass
250 | bootswatch-rails
251 | byebug
252 | chart-js-rails
253 | coffee-rails (~> 4.2)
254 | devise
255 | font-awesome-rails
256 | grape
257 | grape-entity
258 | jbuilder (~> 2.5)
259 | jquery-rails
260 | listen (~> 3.0.5)
261 | mechanize
262 | mysql2
263 | puma (~> 3.0)
264 | rails (~> 5.0.6)
265 | ransack
266 | sass-rails (~> 5.0)
267 | spring
268 | spring-watcher-listen (~> 2.0.0)
269 | turbolinks (~> 5)
270 | tzinfo-data
271 | uglifier (>= 1.3.0)
272 | web-console (>= 3.3.0)
273 | whenever
274 | will_paginate-bootstrap
275 |
276 | BUNDLED WITH
277 | 1.15.3
278 |
--------------------------------------------------------------------------------
/config/initializers/devise.rb:
--------------------------------------------------------------------------------
1 | # Use this hook to configure devise mailer, warden hooks and so forth.
2 | # Many of these configuration options can be set straight in your model.
3 | Devise.setup do |config|
4 | # The secret key used by Devise. Devise uses this key to generate
5 | # random tokens. Changing this key will render invalid all existing
6 | # confirmation, reset password and unlock tokens in the database.
7 | # Devise will use the `secret_key_base` as its `secret_key`
8 | # by default. You can change it below and use your own secret key.
9 | # config.secret_key = '6d1fe484990b049ff97e3c76b3c3a79e915abaebedf2809f6d38145b511df6bcfbe4177280ee5498f33545709f4e1e16cf7ff8d0bf1129774def95d3b803ef8b'
10 |
11 | # ==> Mailer Configuration
12 | # Configure the e-mail address which will be shown in Devise::Mailer,
13 | # note that it will be overwritten if you use your own mailer class
14 | # with default "from" parameter.
15 | config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com'
16 |
17 | # Configure the class responsible to send e-mails.
18 | # config.mailer = 'Devise::Mailer'
19 |
20 | # Configure the parent class responsible to send e-mails.
21 | # config.parent_mailer = 'ActionMailer::Base'
22 |
23 | # ==> ORM configuration
24 | # Load and configure the ORM. Supports :active_record (default) and
25 | # :mongoid (bson_ext recommended) by default. Other ORMs may be
26 | # available as additional gems.
27 | require 'devise/orm/active_record'
28 |
29 | # ==> Configuration for any authentication mechanism
30 | # Configure which keys are used when authenticating a user. The default is
31 | # just :email. You can configure it to use [:username, :subdomain], so for
32 | # authenticating a user, both parameters are required. Remember that those
33 | # parameters are used only when authenticating and not when retrieving from
34 | # session. If you need permissions, you should implement that in a before filter.
35 | # You can also supply a hash where the value is a boolean determining whether
36 | # or not authentication should be aborted when the value is not present.
37 | # config.authentication_keys = [:email]
38 | # config.authentication_keys = [:username, :email]
39 |
40 | # Configure parameters from the request object used for authentication. Each entry
41 | # given should be a request method and it will automatically be passed to the
42 | # find_for_authentication method and considered in your model lookup. For instance,
43 | # if you set :request_keys to [:subdomain], :subdomain will be used on authentication.
44 | # The same considerations mentioned for authentication_keys also apply to request_keys.
45 | # config.request_keys = []
46 |
47 | # Configure which authentication keys should be case-insensitive.
48 | # These keys will be downcased upon creating or modifying a user and when used
49 | # to authenticate or find a user. Default is :email.
50 | config.case_insensitive_keys = [:email]
51 |
52 | # Configure which authentication keys should have whitespace stripped.
53 | # These keys will have whitespace before and after removed upon creating or
54 | # modifying a user and when used to authenticate or find a user. Default is :email.
55 | config.strip_whitespace_keys = [:email]
56 |
57 | # Tell if authentication through request.params is enabled. True by default.
58 | # It can be set to an array that will enable params authentication only for the
59 | # given strategies, for example, `config.params_authenticatable = [:database]` will
60 | # enable it only for database (email + password) authentication.
61 | # config.params_authenticatable = true
62 |
63 | # Tell if authentication through HTTP Auth is enabled. False by default.
64 | # It can be set to an array that will enable http authentication only for the
65 | # given strategies, for example, `config.http_authenticatable = [:database]` will
66 | # enable it only for database authentication. The supported strategies are:
67 | # :database = Support basic authentication with authentication key + password
68 | # config.http_authenticatable = false
69 |
70 | # If 401 status code should be returned for AJAX requests. True by default.
71 | # config.http_authenticatable_on_xhr = true
72 |
73 | # The realm used in Http Basic Authentication. 'Application' by default.
74 | # config.http_authentication_realm = 'Application'
75 |
76 | # It will change confirmation, password recovery and other workflows
77 | # to behave the same regardless if the e-mail provided was right or wrong.
78 | # Does not affect registerable.
79 | # config.paranoid = true
80 |
81 | # By default Devise will store the user in session. You can skip storage for
82 | # particular strategies by setting this option.
83 | # Notice that if you are skipping storage for all authentication paths, you
84 | # may want to disable generating routes to Devise's sessions controller by
85 | # passing skip: :sessions to `devise_for` in your config/routes.rb
86 | config.skip_session_storage = [:http_auth]
87 |
88 | # By default, Devise cleans up the CSRF token on authentication to
89 | # avoid CSRF token fixation attacks. This means that, when using AJAX
90 | # requests for sign in and sign up, you need to get a new CSRF token
91 | # from the server. You can disable this option at your own risk.
92 | # config.clean_up_csrf_token_on_authentication = true
93 |
94 | # When false, Devise will not attempt to reload routes on eager load.
95 | # This can reduce the time taken to boot the app but if your application
96 | # requires the Devise mappings to be loaded during boot time the application
97 | # won't boot properly.
98 | # config.reload_routes = true
99 |
100 | # ==> Configuration for :database_authenticatable
101 | # For bcrypt, this is the cost for hashing the password and defaults to 11. If
102 | # using other algorithms, it sets how many times you want the password to be hashed.
103 | #
104 | # Limiting the stretches to just one in testing will increase the performance of
105 | # your test suite dramatically. However, it is STRONGLY RECOMMENDED to not use
106 | # a value less than 10 in other environments. Note that, for bcrypt (the default
107 | # algorithm), the cost increases exponentially with the number of stretches (e.g.
108 | # a value of 20 is already extremely slow: approx. 60 seconds for 1 calculation).
109 | config.stretches = Rails.env.test? ? 1 : 11
110 |
111 | # Set up a pepper to generate the hashed password.
112 | # config.pepper = '78404a287d6fec652be5f501d4567f3ddbf6abfbc322bc347165bf83ad8fd2f66d9d6373f61973cc1bd76158852bd36248b72b296f433f4f93eeb7b29622fbb8'
113 |
114 | # Send a notification to the original email when the user's email is changed.
115 | # config.send_email_changed_notification = false
116 |
117 | # Send a notification email when the user's password is changed.
118 | # config.send_password_change_notification = false
119 |
120 | # ==> Configuration for :confirmable
121 | # A period that the user is allowed to access the website even without
122 | # confirming their account. For instance, if set to 2.days, the user will be
123 | # able to access the website for two days without confirming their account,
124 | # access will be blocked just in the third day. Default is 0.days, meaning
125 | # the user cannot access the website without confirming their account.
126 | # config.allow_unconfirmed_access_for = 2.days
127 |
128 | # A period that the user is allowed to confirm their account before their
129 | # token becomes invalid. For example, if set to 3.days, the user can confirm
130 | # their account within 3 days after the mail was sent, but on the fourth day
131 | # their account can't be confirmed with the token any more.
132 | # Default is nil, meaning there is no restriction on how long a user can take
133 | # before confirming their account.
134 | # config.confirm_within = 3.days
135 |
136 | # If true, requires any email changes to be confirmed (exactly the same way as
137 | # initial account confirmation) to be applied. Requires additional unconfirmed_email
138 | # db field (see migrations). Until confirmed, new email is stored in
139 | # unconfirmed_email column, and copied to email column on successful confirmation.
140 | config.reconfirmable = true
141 |
142 | # Defines which key will be used when confirming an account
143 | # config.confirmation_keys = [:email]
144 |
145 | # ==> Configuration for :rememberable
146 | # The time the user will be remembered without asking for credentials again.
147 | # config.remember_for = 2.weeks
148 |
149 | # Invalidates all the remember me tokens when the user signs out.
150 | config.expire_all_remember_me_on_sign_out = true
151 |
152 | # If true, extends the user's remember period when remembered via cookie.
153 | # config.extend_remember_period = false
154 |
155 | # Options to be passed to the created cookie. For instance, you can set
156 | # secure: true in order to force SSL only cookies.
157 | # config.rememberable_options = {}
158 |
159 | # ==> Configuration for :validatable
160 | # Range for password length.
161 | config.password_length = 6..128
162 |
163 | # Email regex used to validate email formats. It simply asserts that
164 | # one (and only one) @ exists in the given string. This is mainly
165 | # to give user feedback and not to assert the e-mail validity.
166 | config.email_regexp = /\A[^@\s]+@[^@\s]+\z/
167 |
168 | # ==> Configuration for :timeoutable
169 | # The time you want to timeout the user session without activity. After this
170 | # time the user will be asked for credentials again. Default is 30 minutes.
171 | # config.timeout_in = 30.minutes
172 |
173 | # ==> Configuration for :lockable
174 | # Defines which strategy will be used to lock an account.
175 | # :failed_attempts = Locks an account after a number of failed attempts to sign in.
176 | # :none = No lock strategy. You should handle locking by yourself.
177 | # config.lock_strategy = :failed_attempts
178 |
179 | # Defines which key will be used when locking and unlocking an account
180 | # config.unlock_keys = [:email]
181 |
182 | # Defines which strategy will be used to unlock an account.
183 | # :email = Sends an unlock link to the user email
184 | # :time = Re-enables login after a certain amount of time (see :unlock_in below)
185 | # :both = Enables both strategies
186 | # :none = No unlock strategy. You should handle unlocking by yourself.
187 | # config.unlock_strategy = :both
188 |
189 | # Number of authentication tries before locking an account if lock_strategy
190 | # is failed attempts.
191 | # config.maximum_attempts = 20
192 |
193 | # Time interval to unlock the account if :time is enabled as unlock_strategy.
194 | # config.unlock_in = 1.hour
195 |
196 | # Warn on the last attempt before the account is locked.
197 | # config.last_attempt_warning = true
198 |
199 | # ==> Configuration for :recoverable
200 | #
201 | # Defines which key will be used when recovering the password for an account
202 | # config.reset_password_keys = [:email]
203 |
204 | # Time interval you can reset your password with a reset password key.
205 | # Don't put a too small interval or your users won't have the time to
206 | # change their passwords.
207 | config.reset_password_within = 6.hours
208 |
209 | # When set to false, does not sign a user in automatically after their password is
210 | # reset. Defaults to true, so a user is signed in automatically after a reset.
211 | # config.sign_in_after_reset_password = true
212 |
213 | # ==> Configuration for :encryptable
214 | # Allow you to use another hashing or encryption algorithm besides bcrypt (default).
215 | # You can use :sha1, :sha512 or algorithms from others authentication tools as
216 | # :clearance_sha1, :authlogic_sha512 (then you should set stretches above to 20
217 | # for default behavior) and :restful_authentication_sha1 (then you should set
218 | # stretches to 10, and copy REST_AUTH_SITE_KEY to pepper).
219 | #
220 | # Require the `devise-encryptable` gem when using anything other than bcrypt
221 | # config.encryptor = :sha512
222 |
223 | # ==> Scopes configuration
224 | # Turn scoped views on. Before rendering "sessions/new", it will first check for
225 | # "users/sessions/new". It's turned off by default because it's slower if you
226 | # are using only default views.
227 | # config.scoped_views = false
228 | config.scoped_views = true
229 |
230 | # Configure the default scope given to Warden. By default it's the first
231 | # devise role declared in your routes (usually :user).
232 | # config.default_scope = :user
233 |
234 | # Set this configuration to false if you want /users/sign_out to sign out
235 | # only the current scope. By default, Devise signs out all scopes.
236 | # config.sign_out_all_scopes = true
237 |
238 | # ==> Navigation configuration
239 | # Lists the formats that should be treated as navigational. Formats like
240 | # :html, should redirect to the sign in page when the user does not have
241 | # access, but formats like :xml or :json, should return 401.
242 | #
243 | # If you have any extra navigational formats, like :iphone or :mobile, you
244 | # should add them to the navigational formats lists.
245 | #
246 | # The "*/*" below is required to match Internet Explorer requests.
247 | # config.navigational_formats = ['*/*', :html]
248 |
249 | # The default HTTP method used to sign out a resource. Default is :delete.
250 | config.sign_out_via = :delete
251 |
252 | # ==> OmniAuth
253 | # Add a new OmniAuth provider. Check the wiki for more information on setting
254 | # up on your models and hooks.
255 | # config.omniauth :github, 'APP_ID', 'APP_SECRET', scope: 'user,public_repo'
256 |
257 | # ==> Warden configuration
258 | # If you want to use other strategies, that are not supported by Devise, or
259 | # change the failure app, you can configure them inside the config.warden block.
260 | #
261 | # config.warden do |manager|
262 | # manager.intercept_401 = false
263 | # manager.default_strategies(scope: :user).unshift :some_external_strategy
264 | # end
265 |
266 | # ==> Mountable engine configurations
267 | # When using Devise inside an engine, let's call it `MyEngine`, and this engine
268 | # is mountable, there are some extra configurations to be taken into account.
269 | # The following options are available, assuming the engine is mounted as:
270 | #
271 | # mount MyEngine, at: '/my_engine'
272 | #
273 | # The router that invoked `devise_for`, in the example above, would be:
274 | # config.router_name = :my_engine
275 | #
276 | # When using OmniAuth, Devise cannot automatically set OmniAuth path,
277 | # so you need to do it manually. For the users scope, it would be:
278 | # config.omniauth_path_prefix = '/my_engine/users/auth'
279 | end
280 |
--------------------------------------------------------------------------------