completed SMS gateway project

This commit is contained in:
Min Zeya Phyo
2025-10-22 17:22:17 +08:00
commit c883fa7128
190 changed files with 16294 additions and 0 deletions

View File

@@ -0,0 +1,7 @@
# Be sure to restart your server when you modify this file.
# Version of your assets, change this if you want to expire all your assets.
Rails.application.config.assets.version = "1.0"
# Add additional assets to the asset load path.
# Rails.application.config.assets.paths << Emoji.images_path

View File

@@ -0,0 +1,25 @@
# Be sure to restart your server when you modify this file.
# Define an application-wide content security policy.
# See the Securing Rails Applications Guide for more information:
# https://guides.rubyonrails.org/security.html#content-security-policy-header
# Rails.application.configure do
# config.content_security_policy do |policy|
# policy.default_src :self, :https
# policy.font_src :self, :https, :data
# policy.img_src :self, :https, :data
# policy.object_src :none
# policy.script_src :self, :https
# policy.style_src :self, :https
# # Specify URI for violation reports
# # policy.report_uri "/csp-violation-report-endpoint"
# end
#
# # Generate session nonces for permitted importmap, inline scripts, and inline styles.
# config.content_security_policy_nonce_generator = ->(request) { request.session.id.to_s }
# config.content_security_policy_nonce_directives = %w(script-src style-src)
#
# # Report violations without enforcing the policy.
# # config.content_security_policy_report_only = true
# end

View File

@@ -0,0 +1,17 @@
# Be sure to restart your server when you modify this file.
# Avoid CORS issues when API is called from the frontend app.
# Handle Cross-Origin Resource Sharing (CORS) in order to accept cross-origin AJAX requests.
# Read more: https://github.com/cyu/rack-cors
Rails.application.config.middleware.insert_before 0, Rack::Cors do
allow do
origins ENV.fetch("ALLOWED_ORIGINS", "*").split(",")
resource "*",
headers: :any,
methods: [:get, :post, :put, :patch, :delete, :options, :head],
expose: ["Authorization"]
end
end

View File

@@ -0,0 +1,8 @@
# Be sure to restart your server when you modify this file.
# Configure parameters to be partially matched (e.g. passw matches password) and filtered from the log file.
# Use this to limit dissemination of sensitive information.
# See the ActiveSupport::ParameterFilter documentation for supported notations and behaviors.
Rails.application.config.filter_parameters += [
:passw, :email, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn, :cvv, :cvc
]

View File

@@ -0,0 +1,16 @@
# Be sure to restart your server when you modify this file.
# Add new inflection rules using the following format. Inflections
# are locale specific, and you may define rules for as many different
# locales as you wish. All of these examples are active by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.plural /^(ox)$/i, "\\1en"
# inflect.singular /^(ox)en/i, "\\1"
# inflect.irregular "person", "people"
# inflect.uncountable %w( fish sheep )
# end
# These inflection rules are supported but not enabled by default:
# ActiveSupport::Inflector.inflections(:en) do |inflect|
# inflect.acronym "RESTful"
# end

View File

@@ -0,0 +1,33 @@
# Pagy initializer file (6.x)
# Customize only what you really need and notice that the core Pagy works also without any of the following lines.
# Should you just cherry pick part of this file, please maintain the require-order of the extras.
# Extras
# See https://ddnexus.github.io/pagy/extras
# Backend Extras
# Array extra: Paginate arrays
# See https://ddnexus.github.io/pagy/extras/array
# require 'pagy/extras/array'
# Countless extra: Paginate without any count
# See https://ddnexus.github.io/pagy/extras/countless
# require 'pagy/extras/countless'
# Metadata extra: Provides the pagination metadata to Javascript frameworks
# See https://ddnexus.github.io/pagy/extras/metadata
require "pagy/extras/metadata"
# Items extra: Allow the client to request a custom number of items per page
# See https://ddnexus.github.io/pagy/extras/items
# require 'pagy/extras/items'
# Overflow extra: Allow for easy handling of overflowing pages
# See https://ddnexus.github.io/pagy/extras/overflow
require "pagy/extras/overflow"
Pagy::DEFAULT[:overflow] = :last_page
# Default configuration
Pagy::DEFAULT[:items] = 20
Pagy::DEFAULT[:max_items] = 100

View File

@@ -0,0 +1,2 @@
# Configure Phonelib for phone number validation
Phonelib.default_country = ENV.fetch("DEFAULT_COUNTRY_CODE", "US")

View File

@@ -0,0 +1,3 @@
# Configure session store for admin interface
# Even though this is an API-only app, the admin interface needs sessions
Rails.application.config.session_store :cookie_store, key: '_my_smsa_pio_session'

View File

@@ -0,0 +1,19 @@
require "sidekiq"
require "sidekiq-cron"
# Sidekiq configuration
Sidekiq.configure_server do |config|
config.redis = { url: ENV.fetch("REDIS_URL", "redis://localhost:6379/1") }
# Load cron jobs from YAML file if it exists
schedule_file = "config/sidekiq_cron.yml"
if File.exist?(schedule_file)
schedule = YAML.load_file(schedule_file)
Sidekiq::Cron::Job.load_from_hash(schedule)
end
end
Sidekiq.configure_client do |config|
config.redis = { url: ENV.fetch("REDIS_URL", "redis://localhost:6379/1") }
end