Showing
15 changed files
with
402 additions
and
63 deletions
... | @@ -14,10 +14,12 @@ | ... | @@ -14,10 +14,12 @@ |
14 | "axios": "^0.27.2", | 14 | "axios": "^0.27.2", |
15 | "body-parser": "^1.20.0", | 15 | "body-parser": "^1.20.0", |
16 | "cors": "^2.8.5", | 16 | "cors": "^2.8.5", |
17 | + "crypto-js": "^4.1.1", | ||
17 | "express": "^4.18.1", | 18 | "express": "^4.18.1", |
18 | "fs": "^0.0.1-security", | 19 | "fs": "^0.0.1-security", |
19 | "localforage": "^1.10.0", | 20 | "localforage": "^1.10.0", |
20 | "mysql": "^2.18.1", | 21 | "mysql": "^2.18.1", |
22 | + "mysql2": "^2.3.3", | ||
21 | "puppeteer": "^14.1.1", | 23 | "puppeteer": "^14.1.1", |
22 | "react": "^18.1.0", | 24 | "react": "^18.1.0", |
23 | "react-dom": "^18.1.0", | 25 | "react-dom": "^18.1.0", |
... | @@ -5627,6 +5629,11 @@ | ... | @@ -5627,6 +5629,11 @@ |
5627 | "node": ">= 8" | 5629 | "node": ">= 8" |
5628 | } | 5630 | } |
5629 | }, | 5631 | }, |
5632 | + "node_modules/crypto-js": { | ||
5633 | + "version": "4.1.1", | ||
5634 | + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", | ||
5635 | + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" | ||
5636 | + }, | ||
5630 | "node_modules/crypto-random-string": { | 5637 | "node_modules/crypto-random-string": { |
5631 | "version": "2.0.0", | 5638 | "version": "2.0.0", |
5632 | "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", | 5639 | "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", |
... | @@ -6154,6 +6161,14 @@ | ... | @@ -6154,6 +6161,14 @@ |
6154 | "node": ">=0.4.0" | 6161 | "node": ">=0.4.0" |
6155 | } | 6162 | } |
6156 | }, | 6163 | }, |
6164 | + "node_modules/denque": { | ||
6165 | + "version": "2.0.1", | ||
6166 | + "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", | ||
6167 | + "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==", | ||
6168 | + "engines": { | ||
6169 | + "node": ">=0.10" | ||
6170 | + } | ||
6171 | + }, | ||
6157 | "node_modules/depd": { | 6172 | "node_modules/depd": { |
6158 | "version": "2.0.0", | 6173 | "version": "2.0.0", |
6159 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", | 6174 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", |
... | @@ -7993,6 +8008,14 @@ | ... | @@ -7993,6 +8008,14 @@ |
7993 | "url": "https://github.com/sponsors/ljharb" | 8008 | "url": "https://github.com/sponsors/ljharb" |
7994 | } | 8009 | } |
7995 | }, | 8010 | }, |
8011 | + "node_modules/generate-function": { | ||
8012 | + "version": "2.3.1", | ||
8013 | + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", | ||
8014 | + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", | ||
8015 | + "dependencies": { | ||
8016 | + "is-property": "^1.0.2" | ||
8017 | + } | ||
8018 | + }, | ||
7996 | "node_modules/gensync": { | 8019 | "node_modules/gensync": { |
7997 | "version": "1.0.0-beta.2", | 8020 | "version": "1.0.0-beta.2", |
7998 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", | 8021 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", |
... | @@ -8847,6 +8870,11 @@ | ... | @@ -8847,6 +8870,11 @@ |
8847 | "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", | 8870 | "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", |
8848 | "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" | 8871 | "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" |
8849 | }, | 8872 | }, |
8873 | + "node_modules/is-property": { | ||
8874 | + "version": "1.0.2", | ||
8875 | + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", | ||
8876 | + "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==" | ||
8877 | + }, | ||
8850 | "node_modules/is-regex": { | 8878 | "node_modules/is-regex": { |
8851 | "version": "1.1.4", | 8879 | "version": "1.1.4", |
8852 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", | 8880 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", |
... | @@ -11305,6 +11333,11 @@ | ... | @@ -11305,6 +11333,11 @@ |
11305 | "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", | 11333 | "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", |
11306 | "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" | 11334 | "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" |
11307 | }, | 11335 | }, |
11336 | + "node_modules/long": { | ||
11337 | + "version": "4.0.0", | ||
11338 | + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", | ||
11339 | + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" | ||
11340 | + }, | ||
11308 | "node_modules/loose-envify": { | 11341 | "node_modules/loose-envify": { |
11309 | "version": "1.4.0", | 11342 | "version": "1.4.0", |
11310 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", | 11343 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", |
... | @@ -11646,6 +11679,57 @@ | ... | @@ -11646,6 +11679,57 @@ |
11646 | "safe-buffer": "~5.1.0" | 11679 | "safe-buffer": "~5.1.0" |
11647 | } | 11680 | } |
11648 | }, | 11681 | }, |
11682 | + "node_modules/mysql2": { | ||
11683 | + "version": "2.3.3", | ||
11684 | + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz", | ||
11685 | + "integrity": "sha512-wxJUev6LgMSgACDkb/InIFxDprRa6T95+VEoR+xPvtngtccNH2dGjEB/fVZ8yg1gWv1510c9CvXuJHi5zUm0ZA==", | ||
11686 | + "dependencies": { | ||
11687 | + "denque": "^2.0.1", | ||
11688 | + "generate-function": "^2.3.1", | ||
11689 | + "iconv-lite": "^0.6.3", | ||
11690 | + "long": "^4.0.0", | ||
11691 | + "lru-cache": "^6.0.0", | ||
11692 | + "named-placeholders": "^1.1.2", | ||
11693 | + "seq-queue": "^0.0.5", | ||
11694 | + "sqlstring": "^2.3.2" | ||
11695 | + }, | ||
11696 | + "engines": { | ||
11697 | + "node": ">= 8.0" | ||
11698 | + } | ||
11699 | + }, | ||
11700 | + "node_modules/mysql2/node_modules/sqlstring": { | ||
11701 | + "version": "2.3.3", | ||
11702 | + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", | ||
11703 | + "integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==", | ||
11704 | + "engines": { | ||
11705 | + "node": ">= 0.6" | ||
11706 | + } | ||
11707 | + }, | ||
11708 | + "node_modules/named-placeholders": { | ||
11709 | + "version": "1.1.2", | ||
11710 | + "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.2.tgz", | ||
11711 | + "integrity": "sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA==", | ||
11712 | + "dependencies": { | ||
11713 | + "lru-cache": "^4.1.3" | ||
11714 | + }, | ||
11715 | + "engines": { | ||
11716 | + "node": ">=6.0.0" | ||
11717 | + } | ||
11718 | + }, | ||
11719 | + "node_modules/named-placeholders/node_modules/lru-cache": { | ||
11720 | + "version": "4.1.5", | ||
11721 | + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", | ||
11722 | + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", | ||
11723 | + "dependencies": { | ||
11724 | + "pseudomap": "^1.0.2", | ||
11725 | + "yallist": "^2.1.2" | ||
11726 | + } | ||
11727 | + }, | ||
11728 | + "node_modules/named-placeholders/node_modules/yallist": { | ||
11729 | + "version": "2.1.2", | ||
11730 | + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", | ||
11731 | + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" | ||
11732 | + }, | ||
11649 | "node_modules/nanoid": { | 11733 | "node_modules/nanoid": { |
11650 | "version": "3.3.4", | 11734 | "version": "3.3.4", |
11651 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", | 11735 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", |
... | @@ -13507,6 +13591,11 @@ | ... | @@ -13507,6 +13591,11 @@ |
13507 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", | 13591 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", |
13508 | "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" | 13592 | "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" |
13509 | }, | 13593 | }, |
13594 | + "node_modules/pseudomap": { | ||
13595 | + "version": "1.0.2", | ||
13596 | + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", | ||
13597 | + "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" | ||
13598 | + }, | ||
13510 | "node_modules/psl": { | 13599 | "node_modules/psl": { |
13511 | "version": "1.8.0", | 13600 | "version": "1.8.0", |
13512 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", | 13601 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", |
... | @@ -14536,6 +14625,11 @@ | ... | @@ -14536,6 +14625,11 @@ |
14536 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", | 14625 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", |
14537 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" | 14626 | "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" |
14538 | }, | 14627 | }, |
14628 | + "node_modules/seq-queue": { | ||
14629 | + "version": "0.0.5", | ||
14630 | + "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", | ||
14631 | + "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=" | ||
14632 | + }, | ||
14539 | "node_modules/serialize-javascript": { | 14633 | "node_modules/serialize-javascript": { |
14540 | "version": "6.0.0", | 14634 | "version": "6.0.0", |
14541 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", | 14635 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", |
... | @@ -20713,6 +20807,11 @@ | ... | @@ -20713,6 +20807,11 @@ |
20713 | "which": "^2.0.1" | 20807 | "which": "^2.0.1" |
20714 | } | 20808 | } |
20715 | }, | 20809 | }, |
20810 | + "crypto-js": { | ||
20811 | + "version": "4.1.1", | ||
20812 | + "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.1.1.tgz", | ||
20813 | + "integrity": "sha512-o2JlM7ydqd3Qk9CA0L4NL6mTzU2sdx96a+oOfPu8Mkl/PK51vSyoi8/rQ8NknZtk44vq15lmhAj9CIAGwgeWKw==" | ||
20814 | + }, | ||
20716 | "crypto-random-string": { | 20815 | "crypto-random-string": { |
20717 | "version": "2.0.0", | 20816 | "version": "2.0.0", |
20718 | "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", | 20817 | "resolved": "https://registry.npmjs.org/crypto-random-string/-/crypto-random-string-2.0.0.tgz", |
... | @@ -21072,6 +21171,11 @@ | ... | @@ -21072,6 +21171,11 @@ |
21072 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", | 21171 | "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", |
21073 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" | 21172 | "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=" |
21074 | }, | 21173 | }, |
21174 | + "denque": { | ||
21175 | + "version": "2.0.1", | ||
21176 | + "resolved": "https://registry.npmjs.org/denque/-/denque-2.0.1.tgz", | ||
21177 | + "integrity": "sha512-tfiWc6BQLXNLpNiR5iGd0Ocu3P3VpxfzFiqubLgMfhfOw9WyvgJBd46CClNn9k3qfbjvT//0cf7AlYRX/OslMQ==" | ||
21178 | + }, | ||
21075 | "depd": { | 21179 | "depd": { |
21076 | "version": "2.0.0", | 21180 | "version": "2.0.0", |
21077 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", | 21181 | "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", |
... | @@ -22417,6 +22521,14 @@ | ... | @@ -22417,6 +22521,14 @@ |
22417 | "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", | 22521 | "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", |
22418 | "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==" | 22522 | "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==" |
22419 | }, | 22523 | }, |
22524 | + "generate-function": { | ||
22525 | + "version": "2.3.1", | ||
22526 | + "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", | ||
22527 | + "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", | ||
22528 | + "requires": { | ||
22529 | + "is-property": "^1.0.2" | ||
22530 | + } | ||
22531 | + }, | ||
22420 | "gensync": { | 22532 | "gensync": { |
22421 | "version": "1.0.0-beta.2", | 22533 | "version": "1.0.0-beta.2", |
22422 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", | 22534 | "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", |
... | @@ -23004,6 +23116,11 @@ | ... | @@ -23004,6 +23116,11 @@ |
23004 | "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", | 23116 | "resolved": "https://registry.npmjs.org/is-potential-custom-element-name/-/is-potential-custom-element-name-1.0.1.tgz", |
23005 | "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" | 23117 | "integrity": "sha512-bCYeRA2rVibKZd+s2625gGnGF/t7DSqDs4dP7CrLA1m7jKWz6pps0LpYLJN8Q64HtmPKJ1hrN3nzPNKFEKOUiQ==" |
23006 | }, | 23118 | }, |
23119 | + "is-property": { | ||
23120 | + "version": "1.0.2", | ||
23121 | + "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", | ||
23122 | + "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==" | ||
23123 | + }, | ||
23007 | "is-regex": { | 23124 | "is-regex": { |
23008 | "version": "1.1.4", | 23125 | "version": "1.1.4", |
23009 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", | 23126 | "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", |
... | @@ -24807,6 +24924,11 @@ | ... | @@ -24807,6 +24924,11 @@ |
24807 | "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", | 24924 | "resolved": "https://registry.npmjs.org/lodash.uniq/-/lodash.uniq-4.5.0.tgz", |
24808 | "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" | 24925 | "integrity": "sha1-0CJTc662Uq3BvILklFM5qEJ1R3M=" |
24809 | }, | 24926 | }, |
24927 | + "long": { | ||
24928 | + "version": "4.0.0", | ||
24929 | + "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", | ||
24930 | + "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" | ||
24931 | + }, | ||
24810 | "loose-envify": { | 24932 | "loose-envify": { |
24811 | "version": "1.4.0", | 24933 | "version": "1.4.0", |
24812 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", | 24934 | "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", |
... | @@ -25067,6 +25189,52 @@ | ... | @@ -25067,6 +25189,52 @@ |
25067 | } | 25189 | } |
25068 | } | 25190 | } |
25069 | }, | 25191 | }, |
25192 | + "mysql2": { | ||
25193 | + "version": "2.3.3", | ||
25194 | + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-2.3.3.tgz", | ||
25195 | + "integrity": "sha512-wxJUev6LgMSgACDkb/InIFxDprRa6T95+VEoR+xPvtngtccNH2dGjEB/fVZ8yg1gWv1510c9CvXuJHi5zUm0ZA==", | ||
25196 | + "requires": { | ||
25197 | + "denque": "^2.0.1", | ||
25198 | + "generate-function": "^2.3.1", | ||
25199 | + "iconv-lite": "^0.6.3", | ||
25200 | + "long": "^4.0.0", | ||
25201 | + "lru-cache": "^6.0.0", | ||
25202 | + "named-placeholders": "^1.1.2", | ||
25203 | + "seq-queue": "^0.0.5", | ||
25204 | + "sqlstring": "^2.3.2" | ||
25205 | + }, | ||
25206 | + "dependencies": { | ||
25207 | + "sqlstring": { | ||
25208 | + "version": "2.3.3", | ||
25209 | + "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", | ||
25210 | + "integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==" | ||
25211 | + } | ||
25212 | + } | ||
25213 | + }, | ||
25214 | + "named-placeholders": { | ||
25215 | + "version": "1.1.2", | ||
25216 | + "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.2.tgz", | ||
25217 | + "integrity": "sha512-wiFWqxoLL3PGVReSZpjLVxyJ1bRqe+KKJVbr4hGs1KWfTZTQyezHFBbuKj9hsizHyGV2ne7EMjHdxEGAybD5SA==", | ||
25218 | + "requires": { | ||
25219 | + "lru-cache": "^4.1.3" | ||
25220 | + }, | ||
25221 | + "dependencies": { | ||
25222 | + "lru-cache": { | ||
25223 | + "version": "4.1.5", | ||
25224 | + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.5.tgz", | ||
25225 | + "integrity": "sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==", | ||
25226 | + "requires": { | ||
25227 | + "pseudomap": "^1.0.2", | ||
25228 | + "yallist": "^2.1.2" | ||
25229 | + } | ||
25230 | + }, | ||
25231 | + "yallist": { | ||
25232 | + "version": "2.1.2", | ||
25233 | + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", | ||
25234 | + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=" | ||
25235 | + } | ||
25236 | + } | ||
25237 | + }, | ||
25070 | "nanoid": { | 25238 | "nanoid": { |
25071 | "version": "3.3.4", | 25239 | "version": "3.3.4", |
25072 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", | 25240 | "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.4.tgz", |
... | @@ -26271,6 +26439,11 @@ | ... | @@ -26271,6 +26439,11 @@ |
26271 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", | 26439 | "resolved": "https://registry.npmjs.org/proxy-from-env/-/proxy-from-env-1.1.0.tgz", |
26272 | "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" | 26440 | "integrity": "sha512-D+zkORCbA9f1tdWRK0RaCR3GPv50cMxcrz4X8k5LTSUD1Dkw47mKJEZQNunItRTkWwgtaUSo1RVFRIG9ZXiFYg==" |
26273 | }, | 26441 | }, |
26442 | + "pseudomap": { | ||
26443 | + "version": "1.0.2", | ||
26444 | + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", | ||
26445 | + "integrity": "sha512-b/YwNhb8lk1Zz2+bXXpS/LK9OisiZZ1SNsSLxN1x2OXVEhW2Ckr/7mWE5vrC1ZTiJlD9g19jWszTmJsB+oEpFQ==" | ||
26446 | + }, | ||
26274 | "psl": { | 26447 | "psl": { |
26275 | "version": "1.8.0", | 26448 | "version": "1.8.0", |
26276 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", | 26449 | "resolved": "https://registry.npmjs.org/psl/-/psl-1.8.0.tgz", |
... | @@ -27003,6 +27176,11 @@ | ... | @@ -27003,6 +27176,11 @@ |
27003 | } | 27176 | } |
27004 | } | 27177 | } |
27005 | }, | 27178 | }, |
27179 | + "seq-queue": { | ||
27180 | + "version": "0.0.5", | ||
27181 | + "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", | ||
27182 | + "integrity": "sha1-1WgS4cAXpuTnw+Ojeh2m143TyT4=" | ||
27183 | + }, | ||
27006 | "serialize-javascript": { | 27184 | "serialize-javascript": { |
27007 | "version": "6.0.0", | 27185 | "version": "6.0.0", |
27008 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", | 27186 | "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", | ... | ... |
... | @@ -9,10 +9,12 @@ | ... | @@ -9,10 +9,12 @@ |
9 | "axios": "^0.27.2", | 9 | "axios": "^0.27.2", |
10 | "body-parser": "^1.20.0", | 10 | "body-parser": "^1.20.0", |
11 | "cors": "^2.8.5", | 11 | "cors": "^2.8.5", |
12 | + "crypto-js": "^4.1.1", | ||
12 | "express": "^4.18.1", | 13 | "express": "^4.18.1", |
13 | "fs": "^0.0.1-security", | 14 | "fs": "^0.0.1-security", |
14 | "localforage": "^1.10.0", | 15 | "localforage": "^1.10.0", |
15 | "mysql": "^2.18.1", | 16 | "mysql": "^2.18.1", |
17 | + "mysql2": "^2.3.3", | ||
16 | "puppeteer": "^14.1.1", | 18 | "puppeteer": "^14.1.1", |
17 | "react": "^18.1.0", | 19 | "react": "^18.1.0", |
18 | "react-dom": "^18.1.0", | 20 | "react-dom": "^18.1.0", | ... | ... |
1 | const express = require("express"); | 1 | const express = require("express"); |
2 | -const mysql = require("mysql"); | 2 | +const mysql = require("mysql2/promise"); |
3 | const fs = require("fs"); | 3 | const fs = require("fs"); |
4 | const router = express.Router(); | 4 | const router = express.Router(); |
5 | 5 | ||
6 | -const [id, pw] = fs | 6 | +async function route() { |
7 | + const [id, pw] = fs | ||
7 | .readFileSync("server/libs/sql.pvdata", "utf8") | 8 | .readFileSync("server/libs/sql.pvdata", "utf8") |
8 | .split("\r\n"); | 9 | .split("\r\n"); |
9 | - | 10 | + const connection = await mysql.createConnection({ |
10 | -const connection = mysql.createConnection({ | ||
11 | host: "localhost", | 11 | host: "localhost", |
12 | user: id, | 12 | user: id, |
13 | password: pw, | 13 | password: pw, |
14 | - database: "mydb", | 14 | + database: "db", |
15 | -}); | 15 | + }); |
16 | - | 16 | + |
17 | -router.get("/", (req, res) => { | 17 | + // (userID, date) => schedules |
18 | - res.send("DB Root"); | 18 | + router.get("/schedules_date", async (req, res) => { |
19 | -}); | 19 | + console.log("/db/schedules_date"); |
20 | - | 20 | + try { |
21 | -router.get("/mytable", (req, res) => { | 21 | + const queryString = ` |
22 | - connection.query("SELECT * from mytable", (error, rows) => { | 22 | + SELECT sc.label, sc.type, sc.description, sc.url, sc.detail, sbj.name, us.color |
23 | - if (error) throw error; | 23 | + FROM schedules_date sc |
24 | - console.log(rows); | 24 | + INNER JOIN \`user-subject\` us |
25 | - res.send(rows); | 25 | + ON sc.userID = us.userID |
26 | + AND sc.subjectID = us.subjectID | ||
27 | + AND us.status = 1 | ||
28 | + INNER JOIN subjects sbj | ||
29 | + ON sc.subjectID = sbj.ID | ||
30 | + WHERE sc.date = "${req.query.date}" | ||
31 | + AND sc.userID = ${req.query.userID} | ||
32 | + AND sc.status = 1`; | ||
33 | + const [results] = await connection.query(queryString); | ||
34 | + res.send(results); | ||
35 | + } catch (e) { | ||
36 | + console.log(e); | ||
37 | + res.end(); | ||
38 | + } | ||
39 | + }); | ||
40 | + | ||
41 | + // (ID) => null | name //unused | ||
42 | + router.get("/subjects", async (req, res) => { | ||
43 | + console.log("/db/subjects"); | ||
44 | + try { | ||
45 | + const queryString = ` | ||
46 | + SELECT name FROM subjects sbj | ||
47 | + WHERE sbj.ID = ${req.query.ID}`; | ||
48 | + const [results] = await connection.query(queryString); | ||
49 | + res.send(results.length && results[0].name); | ||
50 | + } catch (e) { | ||
51 | + console.log(e); | ||
52 | + res.end(); | ||
53 | + } | ||
54 | + }); | ||
55 | + | ||
56 | + // (loginID) => null | ID(str) | ||
57 | + router.get("/users", async (req, res) => { | ||
58 | + console.log("/db/users"); | ||
59 | + try { | ||
60 | + const queryString = ` | ||
61 | + SELECT ID FROM users us | ||
62 | + WHERE us.loginID = '${req.query.loginID}'`; | ||
63 | + const [results] = await connection.query(queryString); | ||
64 | + res.send(results.length ? results[0].ID.toString() : null); | ||
65 | + } catch (e) { | ||
66 | + console.log(e); | ||
67 | + res.end(); | ||
68 | + } | ||
26 | }); | 69 | }); |
27 | -}); | 70 | + |
71 | + // (loginID, loginPW) => null | "correct" | ||
72 | + router.get("/users/check", async (req, res) => { | ||
73 | + console.log("/db/users/check"); | ||
74 | + try { | ||
75 | + const queryString = ` | ||
76 | + SELECT loginPW FROM users us | ||
77 | + WHERE us.loginID = '${req.query.loginID}'`; | ||
78 | + const [results] = await connection.query(queryString); | ||
79 | + res.send(results[0].loginPW === req.query.loginPW ? "correct" : null); | ||
80 | + } catch (e) { | ||
81 | + console.log(e); | ||
82 | + res.end(); | ||
83 | + } | ||
84 | + }); | ||
85 | + | ||
86 | + // (userID) => subjects | ||
87 | + router.get("/user-subject", async (req, res) => { | ||
88 | + console.log("/db/user-subject"); | ||
89 | + try { | ||
90 | + const queryString = ` | ||
91 | + SELECT subjectID, nickname, status, color FROM \`user-subject\` us | ||
92 | + WHERE us.userID = ${req.query.userID}`; | ||
93 | + const [results] = await connection.query(queryString); | ||
94 | + res.send(results); | ||
95 | + } catch (e) { | ||
96 | + console.log(e); | ||
97 | + res.end(); | ||
98 | + } | ||
99 | + }); | ||
100 | + | ||
101 | + router.get("*", (req, res) => { | ||
102 | + console.log("/db/*"); | ||
103 | + res.end(); | ||
104 | + }); | ||
105 | +} | ||
106 | + | ||
107 | +route(); | ||
28 | 108 | ||
29 | module.exports = router; | 109 | module.exports = router; | ... | ... |
... | @@ -15,8 +15,10 @@ app.use( | ... | @@ -15,8 +15,10 @@ app.use( |
15 | credentials: true, | 15 | credentials: true, |
16 | }) | 16 | }) |
17 | ); | 17 | ); |
18 | -app.use(bodyParser.urlencoded({ extended: false })); | 18 | +// app.use(bodyParser.urlencoded({ extended: false })); |
19 | -app.use(bodyParser.json()); | 19 | +// app.use(bodyParser.json()); |
20 | +app.use(express.json()); | ||
21 | +app.use(express.urlencoded({ extended: true })); | ||
20 | 22 | ||
21 | app.post("/", (req, res) => { | 23 | app.post("/", (req, res) => { |
22 | res.send({ body: req.body }); | 24 | res.send({ body: req.body }); | ... | ... |
1 | import { useContext, useEffect, useState } from "react"; | 1 | import { useContext, useEffect, useState } from "react"; |
2 | +import localforage from "localforage"; | ||
2 | 3 | ||
3 | import { toYMD, toYMDStr } from "../utils/Dates"; | 4 | import { toYMD, toYMDStr } from "../utils/Dates"; |
4 | import { scheForage } from "../utils/LocalForage"; | 5 | import { scheForage } from "../utils/LocalForage"; |
5 | 6 | ||
6 | import { CalendarStateContext } from "../pages/Calendar"; | 7 | import { CalendarStateContext } from "../pages/Calendar"; |
7 | import ScheduleItem from "./ScheduleItem"; | 8 | import ScheduleItem from "./ScheduleItem"; |
9 | +import axios from "axios"; | ||
8 | 10 | ||
9 | const GridItem = ({ targetDate }) => { | 11 | const GridItem = ({ targetDate }) => { |
10 | const { state } = useContext(CalendarStateContext); | 12 | const { state } = useContext(CalendarStateContext); |
... | @@ -14,7 +16,14 @@ const GridItem = ({ targetDate }) => { | ... | @@ -14,7 +16,14 @@ const GridItem = ({ targetDate }) => { |
14 | 16 | ||
15 | useEffect(() => { | 17 | useEffect(() => { |
16 | async function loadScheduleItems() { | 18 | async function loadScheduleItems() { |
17 | - setSchedules(await scheForage.getItem(toYMDStr(targetDate))); | 19 | + const userID = await localforage.getItem("userID"); |
20 | + const res = await axios.get("http://localhost:3001/db/schedules_date", { | ||
21 | + params: { | ||
22 | + userID, | ||
23 | + date: toYMDStr(targetDate, "-"), | ||
24 | + }, | ||
25 | + }); | ||
26 | + setSchedules(res.data); | ||
18 | } | 27 | } |
19 | loadScheduleItems(); | 28 | loadScheduleItems(); |
20 | }, [targetDate]); | 29 | }, [targetDate]); | ... | ... |
1 | +import localforage from "localforage"; | ||
1 | import { useContext } from "react"; | 2 | import { useContext } from "react"; |
2 | import { useNavigate } from "react-router-dom"; | 3 | import { useNavigate } from "react-router-dom"; |
3 | 4 | ||
4 | import { CalendarStateContext } from "../pages/Calendar"; | 5 | import { CalendarStateContext } from "../pages/Calendar"; |
5 | import "../styles/Header.css"; | 6 | import "../styles/Header.css"; |
6 | import { moveDate, toYMD } from "../utils/Dates"; | 7 | import { moveDate, toYMD } from "../utils/Dates"; |
7 | -import { dataForage } from "../utils/LocalForage"; | ||
8 | 8 | ||
9 | const Header = () => { | 9 | const Header = () => { |
10 | const { state, setState } = useContext(CalendarStateContext); | 10 | const { state, setState } = useContext(CalendarStateContext); |
... | @@ -93,7 +93,7 @@ const Header = () => { | ... | @@ -93,7 +93,7 @@ const Header = () => { |
93 | <button | 93 | <button |
94 | className="hrb_r" | 94 | className="hrb_r" |
95 | onClick={async () => { | 95 | onClick={async () => { |
96 | - await dataForage.setItem("session", ""); | 96 | + await localforage.setItem("session", null); |
97 | navigate("/"); | 97 | navigate("/"); |
98 | }} | 98 | }} |
99 | > | 99 | > | ... | ... |
... | @@ -5,14 +5,17 @@ import zoomSymbol from "../assets/zoom.png"; | ... | @@ -5,14 +5,17 @@ import zoomSymbol from "../assets/zoom.png"; |
5 | import ecampusSymbol from "../assets/e-Campus.png"; | 5 | import ecampusSymbol from "../assets/e-Campus.png"; |
6 | 6 | ||
7 | const ScheduleItem = ({ schedule }) => { | 7 | const ScheduleItem = ({ schedule }) => { |
8 | - const { subCode, type, category, label, start, end } = schedule; | 8 | + const { |
9 | - const { subsObj } = useContext(CalendarStateContext); | 9 | + name: subjectName, |
10 | - const subject = subsObj[subCode]; | 10 | + color: subjectColor, |
11 | - if (!subject) { | 11 | + type, |
12 | - console.log("can't find " + subCode); | 12 | + label, |
13 | - return; | 13 | + description, |
14 | - } | 14 | + url, |
15 | - if (!subject.selected) return; | 15 | + detail, |
16 | + startTime = null, | ||
17 | + endTime = null, | ||
18 | + } = schedule; | ||
16 | 19 | ||
17 | const selectSymbol = () => { | 20 | const selectSymbol = () => { |
18 | let symbol; | 21 | let symbol; |
... | @@ -20,7 +23,7 @@ const ScheduleItem = ({ schedule }) => { | ... | @@ -20,7 +23,7 @@ const ScheduleItem = ({ schedule }) => { |
20 | case "zoom": | 23 | case "zoom": |
21 | symbol = zoomSymbol; | 24 | symbol = zoomSymbol; |
22 | break; | 25 | break; |
23 | - case "ecampus": | 26 | + case "assignment": |
24 | symbol = ecampusSymbol; | 27 | symbol = ecampusSymbol; |
25 | break; | 28 | break; |
26 | default: | 29 | default: |
... | @@ -29,11 +32,15 @@ const ScheduleItem = ({ schedule }) => { | ... | @@ -29,11 +32,15 @@ const ScheduleItem = ({ schedule }) => { |
29 | }; | 32 | }; |
30 | 33 | ||
31 | return ( | 34 | return ( |
32 | - <div className="ScheduleItem" style={{ borderColor: subject.color }}> | 35 | + <div className="ScheduleItem" style={{ borderColor: subjectColor }}> |
33 | <img className="s_symbol" src={selectSymbol()} alt="404" /> | 36 | <img className="s_symbol" src={selectSymbol()} alt="404" /> |
34 | - {start && <span className="s_start">{start[0] + ":" + start[1]}</span>} | 37 | + {startTime && ( |
35 | - {end && <span className="s_end">{end[0] + ":" + end[1]}</span>} | 38 | + <span className="s_start">{startTime[0] + ":" + startTime[1]}</span> |
36 | - <span className="s_category">{category}</span> | 39 | + )} |
40 | + {endTime && ( | ||
41 | + <span className="s_end">{endTime[0] + ":" + endTime[1]}</span> | ||
42 | + )} | ||
43 | + {/* <span className="s_category">{subjectName}</span> */} | ||
37 | <span className="s_slabel">{label}</span> | 44 | <span className="s_slabel">{label}</span> |
38 | </div> | 45 | </div> |
39 | ); | 46 | ); | ... | ... |
1 | import React, { useEffect, useReducer, useState } from "react"; | 1 | import React, { useEffect, useReducer, useState } from "react"; |
2 | import { useNavigate, Route, Routes } from "react-router-dom"; | 2 | import { useNavigate, Route, Routes } from "react-router-dom"; |
3 | 3 | ||
4 | -import { initTempSubjects } from "../utils/Test"; | 4 | +import { subForage } from "../utils/LocalForage"; |
5 | -import { dataForage, subForage } from "../utils/LocalForage"; | ||
6 | 5 | ||
7 | import Month from "../components/Month"; | 6 | import Month from "../components/Month"; |
8 | import Header from "../components/Header"; | 7 | import Header from "../components/Header"; |
9 | import Side from "../components/Side"; | 8 | import Side from "../components/Side"; |
9 | +import localforage from "localforage"; | ||
10 | +import axios from "axios"; | ||
10 | 11 | ||
11 | export const CalendarStateContext = React.createContext(); | 12 | export const CalendarStateContext = React.createContext(); |
12 | 13 | ||
... | @@ -36,12 +37,17 @@ const Calendar = () => { | ... | @@ -36,12 +37,17 @@ const Calendar = () => { |
36 | const navigate = useNavigate(); | 37 | const navigate = useNavigate(); |
37 | useEffect(() => { | 38 | useEffect(() => { |
38 | async function onMount() { | 39 | async function onMount() { |
39 | - if (!(await dataForage.getItem("session"))) return navigate("/login"); | 40 | + if (!(await localforage.getItem("session"))) return navigate("/login"); |
40 | - | 41 | + // get user's subjects |
41 | - if (!(await dataForage.getItem("Subjects"))) await initTempSubjects(); | 42 | + const userID = await localforage.getItem("userID"); |
43 | + const subjects = await axios.get( | ||
44 | + "http://localhost:3001/db/user-subject", | ||
45 | + { params: { userID } } | ||
46 | + ).data; | ||
47 | + console.log(subjects); | ||
42 | let tsubsObj = {}; | 48 | let tsubsObj = {}; |
43 | - for (const code of await dataForage.getItem("Subjects")) { | 49 | + for (const sub of subjects) { |
44 | - tsubsObj[code] = await subForage.getItem(code); | 50 | + tsubsObj[sub.subjectID] = sub; |
45 | } | 51 | } |
46 | dispatch({ type: "INIT", subsObj: tsubsObj }); | 52 | dispatch({ type: "INIT", subsObj: tsubsObj }); |
47 | } | 53 | } | ... | ... |
1 | +import localforage from "localforage"; | ||
1 | import { useEffect } from "react"; | 2 | import { useEffect } from "react"; |
2 | import { useNavigate } from "react-router-dom"; | 3 | import { useNavigate } from "react-router-dom"; |
3 | 4 | ||
4 | -import { dataForage } from "../utils/LocalForage"; | ||
5 | - | ||
6 | const Home = () => { | 5 | const Home = () => { |
7 | console.log("visit Home"); | 6 | console.log("visit Home"); |
8 | 7 | ||
... | @@ -10,7 +9,7 @@ const Home = () => { | ... | @@ -10,7 +9,7 @@ const Home = () => { |
10 | useEffect(() => { | 9 | useEffect(() => { |
11 | async function where() { | 10 | async function where() { |
12 | let destination; | 11 | let destination; |
13 | - if (await dataForage.getItem("session")) { | 12 | + if (await localforage.getItem("session")) { |
14 | destination = "/calendar/month"; | 13 | destination = "/calendar/month"; |
15 | } else { | 14 | } else { |
16 | destination = "/login"; | 15 | destination = "/login"; | ... | ... |
1 | import { useEffect, useState } from "react"; | 1 | import { useEffect, useState } from "react"; |
2 | import { useNavigate } from "react-router-dom"; | 2 | import { useNavigate } from "react-router-dom"; |
3 | +import localforage from "localforage"; | ||
3 | 4 | ||
4 | -import { dataForage } from "../utils/LocalForage"; | ||
5 | import "../styles/Login.css"; | 5 | import "../styles/Login.css"; |
6 | import axios from "axios"; | 6 | import axios from "axios"; |
7 | +import cryptoJs from "crypto-js"; | ||
7 | 8 | ||
8 | const Login = () => { | 9 | const Login = () => { |
9 | console.log("visit Login"); | 10 | console.log("visit Login"); |
10 | const [state, setState] = useState({ | 11 | const [state, setState] = useState({ |
11 | id: "", | 12 | id: "", |
12 | pw: "", | 13 | pw: "", |
14 | + btn: "Login", | ||
13 | }); | 15 | }); |
14 | 16 | ||
15 | const handleChangeState = (e) => { | 17 | const handleChangeState = (e) => { |
... | @@ -21,21 +23,57 @@ const Login = () => { | ... | @@ -21,21 +23,57 @@ const Login = () => { |
21 | 23 | ||
22 | const navigate = useNavigate(); | 24 | const navigate = useNavigate(); |
23 | const login = async () => { | 25 | const login = async () => { |
24 | - const res = await axios.post("http://localhost:3001/login/", { | 26 | + setState({ ...state, btn: "Login..." }); |
25 | - id: state.id, | 27 | + const { data: userDBID } = await axios.get( |
26 | - pw: state.pw, | 28 | + "http://localhost:3001/db/users", |
27 | - }); | 29 | + { |
30 | + params: { | ||
31 | + loginID: state.id, | ||
32 | + }, | ||
33 | + } | ||
34 | + ); | ||
28 | 35 | ||
29 | - if (res.data === "login failed") alert("ID/PW를 확인해주세요"); | 36 | + if (userDBID) { |
37 | + //pass crawling | ||
38 | + const hashpw = cryptoJs.SHA256(state.pw).toString(); | ||
39 | + const { data: isCorrectPW } = await axios.get( | ||
40 | + "http://localhost:3001/db/users/check", | ||
41 | + { | ||
42 | + params: { loginID: state.id, loginPW: hashpw }, | ||
43 | + } | ||
44 | + ); | ||
45 | + if (isCorrectPW) await localforage.setItem("userID", Number(userDBID)); | ||
30 | else { | 46 | else { |
31 | - await dataForage.setItem("session", true); | 47 | + setState({ ...state, btn: "Login" }); |
32 | - navigate("/"); | 48 | + alert("ID/PW를 확인해주세요"); |
49 | + return; | ||
33 | } | 50 | } |
51 | + } else { | ||
52 | + //crawling | ||
53 | + const { data: loginResult } = await axios.post( | ||
54 | + "http://localhost:3001/login/", | ||
55 | + { | ||
56 | + id: state.id, | ||
57 | + pw: state.pw, | ||
58 | + } | ||
59 | + ); | ||
60 | + if (loginResult === "login failed") { | ||
61 | + setState({ ...state, btn: "Login" }); | ||
62 | + alert("ID/PW를 확인해주세요"); | ||
63 | + return; | ||
64 | + } | ||
65 | + // + else (성공시) localforage에 userID추가 | ||
66 | + } | ||
67 | + // + localforage에 id pw 추가 | ||
68 | + await localforage.setItem("id", state.id); | ||
69 | + await localforage.setItem("pw", state.pw); | ||
70 | + await localforage.setItem("session", true); | ||
71 | + navigate("/"); | ||
34 | }; | 72 | }; |
35 | 73 | ||
36 | useEffect(() => { | 74 | useEffect(() => { |
37 | async function ifAlreadyLogined() { | 75 | async function ifAlreadyLogined() { |
38 | - if (await dataForage.getItem("session")) navigate("/"); | 76 | + if (await localforage.getItem("session")) navigate("/"); |
39 | } | 77 | } |
40 | ifAlreadyLogined(); | 78 | ifAlreadyLogined(); |
41 | }, [navigate]); | 79 | }, [navigate]); |
... | @@ -61,7 +99,7 @@ const Login = () => { | ... | @@ -61,7 +99,7 @@ const Login = () => { |
61 | type="password" | 99 | type="password" |
62 | /> | 100 | /> |
63 | </div> | 101 | </div> |
64 | - <button onClick={login}>Login</button> | 102 | + <button onClick={login}>{state.btn}</button> |
65 | </div> | 103 | </div> |
66 | ); | 104 | ); |
67 | }; | 105 | }; | ... | ... |
1 | +import localforage from "localforage"; | ||
1 | import { Navigate, useNavigate } from "react-router-dom"; | 2 | import { Navigate, useNavigate } from "react-router-dom"; |
2 | 3 | ||
3 | import "../styles/Settings.css"; | 4 | import "../styles/Settings.css"; |
4 | -import { dataForage } from "../utils/LocalForage"; | ||
5 | 5 | ||
6 | const Settings = () => { | 6 | const Settings = () => { |
7 | console.log("visit Settings"); | 7 | console.log("visit Settings"); |
8 | 8 | ||
9 | - const session = dataForage.getItem("session"); | 9 | + const session = localforage.getItem("session"); |
10 | 10 | ||
11 | const navigate = useNavigate(); | 11 | const navigate = useNavigate(); |
12 | 12 | ... | ... |
... | @@ -6,12 +6,12 @@ function toYMD(dateObj) { | ... | @@ -6,12 +6,12 @@ function toYMD(dateObj) { |
6 | return { year, month, date }; | 6 | return { year, month, date }; |
7 | } | 7 | } |
8 | 8 | ||
9 | -function toYMDStr(dateObj) { | 9 | +function toYMDStr(dateObj, joint) { |
10 | return [ | 10 | return [ |
11 | dateObj.getFullYear(), | 11 | dateObj.getFullYear(), |
12 | dateObj.getMonth() + 1, | 12 | dateObj.getMonth() + 1, |
13 | dateObj.getDate(), | 13 | dateObj.getDate(), |
14 | - ].join("/"); | 14 | + ].join(joint); |
15 | } | 15 | } |
16 | 16 | ||
17 | function toSunday(dateObj) { | 17 | function toSunday(dateObj) { | ... | ... |
src/utils/Encrypt.js
0 → 100644
1 | +const CryptoJS = require("crypto-js"); | ||
2 | + | ||
3 | +function createHashed(str) { | ||
4 | + var hash = CryptoJS.SHA256(str); | ||
5 | + console.log("암호화된 값 : " + hash); | ||
6 | + | ||
7 | + // base64 | ||
8 | + // var key = CryptoJS.enc.Utf8.parse(str); | ||
9 | + // var base64 = CryptoJS.enc.Base64.stringify(key); //encoded | ||
10 | + // var decrypt = CryptoJS.enc.Base64.parse(base64); | ||
11 | + // var hashData = decrypt.toString(CryptoJS.enc.Utf8); //decoded | ||
12 | +} | ||
13 | + | ||
14 | +createHashed("Happy2468!"); | ||
15 | + | ||
16 | +module.exports = createHashed; |
... | @@ -19,9 +19,9 @@ async function initTempSubjects() { | ... | @@ -19,9 +19,9 @@ async function initTempSubjects() { |
19 | }, | 19 | }, |
20 | ]; | 20 | ]; |
21 | 21 | ||
22 | - await scheForage.setItem(toYMDStr(new Date("2022-5-20")), tempsch); | 22 | + await scheForage.setItem(toYMDStr(new Date("2022-5-20"), "/"), tempsch); |
23 | - await scheForage.setItem(toYMDStr(new Date("2022-5-27")), tempsch); | 23 | + await scheForage.setItem(toYMDStr(new Date("2022-5-27"), "/"), tempsch); |
24 | - await scheForage.setItem(toYMDStr(new Date("2022-6-3")), tempsch); | 24 | + await scheForage.setItem(toYMDStr(new Date("2022-6-3"), "/"), tempsch); |
25 | 25 | ||
26 | let tcolors = [ | 26 | let tcolors = [ |
27 | "red", | 27 | "red", | ... | ... |
-
Please register or login to post a comment