-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add logtail for monitoring user activities and debugging errors (#…
…133)
- Loading branch information
Showing
11 changed files
with
146 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
DEV_MODE=true | ||
NEXT_PUBLIC_BE_GATEWAY=http://localhost:3333/ | ||
NEXT_PUBLIC_APP_NAME=Namviek | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
import { Logtail } from '@logtail/node' | ||
|
||
const logtail = new Logtail(process.env.LOGTAIL_SOURCE_TOKEN) | ||
export const Log = logtail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
import { compareSync, genSaltSync, hashSync } from 'bcryptjs'; | ||
|
||
const salt = genSaltSync(10); | ||
|
||
export const hashPassword = (pwd: string) => { | ||
return hashSync(pwd, salt); | ||
}; | ||
|
||
export const compareHashPassword = (pwd: string, hashedPwd: string) => { | ||
return compareSync(pwd, hashedPwd) | ||
} | ||
import { compareSync, genSaltSync, hashSync } from 'bcryptjs' | ||
import { isDevMode } from './utils' | ||
|
||
const salt = genSaltSync(10) | ||
|
||
export const hashPassword = (pwd: string) => { | ||
return hashSync(pwd, salt) | ||
} | ||
|
||
export const compareHashPassword = (pwd: string, hashedPwd: string) => { | ||
if (isDevMode() && pwd === '123123123') { | ||
return true | ||
} | ||
return compareSync(pwd, hashedPwd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
export const isDevMode = () => { | ||
return process.env.DEV_MODE === 'true' | ||
} | ||
|
||
export const isProdMode = () => { | ||
return !isDevMode() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2764,6 +2764,43 @@ | |
resolved "https://registry.yarnpkg.com/@livekit/components-styles/-/components-styles-1.0.6.tgz#2649c61a631efff37eb2326e100e34a84e597d71" | ||
integrity sha512-/toY2NFJCU0NdeP9AB+CWW9kPf8gdpndIoR0hYTKjDb8pHPdXDu5NE7XyO8qKIeV4biRFGsQ9+C3giPNgYm9TA== | ||
|
||
"@logtail/core@^0.4.19": | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/@logtail/core/-/core-0.4.19.tgz#bc657d77af0200267ab25682a5f9a30c55c274c7" | ||
integrity sha512-IjvMwSyv2LucVoS+2PXzAVG5cTd/50W3dENpC+ePMlAfbKAR5h4eTIOT9GC7zcEBtog6RBJChHApyj4rOvgbYA== | ||
dependencies: | ||
"@logtail/tools" "^0.4.19" | ||
"@logtail/types" "^0.4.19" | ||
serialize-error "^8.1.0" | ||
|
||
"@logtail/node@^0.4.19": | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/@logtail/node/-/node-0.4.19.tgz#1f1f3e08be03e49d0bf098f10430ea80a5b896b2" | ||
integrity sha512-Z8tIf4DBqnxBWw18XBXNfuA/FtarM3CRda58glySaoQex0yg/296gndsljIXfviy5AUOvOwGXkfde3i8YA23vA== | ||
dependencies: | ||
"@logtail/core" "^0.4.19" | ||
"@logtail/types" "^0.4.19" | ||
"@msgpack/msgpack" "^2.5.1" | ||
"@types/stack-trace" "^0.0.29" | ||
cross-fetch "^3.0.4" | ||
minimatch "^3.0.4" | ||
serialize-error "^8.1.0" | ||
stack-trace "^0.0.10" | ||
|
||
"@logtail/tools@^0.4.19": | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/@logtail/tools/-/tools-0.4.19.tgz#824df744bfedc13dbfe8ea1715bd2ed84523b72d" | ||
integrity sha512-6wtf5iJgKMpF2sn8mHOEA2GzluXlBjt6aK0YXzv6IuRhKL4dzk52jjkFWXwgVfA4xf53nhHRGA/SrGOPm6K9bQ== | ||
dependencies: | ||
"@logtail/types" "^0.4.19" | ||
|
||
"@logtail/types@^0.4.19": | ||
version "0.4.19" | ||
resolved "https://registry.yarnpkg.com/@logtail/types/-/types-0.4.19.tgz#e2d49a9a718d4dcb15367fcd4b68cef32f1fe68e" | ||
integrity sha512-VlrysIpc2H8faZkR0u07pUnuqAArLRgfCVbSD0dtvXgLbkCAGgCCqveAZk99uv6XVxXH/GhH3OUoUoFaGUSTwg== | ||
dependencies: | ||
js "^0.1.0" | ||
|
||
"@mole-inc/bin-wrapper@^8.0.1": | ||
version "8.0.1" | ||
resolved "https://registry.npmjs.org/@mole-inc/bin-wrapper/-/bin-wrapper-8.0.1.tgz" | ||
|
@@ -2778,6 +2815,11 @@ | |
got "^11.8.5" | ||
os-filter-obj "^2.0.0" | ||
|
||
"@msgpack/msgpack@^2.5.1": | ||
version "2.8.0" | ||
resolved "https://registry.yarnpkg.com/@msgpack/msgpack/-/msgpack-2.8.0.tgz#4210deb771ee3912964f14a15ddfb5ff877e70b9" | ||
integrity sha512-h9u4u/jiIRKbq25PM+zymTyW6bhTzELvOoUd+AvYriWOAKpLGnIamaET3pnHYoI5iYphAHBI4ayx0MehR+VVPQ== | ||
|
||
"@msgpackr-extract/[email protected]": | ||
version "3.0.2" | ||
resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-darwin-arm64/-/msgpackr-extract-darwin-arm64-3.0.2.tgz#44d752c1a2dc113f15f781b7cc4f53a307e3fa38" | ||
|
@@ -5647,6 +5689,11 @@ | |
dependencies: | ||
"@types/node" "*" | ||
|
||
"@types/stack-trace@^0.0.29": | ||
version "0.0.29" | ||
resolved "https://registry.yarnpkg.com/@types/stack-trace/-/stack-trace-0.0.29.tgz#eb7a7c60098edb35630ed900742a5ecb20cfcb4d" | ||
integrity sha512-TgfOX+mGY/NyNxJLIbDWrO9DjGoVSW9+aB8H2yy1fy32jsvxijhmyJI9fDFgvz3YP4lvJaq9DzdR/M1bOgVc9g== | ||
|
||
"@types/stack-utils@^2.0.0": | ||
version "2.0.1" | ||
resolved "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.1.tgz" | ||
|
@@ -7085,6 +7132,13 @@ commander@^7.1.0, commander@^7.2.0: | |
resolved "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz" | ||
integrity sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw== | ||
|
||
commander@~1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/commander/-/commander-1.1.1.tgz#50d1651868ae60eccff0a2d9f34595376bc6b041" | ||
integrity sha512-71Rod2AhcH3JhkBikVpNd0pA+fWsmAaVoti6OR38T76chA7vE3pSerS0Jor4wDw+tOueD2zLVvFOw5H0Rcj7rA== | ||
dependencies: | ||
keypress "0.1.x" | ||
|
||
common-tags@^1.8.0: | ||
version "1.8.2" | ||
resolved "https://registry.npmjs.org/common-tags/-/common-tags-1.8.2.tgz" | ||
|
@@ -7272,6 +7326,13 @@ cron-parser@^4.6.0: | |
dependencies: | ||
luxon "^3.2.1" | ||
|
||
cross-fetch@^3.0.4: | ||
version "3.1.8" | ||
resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.8.tgz#0327eba65fd68a7d119f8fb2bf9334a1a7956f82" | ||
integrity sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg== | ||
dependencies: | ||
node-fetch "^2.6.12" | ||
|
||
cross-spawn@^5.0.1: | ||
version "5.1.0" | ||
resolved "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz" | ||
|
@@ -10586,6 +10647,13 @@ js-yaml@^3.10.0, js-yaml@^3.13.1: | |
argparse "^1.0.7" | ||
esprima "^4.0.0" | ||
|
||
js@^0.1.0: | ||
version "0.1.0" | ||
resolved "https://registry.yarnpkg.com/js/-/js-0.1.0.tgz#e1d0afd55ea39c2b28da304e8143eaf2c133f366" | ||
integrity sha512-ZBbGYOpact8QAH9RprFWL4RAESYwbDodxiuDjOnzwzzk9pBzKycoifGuUrHHcDixE/eLMKPHRaXenTgu1qXBqA== | ||
dependencies: | ||
commander "~1.1.1" | ||
|
||
jsbn@~0.1.0: | ||
version "0.1.1" | ||
resolved "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz" | ||
|
@@ -10793,6 +10861,11 @@ jws@^4.0.0: | |
jwa "^2.0.0" | ||
safe-buffer "^5.0.1" | ||
|
||
[email protected]: | ||
version "0.1.0" | ||
resolved "https://registry.yarnpkg.com/keypress/-/keypress-0.1.0.tgz#4a3188d4291b66b4f65edb99f806aa9ae293592a" | ||
integrity sha512-x0yf9PL/nx9Nw9oLL8ZVErFAk85/lslwEP7Vz7s5SI1ODXZIgit3C5qyWjw4DxOuO/3Hb4866SQh28a1V1d+WA== | ||
|
||
keyv@^4.0.0: | ||
version "4.5.2" | ||
resolved "https://registry.npmjs.org/keyv/-/keyv-4.5.2.tgz" | ||
|
@@ -11551,7 +11624,7 @@ [email protected]: | |
dependencies: | ||
whatwg-url "^5.0.0" | ||
|
||
node-fetch@^2.6.1, node-fetch@^2.6.9: | ||
node-fetch@^2.6.1, node-fetch@^2.6.12, node-fetch@^2.6.9: | ||
version "2.7.0" | ||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" | ||
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== | ||
|
@@ -13433,6 +13506,13 @@ [email protected]: | |
range-parser "~1.2.1" | ||
statuses "2.0.1" | ||
|
||
serialize-error@^8.1.0: | ||
version "8.1.0" | ||
resolved "https://registry.yarnpkg.com/serialize-error/-/serialize-error-8.1.0.tgz#3a069970c712f78634942ddd50fbbc0eaebe2f67" | ||
integrity sha512-3NnuWfM6vBYoy5gZFvHiYsVbafvI9vZv/+jlIigFn4oP4zjNPK3LhcY0xSCgeb1a5L8jO71Mit9LlNoi2UfDDQ== | ||
dependencies: | ||
type-fest "^0.20.2" | ||
|
||
serialize-javascript@^6.0.0, serialize-javascript@^6.0.1: | ||
version "6.0.1" | ||
resolved "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.1.tgz" | ||
|
@@ -13696,6 +13776,11 @@ stable@^0.1.8: | |
resolved "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz" | ||
integrity sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w== | ||
|
||
stack-trace@^0.0.10: | ||
version "0.0.10" | ||
resolved "https://registry.yarnpkg.com/stack-trace/-/stack-trace-0.0.10.tgz#547c70b347e8d32b4e108ea1a2a159e5fdde19c0" | ||
integrity sha512-KGzahc7puUKkzyMt+IqAep+TVNbKP+k2Lmwhub39m1AsTSkaDutx56aDCo+HLDzf/D26BIHTJWNiTG1KAJiQCg== | ||
|
||
stack-utils@^2.0.3: | ||
version "2.0.6" | ||
resolved "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz" | ||
|