Compare commits

...

2 commits

Author SHA1 Message Date
bf70d7b476
chore: run prettier
All checks were successful
continuous-integration/drone/push Build is passing
2022-07-26 22:18:54 +01:00
a3a3bca81f
chore: Update lockfile to new pnpm version 2022-07-26 22:09:20 +01:00
6 changed files with 135 additions and 73 deletions

View file

@ -28,7 +28,13 @@ export default function Button({
'transition-colors' 'transition-colors'
); );
if (!noDefaultColous) { if (!noDefaultColous) {
classes.push('bg-slate-600', 'text-slate-50', 'hover:bg-slate-500', 'disabled:bg-slate-900', 'disabled:text-slate-200'); classes.push(
'bg-slate-600',
'text-slate-50',
'hover:bg-slate-500',
'disabled:bg-slate-900',
'disabled:text-slate-200'
);
} }
return <button className={classes.join(' ')} {...props} />; return <button className={classes.join(' ')} {...props} />;
} }

17
next-auth.d.ts vendored
View file

@ -1,11 +1,10 @@
import NextAuth, { DefaultSession } from "next-auth" import NextAuth, { DefaultSession } from 'next-auth';
declare module "next-auth" { declare module 'next-auth' {
interface Session { interface Session {
user: { user: {
/** The user's internal ID. */ /** The user's internal ID. */
id: string; id: string;
} & DefaultSession["user"] } & DefaultSession['user'];
} }
} }

View file

@ -110,7 +110,7 @@ export default async function handler(
}, },
include: { include: {
bubbles: true, bubbles: true,
} },
}); });
await auditPageUpdate(page, after, data, session.user); await auditPageUpdate(page, after, data, session.user);

View file

