Showing
1 changed file
with
43 additions
and
20 deletions
... | @@ -8,6 +8,8 @@ const sslport = 23023; | ... | @@ -8,6 +8,8 @@ const sslport = 23023; |
8 | const MULTI_TARGET_URL = 'https://api.line.me/v2/bot/message/multicast' | 8 | const MULTI_TARGET_URL = 'https://api.line.me/v2/bot/message/multicast' |
9 | const BROAD_TARGET_URL = 'https://api.line.me/v2/bot/message/broadcast' | 9 | const BROAD_TARGET_URL = 'https://api.line.me/v2/bot/message/broadcast' |
10 | 10 | ||
11 | +const info = require('./info.js'); | ||
12 | + | ||
11 | var spring = 0 | 13 | var spring = 0 |
12 | var summer = 0 | 14 | var summer = 0 |
13 | var fall = 0 | 15 | var fall = 0 |
... | @@ -70,7 +72,7 @@ request.post( | ... | @@ -70,7 +72,7 @@ request.post( |
70 | { | 72 | { |
71 | url: BROAD_TARGET_URL, | 73 | url: BROAD_TARGET_URL, |
72 | headers: { | 74 | headers: { |
73 | - 'Authorization': `Bearer ${TOKEN}` | 75 | + 'Authorization': `Bearer ${info.TOKEN}` |
74 | }, | 76 | }, |
75 | json: { | 77 | json: { |
76 | "messages": [ | 78 | "messages": [ |
... | @@ -118,7 +120,7 @@ function TestSkinType(replyToken, message) { | ... | @@ -118,7 +120,7 @@ function TestSkinType(replyToken, message) { |
118 | { | 120 | { |
119 | url: TARGET_URL, | 121 | url: TARGET_URL, |
120 | headers: { | 122 | headers: { |
121 | - 'Authorization': `Bearer ${TOKEN}` | 123 | + 'Authorization': `Bearer ${info.TOKEN}` |
122 | }, | 124 | }, |
123 | json: { | 125 | json: { |
124 | "replyToken": replyToken, | 126 | "replyToken": replyToken, |
... | @@ -143,7 +145,7 @@ function Color_Test(replyToken, message) { | ... | @@ -143,7 +145,7 @@ function Color_Test(replyToken, message) { |
143 | { | 145 | { |
144 | url: TARGET_URL, | 146 | url: TARGET_URL, |
145 | headers: { | 147 | headers: { |
146 | - 'Authorization': `Bearer ${TOKEN}` | 148 | + 'Authorization': `Bearer ${info.TOKEN}` |
147 | }, | 149 | }, |
148 | json: { | 150 | json: { |
149 | "replyToken": replyToken, | 151 | "replyToken": replyToken, |
... | @@ -167,7 +169,7 @@ function Color_Test(replyToken, message) { | ... | @@ -167,7 +169,7 @@ function Color_Test(replyToken, message) { |
167 | { | 169 | { |
168 | url: TARGET_URL, | 170 | url: TARGET_URL, |
169 | headers: { | 171 | headers: { |
170 | - 'Authorization': `Bearer ${TOKEN}` | 172 | + 'Authorization': `Bearer ${info.TOKEN}` |
171 | }, | 173 | }, |
172 | json: { | 174 | json: { |
173 | "replyToken": replyToken, | 175 | "replyToken": replyToken, |
... | @@ -188,7 +190,7 @@ function Color_Test(replyToken, message) { | ... | @@ -188,7 +190,7 @@ function Color_Test(replyToken, message) { |
188 | { | 190 | { |
189 | url: TARGET_URL, | 191 | url: TARGET_URL, |
190 | headers: { | 192 | headers: { |
191 | - 'Authorization': `Bearer ${TOKEN}` | 193 | + 'Authorization': `Bearer ${info.TOKEN}` |
192 | }, | 194 | }, |
193 | json: { | 195 | json: { |
194 | "replyToken": replyToken, | 196 | "replyToken": replyToken, |
... | @@ -214,7 +216,7 @@ function Color_Test(replyToken, message) { | ... | @@ -214,7 +216,7 @@ function Color_Test(replyToken, message) { |
214 | { | 216 | { |
215 | url: TARGET_URL, | 217 | url: TARGET_URL, |
216 | headers: { | 218 | headers: { |
217 | - 'Authorization': `Bearer ${TOKEN}` | 219 | + 'Authorization': `Bearer ${info.TOKEN}` |
218 | }, | 220 | }, |
219 | json: { | 221 | json: { |
220 | "replyToken": replyToken, | 222 | "replyToken": replyToken, |
... | @@ -288,14 +290,19 @@ function Get_warmColor(replyToken, message) { | ... | @@ -288,14 +290,19 @@ function Get_warmColor(replyToken, message) { |
288 | { | 290 | { |
289 | url: TARGET_URL, | 291 | url: TARGET_URL, |
290 | headers: { | 292 | headers: { |
291 | - 'Authorization': `Bearer ${TOKEN}` | 293 | + 'Authorization': `Bearer ${info.TOKEN}` |
292 | }, | 294 | }, |
293 | json: { | 295 | json: { |
294 | "replyToken": replyToken, | 296 | "replyToken": replyToken, |
295 | "messages": [ | 297 | "messages": [ |
296 | { | 298 | { |
299 | + "type": "image", | ||
300 | + "originalContentUrl": 'https://personal-color-chatbot.s3.amazonaws.com/warm_spring.png', | ||
301 | + "previewImageUrl": 'https://personal-color-chatbot.s3.amazonaws.com/warm_spring.png', | ||
302 | + }, | ||
303 | + { | ||
297 | "type": "text", | 304 | "type": "text", |
298 | - "text": "봄 웜 입니다." | 305 | + "text": "당신의 퍼스널 컬러는 '봄 웜'입니다.\nBEST: 명도가 높고 채도가 낮은 색상 \nWORST: 전체적으로 흰 빛과 푸른 빛이 감도는 색상, 또는 무채색" |
299 | } | 306 | } |
300 | ], | 307 | ], |
301 | } | 308 | } |
... | @@ -308,15 +315,20 @@ function Get_warmColor(replyToken, message) { | ... | @@ -308,15 +315,20 @@ function Get_warmColor(replyToken, message) { |
308 | { | 315 | { |
309 | url: TARGET_URL, | 316 | url: TARGET_URL, |
310 | headers: { | 317 | headers: { |
311 | - 'Authorization': `Bearer ${TOKEN}` | 318 | + 'Authorization': `Bearer ${info.TOKEN}` |
312 | }, | 319 | }, |
313 | json: { | 320 | json: { |
314 | "replyToken": replyToken, | 321 | "replyToken": replyToken, |
315 | "messages": [ | 322 | "messages": [ |
316 | { | 323 | { |
324 | + "type": "image", | ||
325 | + "originalContentUrl": 'https://personal-color-chatbot.s3.amazonaws.com/warm_fall.png', | ||
326 | + "previewImageUrl": 'https://personal-color-chatbot.s3.amazonaws.com/warm_fall.png', | ||
327 | + }, | ||
328 | + { | ||
317 | "type": "text", | 329 | "type": "text", |
318 | - "text": "가을 웜 입니다." | 330 | + "text": "당신의 퍼스널 컬러는 '가을 웜'입니다.\nBEST: 명도와 채도가 낮고 탁한톤의 색상, 노랑과 검정이 섞여있는 색상 \nWORST: 찬 계열의 색상과 파스텔톤" |
319 | - } | 331 | + }, |
320 | 332 | ||
321 | ], | 333 | ], |
322 | } | 334 | } |
... | @@ -334,15 +346,20 @@ function Get_coolColor(replyToken, message) { | ... | @@ -334,15 +346,20 @@ function Get_coolColor(replyToken, message) { |
334 | { | 346 | { |
335 | url: TARGET_URL, | 347 | url: TARGET_URL, |
336 | headers: { | 348 | headers: { |
337 | - 'Authorization': `Bearer ${TOKEN}` | 349 | + 'Authorization': `Bearer ${info.TOKEN}` |
338 | }, | 350 | }, |
339 | json: { | 351 | json: { |
340 | "replyToken": replyToken, | 352 | "replyToken": replyToken, |
341 | "messages": [ | 353 | "messages": [ |
342 | { | 354 | { |
355 | + "type": "image", | ||
356 | + "originalContentUrl": 'https://personal-color-chatbot.s3.amazonaws.com/cool_summer.png', | ||
357 | + "previewImageUrl": 'https://personal-color-chatbot.s3.amazonaws.com/cool_summer.png', | ||
358 | + }, | ||
359 | + { | ||
343 | "type": "text", | 360 | "type": "text", |
344 | - "text": "여름 쿨 입니다." | 361 | + "text": "당신의 퍼스널 컬러는 '여름 쿨'입니다.\nBEST: 명도는 높고 채도는 낮은 톤, 흰색과 파랑 톤의 기운이 느껴지는 색상\nWORST: 검은색과 너무 어두운색, 금속성의 반사적인 색, 노란기미가 있는 색" |
345 | - } | 362 | + }, |
346 | 363 | ||
347 | ], | 364 | ], |
348 | } | 365 | } |
... | @@ -355,15 +372,21 @@ function Get_coolColor(replyToken, message) { | ... | @@ -355,15 +372,21 @@ function Get_coolColor(replyToken, message) { |
355 | { | 372 | { |
356 | url: TARGET_URL, | 373 | url: TARGET_URL, |
357 | headers: { | 374 | headers: { |
358 | - 'Authorization': `Bearer ${TOKEN}` | 375 | + 'Authorization': `Bearer ${info.TOKEN}` |
359 | }, | 376 | }, |
360 | json: { | 377 | json: { |
361 | "replyToken": replyToken, | 378 | "replyToken": replyToken, |
362 | "messages": [ | 379 | "messages": [ |
363 | { | 380 | { |
381 | + "type": "image", | ||
382 | + "originalContentUrl": 'https://personal-color-chatbot.s3.amazonaws.com/cool_winter.png', | ||
383 | + "previewImageUrl": 'https://personal-color-chatbot.s3.amazonaws.com/cool_winter.png', | ||
384 | + }, | ||
385 | + { | ||
364 | "type": "text", | 386 | "type": "text", |
365 | - "text": "겨울 쿨 입니다." | 387 | + "text": "당신의 퍼스널 컬러는 '겨울 쿨'입니다.\nBEST: 명도와 채도가 높은 톤, 푸르면서 흰색이 기본 색상\nWORST: 황금색 계열" |
366 | - } | 388 | + |
389 | + }, | ||
367 | ], | 390 | ], |
368 | } | 391 | } |
369 | }, (error, response, body) => { | 392 | }, (error, response, body) => { |
... | @@ -376,9 +399,9 @@ function Get_coolColor(replyToken, message) { | ... | @@ -376,9 +399,9 @@ function Get_coolColor(replyToken, message) { |
376 | 399 | ||
377 | try { | 400 | try { |
378 | const option = { | 401 | const option = { |
379 | - ca: fs.readFileSync('/etc/letsencrypt/live/' + domain + '/fullchain.pem'), | 402 | + ca: fs.readFileSync('/etc/letsencrypt/live/' + info.domain + '/fullchain.pem'), |
380 | - key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/privkey.pem'), 'utf8').toString(), | 403 | + key: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + info.domain + '/privkey.pem'), 'utf8').toString(), |
381 | - cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + domain + '/cert.pem'), 'utf8').toString(), | 404 | + cert: fs.readFileSync(path.resolve(process.cwd(), '/etc/letsencrypt/live/' + info.domain + '/cert.pem'), 'utf8').toString(), |
382 | }; | 405 | }; |
383 | HTTPS.createServer(option, app).listen(sslport, () => { | 406 | HTTPS.createServer(option, app).listen(sslport, () => { |
384 | console.log(`[HTTPS] Server is started on port ${sslport}`); | 407 | console.log(`[HTTPS] Server is started on port ${sslport}`); | ... | ... |
-
Please register or login to post a comment