mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-09-15 12:45:33 -04:00
add prefix to redis keys
This commit is contained in:
@@ -17,6 +17,7 @@ export const GET = async (): Promise<
|
||||
> => {
|
||||
// get all keys (aka slugs)
|
||||
const slugs = await redis.scan(0, {
|
||||
match: "hits:*",
|
||||
type: "string",
|
||||
// set an arbitrary yet generous upper limit, just in case...
|
||||
count: 99,
|
||||
@@ -27,7 +28,7 @@ export const GET = async (): Promise<
|
||||
|
||||
// pair the slugs with their hit values
|
||||
const pages = slugs[1].map((slug, index) => ({
|
||||
slug,
|
||||
slug: slug.split(":").pop() as string, // remove the "hits:" prefix
|
||||
hits: parseInt(values[index], 10),
|
||||
}));
|
||||
|
||||
|
@@ -96,7 +96,7 @@ const ContactForm = () => {
|
||||
Markdown syntax
|
||||
</Link>{" "}
|
||||
is allowed here, e.g.: <strong>**bold**</strong>, <em>_italics_</em>, [
|
||||
<Link href="https://jarv.is" plain openInNewTab>
|
||||
<Link href="https://jarv.is" plain>
|
||||
links
|
||||
</Link>
|
||||
](https://jarv.is), and <code style={{ fontFamily: "var(--fonts-mono)" }}>`code`</code>.
|
||||
|
@@ -54,7 +54,7 @@ const Page = () => {
|
||||
G4techTV Canada
|
||||
</Link>{" "}
|
||||
&{" "}
|
||||
<Link href="https://leolaporte.com/" style={{ fontWeight: 700 }}>
|
||||
<Link href="https://leo.fm/" style={{ fontWeight: 700 }}>
|
||||
Leo Laporte
|
||||
</Link>
|
||||
. © 2007 G4 Media, Inc.
|
||||
|
@@ -12,7 +12,7 @@ const HitCounter = async ({ slug }: { slug: string }) => {
|
||||
// TODO: maybe don't allow this? or maybe it's fine? kinda unclear how secure this is:
|
||||
// https://nextjs.org/blog/security-nextjs-server-components-actions
|
||||
// https://nextjs.org/docs/app/building-your-application/rendering/server-components
|
||||
const hits = await redis.incr(slug);
|
||||
const hits = await redis.incr(`hits:${slug}`);
|
||||
|
||||
// we have data!
|
||||
return (
|
||||
|
Reference in New Issue
Block a user