Merge branch 'main' into feature/gemini-fixes
This commit is contained in:
commit
45162e6130
4 changed files with 514 additions and 242 deletions
245
app.rb
245
app.rb
|
|
@ -6,7 +6,9 @@ require 'yaml'
|
|||
|
||||
# Configure Sinatra
|
||||
set :port, ENV['PORT'] || 4567
|
||||
set :bind, '::'
|
||||
set :bind, '0.0.0.0'
|
||||
set :public_folder, 'public'
|
||||
set :views, 'views'
|
||||
|
||||
# Load responses from YAML file
|
||||
RESPONSES = YAML.load_file('responses.yml')
|
||||
|
|
@ -215,244 +217,3 @@ get '/*' do
|
|||
}
|
||||
end
|
||||
end
|
||||
|
||||
__END__
|
||||
|
||||
@@index
|
||||
<!DOCTYPE html>
|
||||
<html lang="<%= language %>">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>No as a Service</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
||||
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
max-width: 700px;
|
||||
padding: 2rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
backdrop-filter: blur(10px);
|
||||
border-radius: 20px;
|
||||
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
margin-bottom: 1rem;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
font-size: 1.2rem;
|
||||
margin-bottom: 1rem;
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
.language-info {
|
||||
font-size: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
padding: 0.5rem 1rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 10px;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.logo {
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
margin: 0 auto 2rem auto;
|
||||
background: radial-gradient(circle at 30% 30%, #ff6b6b, #ee5a52, #dc3545);
|
||||
border-radius: 50%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 4rem;
|
||||
text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0 8px 32px rgba(255, 107, 107, 0.4);
|
||||
border: 3px solid rgba(255, 255, 255, 0.3);
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.logo::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: -3px;
|
||||
left: -3px;
|
||||
right: -3px;
|
||||
bottom: -3px;
|
||||
background: conic-gradient(from 0deg, #ff6b6b, #ff8e8e, #ff6b6b);
|
||||
border-radius: 50%;
|
||||
z-index: -1;
|
||||
animation: rotate 3s linear infinite;
|
||||
}
|
||||
|
||||
@keyframes rotate {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
|
||||
.no-response {
|
||||
font-size: 4rem;
|
||||
font-weight: bold;
|
||||
color: #ff6b6b;
|
||||
text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.5);
|
||||
margin: 2rem 0;
|
||||
padding: 1rem;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 15px;
|
||||
border: 2px solid rgba(255, 107, 107, 0.3);
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.controls {
|
||||
margin: 2rem 0;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 1rem;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.refresh-btn {
|
||||
background: linear-gradient(45deg, #ff6b6b, #ff8e8e);
|
||||
color: white;
|
||||
border: none;
|
||||
padding: 1rem 2rem;
|
||||
font-size: 1.1rem;
|
||||
border-radius: 50px;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s ease;
|
||||
box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
|
||||
}
|
||||
|
||||
.refresh-btn:hover {
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 6px 20px rgba(255, 107, 107, 0.4);
|
||||
}
|
||||
|
||||
.language-selector {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
color: white;
|
||||
padding: 0.5rem 1rem;
|
||||
border-radius: 25px;
|
||||
font-size: 1rem;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.language-selector option {
|
||||
background: #444;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.api-info {
|
||||
margin-top: 2rem;
|
||||
padding: 1rem;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border-radius: 10px;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.api-info code {
|
||||
background: rgba(0, 0, 0, 0.2);
|
||||
padding: 0.2rem 0.5rem;
|
||||
border-radius: 4px;
|
||||
font-family: 'Courier New', monospace;
|
||||
}
|
||||
|
||||
.nordic-flag {
|
||||
display: inline-block;
|
||||
margin-left: 0.5rem;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.container {
|
||||
margin: 1rem;
|
||||
padding: 1.5rem;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
|
||||
.no-response {
|
||||
font-size: 2.5rem;
|
||||
}
|
||||
|
||||
.controls {
|
||||
flex-direction: column;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>No as a Service</h1>
|
||||
<p class="subtitle">The definitive multilingual API for negative responses</p>
|
||||
|
||||
<div class="language-info">
|
||||
Currently in: <strong><%= language_name %></strong>
|
||||
<% if language == 'no' %><span class="nordic-flag">🇳🇴</span><% end %>
|
||||
<% if language == 'sv' %><span class="nordic-flag">🇸🇪</span><% end %>
|
||||
<% if language == 'da' %><span class="nordic-flag">🇩🇰</span><% end %>
|
||||
<% if language == 'is' %><span class="nordic-flag">🇮🇸</span><% end %>
|
||||
<% if language == 'fi' %><span class="nordic-flag">🇫🇮</span><% end %>
|
||||
<% if language == 'fo' %><span class="nordic-flag">🇫🇴</span><% end %>
|
||||
</div>
|
||||
|
||||
<div class="no-response">
|
||||
<%= no_response %>
|
||||
</div>
|
||||
|
||||
<div class="controls">
|
||||
<button class="refresh-btn" onclick="location.reload()">
|
||||
Get Another No
|
||||
</button>
|
||||
|
||||
<select class="language-selector" onchange="changeLanguage(this.value)">
|
||||
<% available_languages.each do |lang| %>
|
||||
<option value="<%= lang[:code] %>" <%= 'selected' if lang[:code] == language %>>
|
||||
<%= lang[:name] %>
|
||||
</option>
|
||||
<% end %>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="api-info">
|
||||
<h3>API Usage</h3>
|
||||
<p>JSON API: <code>GET /api/no</code> or <code>GET /api/no/:lang</code></p>
|
||||
<p>Languages: <code>GET /languages</code></p>
|
||||
<p>URL Parameter: <code>?lang=<%= language %></code></p>
|
||||
<p>Accept-Language header supported</p>
|
||||
<p>Health Check: <code>GET /health</code></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function changeLanguage(lang) {
|
||||
const url = new URL(window.location);
|
||||
url.searchParams.set('lang', lang);
|
||||
window.location.href = url.toString();
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue