Voting separated.

This commit is contained in:
Fergal Moran
2022-10-01 21:15:04 +01:00
parent 37aeabc23e
commit 0d9132dc51
21 changed files with 420 additions and 84 deletions

View File

@@ -11,7 +11,7 @@ const Navbar = () => {
<Image alt="Logo" width={48} height={48}
className="rounded-full"
src={'/img/header-logo.gif'} />
<h1 className='ml-4 text-2xl text-gray-700 text-bold'>Frasier Gifs</h1>
<h1 className='ml-4 text-2xl text-gray-700 text-bold'>I&apos;m pro opera and I vote!</h1>
</div>
<div className="hidden sm:-my-px sm:ml-6 sm:flex sm:space-x-8">
<a href="#" className="inline-flex items-center px-1 pt-1 text-sm font-medium text-gray-900 border-b-2 border-indigo-500" aria-current="page"> Upload </a>

View File

@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "node ./server.js",
"build": "next build",
"start": "next start",
"lint": "next lint"

View File

@@ -1,11 +1,12 @@
import React from 'react'
import '../styles/globals.css'
import type {AppProps} from 'next/app'
import {PageLayout} from 'components/layout'
import {generateBrowserId} from 'utils/browser'
import type { AppProps } from 'next/app'
import { PageLayout } from 'components/layout'
import { generateBrowserId } from 'utils/browser'
import Cookies from 'js-cookie'
import Head from 'next/head'
function MyApp({Component, pageProps}: AppProps) {
function MyApp({ Component, pageProps }: AppProps) {
React.useEffect(() => {
const checkBrowserId = async () => {
const storedId = localStorage.getItem('__effp')
@@ -18,9 +19,22 @@ function MyApp({Component, pageProps}: AppProps) {
.catch(console.error);
}, [])
return (
<>
<Head>
<title>Frasier Gifs</title>
<link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
<link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
<link rel="manifest" href="/site.webmanifest" />
<link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
<meta name="msapplication-TileColor" content="#da532c" />
<meta name="theme-color" content="#ffffff" />
</Head>
<PageLayout>
<Component {...pageProps} />
</PageLayout>)
</PageLayout>
</>
)
}
export default MyApp

View File

@@ -1,37 +1,102 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type {NextApiRequest, NextApiResponse} from "next";
import {PrismaClient} from "@prisma/client";
import {getBrowserId} from "utils/browser";
import qs from 'querystring'
import type { NextApiRequest, NextApiResponse } from "next";
import { PrismaClient } from "@prisma/client";
import { getBrowserId } from "utils/browser";
import qs from "querystring";
export default async function handler(
req: NextApiRequest,
res: NextApiResponse
) {
const {
query: {gifId, isUp},
query: { gifId, isUp },
} = req;
const prisma = new PrismaClient();
const browserId = req.cookies.bid;
const exists = await prisma.votes.count({
if (!gifId || !browserId) {
return res.status(400);
}
if (isUp === "1") {
return _processUpvote(res, gifId as string, browserId);
} else {
return _processDownvote(res, gifId as string, browserId);
}
}
const _processDownvote = async (
res: NextApiResponse,
gifId: string,
browserId: string
) => {
const prisma = new PrismaClient();
//check for existing downvote
const exists = await prisma.downVotes.count({
where: {
gifId: gifId as string,
gifId: gifId,
browserId: browserId,
},
});
if (exists !== 0) {
res.status(403).json({
message: "You have already voted on this gif",
return res.status(403).json({
message: "You have already downvoted on this gif",
});
}
const result = await prisma.votes.create({
//delete any upvotes
try {
await prisma.upVotes.delete({
where: {
browserId_gifId: {
gifId: gifId,
browserId: browserId,
},
},
});
} catch {}
const result = await prisma.downVotes.create({
data: {
isUp: isUp === "1",
browserId: browserId as string,
gifId: gifId as string,
},
});
res.status(200).json(result);
}
return res.status(200).json(result);
};
const _processUpvote = async (
res: NextApiResponse,
gifId: string,
browserId: string
) => {
const prisma = new PrismaClient();
//check for existing upvote
const exists = await prisma.upVotes.count({
where: {
gifId: gifId,
browserId: browserId,
},
});
if (exists !== 0) {
return res.status(403).json({
message: "You have already upvoted this gif",
});
}
//delete any downvotes
try {
await prisma.downVotes.delete({
where: {
browserId_gifId: {
gifId: gifId,
browserId: browserId,
},
},
});
} catch {}
const result = await prisma.upVotes.create({
data: {
browserId: browserId as string,
gifId: gifId as string,
},
});
return res.status(200).json(result);
};

View File

@@ -1,21 +1,21 @@
import {PrismaClient} from "@prisma/client";
import type {GetServerSideProps, NextPage} from "next";
import {Gif} from "models"
import {GifContainer} from "components";
import {getBrowserId} from "../utils/browser";
import { PrismaClient } from "@prisma/client";
import type { GetServerSideProps, NextPage } from "next";
import { Gif } from "models"
import { GifContainer } from "components";
import { getBrowserId } from "../utils/browser";
interface IHomeProps {
gifs: Gif[]
}
const Home: NextPage<IHomeProps> = ({gifs}) => {
const Home: NextPage<IHomeProps> = ({ gifs }) => {
return (
<div>
<div className="grid grid-cols-1 xl:grid-cols-4 lg:grid-cols-3 md:grid-cols-2">
{gifs.map((gif: Gif) => {
return (
<div key={gif.id} className="m-2">
<GifContainer gif={gif}/>
<GifContainer gif={gif} />
</div>
)
})}
@@ -24,51 +24,31 @@ const Home: NextPage<IHomeProps> = ({gifs}) => {
);
};
export const getServerSideProps: GetServerSideProps = async ({req}) => {
export const getServerSideProps: GetServerSideProps = async ({ req }) => {
const browserId = getBrowserId(req.headers.cookie || '');
const prisma = new PrismaClient();
const results = await prisma.gif.findMany({
take: 12, orderBy: {title: 'asc'},
take: 12, orderBy: { title: 'asc' },
include: {
_count: {
select: {
votes: {where: {isUp: true}},
// votes: { where: { isUp: false } }, //how to achieve
upVotes: true,
downVotes: true,
}
}
}
});
const gifs = await Promise.all(results.map(async (gif): Promise<Gif> => {
const votes = await prisma.votes.count({
where: {
gifId: gif.id as string,
browserId: browserId,
},
})
const upVotes = await prisma.votes.count({
where: {
gifId: gif.id as string,
browserId: browserId,
isUp: true
},
})
const downVotes = await prisma.votes.count({
where: {
gifId: gif.id as string,
browserId: browserId,
isUp: false
},
})
return {
id: gif.id,
title: gif.title,
description: gif.description,
fileName: gif.fileName,
dateCreated: gif.createdAt.toISOString(),
upVotes: upVotes,
downVotes: downVotes,
hasVoted: votes !== 0
upVotes: gif._count.upVotes,
downVotes: gif._count.downVotes,
hasVoted: false
}
}))
return {

View File

@@ -0,0 +1,39 @@
/*
Warnings:
- You are about to drop the `Votes` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE "Votes" DROP CONSTRAINT "Votes_gifId_fkey";
-- DropTable
DROP TABLE "Votes";
-- CreateTable
CREATE TABLE "UpVotes" (
"id" TEXT NOT NULL,
"isUp" BOOLEAN NOT NULL,
"browserId" VARCHAR(1000) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gifId" TEXT NOT NULL,
CONSTRAINT "UpVotes_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "DownVotes" (
"id" TEXT NOT NULL,
"isUp" BOOLEAN NOT NULL,
"browserId" VARCHAR(1000) NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"gifId" TEXT NOT NULL,
CONSTRAINT "DownVotes_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "UpVotes" ADD CONSTRAINT "UpVotes_gifId_fkey" FOREIGN KEY ("gifId") REFERENCES "Gif"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "DownVotes" ADD CONSTRAINT "DownVotes_gifId_fkey" FOREIGN KEY ("gifId") REFERENCES "Gif"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@@ -0,0 +1,12 @@
/*
Warnings:
- You are about to drop the column `isUp` on the `DownVotes` table. All the data in the column will be lost.
- You are about to drop the column `isUp` on the `UpVotes` table. All the data in the column will be lost.
*/
-- AlterTable
ALTER TABLE "DownVotes" DROP COLUMN "isUp";
-- AlterTable
ALTER TABLE "UpVotes" DROP COLUMN "isUp";

View File

@@ -0,0 +1,12 @@
/*
Warnings:
- A unique constraint covering the columns `[browserId,gifId]` on the table `DownVotes` will be added. If there are existing duplicate values, this will fail.
- A unique constraint covering the columns `[browserId,gifId]` on the table `UpVotes` will be added. If there are existing duplicate values, this will fail.
*/
-- CreateIndex
CREATE UNIQUE INDEX "DownVotes_browserId_gifId_key" ON "DownVotes"("browserId", "gifId");
-- CreateIndex
CREATE UNIQUE INDEX "UpVotes_browserId_gifId_key" ON "UpVotes"("browserId", "gifId");

View File

@@ -20,17 +20,30 @@ model Gif {
//this is temporary, filenames should always match the GUID above
fileName String @db.VarChar(100)
votes Votes[]
upVotes UpVotes[]
downVotes DownVotes[]
createdAt DateTime @default(now())
}
model Votes {
model UpVotes {
id String @id @default(uuid())
isUp Boolean @db.Boolean()
browserId String @db.VarChar(1000)
createdAt DateTime @default(now())
gif Gif @relation(fields: [gifId], references: [id])
gifId String
@@unique([browserId, gifId])
}
model DownVotes {
id String @id @default(uuid())
browserId String @db.VarChar(1000)
createdAt DateTime @default(now())
gif Gif @relation(fields: [gifId], references: [id])
gifId String
@@unique([browserId, gifId])
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 444 KiB

BIN
public/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

9
public/browserconfig.xml Normal file
View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<browserconfig>
<msapplication>
<tile>
<square150x150logo src="/mstile-150x150.png"/>
<TileColor>#da532c</TileColor>
</tile>
</msapplication>
</browserconfig>

BIN
public/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
public/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 15 KiB

BIN
public/mstile-150x150.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

View File

@@ -0,0 +1,155 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="993.000000pt" height="993.000000pt" viewBox="0 0 993.000000 993.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,993.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M6622 9921 c-8 -5 -78 -8 -157 -7 -79 1 -142 -1 -140 -4 2 -3 -22 -5
-53 -6 -64 0 -243 -11 -314 -19 -26 -2 -50 0 -53 5 -10 16 -42 12 -49 -6 -5
-12 -13 -15 -34 -10 -15 4 -39 8 -54 9 -15 1 -29 5 -33 8 -3 4 -25 2 -48 -3
-93 -19 -100 -20 -107 -7 -6 9 -16 9 -47 -3 -21 -8 -63 -16 -93 -17 -141 -7
-188 -22 -220 -69 -14 -20 -24 -40 -23 -44 4 -12 -15 -10 -22 2 -3 6 -13 10
-21 10 -8 0 -12 -5 -9 -10 7 -12 -3 -50 -14 -50 -4 0 -6 14 -3 30 4 29 3 30
-23 20 -15 -6 -31 -8 -36 -4 -12 7 -11 -7 1 -26 8 -13 11 -12 25 5 15 20 16
19 13 -5 -2 -17 -10 -25 -23 -26 -11 -1 -27 -3 -35 -5 -11 -3 -14 3 -12 21 6
41 17 52 58 56 41 4 73 33 74 69 1 19 2 19 9 1 5 -12 10 -15 14 -9 9 14 -17
35 -40 31 -10 -1 -23 0 -28 4 -6 3 -26 3 -45 -2 -19 -4 -31 -8 -26 -9 5 -1 3
-8 -4 -16 -11 -14 -14 -13 -25 1 -8 12 -14 14 -19 6 -9 -15 -66 -16 -66 -2 0
6 -9 10 -20 10 -11 0 -20 -5 -20 -11 0 -7 -9 -9 -21 -6 -12 3 -35 3 -51 0 -22
-4 -28 -10 -25 -24 5 -19 -19 -35 -26 -16 -7 22 -221 2 -254 -25 -6 -5 -22
-10 -35 -12 -13 -2 -41 -11 -63 -21 -22 -10 -52 -17 -68 -16 -15 2 -49 -4 -75
-12 -26 -9 -61 -15 -78 -14 -43 1 -93 -25 -132 -68 -18 -19 -37 -33 -42 -30
-6 4 -10 -1 -10 -9 0 -9 -5 -16 -12 -16 -6 0 -19 -7 -27 -14 -11 -10 -22 -12
-31 -6 -11 7 -8 15 14 45 38 50 29 67 -31 60 -25 -3 -51 -9 -57 -14 -10 -8
-49 -20 -86 -27 -8 -2 -44 -8 -80 -15 -37 -7 -82 -24 -106 -40 -22 -15 -56
-30 -76 -34 -20 -4 -45 -15 -55 -25 -11 -10 -30 -21 -42 -25 -16 -5 -20 -12
-15 -27 4 -15 2 -19 -7 -16 -8 3 -14 10 -14 16 0 18 -12 16 -53 -8 -33 -20
-35 -23 -19 -35 9 -7 17 -19 17 -27 0 -8 6 -20 13 -27 10 -11 9 -13 -6 -7 -10
3 -21 6 -23 6 -2 0 -4 9 -4 20 0 33 -19 22 -26 -15 -3 -19 -12 -39 -19 -43 -6
-4 -17 -16 -22 -26 -9 -16 -23 -20 -75 -21 -57 -2 -114 -20 -138 -45 -3 -3
-22 -14 -43 -25 -21 -11 -43 -27 -48 -36 -4 -9 -19 -19 -31 -22 -13 -4 -27
-15 -33 -25 -62 -119 -93 -231 -76 -275 12 -30 23 -137 27 -252 2 -49 6 -128
10 -175 19 -284 31 -849 20 -990 -4 -52 -9 -122 -11 -155 -3 -33 -7 -78 -10
-100 -9 -75 -2 -806 8 -822 4 -6 9 -59 12 -119 4 -60 8 -127 10 -149 3 -22 7
-65 10 -95 3 -30 7 -113 10 -185 2 -71 6 -153 9 -182 4 -42 2 -52 -12 -57 -9
-3 -34 -12 -54 -19 -21 -8 -40 -12 -42 -9 -3 3 -12 0 -19 -6 -7 -6 -37 -16
-65 -23 -29 -6 -52 -14 -52 -18 0 -5 -14 -8 -31 -9 -20 0 -42 -11 -59 -27 -18
-17 -29 -22 -32 -15 -2 7 -15 -4 -28 -24 -14 -19 -38 -41 -55 -48 -40 -15 -40
-15 -25 -33 10 -12 10 -15 -3 -15 -9 0 -21 9 -27 20 -8 15 -6 21 9 30 11 5 26
10 35 10 8 0 17 3 19 8 8 11 -46 12 -60 0 -7 -5 -17 -7 -22 -3 -6 3 -21 0 -33
-6 -13 -7 -67 -25 -121 -40 -81 -22 -116 -26 -195 -24 -136 4 -264 -15 -337
-49 -33 -16 -89 -42 -124 -59 -36 -16 -75 -40 -88 -53 -13 -13 -27 -24 -31
-24 -18 0 -92 -78 -92 -96 0 -11 -9 -38 -19 -61 -17 -33 -19 -54 -15 -124 3
-46 10 -86 15 -87 5 -2 7 -8 4 -13 -3 -4 -3 -31 1 -59 5 -42 10 -50 27 -50 16
0 18 -3 10 -11 -9 -9 -8 -15 3 -26 16 -16 19 -37 4 -28 -6 3 -7 -1 -4 -9 3 -9
10 -16 15 -16 5 0 14 -12 19 -26 7 -18 15 -24 26 -20 12 5 15 2 10 -10 -4 -9
0 -24 8 -33 10 -12 12 -27 7 -56 -7 -38 -6 -55 2 -135 2 -19 2 -39 -1 -45 -3
-5 -7 -28 -8 -50 -4 -88 -15 -165 -29 -205 -8 -23 -12 -46 -9 -51 3 -5 1 -9
-3 -9 -12 0 -43 -77 -37 -93 2 -7 -6 -25 -19 -38 -13 -15 -22 -37 -22 -53 2
-27 -24 -109 -59 -188 -9 -21 -13 -38 -10 -38 4 0 1 -7 -7 -16 -25 -30 -55
-120 -53 -159 3 -75 14 -188 19 -196 3 -4 6 -25 6 -46 1 -21 5 -52 11 -70 9
-32 17 -102 19 -181 1 -23 5 -42 9 -42 12 0 26 -92 35 -220 2 -41 7 -95 11
-120 4 -25 8 -65 9 -90 1 -25 4 -47 5 -50 1 -3 1 -17 0 -32 -1 -14 3 -29 9
-32 6 -4 8 -12 6 -19 -10 -27 -13 -67 -6 -62 5 2 8 -10 9 -28 0 -82 12 -231
19 -236 5 -3 9 -17 10 -31 1 -14 5 -50 8 -80 4 -30 9 -71 11 -90 1 -19 6 -55
10 -80 3 -25 7 -65 9 -90 1 -25 3 -47 4 -50 8 -19 36 -213 56 -385 2 -16 10
-61 18 -99 8 -38 14 -77 12 -88 -2 -10 1 -18 7 -18 5 0 7 -7 4 -16 -4 -9 -1
-23 5 -30 6 -7 13 -44 15 -80 2 -37 8 -72 14 -78 5 -5 10 -27 10 -48 0 -21 4
-38 9 -38 5 0 11 -13 14 -29 3 -16 13 -36 22 -44 8 -9 15 -19 15 -24 0 -17 94
-104 107 -99 7 3 13 2 13 -2 0 -4 11 -8 25 -8 14 -1 25 2 25 7 0 4 10 5 22 0
12 -4 37 -5 56 0 33 7 34 7 28 -19 -4 -15 -9 -58 -13 -95 -5 -65 -4 -70 26
-107 17 -21 31 -44 31 -49 0 -6 6 -11 14 -11 7 0 16 -9 19 -21 3 -11 15 -23
26 -26 11 -3 18 -10 14 -16 -3 -6 -1 -7 6 -3 6 4 18 3 25 -3 8 -7 28 -13 45
-14 21 -1 30 -6 26 -15 -3 -9 1 -12 13 -8 9 2 33 7 52 11 53 10 120 36 120 47
0 6 7 8 15 4 8 -3 15 -1 15 5 0 5 12 20 26 32 16 14 27 35 28 53 2 17 6 36 10
43 15 24 16 129 1 158 -13 25 -13 28 3 34 15 5 75 -30 67 -39 -7 -8 31 -38 42
-35 6 3 16 -4 22 -15 11 -20 69 -61 94 -66 6 -2 23 -8 37 -13 14 -6 28 -9 33
-6 4 2 7 -1 7 -8 0 -6 8 -9 20 -6 11 3 20 1 20 -5 0 -5 5 -6 12 -2 7 4 41 9
77 10 37 1 66 3 66 4 0 1 36 3 80 5 44 2 80 4 80 5 0 6 117 6 153 0 23 -4 42
-4 42 0 0 8 8 9 85 10 30 1 57 6 60 11 4 5 11 9 16 9 6 0 7 -5 3 -12 -4 -6 -3
-9 2 -6 14 9 109 19 232 23 63 3 118 8 123 11 11 7 54 12 163 19 44 3 84 9 90
13 6 4 27 8 48 7 20 0 34 4 31 8 -3 5 3 7 13 3 40 -12 71 -13 124 -6 33 4 57
3 61 -2 4 -6 9 -6 12 -1 3 5 23 7 44 6 59 -5 58 -5 223 2 210 10 203 9 218 19
8 4 41 10 75 12 34 2 76 6 92 8 99 13 266 19 537 20 168 1 305 3 303 6 -2 3
25 6 58 7 34 0 82 3 107 7 25 3 74 7 110 10 36 3 81 7 100 10 55 9 180 20 232
20 27 1 48 4 48 8 0 4 7 5 15 2 8 -3 20 -2 27 2 6 4 42 9 78 10 36 2 85 5 110
8 88 9 175 18 203 19 15 1 27 6 27 10 0 5 3 6 8 4 4 -2 45 2 92 10 47 8 104
14 128 14 23 0 42 4 42 9 0 4 12 7 27 5 19 -2 34 6 54 28 27 30 28 30 61 14
30 -15 33 -15 39 0 5 15 6 14 13 -2 5 -14 9 -16 18 -7 7 7 35 12 64 12 50 0
52 -1 58 -31 3 -17 6 -47 6 -65 0 -19 4 -34 10 -34 5 0 16 -13 25 -30 18 -36
85 -102 108 -107 4 -1 20 -12 35 -23 14 -12 28 -17 30 -12 2 6 16 4 33 -5 25
-13 35 -13 54 -3 13 7 28 10 33 6 5 -3 27 1 48 10 22 9 39 15 39 13 0 -1 20
16 45 39 25 23 48 42 53 42 4 0 7 14 7 30 0 21 5 30 16 30 9 0 12 5 8 12 -4 6
-8 33 -9 60 -2 26 -8 54 -14 62 -13 15 -5 62 13 83 38 43 39 45 26 53 -11 7
-11 12 -2 22 9 11 9 17 -1 27 -9 10 -8 14 6 22 9 6 17 16 17 23 0 8 7 19 15
26 9 7 14 19 11 27 -3 7 -2 13 2 13 5 0 14 16 22 35 8 19 17 35 22 35 4 0 8 5
8 10 0 6 9 19 20 30 11 11 17 26 14 33 -3 8 2 17 11 21 9 3 13 10 10 16 -3 6
3 23 14 39 12 16 21 37 21 48 0 14 2 15 9 4 7 -11 12 -4 20 25 6 21 11 44 11
51 0 7 9 17 20 23 11 6 18 16 14 21 -5 9 21 74 36 89 12 12 30 51 30 64 0 8 6
21 13 28 6 7 13 20 15 28 4 18 53 123 61 130 15 13 31 52 31 75 0 14 9 34 19
44 11 11 17 22 14 25 -3 2 4 14 15 26 11 11 27 39 37 60 10 22 24 40 31 40 7
0 16 17 20 38 7 38 28 83 52 114 8 9 11 22 7 27 -3 6 1 11 10 11 9 0 14 -4 11
-9 -3 -5 1 -14 9 -21 8 -7 15 -9 15 -5 0 4 6 3 13 -2 18 -15 77 -12 77 4 0 7
5 12 11 11 6 -2 16 11 23 28 6 17 19 39 28 48 10 10 21 28 24 42 3 13 10 24
15 24 5 0 5 10 0 23 -5 13 -5 30 -1 37 5 8 5 19 1 25 -4 5 -8 26 -9 45 -1 19
-7 59 -13 88 -9 46 -8 58 9 91 19 36 20 54 16 277 -2 132 -6 311 -10 399 -7
199 -7 199 5 203 7 2 5 10 -4 18 -10 10 -12 21 -6 32 7 14 7 362 -1 1022 0 80
0 165 2 190 4 61 -3 101 -27 149 -12 23 -18 53 -16 73 2 18 -6 80 -17 137 -24
119 -32 224 -20 255 19 49 22 64 27 131 9 140 -2 199 -53 297 -14 27 -23 52
-20 57 4 5 9 46 12 92 2 45 8 87 11 92 4 6 8 24 10 41 8 70 14 134 17 181 2
28 5 50 6 50 2 0 3 186 2 310 -1 50 -1 99 -1 110 1 33 -11 439 -17 595 -4 80
-7 166 -8 192 0 25 -4 44 -7 42 -9 -5 -6 60 3 66 4 3 3 23 -2 45 -5 22 -5 42
-1 45 5 3 7 14 5 25 -2 11 -6 70 -9 130 -3 61 -6 117 -7 125 0 8 0 31 1 50 1
19 -1 60 -4 90 -3 30 -6 85 -5 121 0 36 -6 84 -14 107 -11 31 -12 42 -3 46 9
3 9 5 0 5 -7 1 -13 12 -13 26 0 15 5 24 13 23 13 -3 11 45 -2 50 -4 1 -6 25
-5 53 2 28 -1 62 -6 75 -5 13 -5 26 -1 28 5 3 6 20 4 38 -3 18 -5 66 -6 106
-1 39 -4 72 -8 72 -10 0 -1 52 10 59 6 4 10 20 10 36 -2 61 4 130 11 135 8 5
13 41 11 68 -1 6 -9 12 -18 12 -12 0 -14 3 -7 8 16 10 12 51 -5 62 -19 11 -23
39 -22 123 l2 68 -36 -7 c-31 -6 -35 -4 -35 16 0 12 -10 43 -21 71 l-21 49 23
20 c23 19 23 20 5 34 -16 13 -22 13 -47 -6 -16 -12 -29 -29 -29 -37 -1 -22
-24 -51 -42 -51 -10 0 -13 8 -11 28 3 20 -4 37 -29 65 -18 20 -38 37 -44 37
-19 0 -105 52 -111 66 -3 8 -11 14 -18 14 -7 0 -15 7 -19 15 -3 8 -15 15 -26
15 -11 0 -20 4 -20 8 0 5 -18 15 -40 22 -22 7 -40 17 -40 21 0 4 -18 16 -40
28 -22 11 -40 17 -40 12 0 -19 -32 -19 -50 -1 -11 11 -30 20 -42 21 -35 1 -84
21 -113 47 -19 17 -30 20 -39 13 -7 -6 -16 -8 -19 -4 -4 3 -7 2 -7 -3 0 -5
-37 -8 -82 -7 -45 1 -87 -2 -93 -7 -15 -12 -31 0 -38 31 l-7 27 -81 -5 c-60
-4 -80 -3 -75 6 5 8 -23 11 -101 12 -59 0 -124 2 -143 4 -19 2 -60 6 -90 9
-30 3 -111 8 -180 12 -69 3 -150 8 -180 10 -153 12 -186 13 -198 5z"/>
<path d="M8720 9439 c0 -5 5 -7 10 -4 6 3 10 8 10 11 0 2 -4 4 -10 4 -5 0 -10
-5 -10 -11z"/>
<path d="M8890 9338 c0 -15 -6 -29 -12 -31 -7 -3 -4 -6 7 -6 16 -1 17 -3 5
-11 -12 -7 -12 -12 0 -35 13 -24 15 -25 21 -7 7 19 -3 98 -15 109 -3 4 -6 -5
-6 -19z"/>
<path d="M8811 9273 c0 -6 -4 -18 -7 -27 -5 -12 0 -16 17 -16 14 0 19 3 13 8
-7 4 -14 16 -17 27 -2 11 -5 15 -6 8z"/>
<path d="M2612 7180 c0 -14 2 -19 5 -12 2 6 2 18 0 25 -3 6 -5 1 -5 -13z"/>
<path d="M2616 6735 c4 -8 8 -15 10 -15 2 0 4 7 4 15 0 8 -4 15 -10 15 -5 0
-7 -7 -4 -15z"/>
<path d="M2628 6423 c-7 -15 4 -143 12 -138 4 2 5 35 2 72 -5 69 -7 81 -14 66z"/>
<path d="M2636 6255 c4 -8 8 -15 10 -15 2 0 4 7 4 15 0 8 -4 15 -10 15 -5 0
-7 -7 -4 -15z"/>
<path d="M2642 6180 c0 -19 2 -27 5 -17 2 9 2 25 0 35 -3 9 -5 1 -5 -18z"/>
<path d="M2637 5811 c-8 -47 -7 -54 8 -43 6 4 8 25 5 47 l-5 40 -8 -44z"/>
<path d="M1151 4524 c0 -11 3 -14 6 -6 3 7 2 16 -1 19 -3 4 -6 -2 -5 -13z"/>
<path d="M1203 4300 c0 -30 2 -43 4 -27 2 15 2 39 0 55 -2 15 -4 2 -4 -28z"/>
<path d="M1030 3690 c0 -5 5 -10 10 -10 6 0 10 5 10 10 0 6 -4 10 -10 10 -5 0
-10 -4 -10 -10z"/>
<path d="M981 3004 c0 -11 3 -14 6 -6 3 7 2 16 -1 19 -3 4 -6 -2 -5 -13z"/>
<path d="M1015 2660 c3 -5 8 -10 11 -10 2 0 4 5 4 10 0 6 -5 10 -11 10 -5 0
-7 -4 -4 -10z"/>
<path d="M1055 2481 c-3 -6 -3 -11 2 -11 4 0 2 -4 -6 -9 -8 -5 -9 -11 -3 -15
6 -3 14 3 17 15 8 23 1 36 -10 20z"/>
<path d="M1053 2330 c0 -36 2 -50 4 -32 2 17 2 47 0 65 -2 17 -4 3 -4 -33z"/>
<path d="M7350 340 c8 -5 22 -10 30 -10 13 0 13 1 0 10 -8 5 -22 10 -30 10
-13 0 -13 -1 0 -10z"/>
<path d="M8142 259 c-19 -30 -11 -32 11 -3 10 13 14 24 10 24 -5 0 -14 -9 -21
-21z"/>
<path d="M7698 93 c6 -2 18 -2 25 0 6 3 1 5 -13 5 -14 0 -19 -2 -12 -5z"/>
<path d="M7788 83 c6 -2 18 -2 25 0 6 3 1 5 -13 5 -14 0 -19 -2 -12 -5z"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 10 KiB

19
public/site.webmanifest Normal file
View File

@@ -0,0 +1,19 @@
{
"name": "",
"short_name": "",
"icons": [
{
"src": "/android-chrome-192x192.png",
"sizes": "192x192",
"type": "image/png"
},
{
"src": "/android-chrome-512x512.png",
"sizes": "512x512",
"type": "image/png"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}

View File

@@ -1,4 +0,0 @@
<svg width="283" height="64" viewBox="0 0 283 64" fill="none"
xmlns="http://www.w3.org/2000/svg">
<path d="M141.04 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.46 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM248.72 16c-11.04 0-19 7.2-19 18s8.96 18 20 18c6.67 0 12.55-2.64 16.19-7.09l-7.65-4.42c-2.02 2.21-5.09 3.5-8.54 3.5-4.79 0-8.86-2.5-10.37-6.5h28.02c.22-1.12.35-2.28.35-3.5 0-10.79-7.96-17.99-19-17.99zm-9.45 14.5c1.25-3.99 4.67-6.5 9.45-6.5 4.79 0 8.21 2.51 9.45 6.5h-18.9zM200.24 34c0 6 3.92 10 10 10 4.12 0 7.21-1.87 8.8-4.92l7.68 4.43c-3.18 5.3-9.14 8.49-16.48 8.49-11.05 0-19-7.2-19-18s7.96-18 19-18c7.34 0 13.29 3.19 16.48 8.49l-7.68 4.43c-1.59-3.05-4.68-4.92-8.8-4.92-6.07 0-10 4-10 10zm82.48-29v46h-9V5h9zM36.95 0L73.9 64H0L36.95 0zm92.38 5l-27.71 48L73.91 5H84.3l17.32 30 17.32-30h10.39zm58.91 12v9.69c-1-.29-2.06-.49-3.2-.49-5.81 0-10 4-10 10V51h-9V17h9v9.2c0-5.08 5.91-9.2 13.2-9.2z" fill="#000"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

22
server.js Normal file
View File

@@ -0,0 +1,22 @@
var https = require("https");
var fs = require("fs");
const next = require("next");
const port = 3000;
const dev = process.env.NODE_ENV !== "production";
const app = next({ dev, dir: __dirname });
const handle = app.getRequestHandler();
var options = {
key: fs.readFileSync("/etc/letsencrypt/live/fergl.ie/privkey.pem"),
cert: fs.readFileSync("/etc/letsencrypt/live/fergl.ie/cert.pem"),
};
app.prepare().then(() => {
https
.createServer(options, (req, res) => handle(req, res))
.listen(port, (err) => {
if (err) throw err;
console.log(`> Ready on localhost:${port}`);
});
});