@ -219,7 +219,8 @@ export default function TranscribePage(props: Props) {
<AreaSelector <AreaSelector
areas={regions.map((r) => r.area)} areas={regions.map((r) => r.area)}
onChange={(areas) => onChange={(areas) =>
!lockAreas && !saving && !lockAreas &&
!saving &&
setRegions( setRegions(
areas.map((area, i) => { areas.map((area, i) => {
if (i < regions.length) { if (i < regions.length) {
@ -269,7 +270,9 @@ export default function TranscribePage(props: Props) {
</section> </section>
<section className='flex-1'> <section className='flex-1'>
<div> <div>
<Button disabled={saving} onClick={extractText}>Extract text</Button> <Button disabled={saving} onClick={extractText}>
Extract text
</Button>
<br /> <br />
<label htmlFor='indicate-numbers'> <label htmlFor='indicate-numbers'>
<input <input
@ -360,7 +363,8 @@ export default function TranscribePage(props: Props) {
<div <div
key={i} key={i}
onClick={() => onClick={() =>
!saving && setSelectedBubble( !saving &&
setSelectedBubble(
selectedBubble === i ? -1 : i selectedBubble === i ? -1 : i
) )
} }
@ -384,7 +388,9 @@ export default function TranscribePage(props: Props) {
<hr className='border-slate-600 my-2' /> <hr className='border-slate-600 my-2' />
<div> <div>
<Button disabled={saving} onClick={submitBubbles}>Save!</Button> <Button disabled={saving} onClick={submitBubbles}>
Save!
</Button>
</div> </div>
</section> </section>
</div> </div>

View file

@ -1,4 +1,4 @@
lockfileVersion: 5.3 lockfileVersion: 5.4
specifiers: specifiers:
'@bmunozg/react-image-area': ^1.0.2 '@bmunozg/react-image-area': ^1.0.2
@ -32,19 +32,19 @@ specifiers:
zod: ^3.17.10 zod: ^3.17.10
dependencies: dependencies:
'@bmunozg/react-image-area': 1.0.2_react-dom@18.2.0+react@18.2.0 '@bmunozg/react-image-area': 1.0.2_biqbaboplfbrettd7655fr4n2y
'@fortawesome/fontawesome-svg-core': 6.1.2 '@fortawesome/fontawesome-svg-core': 6.1.2
'@fortawesome/free-brands-svg-icons': 6.1.2 '@fortawesome/free-brands-svg-icons': 6.1.2
'@fortawesome/react-fontawesome': 0.2.0_990294e19fa18431d2a389426fd0d6bc '@fortawesome/react-fontawesome': 0.2.0_tebjjym7ugcdduvdrfbg7ugwxq
'@next-auth/prisma-adapter': 1.0.4_9818e1f55ecb9769742928f823304203 '@next-auth/prisma-adapter': 1.0.4_tamod5k6zolws5bjfd4cgmccam
'@prisma/client': 4.1.0_prisma@4.1.0 '@prisma/client': 4.1.0_prisma@4.1.0
diff: 5.1.0 diff: 5.1.0
discord.js: 14.0.3 discord.js: 14.0.3
next: 12.2.2_react-dom@18.2.0+react@18.2.0 next: 12.2.2_biqbaboplfbrettd7655fr4n2y
next-auth: 4.10.1_react-dom@18.2.0+react@18.2.0 next-auth: 4.10.1_biqbaboplfbrettd7655fr4n2y
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0_react@18.2.0 react-dom: 18.2.0_react@18.2.0
react-select: 5.4.0_08741bd84ef3e6fa073678331eea05f2 react-select: 5.4.0_bb2bxwco6ptpubzwpazr52qf6i
tesseract.js: 2.1.5 tesseract.js: 2.1.5
zod: 3.17.10 zod: 3.17.10
@ -53,15 +53,15 @@ devDependencies:
'@types/node': 18.0.6 '@types/node': 18.0.6
'@types/react': 18.0.15 '@types/react': 18.0.15
'@types/react-dom': 18.0.6 '@types/react-dom': 18.0.6
'@typescript-eslint/eslint-plugin': 5.31.0_eslint@8.20.0+typescript@4.7.4 '@typescript-eslint/eslint-plugin': 5.31.0_he2ccbldppg44uulnyq4rwocfa
autoprefixer: 10.4.7_postcss@8.4.14 autoprefixer: 10.4.7_postcss@8.4.14
eslint: 8.20.0 eslint: 8.20.0
eslint-config-next: 12.2.2_eslint@8.20.0+typescript@4.7.4 eslint-config-next: 12.2.2_he2ccbldppg44uulnyq4rwocfa
postcss: 8.4.14 postcss: 8.4.14
prettier: 2.7.1 prettier: 2.7.1
prisma: 4.1.0 prisma: 4.1.0
tailwindcss: 3.1.6_ts-node@10.9.1 tailwindcss: 3.1.6_ts-node@10.9.1
ts-node: 10.9.1_98dbbc3ccd2e3c16131a870f4ea5cdb2 ts-node: 10.9.1_tdn3ypgnfy6bmey2q4hu5jonwi
typescript: 4.7.4 typescript: 4.7.4
packages: packages:
@ -130,7 +130,7 @@ packages:
to-fast-properties: 2.0.0 to-fast-properties: 2.0.0
dev: false dev: false
/@bmunozg/react-image-area/1.0.2_react-dom@18.2.0+react@18.2.0: /@bmunozg/react-image-area/1.0.2_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-IXL8CLM5C3WenY65c0FmD18hm+ApkBnZ1hMhDOV4Wu1DRSKgjG/mLJBfN3MkTLUSgZ7isl7ssqHQuQWZFNoIlg==} resolution: {integrity: sha512-IXL8CLM5C3WenY65c0FmD18hm+ApkBnZ1hMhDOV4Wu1DRSKgjG/mLJBfN3MkTLUSgZ7isl7ssqHQuQWZFNoIlg==}
peerDependencies: peerDependencies:
react: ^17.0.2 react: ^17.0.2
@ -213,7 +213,7 @@ packages:
resolution: {integrity: sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==} resolution: {integrity: sha512-igX9a37DR2ZPGYtV6suZ6whr8pTFtyHL3K/oLUotxpSVO2ASaprmAe2Dkq7tBo7CRY7MMDrAa9nuQP9/YG8FxQ==}
dev: false dev: false
/@emotion/react/11.9.3_d9efaa4a57b9ddc48121b447e3437c81: /@emotion/react/11.9.3_3hx2ussxxho4jajbwrd6gq34qe:
resolution: {integrity: sha512-g9Q1GcTOlzOEjqwuLF/Zd9LC+4FljjPjDfxSM7KmEakm+hsHXk+bYZ2q+/hTJzr0OUNkujo72pXLQvXj6H+GJQ==} resolution: {integrity: sha512-g9Q1GcTOlzOEjqwuLF/Zd9LC+4FljjPjDfxSM7KmEakm+hsHXk+bYZ2q+/hTJzr0OUNkujo72pXLQvXj6H+GJQ==}
peerDependencies: peerDependencies:
'@babel/core': ^7.0.0 '@babel/core': ^7.0.0
@ -301,7 +301,7 @@ packages:
'@fortawesome/fontawesome-common-types': 6.1.2 '@fortawesome/fontawesome-common-types': 6.1.2
dev: false dev: false
/@fortawesome/react-fontawesome/0.2.0_990294e19fa18431d2a389426fd0d6bc: /@fortawesome/react-fontawesome/0.2.0_tebjjym7ugcdduvdrfbg7ugwxq:
resolution: {integrity: sha512-uHg75Rb/XORTtVt7OS9WoK8uM276Ufi7gCzshVWkUJbHhh3svsUUeqXerrM96Wm7fRiDzfKRwSoahhMIkGAYHw==} resolution: {integrity: sha512-uHg75Rb/XORTtVt7OS9WoK8uM276Ufi7gCzshVWkUJbHhh3svsUUeqXerrM96Wm7fRiDzfKRwSoahhMIkGAYHw==}
peerDependencies: peerDependencies:
'@fortawesome/fontawesome-svg-core': ~1 || ~6 '@fortawesome/fontawesome-svg-core': ~1 || ~6
@ -343,14 +343,14 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.14 '@jridgewell/sourcemap-codec': 1.4.14
dev: true dev: true
/@next-auth/prisma-adapter/1.0.4_9818e1f55ecb9769742928f823304203: /@next-auth/prisma-adapter/1.0.4_tamod5k6zolws5bjfd4cgmccam:
resolution: {integrity: sha512-jIOM6CzCbl2/Mzbx9kb2IjtHoJOeRN9wtQgLk4EUm5bhneSVGv1rtz5TDskvp2UfCa+EK9nDmug+lje41z80Gg==} resolution: {integrity: sha512-jIOM6CzCbl2/Mzbx9kb2IjtHoJOeRN9wtQgLk4EUm5bhneSVGv1rtz5TDskvp2UfCa+EK9nDmug+lje41z80Gg==}
peerDependencies: peerDependencies:
'@prisma/client': '>=2.26.0 || >=3' '@prisma/client': '>=2.26.0 || >=3'
next-auth: ^4 next-auth: ^4
dependencies: dependencies:
'@prisma/client': 4.1.0_prisma@4.1.0 '@prisma/client': 4.1.0_prisma@4.1.0
next-auth: 4.10.1_react-dom@18.2.0+react@18.2.0 next-auth: 4.10.1_biqbaboplfbrettd7655fr4n2y
dev: false dev: false
/@next/env/12.2.2: /@next/env/12.2.2:
@ -526,7 +526,6 @@ packages:
/@prisma/engines/4.1.0: /@prisma/engines/4.1.0:
resolution: {integrity: sha512-quqHXD3P83NBLVtRlts4SgKHmqgA8GMiyDTJ7af03Wg0gl6F5t65mBYvIuwmD+52vHm42JtIsp/fAO9YIV0JBA==} resolution: {integrity: sha512-quqHXD3P83NBLVtRlts4SgKHmqgA8GMiyDTJ7af03Wg0gl6F5t65mBYvIuwmD+52vHm42JtIsp/fAO9YIV0JBA==}
requiresBuild: true requiresBuild: true
dev: true
/@rushstack/eslint-patch/1.1.4: /@rushstack/eslint-patch/1.1.4:
resolution: {integrity: sha512-LwzQKA4vzIct1zNZzBmRKI9QuNpLgTQMEjsQLf3BXuGYb3QPTP4Yjf6mkdX+X1mYttZ808QpOwAzZjv28kq7DA==} resolution: {integrity: sha512-LwzQKA4vzIct1zNZzBmRKI9QuNpLgTQMEjsQLf3BXuGYb3QPTP4Yjf6mkdX+X1mYttZ808QpOwAzZjv28kq7DA==}
@ -626,7 +625,7 @@ packages:
'@types/node': 18.0.6 '@types/node': 18.0.6
dev: false dev: false
/@typescript-eslint/eslint-plugin/5.31.0_eslint@8.20.0+typescript@4.7.4: /@typescript-eslint/eslint-plugin/5.31.0_he2ccbldppg44uulnyq4rwocfa:
resolution: {integrity: sha512-VKW4JPHzG5yhYQrQ1AzXgVgX8ZAJEvCz0QI6mLRX4tf7rnFfh5D8SKm0Pq6w5PyNfAWJk6sv313+nEt3ohWMBQ==} resolution: {integrity: sha512-VKW4JPHzG5yhYQrQ1AzXgVgX8ZAJEvCz0QI6mLRX4tf7rnFfh5D8SKm0Pq6w5PyNfAWJk6sv313+nEt3ohWMBQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -638,8 +637,8 @@ packages:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/scope-manager': 5.31.0 '@typescript-eslint/scope-manager': 5.31.0
'@typescript-eslint/type-utils': 5.31.0_eslint@8.20.0+typescript@4.7.4 '@typescript-eslint/type-utils': 5.31.0_he2ccbldppg44uulnyq4rwocfa
'@typescript-eslint/utils': 5.31.0_eslint@8.20.0+typescript@4.7.4 '@typescript-eslint/utils': 5.31.0_he2ccbldppg44uulnyq4rwocfa
debug: 4.3.4 debug: 4.3.4
eslint: 8.20.0 eslint: 8.20.0
functional-red-black-tree: 1.0.1 functional-red-black-tree: 1.0.1
@ -652,7 +651,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/parser/5.30.7_eslint@8.20.0+typescript@4.7.4: /@typescript-eslint/parser/5.30.7_he2ccbldppg44uulnyq4rwocfa:
resolution: {integrity: sha512-Rg5xwznHWWSy7v2o0cdho6n+xLhK2gntImp0rJroVVFkcYFYQ8C8UJTSuTw/3CnExBmPjycjmUJkxVmjXsld6A==} resolution: {integrity: sha512-Rg5xwznHWWSy7v2o0cdho6n+xLhK2gntImp0rJroVVFkcYFYQ8C8UJTSuTw/3CnExBmPjycjmUJkxVmjXsld6A==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -688,7 +687,7 @@ packages:
'@typescript-eslint/visitor-keys': 5.31.0 '@typescript-eslint/visitor-keys': 5.31.0
dev: true dev: true
/@typescript-eslint/type-utils/5.31.0_eslint@8.20.0+typescript@4.7.4: /@typescript-eslint/type-utils/5.31.0_he2ccbldppg44uulnyq4rwocfa:
resolution: {integrity: sha512-7ZYqFbvEvYXFn9ax02GsPcEOmuWNg+14HIf4q+oUuLnMbpJ6eHAivCg7tZMVwzrIuzX3QCeAOqKoyMZCv5xe+w==} resolution: {integrity: sha512-7ZYqFbvEvYXFn9ax02GsPcEOmuWNg+14HIf4q+oUuLnMbpJ6eHAivCg7tZMVwzrIuzX3QCeAOqKoyMZCv5xe+w==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -698,7 +697,7 @@ packages:
typescript: typescript:
optional: true optional: true
dependencies: dependencies:
'@typescript-eslint/utils': 5.31.0_eslint@8.20.0+typescript@4.7.4 '@typescript-eslint/utils': 5.31.0_he2ccbldppg44uulnyq4rwocfa
debug: 4.3.4 debug: 4.3.4
eslint: 8.20.0 eslint: 8.20.0
tsutils: 3.21.0_typescript@4.7.4 tsutils: 3.21.0_typescript@4.7.4
@ -759,7 +758,7 @@ packages:
- supports-color - supports-color
dev: true dev: true
/@typescript-eslint/utils/5.31.0_eslint@8.20.0+typescript@4.7.4: /@typescript-eslint/utils/5.31.0_he2ccbldppg44uulnyq4rwocfa:
resolution: {integrity: sha512-kcVPdQS6VIpVTQ7QnGNKMFtdJdvnStkqS5LeALr4rcwx11G6OWb2HB17NMPnlRHvaZP38hL9iK8DdE9Fne7NYg==} resolution: {integrity: sha512-kcVPdQS6VIpVTQ7QnGNKMFtdJdvnStkqS5LeALr4rcwx11G6OWb2HB17NMPnlRHvaZP38hL9iK8DdE9Fne7NYg==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}
peerDependencies: peerDependencies:
@ -1135,12 +1134,22 @@ packages:
/debug/2.6.9: /debug/2.6.9:
resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==} resolution: {integrity: sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies: dependencies:
ms: 2.0.0 ms: 2.0.0
dev: true dev: true
/debug/3.2.7: /debug/3.2.7:
resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
dependencies: dependencies:
ms: 2.1.3 ms: 2.1.3
dev: true dev: true
@ -1325,7 +1334,7 @@ packages:
resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==}
engines: {node: '>=10'} engines: {node: '>=10'}
/eslint-config-next/12.2.2_eslint@8.20.0+typescript@4.7.4: /eslint-config-next/12.2.2_he2ccbldppg44uulnyq4rwocfa:
resolution: {integrity: sha512-oJhWBLC4wDYYUFv/5APbjHUFd0QRFCojMdj/QnMoOEktmeTvwnnoA8F8uaXs0fQgsaTK0tbUxBRv9/Y4/rpxOA==} resolution: {integrity: sha512-oJhWBLC4wDYYUFv/5APbjHUFd0QRFCojMdj/QnMoOEktmeTvwnnoA8F8uaXs0fQgsaTK0tbUxBRv9/Y4/rpxOA==}
peerDependencies: peerDependencies:
eslint: ^7.23.0 || ^8.0.0 eslint: ^7.23.0 || ^8.0.0
@ -1336,16 +1345,17 @@ packages:
dependencies: dependencies:
'@next/eslint-plugin-next': 12.2.2 '@next/eslint-plugin-next': 12.2.2
'@rushstack/eslint-patch': 1.1.4 '@rushstack/eslint-patch': 1.1.4
'@typescript-eslint/parser': 5.30.7_eslint@8.20.0+typescript@4.7.4 '@typescript-eslint/parser': 5.30.7_he2ccbldppg44uulnyq4rwocfa
eslint: 8.20.0 eslint: 8.20.0
eslint-import-resolver-node: 0.3.6 eslint-import-resolver-node: 0.3.6
eslint-import-resolver-typescript: 2.7.1_0157baa8edf6c20407205f3a831c9174 eslint-import-resolver-typescript: 2.7.1_afl3vkhn63baibzal45igheroq
eslint-plugin-import: 2.26.0_eslint@8.20.0 eslint-plugin-import: 2.26.0_w3h2x6a7zgcj3scdfl3yk2yqgq
eslint-plugin-jsx-a11y: 6.6.0_eslint@8.20.0 eslint-plugin-jsx-a11y: 6.6.0_eslint@8.20.0
eslint-plugin-react: 7.30.1_eslint@8.20.0 eslint-plugin-react: 7.30.1_eslint@8.20.0
eslint-plugin-react-hooks: 4.6.0_eslint@8.20.0 eslint-plugin-react-hooks: 4.6.0_eslint@8.20.0
typescript: 4.7.4 typescript: 4.7.4
transitivePeerDependencies: transitivePeerDependencies:
- eslint-import-resolver-webpack
- supports-color - supports-color
dev: true dev: true
@ -1354,9 +1364,11 @@ packages:
dependencies: dependencies:
debug: 3.2.7 debug: 3.2.7
resolve: 1.22.1 resolve: 1.22.1
transitivePeerDependencies:
- supports-color
dev: true dev: true
/eslint-import-resolver-typescript/2.7.1_0157baa8edf6c20407205f3a831c9174: /eslint-import-resolver-typescript/2.7.1_afl3vkhn63baibzal45igheroq:
resolution: {integrity: sha512-00UbgGwV8bSgUv34igBDbTOtKhqoRMy9bFjNehT40bXg6585PNIct8HhXZ0SybqB9rWtXj9crcku8ndDn/gIqQ==} resolution: {integrity: sha512-00UbgGwV8bSgUv34igBDbTOtKhqoRMy9bFjNehT40bXg6585PNIct8HhXZ0SybqB9rWtXj9crcku8ndDn/gIqQ==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
@ -1365,7 +1377,7 @@ packages:
dependencies: dependencies:
debug: 4.3.4 debug: 4.3.4
eslint: 8.20.0 eslint: 8.20.0
eslint-plugin-import: 2.26.0_eslint@8.20.0 eslint-plugin-import: 2.26.0_w3h2x6a7zgcj3scdfl3yk2yqgq
glob: 7.2.3 glob: 7.2.3
is-glob: 4.0.3 is-glob: 4.0.3
resolve: 1.22.1 resolve: 1.22.1
@ -1374,27 +1386,51 @@ packages:
- supports-color - supports-color
dev: true dev: true
/eslint-module-utils/2.7.3: /eslint-module-utils/2.7.3_ggupe3rfxc6u74is6c4nrru3k4:
resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==} resolution: {integrity: sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies:
'@typescript-eslint/parser': '*'
eslint-import-resolver-node: '*'
eslint-import-resolver-typescript: '*'
eslint-import-resolver-webpack: '*'
peerDependenciesMeta:
'@typescript-eslint/parser':
optional: true
eslint-import-resolver-node:
optional: true
eslint-import-resolver-typescript:
optional: true
eslint-import-resolver-webpack:
optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.30.7_he2ccbldppg44uulnyq4rwocfa
debug: 3.2.7 debug: 3.2.7
eslint-import-resolver-node: 0.3.6
eslint-import-resolver-typescript: 2.7.1_afl3vkhn63baibzal45igheroq
find-up: 2.1.0 find-up: 2.1.0
transitivePeerDependencies:
- supports-color
dev: true dev: true
/eslint-plugin-import/2.26.0_eslint@8.20.0: /eslint-plugin-import/2.26.0_w3h2x6a7zgcj3scdfl3yk2yqgq:
resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==} resolution: {integrity: sha512-hYfi3FXaM8WPLf4S1cikh/r4IxnO6zrhZbEGz2b660EJRbuxgpDS5gkCuYgGWg2xxh2rBuIr4Pvhve/7c31koA==}
engines: {node: '>=4'} engines: {node: '>=4'}
peerDependencies: peerDependencies:
'@typescript-eslint/parser': '*'
eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8
peerDependenciesMeta:
'@typescript-eslint/parser':
optional: true
dependencies: dependencies:
'@typescript-eslint/parser': 5.30.7_he2ccbldppg44uulnyq4rwocfa
array-includes: 3.1.5 array-includes: 3.1.5
array.prototype.flat: 1.3.0 array.prototype.flat: 1.3.0
debug: 2.6.9 debug: 2.6.9
doctrine: 2.1.0 doctrine: 2.1.0
eslint: 8.20.0 eslint: 8.20.0
eslint-import-resolver-node: 0.3.6 eslint-import-resolver-node: 0.3.6
eslint-module-utils: 2.7.3 eslint-module-utils: 2.7.3_ggupe3rfxc6u74is6c4nrru3k4
has: 1.0.3 has: 1.0.3
is-core-module: 2.9.0 is-core-module: 2.9.0
is-glob: 4.0.3 is-glob: 4.0.3
@ -1402,6 +1438,10 @@ packages:
object.values: 1.1.5 object.values: 1.1.5
resolve: 1.22.1 resolve: 1.22.1
tsconfig-paths: 3.14.1 tsconfig-paths: 3.14.1
transitivePeerDependencies:
- eslint-import-resolver-typescript
- eslint-import-resolver-webpack
- supports-color
dev: true dev: true
/eslint-plugin-jsx-a11y/6.6.0_eslint@8.20.0: /eslint-plugin-jsx-a11y/6.6.0_eslint@8.20.0:
@ -2132,7 +2172,7 @@ packages:
resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==}
dev: true dev: true
/next-auth/4.10.1_react-dom@18.2.0+react@18.2.0: /next-auth/4.10.1_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-F00vtwBdyMIIJ8IORHOAOHjVGTDEhhm9+HpB2BQ8r40WtGxqToWWLN7Z+2ZW/z2RFlo3zhcuAtUCPUzVJxtZwQ==} resolution: {integrity: sha512-F00vtwBdyMIIJ8IORHOAOHjVGTDEhhm9+HpB2BQ8r40WtGxqToWWLN7Z+2ZW/z2RFlo3zhcuAtUCPUzVJxtZwQ==}
engines: {node: ^12.19.0 || ^14.15.0 || ^16.13.0} engines: {node: ^12.19.0 || ^14.15.0 || ^16.13.0}
peerDependencies: peerDependencies:
@ -2156,7 +2196,7 @@ packages:
uuid: 8.3.2 uuid: 8.3.2
dev: false dev: false
/next/12.2.2_react-dom@18.2.0+react@18.2.0: /next/12.2.2_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-zAYFY45aBry/PlKONqtlloRFqU/We3zWYdn2NoGvDZkoYUYQSJC8WMcalS5C19MxbCZLUVCX7D7a6gTGgl2yLg==} resolution: {integrity: sha512-zAYFY45aBry/PlKONqtlloRFqU/We3zWYdn2NoGvDZkoYUYQSJC8WMcalS5C19MxbCZLUVCX7D7a6gTGgl2yLg==}
engines: {node: '>=12.22.0'} engines: {node: '>=12.22.0'}
hasBin: true hasBin: true
@ -2435,7 +2475,7 @@ packages:
postcss: 8.4.14 postcss: 8.4.14
dev: true dev: true
/postcss-load-config/3.1.4_postcss@8.4.14+ts-node@10.9.1: /postcss-load-config/3.1.4_pe6iykxod2v7i2uk6okjazxzki:
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==} resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
engines: {node: '>= 10'} engines: {node: '>= 10'}
peerDependencies: peerDependencies:
@ -2449,7 +2489,7 @@ packages:
dependencies: dependencies:
lilconfig: 2.0.6 lilconfig: 2.0.6
postcss: 8.4.14 postcss: 8.4.14
ts-node: 10.9.1_98dbbc3ccd2e3c16131a870f4ea5cdb2 ts-node: 10.9.1_tdn3ypgnfy6bmey2q4hu5jonwi
yaml: 1.10.2 yaml: 1.10.2
dev: true dev: true
@ -2528,7 +2568,6 @@ packages:
requiresBuild: true requiresBuild: true
dependencies: dependencies:
'@prisma/engines': 4.1.0 '@prisma/engines': 4.1.0
dev: true
/prop-types/15.8.1: /prop-types/15.8.1:
resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==} resolution: {integrity: sha512-oj87CgZICdulUohogVAR7AjlC0327U4el4L6eAvOqCeudMDVU0NThNaV+b9Df4dXgSP1gXMTnPdhfe/2qDH5cg==}
@ -2564,7 +2603,7 @@ packages:
/react-is/16.13.1: /react-is/16.13.1:
resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==} resolution: {integrity: sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==}
/react-select/5.4.0_08741bd84ef3e6fa073678331eea05f2: /react-select/5.4.0_bb2bxwco6ptpubzwpazr52qf6i:
resolution: {integrity: sha512-CjE9RFLUvChd5SdlfG4vqxZd55AZJRrLrHzkQyTYeHlpOztqcgnyftYAolJ0SGsBev6zAs6qFrjm6KU3eo2hzg==} resolution: {integrity: sha512-CjE9RFLUvChd5SdlfG4vqxZd55AZJRrLrHzkQyTYeHlpOztqcgnyftYAolJ0SGsBev6zAs6qFrjm6KU3eo2hzg==}
peerDependencies: peerDependencies:
react: ^16.8.0 || ^17.0.0 || ^18.0.0 react: ^16.8.0 || ^17.0.0 || ^18.0.0
@ -2572,19 +2611,19 @@ packages:
dependencies: dependencies:
'@babel/runtime': 7.18.9 '@babel/runtime': 7.18.9
'@emotion/cache': 11.9.3 '@emotion/cache': 11.9.3
'@emotion/react': 11.9.3_d9efaa4a57b9ddc48121b447e3437c81 '@emotion/react': 11.9.3_3hx2ussxxho4jajbwrd6gq34qe
'@types/react-transition-group': 4.4.5 '@types/react-transition-group': 4.4.5
memoize-one: 5.2.1 memoize-one: 5.2.1
prop-types: 15.8.1 prop-types: 15.8.1
react: 18.2.0 react: 18.2.0
react-dom: 18.2.0_react@18.2.0 react-dom: 18.2.0_react@18.2.0
react-transition-group: 4.4.2_react-dom@18.2.0+react@18.2.0 react-transition-group: 4.4.2_biqbaboplfbrettd7655fr4n2y
transitivePeerDependencies: transitivePeerDependencies:
- '@babel/core' - '@babel/core'
- '@types/react' - '@types/react'
dev: false dev: false
/react-transition-group/4.4.2_react-dom@18.2.0+react@18.2.0: /react-transition-group/4.4.2_biqbaboplfbrettd7655fr4n2y:
resolution: {integrity: sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==} resolution: {integrity: sha512-/RNYfRAMlZwDSr6z4zNKV6xu53/e2BuaBbGhbyYIXTrmgu/bGHzmqOs7mJSJBHy9Ud+ApHx3QjrkKSp1pxvlFg==}
peerDependencies: peerDependencies:
react: '>=16.6.0' react: '>=16.6.0'
@ -2875,7 +2914,7 @@ packages:
postcss: 8.4.14 postcss: 8.4.14
postcss-import: 14.1.0_postcss@8.4.14 postcss-import: 14.1.0_postcss@8.4.14
postcss-js: 4.0.0_postcss@8.4.14 postcss-js: 4.0.0_postcss@8.4.14
postcss-load-config: 3.1.4_postcss@8.4.14+ts-node@10.9.1 postcss-load-config: 3.1.4_pe6iykxod2v7i2uk6okjazxzki
postcss-nested: 5.0.6_postcss@8.4.14 postcss-nested: 5.0.6_postcss@8.4.14
postcss-selector-parser: 6.0.10 postcss-selector-parser: 6.0.10
postcss-value-parser: 4.2.0 postcss-value-parser: 4.2.0
@ -2942,7 +2981,7 @@ packages:
resolution: {integrity: sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg==} resolution: {integrity: sha512-hvE+ZYXuINrx6Ei6D6hz+PTim0Uf++dYbK9FFifLNwQj+RwKquhQpn868yZsCtJYiclZF1u8l6WZxxKi+vv7Rg==}
dev: false dev: false
/ts-node/10.9.1_98dbbc3ccd2e3c16131a870f4ea5cdb2: /ts-node/10.9.1_tdn3ypgnfy6bmey2q4hu5jonwi:
resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==} resolution: {integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==}
hasBin: true hasBin: true
peerDependencies: peerDependencies:

View file

@ -1,27 +1,39 @@
import { ComicBubble, ComicPage } from "@prisma/client"; import { ComicBubble, ComicPage } from '@prisma/client';
import { WebhookClient } from "discord.js"; import { WebhookClient } from 'discord.js';
import { Session } from "next-auth"; import { Session } from 'next-auth';
import { PageBubbles } from "../pages/api/submit-page-bubbles"; import { PageBubbles } from '../pages/api/submit-page-bubbles';
import { createPatch } from 'diff'; import { createPatch } from 'diff';
type Page = ComicPage & { bubbles: ComicBubble[] }; type Page = ComicPage & { bubbles: ComicBubble[] };
const DJS_CLIENT = new WebhookClient({ const DJS_CLIENT = new WebhookClient(
url: process.env.AUDIT_WEBHOOK!, {
}, { url: process.env.AUDIT_WEBHOOK!,
allowedMentions: {
parse: [],
}, },
}) {
allowedMentions: {
parse: [],
},
}
);
export async function auditPageUpdate(before: Page, after: Page, update: PageBubbles, user: Session['user']) { export async function auditPageUpdate(
before: Page,
after: Page,
update: PageBubbles,
user: Session['user']
) {
const beforeS = JSON.stringify(before, null, 2); const beforeS = JSON.stringify(before, null, 2);
const afterS = JSON.stringify(after, null, 2); const afterS = JSON.stringify(after, null, 2);
if (beforeS === afterS) { if (beforeS === afterS) {
return; return;
} }
const patch = createPatch(`/comic/${update.comicId}/${update.pageId}`, beforeS, afterS); const patch = createPatch(
`/comic/${update.comicId}/${update.pageId}`,
beforeS,
afterS
);
await DJS_CLIENT.send({ await DJS_CLIENT.send({
embeds: [ embeds: [
{ {
@ -40,7 +52,7 @@ export async function auditPageUpdate(before: Page, after: Page, update: PageBub
footer: { footer: {
text: `${user.name} (${user.id})`, text: `${user.name} (${user.id})`,
}, },
} },
] ],
}) });
} }