From 0b8a33890293a3e0dad7e9230a9527b9057a1abe Mon Sep 17 00:00:00 2001 From: 24c02 <163450896+24c02@users.noreply.github.com> Date: Mon, 24 Nov 2025 19:03:34 -0500 Subject: [PATCH] rename to account.hackclub.com woag!! --- README.md | 4 ++-- app/services/saml_service/entities.rb | 2 +- app/views/docs/welcome.md.erb | 2 +- app/views/pwa/manifest.json.erb | 4 ++-- config/application.rb | 6 ++++-- config/environments/production.rb | 4 ++-- config/environments/uat.rb | 2 +- config/initializers/git_version.rb | 2 +- config/saml.yml | 4 ++-- lib/middleware/domain_redirect.rb | 16 ++++++++++++++++ 10 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 lib/middleware/domain_redirect.rb diff --git a/README.md b/README.md index e47f353..083b3b3 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Identity Vault +# Hack Club Account -This is the Rails codebase powering https://identity.hackclub.com! +This is the Rails codebase powering https://account.hackclub.com! ## contributing diff --git a/app/services/saml_service/entities.rb b/app/services/saml_service/entities.rb index ef7183a..2108498 100644 --- a/app/services/saml_service/entities.rb +++ b/app/services/saml_service/entities.rb @@ -42,7 +42,7 @@ module SAMLService @metadata_xml ||= begin xml = idp_entity.to_xml xml.root.add_child Nokogiri::XML::Comment.new(xml, " haiii :3 ") - xml.add_child Nokogiri::XML::Comment.new(xml, " curious thing, aren't you? – https://hack.af/gh/identity-vault , glory awaits") + xml.add_child Nokogiri::XML::Comment.new(xml, " curious thing, aren't you? – https://hack.af/gh/account , glory awaits") xml.to_s end end diff --git a/app/views/docs/welcome.md.erb b/app/views/docs/welcome.md.erb index 1cd4a81..52bd17e 100644 --- a/app/views/docs/welcome.md.erb +++ b/app/views/docs/welcome.md.erb @@ -11,4 +11,4 @@ thank you for being the kind of person who reads documentation. these are still WIP, but i'll be adding more content here over time. -if you want to contribute, please open a PR! they're just [markdown files](https://github.com/hackclub/identity-vault/tree/main/app/views/docs/) :-) +if you want to contribute, please open a PR! they're just [markdown files](https://github.com/hackclub/account/tree/main/app/views/docs/) :-) diff --git a/app/views/pwa/manifest.json.erb b/app/views/pwa/manifest.json.erb index 27d570f..33b25b9 100644 --- a/app/views/pwa/manifest.json.erb +++ b/app/views/pwa/manifest.json.erb @@ -1,5 +1,5 @@ { - "name": "IdentityVault", + "name": "Hack Club Account", "icons": [ { "src": "/icon.png", @@ -16,7 +16,7 @@ "start_url": "/", "display": "standalone", "scope": "/", - "description": "IdentityVault.", + "description": "hack club account!", "theme_color": "red", "background_color": "red" } diff --git a/config/application.rb b/config/application.rb index 55f4d16..0630a49 100644 --- a/config/application.rb +++ b/config/application.rb @@ -1,4 +1,5 @@ require_relative "boot" +require_relative "../lib/middleware/domain_redirect" require "rails" # Pick the frameworks you want: @@ -27,7 +28,8 @@ module IdentityVault # Please, add to the `ignore` list any other `lib` subdirectories that do # not contain `.rb` files, or that should not be reloaded or eager loaded. # Common ones are `templates`, `generators`, or `middleware`, for example. - config.autoload_lib(ignore: %w[assets tasks]) + config.autoload_lib(ignore: %w[assets tasks middleware]) + config.autoload_paths << "#{root}/lib/middleware" # Configuration for the application, engines, and railties goes here. # @@ -63,7 +65,7 @@ module IdentityVault httponly: true, same_site: :lax - config.middleware.use Rack::Attack + config.middleware.use DomainRedirect config.audits1984.base_controller_class = "Backend::NoAuthController" config.audits1984.auditor_class = "Backend::User" diff --git a/config/environments/production.rb b/config/environments/production.rb index 75c91f0..120466f 100644 --- a/config/environments/production.rb +++ b/config/environments/production.rb @@ -57,9 +57,9 @@ Rails.application.configure do # config.action_mailer.raise_delivery_errors = false # Set host to be used by links generated in mailer templates. - config.action_mailer.default_url_options = { host: "identity.hackclub.com" } + config.action_mailer.default_url_options = { host: "account.hackclub.com" } - Rails.application.routes.default_url_options[:host] = "identity.hackclub.com" + Rails.application.routes.default_url_options[:host] = "account.hackclub.com" # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. config.action_mailer.delivery_method = :smtp diff --git a/config/environments/uat.rb b/config/environments/uat.rb index 1d57d1d..0b3cb61 100644 --- a/config/environments/uat.rb +++ b/config/environments/uat.rb @@ -57,7 +57,7 @@ Rails.application.configure do # config.action_mailer.raise_delivery_errors = false # Set host to be used by links generated in mailer templates. - config.action_mailer.default_url_options = { host: "identity.hackclub.com" } + config.action_mailer.default_url_options = { host: "account.hackclub.com" } # Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit. config.action_mailer.delivery_method = :smtp diff --git a/config/initializers/git_version.rb b/config/initializers/git_version.rb index 241603d..121ed94 100644 --- a/config/initializers/git_version.rb +++ b/config/initializers/git_version.rb @@ -1,7 +1,7 @@ # Get the first 6 characters of the current git commit hash git_hash = ENV["SOURCE_COMMIT"] || `git rev-parse HEAD` rescue "unknown" -commit_link = git_hash != "unknown" ? "https://github.com/hackclub/identity-vault/commit/#{git_hash}" : nil +commit_link = git_hash != "unknown" ? "https://github.com/hackclub/account/commit/#{git_hash}" : nil short_hash = git_hash[0..7] diff --git a/config/saml.yml b/config/saml.yml index 00b9608..585a895 100644 --- a/config/saml.yml +++ b/config/saml.yml @@ -159,9 +159,9 @@ uat: allow_unsigned_requests: true production: idp_metadata: - entity_id: https://identity.hackclub.com + entity_id: https://account.hackclub.com single_sign_on_services: - - location: https://identity.hackclub.com/saml/auth + - location: https://account.hackclub.com/saml/auth binding: urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST service_providers: - slug: slack diff --git a/lib/middleware/domain_redirect.rb b/lib/middleware/domain_redirect.rb new file mode 100644 index 0000000..732ec19 --- /dev/null +++ b/lib/middleware/domain_redirect.rb @@ -0,0 +1,16 @@ +class DomainRedirect + def initialize(app) + @app = app + end + + def call(env) + request = Rack::Request.new(env) + + if request.path.start_with?('/api') || request.host == 'account.hackclub.com' + return @app.call(env) + end + + # Redirect to account.hackclub.com + [301, { 'Location' => "https://account.hackclub.com#{request.fullpath}", 'Content-Type' => 'text/html' }, []] + end +end