├── log └── .keep ├── app ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── concerns │ │ ├── .keep │ │ └── rearrangeable.rb │ ├── application_record.rb │ ├── setting.rb │ ├── consumer.rb │ ├── user.rb │ ├── consumer_event.rb │ ├── subscription_user.rb │ ├── notification.rb │ └── push_device.rb ├── assets │ ├── images │ │ └── .keep │ ├── config │ │ └── manifest.js │ └── stylesheets │ │ ├── preferences.scss │ │ ├── users.scss │ │ ├── articles.scss │ │ ├── subscriptions.scss │ │ ├── administration.scss │ │ ├── notifications.scss │ │ └── application.css ├── controllers │ ├── concerns │ │ └── .keep │ ├── administration_controller.rb │ ├── analytics_controller.rb │ ├── subscriptions_controller.rb │ └── users_controller.rb ├── views │ ├── notifications │ │ ├── _notification.html.erb │ │ ├── subscribe.json.erb │ │ ├── unsubscribe.json.erb │ │ ├── resubscribe.html.erb │ │ ├── cert_upload.html.erb │ │ ├── admin.html.erb │ │ ├── index.html.erb │ │ ├── show.html.erb │ │ ├── new.html.erb │ │ └── fcm.html.erb │ ├── articles │ │ ├── index.html.erb │ │ ├── search.json.erb │ │ ├── article.json.erb │ │ └── index.json.erb │ ├── devise │ │ ├── mailer │ │ │ ├── password_change.html.erb │ │ │ ├── confirmation_instructions.html.erb │ │ │ ├── unlock_instructions.html.erb │ │ │ └── reset_password_instructions.html.erb │ │ ├── unlocks │ │ │ └── new.html.erb │ │ ├── confirmations │ │ │ └── new.html.erb │ │ ├── passwords │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ │ ├── sessions │ │ │ └── new.html.erb │ │ ├── shared │ │ │ └── _links.html.erb │ │ └── registrations │ │ │ ├── new.html.erb │ │ │ └── edit.html.erb │ ├── administration │ │ └── index.html.erb │ ├── subscriptions │ │ └── authenticate.json.erb │ ├── preferences │ │ ├── _category.html.erb │ │ ├── index_snworks.html.erb │ │ └── index.html.erb │ ├── users │ │ ├── index.html.erb │ │ ├── show.html.erb │ │ ├── edit.html.erb │ │ └── new.html.erb │ ├── analytics │ │ └── index.html.erb │ └── layouts │ │ └── application.html.erb ├── helpers │ ├── users_helper.rb │ ├── articles_helper.rb │ ├── administration_helper.rb │ ├── notifications_helper.rb │ ├── subscriptions_helper.rb │ └── application_helper.rb ├── jobs │ ├── application_job.rb │ └── scheduled_tasks │ │ ├── caching │ │ └── warm_cache_job.rb │ │ └── scheduled_task.rb └── javascript │ ├── controllers │ ├── index.js │ └── category_list_controller.js │ └── packs │ └── application.js ├── lib ├── assets │ └── .keep └── tasks │ ├── .keep │ └── scheduled_tasks.rb ├── public ├── favicon.ico ├── robots.txt ├── packs │ └── manifest.json ├── 500.html ├── 422.html └── 404.html ├── test ├── helpers │ └── .keep ├── mailers │ └── .keep ├── models │ ├── .keep │ ├── user_test.rb │ ├── consumer_test.rb │ ├── push_device_test.rb │ ├── notification_test.rb │ ├── consumer_event_test.rb │ ├── subscription_user_test.rb │ ├── sn_works_ceo_test.rb │ └── wordpress_test.rb ├── controllers │ ├── .keep │ ├── users_controller_test.rb │ ├── articles_controller_test.rb │ ├── notifications_controller_test.rb │ ├── administration_controller_test.rb │ └── subscriptions_controller_test.rb ├── fixtures │ ├── .keep │ ├── users.yml │ ├── consumers.yml │ ├── consumer_events.yml │ ├── notifications.yml │ ├── push_devices.yml │ ├── sn_works_ceos.yml │ └── subscription_users.yml ├── integration │ └── .keep ├── jobs │ └── warm_cache_job_test.rb └── test_helper.rb ├── .docker ├── backups │ └── .keep ├── .DS_Store ├── data │ └── .DS_Store └── nginx │ ├── .DS_Store │ ├── dev │ └── nginx.conf │ └── nginx.conf ├── .ruby-version ├── .browserslistrc ├── vendor └── assets │ ├── javascripts │ └── .keep │ └── stylesheets │ └── .keep ├── Procfile ├── config ├── initializers │ ├── time_formats.rb │ ├── session_store.rb │ ├── mime_types.rb │ ├── content_security_policy.rb │ ├── filter_parameter_logging.rb │ ├── application_controller_renderer.rb │ ├── cookies_serializer.rb │ ├── sidekiq.rb │ ├── backtrace_silencers.rb │ ├── wrap_parameters.rb │ ├── inflections.rb │ ├── assets.rb │ ├── figaro.rb │ ├── new_framework_defaults_5_2.rb │ └── scheduler.rb ├── webpack │ ├── environment.js │ ├── test.js │ ├── production.js │ └── development.js ├── boot.rb ├── environment.rb ├── sidekiq.yml ├── app.yml ├── cable.yml ├── database.yml ├── application.rb ├── locales │ ├── en.yml │ └── devise.en.yml ├── secrets.yml ├── puma.rb ├── storage.yml ├── routes.rb ├── environments │ ├── test.rb │ ├── development.rb │ └── production.rb └── webpacker.yml ├── bin ├── rake ├── bundle ├── rails ├── yarn ├── webpack ├── webpack-dev-server ├── spring ├── update └── setup ├── config.ru ├── db ├── migrate │ ├── 20160710185334_add_push_time_to_notification.rb │ ├── 20200417030553_add_headline_to_notification.rb │ ├── 20160712130648_add_article_id_to_notification.rb │ ├── 20190217052137_create_sn_works_ceos.rb │ ├── 20161104181227_add_status_to_push_device.rb │ ├── 20180116215137_create_subscription_users.rb │ ├── 20160708161758_create_push_devices.rb │ ├── 20160708160654_create_notifications.rb │ ├── 20170213215532_create_consumers.rb │ ├── 20160710162055_create_settings.rb │ ├── 20170213220839_create_consumer_events.rb │ ├── 20160719172629_add_confirmable_to_devise.rb │ └── 20160708160653_devise_create_users.rb ├── seeds.rb └── schema.rb ├── .gitmodules ├── entrypoint_sidekiq.sh ├── entrypoint_webpacker.sh ├── Cheffile ├── Rakefile ├── entrypoint_scheduled_jobs.sh ├── postcss.config.js ├── package.json ├── githooks ├── pre-commit └── README.md ├── scheduler.rb ├── README.rdoc ├── Vagrantfile ├── Dockerfile ├── LICENSE ├── Cheffile.lock ├── maintence-scripts ├── setup-databases.sh ├── setup.sh ├── upgrade.sh ├── renew-lets_encrypt.sh ├── includes.sh ├── export.sh └── setup-lets_encrypt.sh ├── app.json ├── .rubocop.yml ├── .gitignore ├── babel.config.js ├── entrypoint.sh ├── secrets.env.template ├── docker-compose-no-nginx.yml ├── letsencrypt-docker-compose.yml ├── Gemfile ├── docker-compose-no-nginx-dev.yml └── data └── appendonly.aof /log/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/assets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /lib/tasks/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/helpers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/mailers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/models/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.docker/backups/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.ruby-version: -------------------------------------------------------------------------------- 1 | 2.6.6 2 | -------------------------------------------------------------------------------- /app/assets/images/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/controllers/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/fixtures/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test/integration/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.browserslistrc: -------------------------------------------------------------------------------- 1 | defaults 2 | -------------------------------------------------------------------------------- /app/models/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/controllers/concerns/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/javascripts/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /vendor/assets/stylesheets/.keep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /app/views/notifications/_notification.html.erb: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Procfile: -------------------------------------------------------------------------------- 1 | web: bundle exec puma -C config/puma.rb 2 | -------------------------------------------------------------------------------- /app/assets/config/manifest.js: -------------------------------------------------------------------------------- 1 | //= link application.css 2 | -------------------------------------------------------------------------------- /app/helpers/users_helper.rb: -------------------------------------------------------------------------------- 1 | module UsersHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/articles_helper.rb: -------------------------------------------------------------------------------- 1 | module ArticlesHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/administration_helper.rb: -------------------------------------------------------------------------------- 1 | module AdministrationHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/notifications_helper.rb: -------------------------------------------------------------------------------- 1 | module NotificationsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/helpers/subscriptions_helper.rb: -------------------------------------------------------------------------------- 1 | module SubscriptionsHelper 2 | end 3 | -------------------------------------------------------------------------------- /app/jobs/application_job.rb: -------------------------------------------------------------------------------- 1 | class ApplicationJob < ActiveJob::Base 2 | end 3 | -------------------------------------------------------------------------------- /app/assets/stylesheets/preferences.scss: -------------------------------------------------------------------------------- 1 | .categories { 2 | width: 50%; 3 | } 4 | -------------------------------------------------------------------------------- /app/views/articles/index.html.erb: -------------------------------------------------------------------------------- 1 | <%= raw(JSON.pretty_generate @response) %> 2 | -------------------------------------------------------------------------------- /config/initializers/time_formats.rb: -------------------------------------------------------------------------------- 1 | Time::DATE_FORMATS[:number_date] = "%Y%m%d" 2 | -------------------------------------------------------------------------------- /.docker/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PushOCCRP/Push-Backend/HEAD/.docker/.DS_Store -------------------------------------------------------------------------------- /.docker/data/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PushOCCRP/Push-Backend/HEAD/.docker/data/.DS_Store -------------------------------------------------------------------------------- /.docker/nginx/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/PushOCCRP/Push-Backend/HEAD/.docker/nginx/.DS_Store -------------------------------------------------------------------------------- /bin/rake: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | require_relative '../config/boot' 3 | require 'rake' 4 | Rake.application.run 5 | -------------------------------------------------------------------------------- /app/models/application_record.rb: -------------------------------------------------------------------------------- 1 | class ApplicationRecord < ActiveRecord::Base 2 | self.abstract_class = true 3 | end 4 | -------------------------------------------------------------------------------- /config/webpack/environment.js: -------------------------------------------------------------------------------- 1 | const { environment } = require('@rails/webpacker') 2 | 3 | module.exports = environment 4 | -------------------------------------------------------------------------------- /bin/bundle: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) 3 | load Gem.bin_path('bundler', 'bundle') 4 | -------------------------------------------------------------------------------- /config/boot.rb: -------------------------------------------------------------------------------- 1 | ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) 2 | 3 | require "bundler/setup" # Set up gems listed in the Gemfile. 4 | -------------------------------------------------------------------------------- /app/models/setting.rb: -------------------------------------------------------------------------------- 1 | # RailsSettings Model 2 | class Setting < RailsSettings::Base 3 | source Rails.root.join("config/app.yml") 4 | namespace Rails.env 5 | end 6 | -------------------------------------------------------------------------------- /bin/rails: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_PATH = File.expand_path('../config/application', __dir__) 3 | require_relative '../config/boot' 4 | require 'rails/commands' 5 | -------------------------------------------------------------------------------- /test/models/user_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class UserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/views/devise/mailer/password_change.html.erb: -------------------------------------------------------------------------------- 1 |
Hello <%= @resource.email %>!
2 | 3 |We're contacting you to notify you that your password has been changed.
4 | -------------------------------------------------------------------------------- /config.ru: -------------------------------------------------------------------------------- 1 | # This file is used by Rack-based servers to start the application. 2 | 3 | require ::File.expand_path("../config/environment", __FILE__) 4 | run Rails.application 5 | -------------------------------------------------------------------------------- /test/models/consumer_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ConsumerTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/controllers/administration_controller.rb: -------------------------------------------------------------------------------- 1 | class AdministrationController < ApplicationController 2 | before_action :authenticate_user! 3 | 4 | def index 5 | end 6 | end 7 | -------------------------------------------------------------------------------- /test/jobs/warm_cache_job_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class WarmCacheJobTest < ActiveJob::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/push_device_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class PushDeviceTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/models/consumer.rb: -------------------------------------------------------------------------------- 1 | class Consumer < ActiveRecord::Base 2 | has_many :consumer_events 3 | 4 | before_save do |consumer| 5 | consumer.last_seen = Time.now 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/models/notification_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class NotificationTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config/environment.rb: -------------------------------------------------------------------------------- 1 | # Load the Rails application. 2 | require File.expand_path("../application", __FILE__) 3 | 4 | # Initialize the Rails application. 5 | Rails.application.initialize! 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: "_Push-Backend_session" 4 | -------------------------------------------------------------------------------- /test/models/consumer_event_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ConsumerEventTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config/webpack/test.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'development' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /test/models/subscription_user_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class SubscriptionUserTest < ActiveSupport::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /config/webpack/production.js: -------------------------------------------------------------------------------- 1 | process.env.NODE_ENV = process.env.NODE_ENV || 'production' 2 | 3 | const environment = require('./environment') 4 | 5 | module.exports = environment.toWebpackConfig() 6 | -------------------------------------------------------------------------------- /test/controllers/users_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class UsersControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /test/controllers/articles_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class ArticlesControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /db/migrate/20160710185334_add_push_time_to_notification.rb: -------------------------------------------------------------------------------- 1 | class AddPushTimeToNotification < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :notifications, :push_time, :date 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20200417030553_add_headline_to_notification.rb: -------------------------------------------------------------------------------- 1 | class AddHeadlineToNotification < ActiveRecord::Migration[5.2] 2 | def change 3 | add_column :notifications, :headline, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /db/migrate/20160712130648_add_article_id_to_notification.rb: -------------------------------------------------------------------------------- 1 | class AddArticleIdToNotification < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :notifications, :article_id, :string 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /test/controllers/notifications_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class NotificationsControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/sidekiq.yml: -------------------------------------------------------------------------------- 1 | development: 2 | :concurrency: 5 3 | production: 4 | :concurrency: 6 5 | :queues: 6 | - [urgent, 2] 7 | - default 8 | - scheduled_tasks 9 | 10 | :verbose: false 11 | :timeout: 8 12 | -------------------------------------------------------------------------------- /db/migrate/20190217052137_create_sn_works_ceos.rb: -------------------------------------------------------------------------------- 1 | class CreateSnWorksCeos < ActiveRecord::Migration[5.2] 2 | def change 3 | create_table :sn_works_ceos do |t| 4 | t.timestamps 5 | end 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/administration_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class AdministrationControllerTest < ActionController::TestCase 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /test/controllers/subscriptions_controller_test.rb: -------------------------------------------------------------------------------- 1 | require "test_helper" 2 | 3 | class SubscriptionsControllerTest < ActionDispatch::IntegrationTest 4 | # test "the truth" do 5 | # assert true 6 | # end 7 | end 8 | -------------------------------------------------------------------------------- /app/assets/stylesheets/articles.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the articles controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /config/initializers/content_security_policy.rb: -------------------------------------------------------------------------------- 1 | Rails.application.config.content_security_policy do |policy| 2 | policy.connect_src :self, :http, "http://localhost:3035", "ws://localhost:3035" if Rails.env.development? 3 | end 4 | -------------------------------------------------------------------------------- /db/migrate/20161104181227_add_status_to_push_device.rb: -------------------------------------------------------------------------------- 1 | class AddStatusToPushDevice < ActiveRecord::Migration[4.2] 2 | def change 3 | add_column :push_devices, :status, :Integer, default: 0, null: false 4 | end 5 | end 6 | -------------------------------------------------------------------------------- /app/assets/stylesheets/subscriptions.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Subscriptions controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "docker-uniqush"] 2 | path = docker-uniqush 3 | url = https://git.occrp.org/libre/docker-uniqush.git 4 | [submodule "uniqush-push"] 5 | path = uniqush-push 6 | url = https://github.com/uniqush/uniqush-push.git 7 | -------------------------------------------------------------------------------- /app/assets/stylesheets/administration.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the administration 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 | -------------------------------------------------------------------------------- /config/app.yml: -------------------------------------------------------------------------------- 1 | # config/app.yml for rails-settings-cached 2 | defaults: &defaults 3 | foo: "Foo" 4 | bar: 123 5 | 6 | development: 7 | <<: *defaults 8 | 9 | test: 10 | <<: *defaults 11 | 12 | production: 13 | <<: *defaults 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /config/cable.yml: -------------------------------------------------------------------------------- 1 | development: 2 | adapter: async 3 | 4 | test: 5 | adapter: async 6 | 7 | production: 8 | adapter: redis 9 | url: <%= ENV.fetch("REDIS_URL") { "redis://localhost:6379/1" } %> 10 | channel_prefix: push_backend_production 11 | -------------------------------------------------------------------------------- /app/views/notifications/subscribe.json.erb: -------------------------------------------------------------------------------- 1 | { 2 | "status": "<%= @status %>", 3 | "status_id": "<%= @status_id %>", 4 | "uniqush_code": "<%= @uniqush_code %>", 5 | "uniqush_message": "<%= @uniqush_message %>", 6 | "uniqush_reponse": "<%= @uniqush_reponse %>" 7 | } -------------------------------------------------------------------------------- /app/views/notifications/unsubscribe.json.erb: -------------------------------------------------------------------------------- 1 | { 2 | "status": "<%= @status %>", 3 | "status_id": "<%= @status_id %>", 4 | "uniqush_code": "<%= @uniqush_code %>", 5 | "uniqush_message": "<%= @uniqush_message %>", 6 | "uniqush_reponse": "<%= @uniqush_reponse %>" 7 | } -------------------------------------------------------------------------------- /entrypoint_sidekiq.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "" 4 | echo "Running Bundler... 🎁" 5 | 6 | bundle config build.nokogiri --use-system-libraries 7 | bundle install --path vendor/bundle 8 | 9 | echo "" 10 | echo "Starting Sidekiq...⚙️🦵" 11 | 12 | exec $@ 13 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /entrypoint_webpacker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "" 4 | echo "Running Bundler... 🎁" 5 | 6 | bundle config build.nokogiri --use-system-libraries 7 | bundle install --path vendor/bundle 8 | 9 | echo "" 10 | echo "Starting Webpacker... 🕸️📦" 11 | 12 | exec $@ 13 | -------------------------------------------------------------------------------- /Cheffile: -------------------------------------------------------------------------------- 1 | site "http://community.opscode.com/api/v1" 2 | 3 | cookbook "apt" 4 | cookbook "build-essential" 5 | cookbook "mysql", "5.5.3" 6 | cookbook "ruby_build" 7 | cookbook "nodejs" 8 | cookbook "rbenv", git: "https://github.com/aminin/chef-rbenv" 9 | cookbook "vim" 10 | -------------------------------------------------------------------------------- /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 File.expand_path("../config/application", __FILE__) 5 | 6 | Rails.application.load_tasks 7 | -------------------------------------------------------------------------------- /app/assets/stylesheets/notifications.scss: -------------------------------------------------------------------------------- 1 | // Place all the styles related to the Notifications controller here. 2 | // They will automatically be included in application.css. 3 | // You can use Sass (SCSS) here: http://sass-lang.com/ 4 | 5 | .action_button { 6 | min-width: 100%; 7 | } -------------------------------------------------------------------------------- /entrypoint_scheduled_jobs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "" 4 | echo "Running Bundler... 🎁" 5 | 6 | bundle config build.nokogiri --use-system-libraries 7 | bundle install --path vendor/bundle 8 | 9 | echo "" 10 | echo "Starting Clockwork Job Scheduler... 🕰️ 🗓️" 11 | 12 | exec $@ 13 | -------------------------------------------------------------------------------- /app/models/user.rb: -------------------------------------------------------------------------------- 1 | class User < ApplicationRecord 2 | # Include default devise modules. Others available are: 3 | # :confirmable, :lockable, :timeoutable and :omniauthable 4 | devise :database_authenticatable, :rememberable, :trackable, :validatable 5 | 6 | has_many :notifications 7 | end 8 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: [ 3 | require('postcss-import'), 4 | require('postcss-flexbugs-fixes'), 5 | require('postcss-preset-env')({ 6 | autoprefixer: { 7 | flexbox: 'no-2009' 8 | }, 9 | stage: 3 10 | }) 11 | ] 12 | } 13 | -------------------------------------------------------------------------------- /app/javascript/controllers/index.js: -------------------------------------------------------------------------------- 1 | import { Application } from "stimulus" 2 | import { definitionsFromContext } from "stimulus/webpack-helpers" 3 | 4 | const application = Application.start() 5 | const context = require.context(".", true, /\.js$/) 6 | application.load(definitionsFromContext(context)) 7 | -------------------------------------------------------------------------------- /app/views/administration/index.html.erb: -------------------------------------------------------------------------------- 1 |Hello <%= @resource.email %>!
2 | 3 |Your account has been locked due to an excessive number of unsuccessful sign in attempts.
4 | 5 |Click the link below to unlock your account:
6 | 7 |<%= link_to 'Unlock my account', unlock_url(@resource, unlock_token: @token) %>
8 | -------------------------------------------------------------------------------- /bin/yarn: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | APP_ROOT = File.expand_path('..', __dir__) 3 | Dir.chdir(APP_ROOT) do 4 | begin 5 | exec "yarnpkg", *ARGV 6 | rescue Errno::ENOENT 7 | $stderr.puts "Yarn executable was not detected in the system." 8 | $stderr.puts "Download Yarn at https://yarnpkg.com/en/docs/install" 9 | exit 1 10 | end 11 | end 12 | -------------------------------------------------------------------------------- /db/migrate/20160708161758_create_push_devices.rb: -------------------------------------------------------------------------------- 1 | class CreatePushDevices < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :push_devices do |t| 4 | t.string :dev_token 5 | t.string :dev_id 6 | 7 | t.string :language 8 | 9 | t.string :platform 10 | 11 | t.timestamps null: false 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "dependencies": { 3 | "@rails/activestorage": "^6.0.2-1", 4 | "@rails/ujs": "^6.0.2-1", 5 | "@rails/webpacker": "4.2.2", 6 | "jquery": "^3.4.1", 7 | "stimulus": "^1.1.1", 8 | "turbolinks": "^5.2.0", 9 | "uuid": "^8.3.0" 10 | }, 11 | "devDependencies": { 12 | "webpack-dev-server": "^3.10.1" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/test_helper.rb: -------------------------------------------------------------------------------- 1 | ENV["RAILS_ENV"] ||= "test" 2 | require File.expand_path("../../config/environment", __FILE__) 3 | require "rails/test_help" 4 | 5 | class ActiveSupport::TestCase 6 | # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order. 7 | fixtures :all 8 | 9 | # Add more helper methods to be used by all tests here... 10 | end 11 | -------------------------------------------------------------------------------- /config/initializers/sidekiq.rb: -------------------------------------------------------------------------------- 1 | require "sidekiq/web" 2 | 3 | Concurrent.use_stdlib_logger(Logger::DEBUG) 4 | 5 | Sidekiq.configure_client do |config| 6 | config.redis = { url: ENV["REDIS_URL"] } 7 | end 8 | 9 | Sidekiq.configure_server do |config| 10 | config.redis = { url: ENV["REDIS_URL"] } 11 | end 12 | 13 | Sidekiq.default_worker_options = { "backtrace" => true } 14 | -------------------------------------------------------------------------------- /db/migrate/20160708160654_create_notifications.rb: -------------------------------------------------------------------------------- 1 | class CreateNotifications < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :notifications do |t| 4 | add_reference :users, index: true, foreign_key: true 5 | 6 | t.text :message 7 | t.string :language 8 | 9 | t.integer :reach 10 | 11 | t.timestamps null: false 12 | end 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /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/consumers.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/consumer_events.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/notifications.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/push_devices.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/sn_works_ceos.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/subscription_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 | -------------------------------------------------------------------------------- /db/migrate/20170213215532_create_consumers.rb: -------------------------------------------------------------------------------- 1 | class CreateConsumers < ActiveRecord::Migration[4.2] 2 | def change 3 | create_table :consumers do |t| 4 | t.string :uuid, null: false 5 | t.datetime :last_seen, null: false 6 | t.integer :times_seen, null: false, default: 0 7 | t.timestamps null: false 8 | end 9 | 10 | add_index :consumers, :uuid, unique: true 11 | end 12 | end 13 | -------------------------------------------------------------------------------- /public/packs/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "application.js": "/packs/js/application-98ad9879f11716ff1bb8.js", 3 | "application.js.map": "/packs/js/application-98ad9879f11716ff1bb8.js.map", 4 | "entrypoints": { 5 | "application": { 6 | "js": [ 7 | "/packs/js/application-98ad9879f11716ff1bb8.js" 8 | ], 9 | "js.map": [ 10 | "/packs/js/application-98ad9879f11716ff1bb8.js.map" 11 | ] 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /app/models/subscription_user.rb: -------------------------------------------------------------------------------- 1 | class SubscriptionUser < ApplicationRecord 2 | before_create :generate_api_key 3 | 4 | def self.authenticate(username, api_key) 5 | user = self.find(username: username) 6 | return false, User.new if user.nil? 7 | 8 | authenticated = user.api_key == api_key 9 | return authenticated, user 10 | end 11 | 12 | def generate_api_key 13 | self.api_key = SecureRandom.hex(12) 14 | end 15 | end 16 | -------------------------------------------------------------------------------- /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.
9 | -------------------------------------------------------------------------------- /app/views/notifications/resubscribe.html.erb: -------------------------------------------------------------------------------- 1 |If you are the application owner check the logs for more information.
64 |Maybe you tried to change something you didn't have access to.
63 |If you are the application owner check the logs for more information.
65 |30 |
You may have mistyped the address or the page may have moved.
63 |If you are the application owner check the logs for more information.
65 |Unhappy? <%= button_to "Cancel my account", registration_path(resource_name), data: { confirm: "Are you sure?" }, method: :delete %>
53 | 54 | <%= link_to "Back", :back %> 55 | 56 || Active Users In the Last Day: | 16 |<%= @consumer_count_last_day %> | 17 |
| Active Users In the Last Week: | 20 |<%= @consumer_count_last_week %> | 21 |
| Active Users In the Last Month: | 24 |<%= @consumer_count_last_month %> | 25 |
| Total Users All Time: | 28 |<%= @consumer_count %> | 29 |
| Articles Load/Reload (last day): | 41 |<%= @articles_request_count_last_day %> | 42 |
| Articles Load/Reload (last week): | 45 |<%= @articles_request_count_last_week %> | 46 |
| Articles Load/Reload (last month): | 49 |<%= @articles_request_count_last_month %> | 50 |
| <%= link_to search.search_phrase, controller: 'articles', action: 'search', format: 'json', language: search.language, q: search.search_phrase %> | 65 |