Showing
4 changed files
with
69 additions
and
31 deletions
... | @@ -11,12 +11,12 @@ app.use(bodyParser.urlencoded({ | ... | @@ -11,12 +11,12 @@ app.use(bodyParser.urlencoded({ |
11 | 11 | ||
12 | app.use('/api', apiRouter); | 12 | app.use('/api', apiRouter); |
13 | 13 | ||
14 | -// NAVER SEARCH API | ||
15 | -const CLIENT_ID = 'fhcqiYQacNyJGILdJBzL'; | ||
16 | -const CLIENT_SECRET = 'dmxhW0M_NA'; | ||
17 | - | ||
18 | let userDB = new Array(); | 14 | let userDB = new Array(); |
19 | 15 | ||
16 | +require('dotenv').config(); | ||
17 | +const KAKAO_KEY = process.env.KAKAO_KEY; | ||
18 | +const CLIENT_ID = process.env.CLIENT_ID; | ||
19 | +const CLIENT_SECRET = process.env.CLIENT_SECRET; | ||
20 | 20 | ||
21 | const mbtiDB= new Array(); | 21 | const mbtiDB= new Array(); |
22 | mbtiDB[0] = ['ISTP', 'https://ifh.cc/g/ac3LWB.jpg']; | 22 | mbtiDB[0] = ['ISTP', 'https://ifh.cc/g/ac3LWB.jpg']; |
... | @@ -893,26 +893,23 @@ apiRouter.post('/result', (req, res) => { | ... | @@ -893,26 +893,23 @@ apiRouter.post('/result', (req, res) => { |
893 | "basicCard": { | 893 | "basicCard": { |
894 | "title": "당신의 MBTI는 : "+userDB[userId][4], | 894 | "title": "당신의 MBTI는 : "+userDB[userId][4], |
895 | "thumbnail": { | 895 | "thumbnail": { |
896 | - "imageUrl": imageurl | 896 | + "imageUrl": imageurl, |
897 | + "fixedRatio": true, | ||
898 | + "height": 100, | ||
899 | + "width": 100 | ||
897 | }, | 900 | }, |
898 | "buttons": [ | 901 | "buttons": [ |
899 | { | 902 | { |
900 | action: "block", | 903 | action: "block", |
901 | - label: "자세한 결과 보기", | 904 | + label: "상세결과보기", |
902 | - message: "자세한 결과 보기", | 905 | + message: "상세결과보기", |
903 | blockId: "6297bc58ab89e678ee86b33a" | 906 | blockId: "6297bc58ab89e678ee86b33a" |
904 | }, | 907 | }, |
905 | { | 908 | { |
906 | action: "block", | 909 | action: "block", |
907 | - label: "내 MBTI 특징은?", | 910 | + label: "테스트 다시하기", |
908 | - message: "내 MBTI 특징은?", | 911 | + message: "테스트 다시하기", |
909 | - blockId: "629ced645ceed96c38548222" | 912 | + blockId : "6297b10d5ceed96c38544a06" |
910 | - }, | ||
911 | - { | ||
912 | - action: "block", | ||
913 | - label: "내 MBTI 관련 영상보기", | ||
914 | - message: "내 MBTI 관련 영상보기", | ||
915 | - blockId: "629b6af95ceed96c38547c19" | ||
916 | } | 913 | } |
917 | ] | 914 | ] |
918 | } | 915 | } |
... | @@ -920,9 +917,15 @@ apiRouter.post('/result', (req, res) => { | ... | @@ -920,9 +917,15 @@ apiRouter.post('/result', (req, res) => { |
920 | ], | 917 | ], |
921 | quickReplies: [{ | 918 | quickReplies: [{ |
922 | action: "block", | 919 | action: "block", |
923 | - label: "MBTI 테스트 다시하기", | 920 | + label: "내 MBTI 특징은?", |
924 | - message: "MBTI 테스트 다시하기", | 921 | + message: "내 MBTI 특징은?", |
925 | - blockId : "6297b10d5ceed96c38544a06" | 922 | + blockId: "629ced645ceed96c38548222" |
923 | + }, | ||
924 | + { | ||
925 | + action: "block", | ||
926 | + label: "내 MBTI 관련영상 보기", | ||
927 | + message: "내 MBTI 관련영상 보기", | ||
928 | + blockId: "629b6af95ceed96c38547c19" | ||
926 | } | 929 | } |
927 | ] | 930 | ] |
928 | } | 931 | } |
... | @@ -988,6 +991,25 @@ apiRouter.post('/detail', (req, res) => { | ... | @@ -988,6 +991,25 @@ apiRouter.post('/detail', (req, res) => { |
988 | text: "E와 I의 비율\nE : "+(E/(E+I)*100.0)+"%\nI : "+(I/(E+I)*100.0)+"%\n\nN와 S의 비율\nN : "+(N/(N+S)*100.0)+"%\nS : "+(S/(N+S)*100.0)+"%\n\nF와 T의 비율\nF : "+(F/(F+T)*100.0)+"%\nT : "+(T/(F+T)*100.0)+"%\n\nJ와 P의 비율\nJ : "+(J/(J+P)*100.0)+"%\nP : "+(P/(J+P)*100.0)+"%" | 991 | text: "E와 I의 비율\nE : "+(E/(E+I)*100.0)+"%\nI : "+(I/(E+I)*100.0)+"%\n\nN와 S의 비율\nN : "+(N/(N+S)*100.0)+"%\nS : "+(S/(N+S)*100.0)+"%\n\nF와 T의 비율\nF : "+(F/(F+T)*100.0)+"%\nT : "+(T/(F+T)*100.0)+"%\n\nJ와 P의 비율\nJ : "+(J/(J+P)*100.0)+"%\nP : "+(P/(J+P)*100.0)+"%" |
989 | } | 992 | } |
990 | } | 993 | } |
994 | + ], | ||
995 | + quickReplies: [{ | ||
996 | + action: "block", | ||
997 | + label: "테스트 다시하기", | ||
998 | + message: "테스트 다시하기", | ||
999 | + blockId : "6297b10d5ceed96c38544a06" | ||
1000 | + }, | ||
1001 | + { | ||
1002 | + action: "block", | ||
1003 | + label: "내 MBTI 특징은?", | ||
1004 | + message: "내 MBTI 특징은?", | ||
1005 | + blockId: "629ced645ceed96c38548222" | ||
1006 | + }, | ||
1007 | + { | ||
1008 | + action: "block", | ||
1009 | + label: "내 MBTI 관련영상 보기", | ||
1010 | + message: "내 MBTI 관련영상 보기", | ||
1011 | + blockId: "629b6af95ceed96c38547c19" | ||
1012 | + } | ||
991 | ] | 1013 | ] |
992 | } | 1014 | } |
993 | } | 1015 | } |
... | @@ -1047,7 +1069,7 @@ apiRouter.post('/mbtivideo', (req, res) => { | ... | @@ -1047,7 +1069,7 @@ apiRouter.post('/mbtivideo', (req, res) => { |
1047 | url: api_url, | 1069 | url: api_url, |
1048 | method: 'GET', | 1070 | method: 'GET', |
1049 | headers: { | 1071 | headers: { |
1050 | - 'Authorization': 'KakaoAK 45ad937a71c8578ec94f9b5c6c58838b' | 1072 | + 'Authorization': 'KakaoAK '+ KAKAO_KEY |
1051 | }, | 1073 | }, |
1052 | encoding: 'UTF-8', | 1074 | encoding: 'UTF-8', |
1053 | } | 1075 | } |
... | @@ -1096,14 +1118,14 @@ apiRouter.post('/mbtivideo', (req, res) => { | ... | @@ -1096,14 +1118,14 @@ apiRouter.post('/mbtivideo', (req, res) => { |
1096 | ], | 1118 | ], |
1097 | quickReplies: [{ | 1119 | quickReplies: [{ |
1098 | action: "block", | 1120 | action: "block", |
1099 | - label: "MBTI 테스트 다시하기", | 1121 | + label: "테스트 다시하기", |
1100 | - message: "MBTI 테스트 다시하기", | 1122 | + message: "테스트 다시하기", |
1101 | blockId : "6297b10d5ceed96c38544a06" | 1123 | blockId : "6297b10d5ceed96c38544a06" |
1102 | }, | 1124 | }, |
1103 | { | 1125 | { |
1104 | action: "block", | 1126 | action: "block", |
1105 | - label: "자세한 결과 보기", | 1127 | + label: "상세결과보기", |
1106 | - message: "자세한 결과 보기", | 1128 | + message: "상세결과보기", |
1107 | blockId: "6297bc58ab89e678ee86b33a" | 1129 | blockId: "6297bc58ab89e678ee86b33a" |
1108 | } | 1130 | } |
1109 | ] | 1131 | ] |
... | @@ -1128,7 +1150,7 @@ apiRouter.post('/searchMBTI', (req, res) => { | ... | @@ -1128,7 +1150,7 @@ apiRouter.post('/searchMBTI', (req, res) => { |
1128 | 1150 | ||
1129 | var options = { | 1151 | var options = { |
1130 | url: api_url, | 1152 | url: api_url, |
1131 | - headers: {'X-Naver-Client-Id':CLIENT_ID, 'X-Naver-Client-Secret': CLIENT_SECRET} | 1153 | + headers: {'X-Naver-Client-Id': CLIENT_ID, 'X-Naver-Client-Secret': CLIENT_SECRET} |
1132 | }; | 1154 | }; |
1133 | 1155 | ||
1134 | request.get(options, function (error, response, body) { | 1156 | request.get(options, function (error, response, body) { |
... | @@ -1172,20 +1194,20 @@ apiRouter.post('/searchMBTI', (req, res) => { | ... | @@ -1172,20 +1194,20 @@ apiRouter.post('/searchMBTI', (req, res) => { |
1172 | ], | 1194 | ], |
1173 | quickReplies: [{ | 1195 | quickReplies: [{ |
1174 | action: "block", | 1196 | action: "block", |
1175 | - label: "MBTI 테스트 다시하기", | 1197 | + label: "테스트 다시하기", |
1176 | - message: "MBTI 테스트 다시하기", | 1198 | + message: "테스트 다시하기", |
1177 | blockId : "6297b10d5ceed96c38544a06" | 1199 | blockId : "6297b10d5ceed96c38544a06" |
1178 | }, | 1200 | }, |
1179 | { | 1201 | { |
1180 | action: "block", | 1202 | action: "block", |
1181 | - label: "자세한 결과 보기", | 1203 | + label: "상세결과보기", |
1182 | - message: "자세한 결과 보기", | 1204 | + message: "상세결과보기", |
1183 | blockId: "6297bc58ab89e678ee86b33a" | 1205 | blockId: "6297bc58ab89e678ee86b33a" |
1184 | }, | 1206 | }, |
1185 | { | 1207 | { |
1186 | action: "block", | 1208 | action: "block", |
1187 | - label: "내 MBTI 관련 영상보기", | 1209 | + label: "내 MBTI 관련영상 보기", |
1188 | - message: "내 MBTI 관련 영상보기", | 1210 | + message: "내 MBTI 관련영상 보기", |
1189 | blockId: "629b6af95ceed96c38547c19" | 1211 | blockId: "629b6af95ceed96c38547c19" |
1190 | } | 1212 | } |
1191 | ] | 1213 | ] | ... | ... |
... | @@ -5,6 +5,7 @@ | ... | @@ -5,6 +5,7 @@ |
5 | "packages": { | 5 | "packages": { |
6 | "": { | 6 | "": { |
7 | "dependencies": { | 7 | "dependencies": { |
8 | + "dotenv": "^16.0.1", | ||
8 | "express": "^4.18.1", | 9 | "express": "^4.18.1", |
9 | "request": "^2.88.2" | 10 | "request": "^2.88.2" |
10 | } | 11 | } |
... | @@ -223,6 +224,14 @@ | ... | @@ -223,6 +224,14 @@ |
223 | "npm": "1.2.8000 || >= 1.4.16" | 224 | "npm": "1.2.8000 || >= 1.4.16" |
224 | } | 225 | } |
225 | }, | 226 | }, |
227 | + "node_modules/dotenv": { | ||
228 | + "version": "16.0.1", | ||
229 | + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", | ||
230 | + "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==", | ||
231 | + "engines": { | ||
232 | + "node": ">=12" | ||
233 | + } | ||
234 | + }, | ||
226 | "node_modules/ecc-jsbn": { | 235 | "node_modules/ecc-jsbn": { |
227 | "version": "0.1.2", | 236 | "version": "0.1.2", |
228 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", | 237 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", |
... | @@ -1137,6 +1146,11 @@ | ... | @@ -1137,6 +1146,11 @@ |
1137 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", | 1146 | "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", |
1138 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" | 1147 | "integrity": "sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==" |
1139 | }, | 1148 | }, |
1149 | + "dotenv": { | ||
1150 | + "version": "16.0.1", | ||
1151 | + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.1.tgz", | ||
1152 | + "integrity": "sha512-1K6hR6wtk2FviQ4kEiSjFiH5rpzEVi8WW0x96aztHVMhEspNpc4DVOUTEHtEva5VThQ8IaBX1Pe4gSzpVVUsKQ==" | ||
1153 | + }, | ||
1140 | "ecc-jsbn": { | 1154 | "ecc-jsbn": { |
1141 | "version": "0.1.2", | 1155 | "version": "0.1.2", |
1142 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", | 1156 | "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz", | ... | ... |
-
Please register or login to post a comment