mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-06-06 18:31:00 +00:00
Increase rate limit range, fix bug with content search if no summary is present
This commit is contained in:
parent
b5d66e8de3
commit
094d2eaa37
@ -1,14 +1,14 @@
|
|||||||
// datasource db {
|
|
||||||
// provider = "postgresql"
|
|
||||||
// url = env("DATABASE_URL")
|
|
||||||
// }
|
|
||||||
|
|
||||||
datasource db {
|
datasource db {
|
||||||
provider = "postgresql"
|
provider = "postgresql"
|
||||||
url = env("POSTGRES_PRISMA_URL")
|
url = env("DATABASE_URL")
|
||||||
directUrl = env("POSTGRES_URL_NON_POOLING")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// datasource db {
|
||||||
|
// provider = "postgresql"
|
||||||
|
// url = env("POSTGRES_PRISMA_URL")
|
||||||
|
// directUrl = env("POSTGRES_URL_NON_POOLING")
|
||||||
|
// }
|
||||||
|
|
||||||
generator client {
|
generator client {
|
||||||
provider = "prisma-client-js"
|
provider = "prisma-client-js"
|
||||||
}
|
}
|
||||||
|
@ -19,16 +19,16 @@ const ContentDropdownItem = ({ content, onSelect }) => {
|
|||||||
className="w-[100px] h-[100px] object-cover object-center border-round"
|
className="w-[100px] h-[100px] object-cover object-center border-round"
|
||||||
/>
|
/>
|
||||||
<div className="flex-1 max-w-[80vw]">
|
<div className="flex-1 max-w-[80vw]">
|
||||||
<div className="text-lg text-900 font-bold">{content.title || content.name}</div>
|
<div className="text-lg text-900 font-bold">{content?.title || content?.name}</div>
|
||||||
<div className="w-full text-sm text-600 text-wrap line-clamp-2">{content.summary || content.description && (
|
<div className="w-full text-sm text-600 text-wrap line-clamp-2">{content?.summary || content?.description && (
|
||||||
<div className="text-xl mt-4">
|
<div className="text-xl mt-4">
|
||||||
{content.summary.split('\n').map((line, index) => (
|
{content?.summary?.split('\n').map((line, index) => (
|
||||||
<p key={index}>{line}</p>
|
<p key={index}>{line}</p>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
{content.price && <div className="text-sm pt-6 text-gray-500">Price: {content.price}</div>}
|
{content?.price && <div className="text-sm pt-6 text-gray-500">Price: {content.price}</div>}
|
||||||
{content?.topics?.length > 0 && (
|
{content?.topics?.length > 0 && (
|
||||||
<div className="text-sm pt-6 text-gray-500">
|
<div className="text-sm pt-6 text-gray-500">
|
||||||
{content.topics.map((topic) => (
|
{content.topics.map((topic) => (
|
||||||
@ -37,7 +37,7 @@ const ContentDropdownItem = ({ content, onSelect }) => {
|
|||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
<div className="text-sm pt-6 text-gray-500">
|
<div className="text-sm pt-6 text-gray-500">
|
||||||
{(content.published_at || content.created_at) ? `Published: ${formatUnixTimestamp(content.published_at || content.created_at)}` : "not yet published"}
|
{(content?.published_at || content?.created_at) ? `Published: ${formatUnixTimestamp(content?.published_at || content?.created_at)}` : "not yet published"}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex flex-col justify-end">
|
<div className="flex flex-col justify-end">
|
||||||
|
@ -10,7 +10,7 @@ const localRatelimit = {
|
|||||||
limit: async (key) => {
|
limit: async (key) => {
|
||||||
const now = Date.now();
|
const now = Date.now();
|
||||||
const windowMs = 10 * 1000; // 10 seconds
|
const windowMs = 10 * 1000; // 10 seconds
|
||||||
const maxRequests = 25;
|
const maxRequests = 40;
|
||||||
|
|
||||||
const requestLog = inMemoryStore.get(key) || [];
|
const requestLog = inMemoryStore.get(key) || [];
|
||||||
const windowStart = now - windowMs;
|
const windowStart = now - windowMs;
|
||||||
@ -36,7 +36,7 @@ const localRatelimit = {
|
|||||||
const ratelimit = process.env.NODE_ENV === 'production'
|
const ratelimit = process.env.NODE_ENV === 'production'
|
||||||
? new Ratelimit({
|
? new Ratelimit({
|
||||||
redis: kv,
|
redis: kv,
|
||||||
limiter: Ratelimit.slidingWindow(25, '10 s'),
|
limiter: Ratelimit.slidingWindow(40, '10 s'),
|
||||||
analytics: true,
|
analytics: true,
|
||||||
timeout: 1000,
|
timeout: 1000,
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user