Toggle navigation
Toggle navigation
This project
Loading...
Sign in
이준성
/
khuwitch
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
Jinsu Park
2020-12-08 02:38:06 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
50d1f6641776d6f7bf19fded990beccba8b44d09
50d1f664
1 parent
d93b940e
2차 통합 완료
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
7 deletions
frontend/src/App.js
frontend/src/Channel.js
frontend/src/Login.js
server/socket_server.js
frontend/src/App.js
View file @
50d1f66
...
...
@@ -3,7 +3,8 @@ import Login from "./Login";
import
Body
from
"./Body"
;
function
App
()
{
let
accessToken
=
null
;
// let accessToken = null;
let
accessToken
=
1
;
return
(
<
div
className
=
"app"
>
...
...
frontend/src/Channel.js
View file @
50d1f66
...
...
@@ -8,7 +8,7 @@ import { WatchOutlined } from "@material-ui/icons";
import
io
from
'socket.io-client'
import
tts
from
'./tts'
;
const
socket
=
io
.
connect
(
"http://localhost:3
000
"
)
const
socket
=
io
.
connect
(
"http://localhost:3
303
"
)
socket
.
on
(
"connect"
,
event
=>
{
// 테스트용으로 umi0410에게 입장.
// 다른 거 아무거나 채널이름을 넣으면 되겠지만, 그렇게 하고싶으면 백엔드에서 인자설정을 해줘야함.
...
...
@@ -18,6 +18,7 @@ socket.on("connect", event=>{
// 말해야할 메시지가 왔을 때. 이건 따로 Component와 묶지 않아도 알아서 실행됩니다.
socket
.
on
(
'chat message'
,
(
name
,
msg
)
=>
{
console
.
log
(
msg
)
console
.
log
(
"got message"
)
tts
.
speak
(
msg
)
})
...
...
frontend/src/Login.js
View file @
50d1f66
import
React
from
"react"
;
import
"./Login.css"
;
function
Login
(){
const
OAuthUrl
=
""
;
// oauth 인증용 url
function
Login
(){
const
OAuthUrl
=
`https://id.twitch.tv/oauth2/authorize?response_type=code&approval_prompt=auto&redirect_uri=http://localhost:3303/join&client_id=2d1gvcqyiyrk180qvnkec2fl23sv1o`
;
// oauth 인증용 url
return
(
<
div
className
=
"login"
>
<
img
...
...
server/socket_server.js
View file @
50d1f66
...
...
@@ -52,7 +52,7 @@ app.post('/jointest',async (req,res)=>{
JoinChannel
(
req
.
body
.
streamer
);
res
.
send
(
req
.
body
.
streamer
)
});
console
.
log
(
`https://id.twitch.tv/oauth2/authorize?response_type=code&approval_prompt=auto&redirect_uri=
${
process
.
env
.
HOST_URI
+
':'
+
process
.
env
.
SOCKET_PORT
}
/join&client_id=
${
process
.
env
.
TWITCH_CLIENT
}
`
)
////////////////////////oauth////////////////////////
const
axios
=
require
(
'axios'
)
app
.
get
(
'/oauth'
,(
req
,
res
)
=>
{
...
...
@@ -72,7 +72,7 @@ app.get('/join', async (req,res)=>{
}
).
then
(
resp2
=>
{
JoinChannel
(
resp2
.
data
.
login
)
res
.
send
(
"Joinned "
+
resp2
.
data
.
login
)
res
.
redirect
(
"http://localhost:8000?authenticated=true"
)
// 이거 프론트 유알엘임
})
})
...
...
@@ -147,7 +147,8 @@ function onMessageHandler (target, context, msg, self) {
}
else
if
(
context
[
"display-name"
]
==
"빵_떡"
||
context
[
"display-name"
]
==
"Nightbot"
||
context
[
"display-name"
]
==
"싹뚝"
){
||
context
[
"display-name"
]
==
"싹뚝"
||
context
[
"display-name"
]
==
"KhuwitchBot"
){
return
;
}
else
{
...
...
Please
register
or
login
to post a comment