mirror of
https://github.com/SrIzan10/hc-harbor.git
synced 2026-05-01 10:45:21 +00:00
Remove wildcard/joker redirect
This commit is contained in:
@@ -40,10 +40,6 @@ LOOPS_API_KEY=your_loops_api_key_here
|
|||||||
# Sentry DSN for error tracking
|
# Sentry DSN for error tracking
|
||||||
SENTRY_DSN=your_sentry_dsn_here
|
SENTRY_DSN=your_sentry_dsn_here
|
||||||
|
|
||||||
# 🃏
|
|
||||||
WILDCARD_AIRTABLE_KEY=your_airtable_key_here
|
|
||||||
WILDCARD_HOST=your_wildcard_host_here
|
|
||||||
|
|
||||||
# key for updating loops via airtable
|
# key for updating loops via airtable
|
||||||
LOOPS_AIRTABLE_PAT=your_airtable_key_here
|
LOOPS_AIRTABLE_PAT=your_airtable_key_here
|
||||||
|
|
||||||
|
|||||||
@@ -182,44 +182,6 @@ class StaticPagesController < ApplicationController
|
|||||||
render partial: "filterable_dashboard_content"
|
render partial: "filterable_dashboard_content"
|
||||||
end
|
end
|
||||||
|
|
||||||
def 🃏
|
|
||||||
redirect_to root_path unless current_user && current_user.slack_uid.present?
|
|
||||||
|
|
||||||
record = HTTP.auth("Bearer #{ENV.fetch("WILDCARD_AIRTABLE_KEY")}").patch("https://api.airtable.com/v0/appt3yVn2nbiUaijm/tblRCAMjfQ4MIsMPp",
|
|
||||||
json: {
|
|
||||||
records: [
|
|
||||||
{
|
|
||||||
fields: {
|
|
||||||
slack_id: current_user.slack_uid
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
performUpsert: {
|
|
||||||
fieldsToMergeOn: [ "slack_id" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
)
|
|
||||||
record_data = JSON.parse(record.body)
|
|
||||||
|
|
||||||
record_id = record_data.dig("records", 0, "id")
|
|
||||||
|
|
||||||
redirect_to root_path unless record_id&.present?
|
|
||||||
|
|
||||||
# if record is created, set a new auth_key:
|
|
||||||
auth_key = SecureRandom.hex(16)
|
|
||||||
HTTP.auth("Bearer #{ENV.fetch("WILDCARD_AIRTABLE_KEY")}").patch("https://api.airtable.com/v0/appt3yVn2nbiUaijm/tblRCAMjfQ4MIsMPp",
|
|
||||||
json: {
|
|
||||||
records: [
|
|
||||||
{ id: record_id, fields: { auth_key: auth_key } }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
wildcard_host = ENV.fetch("WILDCARD_HOST")
|
|
||||||
|
|
||||||
redirect_to "#{wildcard_host}?auth_key=#{auth_key}", allow_other_host: wildcard_host
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def ensure_current_user
|
def ensure_current_user
|
||||||
|
|||||||
@@ -52,7 +52,6 @@ Rails.application.routes.draw do
|
|||||||
get :filterable_dashboard_content
|
get :filterable_dashboard_content
|
||||||
get :filterable_dashboard
|
get :filterable_dashboard
|
||||||
get :mini_leaderboard
|
get :mini_leaderboard
|
||||||
get "🃏", to: "static_pages#🃏", as: :wildcard
|
|
||||||
get :streak
|
get :streak
|
||||||
# get :timeline # Removed: Old route for timeline
|
# get :timeline # Removed: Old route for timeline
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user