mirror of
https://github.com/System-End/hackatime.git
synced 2026-04-19 22:15:14 +00:00
Add 🃏 easter egg
This commit is contained in:
parent
fd9e4fc934
commit
2c6d53250b
4 changed files with 56 additions and 2 deletions
|
|
@ -37,4 +37,8 @@ SMTP_PORT=replace_with_your_smtp_port
|
|||
LOOPS_API_KEY=your_loops_api_key_here
|
||||
|
||||
# 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
|
||||
|
|
@ -98,6 +98,44 @@ class StaticPagesController < ApplicationController
|
|||
}
|
||||
end
|
||||
|
||||
def 🃏
|
||||
redirect_to root_path unless current_user&.slack_uid
|
||||
|
||||
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
|
||||
|
||||
def get_setup_social_proof
|
||||
|
|
|
|||
|
|
@ -1,6 +1,17 @@
|
|||
<div class="container">
|
||||
<p class="super">aka Wakatime v2</p>
|
||||
<h1 class="title">Keep Track of <span class="primary-color">Your</span> Coding Time</h1>
|
||||
<h1 class="title">
|
||||
Keep Track of <span class="primary-color">Your</span> Coding Time
|
||||
<%= link_to "🃏", wildcard_static_pages_path, class: "wildcard" %>
|
||||
</h1>
|
||||
<style>
|
||||
.wildcard {
|
||||
opacity: 0;
|
||||
}
|
||||
.wildcard:hover {
|
||||
opacity: 1;
|
||||
}
|
||||
</style>
|
||||
<p class="flavor">
|
||||
<%= FlavorText.motto.sample %>
|
||||
<%= @social_proof&.downcase %>
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ Rails.application.routes.draw do
|
|||
collection do
|
||||
get :project_durations
|
||||
get :activity_graph
|
||||
get "🃏", to: "static_pages#🃏", as: :wildcard
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue