Files
simple-object-server/src/welcome_page.cpp
Your Name f9fee188e8
Some checks failed
Build-Test-Publish / Build (push) Failing after 2s
:-'Generic Commit'
2025-05-29 22:26:48 +12:00

194 lines
6.1 KiB
C++

#include "welcome_page.hpp"
namespace simple_object_storage {
std::string welcome_page() {
return R"(
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Simple Object Storage</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
line-height: 1.6;
margin: 0;
padding: 0;
background-color: #f5f7fa;
color: #2d3748;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 2rem;
}
header {
text-align: center;
margin-bottom: 3rem;
padding: 2rem 0;
background-color: #fff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
h1 {
color: #2b6cb0;
margin: 0;
font-size: 2.5rem;
}
.subtitle {
color: #4a5568;
margin-top: 0.5rem;
font-size: 1.2rem;
}
.features {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
gap: 1.5rem;
margin-top: 2rem;
}
.feature-card {
background: white;
padding: 1.5rem;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.feature-card h3 {
color: #2b6cb0;
margin-top: 0;
}
.endpoints {
background: white;
padding: 1.25rem;
border-radius: 8px;
margin-top: 2rem;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.endpoints h2 {
color: #2b6cb0;
margin: 0 0 1rem 0;
font-size: 1.5rem;
}
.endpoint-group {
margin-bottom: 1.25rem;
}
.endpoint-group:last-child {
margin-bottom: 0;
}
.endpoint-group h3 {
color: #4a5568;
font-size: 1.1rem;
margin: 0 0 0.5rem 0;
padding-bottom: 0.25rem;
border-bottom: 1px solid #e2e8f0;
}
.endpoint-list {
list-style: none;
padding: 0;
margin: 0;
}
.endpoint-list li {
margin-bottom: 0.5rem;
padding: 0.5rem;
background: #f8fafc;
border-radius: 4px;
display: flex;
align-items: center;
font-size: 0.95rem;
}
.endpoint-list li:last-child {
margin-bottom: 0;
}
.endpoint-method {
font-weight: bold;
color: #2b6cb0;
margin-right: 0.5rem;
min-width: 50px;
}
.endpoint-path {
font-family: 'Courier New', Courier, monospace;
background: #edf2f7;
padding: 0.15rem 0.3rem;
border-radius: 3px;
margin-right: 0.75rem;
}
.endpoint-desc {
color: #4a5568;
}
.endpoint-param {
color: #805ad5;
font-weight: 500;
}
</style>
</head>
<body>
<div class="container">
<header>
<h1>Simple Object Storage</h1>
<p class="subtitle">A lightweight, simple object storage service</p>
</header>
<div class="features">
<div class="feature-card">
<h3>Simple Storage</h3>
<p>Store and retrieve objects using unique hashes or label:tag combinations.</p>
</div>
<div class="feature-card">
<h3>RESTful API</h3>
<p>Access objects through a clean, intuitive REST API interface.</p>
</div>
</div>
<div class="endpoints">
<h2>API Endpoints</h2>
<div class="endpoint-group">
<h3>Directory Operations</h3>
<ul class="endpoint-list">
<li>
<span class="endpoint-method">GET</span>
<span class="endpoint-path">/dir</span>
<span class="endpoint-desc">List all objects in the storage</span>
</li>
</ul>
</div>
<div class="endpoint-group">
<h3>Operations</h3>
<ul class="endpoint-list">
<li>
<span class="endpoint-method">GET</span>
<span class="endpoint-path">/<span class="endpoint-param">{label:tag|hash}</span></span>
<span class="endpoint-desc">Retrieve an object</span>
</li>
<li>
<span class="endpoint-method">GET</span>
<span class="endpoint-path">/hash/<span class="endpoint-param">label:tag</span></span>
<span class="endpoint-desc">Get hash for a label:tag</span>
</li>
<li>
<span class="endpoint-method">GET</span>
<span class="endpoint-path">/version/<span class="endpoint-param">label:tag</span></span>
<span class="endpoint-desc">Get version for a label:tag</span>
</li>
<li>
<span class="endpoint-method">GET</span>
<span class="endpoint-path">/exists/<span class="endpoint-param">{label:tag|hash}</span></span>
<span class="endpoint-desc">Check if an object exists</span>
</li>
<li>
<span class="endpoint-method">GET</span>
<span class="endpoint-path">/meta/<span class="endpoint-param">{label:tag|hash}</span></span>
<span class="endpoint-desc">Get object metadata</span>
</li>
</ul>
</div>
</div>
</div>
</body>
</html>
)";
}
} // namespace simple_object_storage