Skip to content

Commit e239e9d

Browse files
committed
url encoding issue fix
1 parent 1d1e326 commit e239e9d

3 files changed

Lines changed: 251 additions & 139 deletions

File tree

app/generate/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,14 @@ const Generate: React.FC = () => {
147147
for (let i = 0; i < data.length; i++) {
148148
encrypted += String.fromCharCode(data.charCodeAt(i) ^ pin.charCodeAt(i % pin.length))
149149
}
150-
return btoa(encrypted)
150+
return btoa(encrypted).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, '')
151151
}
152152

153153
const handleGenerateQRCode = async () => {
154154
setLoading(true)
155155
const encodedData = encodeData(formData)
156156
const encryptedData = encryptData(encodedData, pin)
157+
console.log("Encrypted Data:", encryptedData)
157158
const qrCodeData = `https://opentag.github.io/q?=${encryptedData}`
158159

159160
const qrCodeOptions = {

app/not-found.tsx

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
"use client";
2+
3+
import Link from "next/link";
4+
import { Button } from "@/components/ui/button";
5+
import { useState, useEffect } from "react";
6+
7+
export default function NotFound() {
8+
const [tagLine, setTagLine] = useState(0);
9+
10+
const funnyTaglines = [
11+
"Looks like this tag is missing from our database!",
12+
"This tag seems to have wandered off...",
13+
"Oops! This tag is playing hide and seek.",
14+
"Error 404: Tag not found in the wild!",
15+
"Houston, we have a problem. This tag is lost in space.",
16+
"This tag has gone on vacation without telling us.",
17+
];
18+
19+
useEffect(() => {
20+
const tagInterval = setInterval(() => {
21+
setTagLine(prev => (prev + 1) % funnyTaglines.length);
22+
}, 4000);
23+
24+
return () => {
25+
clearInterval(tagInterval);
26+
};
27+
}, []);
28+
29+
return (
30+
<div className="min-h-[80vh] flex flex-col items-center justify-center text-center px-4">
31+
<div className="relative mb-8">
32+
<h1 className="text-9xl font-bold">
33+
404
34+
</h1>
35+
</div>
36+
<h2 className="text-3xl md:text-4xl font-bold mb-4">Page Not Found</h2>
37+
38+
<p className="text-xl mb-8 max-w-md min-h-[60px] transition-all duration-500">
39+
{funnyTaglines[tagLine]}
40+
</p>
41+
42+
<div className="flex flex-col sm:flex-row gap-4">
43+
<Button asChild size="lg">
44+
<Link href="/">
45+
Take Me Home
46+
</Link>
47+
</Button>
48+
49+
<Button variant="outline" asChild size="lg">
50+
<Link href="/lookup">
51+
Look Up a Tag
52+
</Link>
53+
</Button>
54+
</div>
55+
</div>
56+
);
57+
}

0 commit comments

Comments
 (0)