From b86c97015835c4d93da2f3d636ff3e83312d897d Mon Sep 17 00:00:00 2001 From: Reinaldy Rafli Date: Thu, 15 Jul 2021 20:41:36 +0700 Subject: [PATCH] hotfix: error on preview --- client/.dockerignore | 126 ++++++++++++++++++++++++++++++ client/package.json | 5 +- client/src/hooks.ts | 24 ------ client/src/routes/__error.svelte | 5 +- client/src/routes/__layout.svelte | 2 +- client/yarn.lock | 24 +----- 6 files changed, 132 insertions(+), 54 deletions(-) create mode 100644 client/.dockerignore delete mode 100644 client/src/hooks.ts diff --git a/client/.dockerignore b/client/.dockerignore new file mode 100644 index 0000000..4487150 --- /dev/null +++ b/client/.dockerignore @@ -0,0 +1,126 @@ +# Created by https://www.toptal.com/developers/gitignore/api/node +# Edit at https://www.toptal.com/developers/gitignore?templates=node + +### Node ### +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +lerna-debug.log* +.pnpm-debug.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage +*.lcov + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# Bower dependency directory (https://bower.io/) +bower_components + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (https://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +jspm_packages/ + +# Snowpack dependency directory (https://snowpack.dev/) +web_modules/ + +# TypeScript cache +*.tsbuildinfo + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Microbundle cache +.rpt2_cache/ +.rts2_cache_cjs/ +.rts2_cache_es/ +.rts2_cache_umd/ + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env +.env.test +.env.production + +# parcel-bundler cache (https://parceljs.org/) +.cache +.parcel-cache + +# Next.js build output +.next +out + +# Nuxt.js build / generate output +.nuxt +dist + +# Gatsby files +.cache/ +# Comment in the public line in if your project uses Gatsby and not Next.js +# https://nextjs.org/blog/next-9-1#public-directory-support +# public + +# vuepress build output +.vuepress/dist + +# Serverless directories +.serverless/ + +# FuseBox cache +.fusebox/ + +# DynamoDB Local files +.dynamodb/ + +# TernJS port file +.tern-port + +# Stores VSCode versions used for testing VSCode extensions +.vscode-test + +# yarn v2 +.yarn/cache +.yarn/unplugged +.yarn/build-state.yml +.yarn/install-state.gz +.pnp.* + +.svelte-kit + +# End of https://www.toptal.com/developers/gitignore/api/node diff --git a/client/package.json b/client/package.json index 14c0d53..920c129 100644 --- a/client/package.json +++ b/client/package.json @@ -22,7 +22,6 @@ "devDependencies": { "@sveltejs/adapter-static": "1.0.0-next.13", "@sveltejs/kit": "1.0.0-next.129", - "@types/cookie": "0.4.1", "@typescript-eslint/eslint-plugin": "4.28.3", "@typescript-eslint/parser": "4.28.3", "cssnano": "5.0.6", @@ -41,9 +40,7 @@ "dependencies": { "@fontsource/fira-mono": "4.5.0", "@fontsource/rubik": "4.5.0", - "@lukeed/uuid": "2.0.0", - "@sentry/browser": "^6.9.0", - "cookie": "0.4.1", + "@sentry/browser": "6.9.0", "dotenv": "10.0.0", "svelte-i18n": "3.3.9" } diff --git a/client/src/hooks.ts b/client/src/hooks.ts deleted file mode 100644 index 7140f07..0000000 --- a/client/src/hooks.ts +++ /dev/null @@ -1,24 +0,0 @@ -// TODO: Find out what the fuck this file is doing -import cookie from 'cookie'; -import { v4 as uuid } from '@lukeed/uuid'; -import type { Handle } from '@sveltejs/kit'; - -export const handle: Handle = async ({ request, resolve }) => { - const cookies = cookie.parse(request.headers.cookie || ''); - request.locals.userid = cookies.userid || uuid(); - - // TODO https://github.com/sveltejs/kit/issues/1046 - if (request.query.has('_method')) { - request.method = request.query.get('_method').toUpperCase(); - } - - const response = await resolve(request); - - if (!cookies.userid) { - // if this is the first time the user has visited this app, - // set a cookie so that we recognise them when they return - response.headers['set-cookie'] = `userid=${request.locals.userid}; Path=/; HttpOnly`; - } - - return response; -}; diff --git a/client/src/routes/__error.svelte b/client/src/routes/__error.svelte index 484a4d3..6df72f5 100644 --- a/client/src/routes/__error.svelte +++ b/client/src/routes/__error.svelte @@ -1,9 +1,10 @@ diff --git a/client/src/routes/__layout.svelte b/client/src/routes/__layout.svelte index 7b1d1b6..1981a19 100644 --- a/client/src/routes/__layout.svelte +++ b/client/src/routes/__layout.svelte @@ -26,7 +26,7 @@
-
+
diff --git a/client/yarn.lock b/client/yarn.lock index 79adb96..a076d8b 100644 --- a/client/yarn.lock +++ b/client/yarn.lock @@ -98,18 +98,6 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.0.tgz#87de7af9c231826fdd68ac7258f77c429e0e5fcf" integrity sha512-wdppn25U8z/2yiaT6YGquE6X8sSv7hNMWSXYSSU1jGv/yd6XqjXgTDJ8KP4NgjTXfJ3GbRjeeb8RTV7a/VpM+w== -"@lukeed/csprng@^1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@lukeed/csprng/-/csprng-1.0.0.tgz#733a122382749d27e2e46ec38f8c71c9d53a9636" - integrity sha512-ruuGHsnabmObBdeMg3vKdGRmh06Oog3eFpf/Tk6X0kDSJDpJTDCj2dqdp1+0VjzIUgHlFF9GBm7uFqfYhhdX9g== - -"@lukeed/uuid@2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@lukeed/uuid/-/uuid-2.0.0.tgz#1c0f33c071cb6902bc3b9e475782ada7314ef9bd" - integrity sha512-dUz8OmYvlY5A9wXaroHIMSPASpSYRLCqbPvxGSyHguhtTQIy24lC+EGxQlwv71AhRCO55WOtgwhzQLpw27JaJQ== - dependencies: - "@lukeed/csprng" "^1.0.0" - "@nodelib/fs.scandir@2.1.5": version "2.1.5" resolved "https://registry.yarnpkg.com/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz#7619c2eb21b25483f6d167548b4cfd5a7488c3d5" @@ -139,7 +127,7 @@ estree-walker "^2.0.1" picomatch "^2.2.2" -"@sentry/browser@^6.9.0": +"@sentry/browser@6.9.0": version "6.9.0" resolved "https://registry.yarnpkg.com/@sentry/browser/-/browser-6.9.0.tgz#b75ac1a6ff8fe60d451b14aea94d66f9dcd5570f" integrity sha512-4JnEPcwoNs6JqeEd4wscBq+hxpotEJ0DJ4eOIsaNZIMyqEHXBHTXCk/gfrSsiZFrkHM4PgvUHOxaC0HcZ92oBA== @@ -223,11 +211,6 @@ resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.1.1.tgz#3348564048e7a2d7398c935d466c0414ebb6a669" integrity sha512-Z6DoceYb/1xSg5+e+ZlPZ9v0N16ZvZ+wYMraFue4HYrE4ttONKtsvruIRf6t9TBR0YvSOfi1hUU0fJfBLCDYow== -"@types/cookie@0.4.1": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.1.tgz#bfd02c1f2224567676c1545199f87c3a861d878d" - integrity sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q== - "@types/json-schema@^7.0.7": version "7.0.8" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.8.tgz#edf1bf1dbf4e04413ca8e5b17b3b7d7d54b59818" @@ -550,11 +533,6 @@ concat-map@0.0.1: resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" integrity sha1-2Klr13/Wjfd5OnMDajug1UBdR3s= -cookie@0.4.1: - version "0.4.1" - resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.1.tgz#afd713fe26ebd21ba95ceb61f9a8116e50a537d1" - integrity sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA== - cosmiconfig@^7.0.0: version "7.0.0" resolved "https://registry.yarnpkg.com/cosmiconfig/-/cosmiconfig-7.0.0.tgz#ef9b44d773959cae63ddecd122de23853b60f8d3"