Skip to content
This repository has been archived by the owner on Feb 25, 2024. It is now read-only.

Commit

Permalink
Add higher HTTP requests per minute limit request form
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldev5 committed Aug 11, 2023
1 parent 22b7184 commit 0111276
Show file tree
Hide file tree
Showing 25 changed files with 1,492 additions and 115 deletions.
13 changes: 12 additions & 1 deletion .env.example
@@ -1,4 +1,15 @@
RATE_LIMIT_TTL_SEC=60
RATE_LIMIT_REQ_COUNT_PUBLIC=20
RATE_LIMIT_REQ_COUNT_AUTH=100
JWT_SECRET_KEY=
JWT_SECRET_KEY=
RECAPTCHA_SECRET_KEY=
DB_HOST=localhost
DB_PORT=5432
DB_USER=
DB_PASS=
DB_NAME=
EMAIL_ADDRESS_SENDER=
EMAIL_CLIENT_ID=
EMAIL_CLIENT_SECRET=
EMAIL_REDIRECT_URI=
EMAIL_REFRESH_TOKEN=
2 changes: 1 addition & 1 deletion client/index.html → client/generate-api-key/index.html
Expand Up @@ -14,7 +14,7 @@
<body>
<div class="container">
<div class="header-container">
<img src="logo.png" alt="Lightspell Logo" class="header-logo" />
<img src="../logo.png" alt="Lightspell Logo" class="header-logo" />
<p class="header-slogan">
Your gateway to enhanced cross-chain experiences!
</p>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
20 changes: 20 additions & 0 deletions client/higher-request-limit/checkmark-icon.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
194 changes: 194 additions & 0 deletions client/higher-request-limit/index.html
@@ -0,0 +1,194 @@
<!DOCTYPE html>
<html>
<head>
<title>Higher Request Limit Form</title>
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap"
rel="stylesheet"
/>
<style>
/* Your CSS styles here */
body {
font-family: 'Open Sans', sans-serif;
font-size: 16px;
line-height: 1.6;
margin: 0;
padding: 0;
color: #333;
background-color: #f4f4f4;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.header {
text-align: center;
margin-bottom: 20px;
}
.section {
margin-bottom: 30px;
}
.section-title {
font-size: 24px;
margin-bottom: 10px;
}
.section-content {
font-size: 16px;
}
.api-form {
background-color: #f9f9f9;
padding: 20px;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.api-form label {
display: block;
margin-bottom: 8px;
font-weight: bold;
}
.api-form input[type='text'],
.api-form input[type='email'],
.api-form textarea {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}

.api-form textarea {
width: 100%;
max-width: 100%; /* Add this line to ensure the textarea doesn't exceed the container's width */
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
resize: vertical;
min-height: 100px;
}

.api-form input[type='number'] {
width: 100%;
padding: 10px;
margin-bottom: 20px;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}
.api-form button[type='submit'] {
background-color: #007bff;
color: #fff;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}
.g-recaptcha {
margin-top: 15px; /* Add top padding */
margin-bottom: 15px; /* Add bottom padding */
}
.header-container {
color: #333;
padding: 20px 0;
text-align: center;
}
.header-logo {
max-width: 200px;
display: block;
margin: 0 auto;
}
.header-slogan {
font-size: 18px;
margin-top: 10px;
}
</style>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
</head>
<body>
<div class="container">
<div class="header-container">
<img src="../logo.png" alt="Lightspell Logo" class="header-logo" />
<p class="header-slogan">
Your gateway to enhanced cross-chain experiences!
</p>
</div>
<div class="section">
<h2 class="section-title">Request Higher Request Limit</h2>
<p class="section-content">
If your use case requires a higher requests per minute limit than the
standard 100, you can submit a request for consideration. Requests for
higher limits are manually reviewed by our team to ensure fair usage
and optimal service quality. Please provide the following details in
your request:
</p>
<ul class="section-content">
<li>Email Address for Notification</li>
<li>Your API Key</li>
<li>Reason for Higher Limit (How you plan to use the API)</li>
<li>Requested Requests Per Minute Limit</li>
</ul>
<p class="section-content">
After your request is submitted, our team will review it to assess its
compatibility with your intended usage. You will be notified via the
provided email address once the review process is complete.
</p>
<form
class="api-form"
action="/auth/higher-request-limit-form"
method="POST"
onsubmit="onSubmitForm(event)"
>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required />
<label for="api_key">API Key:</label>
<input
type="text"
id="api_key"
name="api_key"
pattern="[\w\-]+\.[\w\-]+\.[\w\-]+"
required
/>

<label for="reason">Reason for Higher Limit:</label>
<textarea id="reason" name="reason" rows="4" required></textarea>
<label for="requestedLimit"
>Requested Requests Per Minute Limit:</label
>
<input
type="number"
id="requested-limit"
name="requestedLimit"
min="1"
required
/>
<div
class="g-recaptcha"
data-sitekey="6LfL0oYnAAAAAEwDq-0SBKDRF1WyIK5H8LV8eHcI"
></div>
<p id="captcha-message" style="display: none; color: red">
Please complete the reCAPTCHA.
</p>
<button type="submit">Submit Request</button>
</form>
</div>
</div>
<script>
function onSubmitForm(event) {
var response = grecaptcha.getResponse();
var captchaMessage = document.getElementById('captcha-message');

if (response.length === 0) {
event.preventDefault();
captchaMessage.style.display = 'block';
} else {
captchaMessage.style.display = 'none';
}
}
</script>
</body>
</html>
46 changes: 46 additions & 0 deletions client/higher-request-limit/submit-success.html
@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<title>Form Submission Successful</title>
<link
href="https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600&display=swap"
rel="stylesheet"
/>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
font-family: 'Open Sans', sans-serif;
font-size: 16px;
line-height: 1.6;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.message {
text-align: center;
padding: 44px;
background-color: #fff;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
.icon {
width: 60px;
height: 60px;
}
</style>
</head>
<body>
<div class="message">
<img src="checkmark-icon.svg" alt="Checkmark Icon" class="icon" />
<h1>Form Submission Successful</h1>
<p>
Your request has been submitted successfully. Our team will review it
and notify you soon.
</p>
</div>
</body>
</html>
8 changes: 7 additions & 1 deletion package.json
Expand Up @@ -30,6 +30,7 @@
"@nestjs/platform-express": "^10.0.0",
"@nestjs/serve-static": "^4.0.0",
"@nestjs/throttler": "4.2.0",
"@nestjs/typeorm": "^10.0.0",
"@paraspell/sdk": "^2.0.5",
"@polkadot/api": "^10.9.1",
"@polkadot/api-base": "^10.9.1",
Expand All @@ -38,8 +39,12 @@
"axios": "^1.4.0",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"googleapis": "^124.0.0",
"nodemailer": "^6.9.4",
"pg": "^8.11.2",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1"
"rxjs": "^7.8.1",
"typeorm": "^0.3.17"
},
"devDependencies": {
"@nestjs/cli": "^10.0.0",
Expand All @@ -48,6 +53,7 @@
"@types/express": "^4.17.17",
"@types/jest": "^29.5.2",
"@types/node": "^20.3.1",
"@types/nodemailer": "^6.4.9",
"@types/supertest": "^2.0.12",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
Expand Down

0 comments on commit 0111276

Please sign in to comment.