Skip to content

Commit

Permalink
0.9.3 (#81)
Browse files Browse the repository at this point in the history
* minor fix (#75)

* minor fix

* fix

* Bump undici and firebase (#74)

Bumps [undici](https://github.com/nodejs/undici) to 5.28.3 and updates ancestor dependency [firebase](https://github.com/firebase/firebase-js-sdk). These dependencies need to be updated together.


Updates `undici` from 5.26.5 to 5.28.3
- [Release notes](https://github.com/nodejs/undici/releases)
- [Commits](nodejs/undici@v5.26.5...v5.28.3)

Updates `firebase` from 10.8.0 to 10.8.1
- [Release notes](https://github.com/firebase/firebase-js-sdk/releases)
- [Changelog](https://github.com/firebase/firebase-js-sdk/blob/master/CHANGELOG.md)
- [Commits](https://github.com/firebase/firebase-js-sdk/compare/firebase@10.8.0...firebase@10.8.1)

---
updated-dependencies:
- dependency-name: undici
  dependency-type: indirect
- dependency-name: firebase
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Amlan Roy <59330872+amlan-roy@users.noreply.github.com>

* fix: fix bug in generate variant page (#79)

* fix: remove unused code used for debugging (#80)

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
amlan-roy and dependabot[bot] committed Mar 2, 2024
1 parent 6e869d5 commit dda048f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
4 changes: 2 additions & 2 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** @type {import('next').NextConfig} */
const nextConfig = {}
const nextConfig = {};

module.exports = nextConfig
module.exports = nextConfig;
2 changes: 1 addition & 1 deletion src/app/(home-page)/home/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const page: React.FC<pageProps> = () => {
</Button>
</Link>

<Link href={`/generate-resume/${new Date().getTime()}`}>
<Link href={`/generate-resume/variant`}>
<Button variant={"outline"} title="Generate resume variant">
Generate Variant
</Button>
Expand Down
23 changes: 23 additions & 0 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ export async function middleware(req: NextRequest) {
return NextResponse.redirect(new URL("/generate-resume/base", req.url));
}

if (req.nextUrl.pathname.endsWith("/generate-resume/variant")) {
const randomFormId = getUniqueHashId(8);
return NextResponse.redirect(
new URL(`/generate-resume/${randomFormId}`, req.url)
);
}

if (req.nextUrl.pathname.endsWith("/enter-data")) {
if (!req.nextUrl.searchParams.get("id")) {
// redirect to '/enter-data' route with all the params passed to the request, and for id query param, add/replace it with id = base
Expand All @@ -73,3 +80,19 @@ export async function middleware(req: NextRequest) {
}
return res;
}

/**
* Generates a unique hash id with the given length. Minimum length is 8.
* Use the additional length to add more characters to the hash id.
*
* @param additionalLength - The additional length to be added to the hash id.
* @returns A unique hash id.
*/
export function getUniqueHashId(additionalLength: number): string {
const idChars: string = "ABCDEFGHJKMNPQRSTUVWXYZ";
const now: Date = new Date();
let id = now.getTime().toString().slice(-8);
for (let i = 0; i < additionalLength; i++)
id += idChars[Math.floor(Math.random() * idChars.length)];
return id;
}

1 comment on commit dda048f

@vercel
Copy link

@vercel vercel bot commented on dda048f Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.