Toggle navigation
Toggle navigation
This project
Loading...
Sign in
오규림
/
Personal_color_chatbot
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
suhyunpark
2021-06-06 23:09:12 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
677631fbba91a4cee7919fbadf6597456189a19a
677631fb
1 parent
00da1cf3
Update result_info
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
20 deletions
app.js
app.js
View file @
677631f
...
...
@@ -8,6 +8,8 @@ const sslport = 23023;
const
MULTI_TARGET_URL
=
'https://api.line.me/v2/bot/message/multicast'
const
BROAD_TARGET_URL
=
'https://api.line.me/v2/bot/message/broadcast'
const
info
=
require
(
'./info.js'
);
var
spring
=
0
var
summer
=
0
var
fall
=
0
...
...
@@ -70,7 +72,7 @@ request.post(
{
url
:
BROAD_TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"messages"
:
[
...
...
@@ -118,7 +120,7 @@ function TestSkinType(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
...
...
@@ -143,7 +145,7 @@ function Color_Test(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
...
...
@@ -167,7 +169,7 @@ function Color_Test(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
...
...
@@ -188,7 +190,7 @@ function Color_Test(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
...
...
@@ -214,7 +216,7 @@ function Color_Test(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
...
...
@@ -288,14 +290,19 @@ function Get_warmColor(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
"messages"
:
[
{
"type"
:
"image"
,
"originalContentUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/warm_spring.png'
,
"previewImageUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/warm_spring.png'
,
},
{
"type"
:
"text"
,
"text"
:
"
봄 웜 입니다.
"
"text"
:
"
당신의 퍼스널 컬러는 '봄 웜'입니다.\nBEST: 명도가 높고 채도가 낮은 색상 \nWORST: 전체적으로 흰 빛과 푸른 빛이 감도는 색상, 또는 무채색
"
}
],
}
...
...
@@ -308,15 +315,20 @@ function Get_warmColor(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
"messages"
:
[
{
"type"
:
"image"
,
"originalContentUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/warm_fall.png'
,
"previewImageUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/warm_fall.png'
,
},
{
"type"
:
"text"
,
"text"
:
"
가을 웜 입니다.
"
}
"text"
:
"
당신의 퍼스널 컬러는 '가을 웜'입니다.\nBEST: 명도와 채도가 낮고 탁한톤의 색상, 노랑과 검정이 섞여있는 색상 \nWORST: 찬 계열의 색상과 파스텔톤
"
}
,
],
}
...
...
@@ -334,15 +346,20 @@ function Get_coolColor(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
"messages"
:
[
{
"type"
:
"image"
,
"originalContentUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/cool_summer.png'
,
"previewImageUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/cool_summer.png'
,
},
{
"type"
:
"text"
,
"text"
:
"
여름 쿨 입니다.
"
}
"text"
:
"
당신의 퍼스널 컬러는 '여름 쿨'입니다.\nBEST: 명도는 높고 채도는 낮은 톤, 흰색과 파랑 톤의 기운이 느껴지는 색상\nWORST: 검은색과 너무 어두운색, 금속성의 반사적인 색, 노란기미가 있는 색
"
}
,
],
}
...
...
@@ -355,15 +372,21 @@ function Get_coolColor(replyToken, message) {
{
url
:
TARGET_URL
,
headers
:
{
'Authorization'
:
`Bearer
${
TOKEN
}
`
'Authorization'
:
`Bearer
${
info
.
TOKEN
}
`
},
json
:
{
"replyToken"
:
replyToken
,
"messages"
:
[
{
"type"
:
"image"
,
"originalContentUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/cool_winter.png'
,
"previewImageUrl"
:
'https://personal-color-chatbot.s3.amazonaws.com/cool_winter.png'
,
},
{
"type"
:
"text"
,
"text"
:
"겨울 쿨 입니다."
}
"text"
:
"당신의 퍼스널 컬러는 '겨울 쿨'입니다.\nBEST: 명도와 채도가 높은 톤, 푸르면서 흰색이 기본 색상\nWORST: 황금색 계열"
},
],
}
},
(
error
,
response
,
body
)
=>
{
...
...
@@ -376,9 +399,9 @@ function Get_coolColor(replyToken, message) {
try
{
const
option
=
{
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
domain
+
'/fullchain.pem'
),
key
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/privkey.pem'
),
'utf8'
).
toString
(),
cert
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
domain
+
'/cert.pem'
),
'utf8'
).
toString
(),
ca
:
fs
.
readFileSync
(
'/etc/letsencrypt/live/'
+
info
.
domain
+
'/fullchain.pem'
),
key
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
info
.
domain
+
'/privkey.pem'
),
'utf8'
).
toString
(),
cert
:
fs
.
readFileSync
(
path
.
resolve
(
process
.
cwd
(),
'/etc/letsencrypt/live/'
+
info
.
domain
+
'/cert.pem'
),
'utf8'
).
toString
(),
};
HTTPS
.
createServer
(
option
,
app
).
listen
(
sslport
,
()
=>
{
console
.
log
(
`[HTTPS] Server is started on port
${
sslport
}
`
);
...
...
Please
register
or
login
to post a comment