Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hyunjong Lee
/
YTMT
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
hyunjong
2019-06-02 13:32:31 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
150b0cad940ccdd9ea65f9d6a78062371dd5a47a
150b0cad
1 parent
934c04ab
네이버, 다음 로그인 에러 처리, 클린코드
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
130 additions
and
136 deletions
public/images/lezhinicon.png
routes/index.js
views/index.ejs
views/mytoons.ejs
public/images/lezhinicon.png
0 → 100644
View file @
150b0ca
2.94 KB
routes/index.js
View file @
150b0ca
...
...
@@ -9,27 +9,27 @@ var NaverStrategy = require('passport-naver').Strategy;
var
GoogleStrategy
=
require
(
'passport-google-oauth'
).
OAuth2Strategy
;
var
router
=
express
.
Router
();
//
설명
//
kakao login API
var
kakaoKey
=
{
clientID
:
'5634a5f8ca5c9a5eb378d6b6e6e869a0'
,
callbackURL
:
'/auth/login/kakao/callback'
};
//
//
naver login API
var
naverKey
=
{
clientID
:
'OHmCrpQuVFnIEB4GkmF_'
,
callbackURL
:
'/auth/login/naver/callback'
,
clientSecret
:
'BBgcRdnj0M'
};
//
//
google login API
var
googleKey
=
{
clientID
:
'924802195853-ir977i2ohnddaaninlqlbeg6sov629hq.apps.googleusercontent.com'
,
callbackURL
:
'/auth/login/google/callback'
,
clientSecret
:
'NaWeoJouUzYq4VfBesTkdUfA'
};
//
//
kakao passport
passport
.
use
(
new
KakaoStrategy
(
kakaoKey
,
function
(
accessToken
,
refreshToken
,
params
,
profile
,
done
)
{
console
.
log
(
profile
);
...
...
@@ -41,7 +41,7 @@ passport.use(new KakaoStrategy(kakaoKey,
}
));
//
//
naver passport
passport
.
use
(
new
NaverStrategy
(
naverKey
,
function
(
accessToken
,
refreshToken
,
profile
,
done
)
{
console
.
log
(
profile
);
...
...
@@ -53,7 +53,7 @@ passport.use(new NaverStrategy(naverKey,
}
));
//
//
google passport
passport
.
use
(
new
GoogleStrategy
(
googleKey
,
function
(
accessToken
,
refreshToken
,
profile
,
done
)
{
console
.
log
(
profile
);
...
...
@@ -73,10 +73,9 @@ router.get('/auth/login/kakao/callback', passport.authenticate('kakao', {
})
);
// naver 로그인
// naver 로그인
, 로그인 콜백
router
.
get
(
'/auth/login/naver'
,
passport
.
authenticate
(
'naver'
));
router
.
get
(
'/auth/login/naver/callback'
,
passport
.
authenticate
(
'naver'
,
{
router
.
get
(
'/auth/login/naver/callback'
,
passport
.
authenticate
(
'naver'
,
{
successRedirect
:
'/mytoons'
,
failureRedirect
:
'/'
})
...
...
@@ -90,7 +89,7 @@ router.get('/auth/login/google/callback', passport.authenticate('google', {
})
);
//
설명
//
로그인 처리
function
loginByThirdparty
(
info
,
done
)
{
var
stmt_duplicated
=
"select *from `user` where id = id"
;
//'select *from `user` where `id` = ?
...
...
@@ -125,7 +124,7 @@ function loginByThirdparty(info, done) {
});
}
router
.
get
(
'/login'
,
function
(
req
,
res
){
router
.
get
(
'/login'
,
function
(
req
,
res
)
{
res
.
render
(
'login_page'
)
})
...
...
@@ -153,14 +152,15 @@ function getLatestToon(titleid, day ,cb) {
}
function
getDaumToons
(
_day
){
// X요일 다음 웹툰
//_day요일의 다음웹툰 불러오기
function
getDaumToons
(
_day
)
{
var
day
=
_day
;
var
day_name
=
day
;
var
daum
=
`http://webtoon.daum.net/data/pc/webtoon/list_serialized/
${
day
}
?timeStamp=1515819276574`
;
var
site
=
'daum'
;
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
)
{
client
.
fetch
(
daum
,
{},
function
(
err
,
$
,
res
,
body
){
var
data
=
JSON
.
parse
(
body
);
var
list
=
data
[
"data"
];
...
...
@@ -183,14 +183,17 @@ function getDaumToons(_day){
});
}
//
function
getNaverToons
(){
// 네이버 전체 웹툰 불러오기
function
getNaverToons
()
{
var
allWeeklyToonsUrl
=
"http://comic.naver.com/webtoon/weekday.nhn"
;
request
(
allWeeklyToonsUrl
,
function
(
err
,
res
,
html
)
{
if
(
!
err
){
var
$
=
cheerio
.
load
(
html
);
var
p
=
Promise
.
resolve
();
var
eachs
=
$
(
".thumb"
).
each
(
function
(
i
)
{
var
week
=
$
(
this
).
parent
().
parent
().
prev
().
attr
(
'class'
);
var
webtoon_link
=
"http://comic.naver.com"
+
$
(
this
).
children
().
first
().
attr
(
'href'
);
var
thumb_link
=
$
(
this
).
children
().
first
().
children
().
first
().
attr
(
'src'
);
...
...
@@ -206,6 +209,7 @@ function getNaverToons(){
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
...
...
@@ -230,10 +234,52 @@ function getNaverToons(){
// 구현중
function
getTomicsToons
(){
var
allWeeklyToonsUrl
=
"https://www.lezhin.com/ko/scheduled"
;
request
(
allWeeklyToonsUrl
,
function
(
err
,
res
,
html
)
{
if
(
!
err
){
var
$
=
cheerio
.
load
(
html
);
var
p
=
Promise
.
resolve
();
var
eachs
=
$
(
".thumb"
).
each
(
function
(
i
)
{
var
week
=
$
(
this
).
parent
().
parent
().
prev
().
attr
(
'class'
);
var
webtoon_link
=
"https://www.lezhin.com/ko"
+
$
(
this
).
children
().
first
().
attr
(
'href'
);
var
thumb_link
=
$
(
this
).
children
().
first
().
children
().
first
().
attr
(
'src'
);
var
name
=
$
(
this
).
next
().
text
();
var
titleid
=
webtoon_link
.
split
(
'?'
)[
1
].
split
(
'&'
)[
0
].
split
(
'='
)[
1
];
var
site
=
'naver'
;
var
webtoon
=
{
toon_index
:
titleid
,
name
:
name
,
thum_link
:
thumb_link
,
webtoon_link
:
webtoon_link
,
week
:
week
,
site
:
site
,
latest
:
0
};
allWebtoonList
.
push
(
webtoon
);
});
p
.
then
(
function
()
{
i
=
0
;
allWebtoonList
.
forEach
(
function
(
webtoon
)
{
var
sql
=
"INSERT INTO `toon` (toon_index, name, thum_link, webtoon_link, week, site, latest) VALUES(?) ON DUPLICATE KEY UPDATE latest=latest"
;
var
values
=
[
webtoon
.
toon_index
,
webtoon
.
name
,
webtoon
.
thum_link
,
webtoon
.
webtoon_link
,
webtoon
.
week
,
webtoon
.
site
,
webtoon
.
latest
];
connection
.
query
(
sql
,[
values
],
function
(
err
,
result
){
if
(
err
)
{
console
.
log
(
"웹툰 DB 에러 : "
+
err
);
}
else
{
console
.
log
(
"웹툰 DB처리 완료!"
);
}
});
})
});
}
});
}
//
설명
//
모든 웹튼을 담고있는 배열
allWebtoons
=
new
Array
();
// 설명
...
...
views/index.ejs
View file @
150b0ca
...
...
@@ -7,8 +7,7 @@
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/bootstrap.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/font-awesome.css"
>
<!-- Stylesheet
================================================== -->
<!-- Stylesheet ================================================== -->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/nivo-lightbox/nivo-lightbox.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/nivo-lightbox/default.css"
>
...
...
@@ -17,15 +16,13 @@
<link
href=
"https://fonts.googleapis.com/css?family=Dancing+Script:400,700"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css?family=Gugi&subset=korean"
rel=
"stylesheet"
>
<script
src=
"http://developers.kakao.com/sdk/js/kakao.min.js"
>
function
daum_click
()
{
function
daum_click
(){
if
(
Daum_webtoons
.
display
==
"none"
)
Daum_webtoons
.
display
==
"block"
;
if
(
Daum_webtoons
.
display
=
"block"
)
Daum_webtoons
.
display
==
"none"
;
}
function
naver_click
()
{
function
naver_click
(){
if
(
Naver_webtoons
.
display
==
"none"
)
Naver_webtoons
.
display
==
"block"
;
if
(
Naver_webtoons
.
display
=
"block"
)
...
...
@@ -40,8 +37,10 @@
<div
class=
"container"
>
<!-- Brand and toggle get grouped for better mobile display -->
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#bs-example-navbar-collapse-1"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand page-scroll"
href=
"#page-top"
style=
"font-family:Gugi"
>
니툰내툰
</a>
</div>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#bs-example-navbar-collapse-1"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand page-scroll"
href=
"#page-top"
style=
"font-family:Gugi"
>
니툰내툰
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div
class=
"collapse navbar-collapse"
id=
"bs-example-navbar-collapse-1"
>
<ul
class=
"nav navbar-nav navbar-right"
>
...
...
@@ -60,10 +59,10 @@
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"intro-text"
>
<h1
style=
"font-family:Gugi"
>
니툰내툰
</h1>
<p>
NAVER / DAUM / WEBTOONS
</p>
<a
href=
"#about"
class=
"btn btn-custom btn-lg page-scroll"
>
All the Webtoons
</a>
</div>
<p>
NAVER / DAUM / Lezhin
</p>
<a
href=
"#about"
class=
"btn btn-custom btn-lg page-scroll"
>
All the Webtoons
</a>
</div>
</div>
</div>
</div>
...
...
@@ -75,93 +74,84 @@
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"col-xs-12 col-md-6 "
>
<div
class=
"about-img"
><img
src=
"images/toon.png"
class=
"img-responsive"
alt=
""
></div>
<div
class=
"about-img"
><img
src=
"images/toon.png"
class=
"img-responsive"
alt=
""
>
</div>
</div>
<div
class=
"col-xs-12 col-md-6"
>
<div
class=
"about-text"
>
<h2>
Our Term-Project
</h2>
<hr>
<!--수정해주세욤!-->
<p>
마더 프로젝트 니툰내툰(YTMT)를 개선하는 프로젝트입니다. 네이버 웹툰 뿐만 아니라 다음 웹툰도 담을 수 있으며, 타인이 담은 웹툰도 확인할 수 있습니다.
</p>
<h3>
Programmers
</h3>
<hr><p>
마더프로젝트 니툰내툰을 개선하는 프로젝트입니다. 네이버웹툰, 다음웹툰, 레진웹툰을 담을 수 있으며 다른 사용자가 담은 웹툰도 확인할 수 있습니다.
</p>
<h3>
Developers
</h3>
<p>
2013100924 이현종, 2018102151 Abdullaev Akhidjon
</p>
</div>
</div>
</div>
</div>
</div>
<!-- Portfolio Section -->
<div
id=
"portfolio"
>
<div
class=
"section-title text-center center"
>
<div
class=
"overlay"
>
<h2>
Gallery
</h2>
<hr>
<p>
니툰내툰에서 제공하는 웹툰 리스트입니다
</p>
<hr><p>
니툰내툰에서 제공하는 웹툰 리스트입니다
</p>
</div>
</div>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"categories"
>
<ul
class=
"cat"
>
<font
size =
30
>
다음 웹툰
</font>
<a
onclick=
"Daum_webtoons.style.display=(Daum_webtoons.style.display=='none')?'block':'none';"
href=
"javascript:void(0)"
>
<img
src =
'/images/daumicon.png'
width=
"83
"
height=
"90"
onclick=
"daum_click"
/>
<img
src =
'/images/daumicon.png'
width=
"90
"
height=
"90"
onclick=
"daum_click"
/>
</a>
<div
style=
"display:none"
id=
"Daum_webtoons"
>
<table>
<
%
var current = "";
<
%var current = "";
for(webtoon in list){
if(current!=list[webtoon].week
&&
list[webtoon].site == 'daum'){
if(current!=""){
%>
</tr>
<
% } %>
<tr>
<th>
<
%= list[webtoon].week %>
</th>
<th>
<
% = list[webtoon].week %>
</th>
<
% } %>
<
%
if(list[webtoon].site == 'daum')
{
if(list[webtoon].site == 'daum'){
%>
<td>
<a
href=
"<%= list[webtoon].webtoon_link %>"
>
<img
alt=
"img"
width=
"83"
height=
"90"
src=
"<%= list[webtoon].thum_link %>"
/>
</a>
<
%
= list[webtoon].name %>
<
%
= list[webtoon].name %>
</td>
<
%
}
%>
<
% } %>
<
%
if(current!=list[webtoon].week) {
<
% if(current!=list[webtoon].week){
current = list[webtoon].week;
%>
<
%
}
}
%>
</tr>
</table>
<!--</br>-->
</div>
<!--<br>-->
<font
size =
30
>
네이버 웹툰
</font>
<a
onclick=
"Naver_webtoons.style.display=(Naver_webtoons.style.display=='none')?'block':'none';"
href=
"javascript:void(0)"
>
<img
src =
'/images/navericon.png'
width=
"83
"
height=
"90"
/>
<img
src =
'/images/navericon.png'
width=
"90
"
height=
"90"
/>
</a>
<div
id=
"Naver_webtoons"
style =
"display:none"
>
<div
id=
"Naver_webtoons"
style =
"display:none"
>
<table>
<
%
var current = "";
...
...
@@ -200,25 +190,21 @@
%>
</tr>
</table>
</br>
</div>
<font
size =
30
>
투믹스 웹툰
</font>
<a
onclick=
"Naver_webtoons.style.display=(Naver_webtoons.style.display=='none')?'block':'none';"
href=
"javascript:void(0)"
>
<img
src =
'https://is4-ssl.mzstatic.com/image/thumb/Purple128/v4/d9/c7/99/d9c79934-4e9a-4926-fa53-b4863bae52b4/source/512x512bb.jpg'
width=
"83"
height=
"90"
/>
</a>
<div
id=
"toomiks"
style =
"display:none"
>
레진 웹툰
</font>
<a
onclick=
"Lezhin_webtoons.style.display=(Lezhin_webtoons.style.display=='none')?'block':'none';"
href=
"javascript:void(0)"
>
<img
src =
'/images/lezhinicon.png'
width=
"90"
height=
"90"
/>
</a>
<div
id=
"Lezhin_webtoons"
style =
"display:none"
>
<table>
<
%
var current = "";
for(webtoon in list){
if(current!=list[webtoon].week
&&
list[webtoon].site == 'toomiks'){
if(current!=list[webtoon].week
&&
list[webtoon].site == 'naver'){
if(current!=""){
%>
</tr>
...
...
@@ -227,7 +213,7 @@
<th>
<
%= list[webtoon].week %>
</th>
<
% } %>
<
%
if(list[webtoon].site == 'toomiks
')
if(list[webtoon].site == 'naver
')
{
%>
<td>
...
...
@@ -243,17 +229,17 @@
<
%
if(current!=list[webtoon].week) {
current = list[webtoon].week;
%>
<
%
}
}
%>
</tr>
</table>
</br>
</div>
</ul>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
...
...
views/mytoons.ejs
View file @
150b0ca
<!DOCTYPE html>
<html>
<head>
<head>
<title>
내툰
</title>
<link
rel=
'stylesheet'
href=
'/stylesheets/style2.css'
/>
<
<!-- Bootstrap -->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/bootstrap.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/font-awesome.css"
>
<!-- Stylesheet
================================================== -->
<!-- Stylesheet================================================== -->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/style.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/nivo-lightbox/nivo-lightbox.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"/stylesheets/nivo-lightbox/default.css"
>
...
...
@@ -16,63 +16,28 @@
<link
href=
"https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css?family=Dancing+Script:400,700"
rel=
"stylesheet"
>
<link
href=
"https://fonts.googleapis.com/css?family=Gugi&subset=korean"
rel=
"stylesheet"
>
<!--===============================================================================================-->
<!--===============================================================================================-->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"fonts/font-awesome-4.7.0/css/font-awesome.min.css"
>
<!--===============================================================================================-->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"vendor/animate/animate.css"
>
<!--===============================================================================================-->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"vendor/select2/select2.min.css"
>
<!--===============================================================================================-->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"vendor/perfect-scrollbar/perfect-scrollbar.css"
>
<!--===============================================================================================-->
<link
rel=
"stylesheet"
type=
"text/css"
href=
"stylesheets/util.css"
>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"stylesheets/main.css"
>
<!--===============================================================================================-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!--
<style>
.toon_name,.toon_thumbnail{
width:10%;
}
td{
vertical-align: middle;
border-bottom: 1px solid #bcbcbc;
border-left: 1px solid #bcbcbc;
border-right: 1px solid #bcbcbc;
margin:0;
Text-align:center;
}
table{
border-collapse:collapse;
border: 2px solid #474747;
}
th{
border-bottom:2px solid #474747;
}
</style>
-->
</head>
</head>
<body
id=
"page-top"
data-spy=
"scroll"
data-target=
".navbar-fixed-top"
>
<body
id=
"page-top"
data-spy=
"scroll"
data-target=
".navbar-fixed-top"
>
<!-- Navigation
==========================================-->
<!-- Navigation==========================================-->
<div
class=
"nabvar"
>
<nav
id=
"menu"
class=
"navbar navbar-default navbar-fixed-top"
>
<div
class=
"container"
>
<!-- Brand and toggle get grouped for better mobile display -->
<div
class=
"navbar-header"
>
<button
type=
"button"
class=
"navbar-toggle collapsed"
data-toggle=
"collapse"
data-target=
"#bs-example-navbar-collapse-1"
>
<span
class=
"sr-only"
>
Toggle navigation
</span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
<span
class=
"icon-bar"
></span>
</button>
<a
class=
"navbar-brand page-scroll"
href=
"#page-top"
style=
"font-family:Gugi"
>
내툰
</a>
</div>
<a
class=
"navbar-brand page-scroll"
href=
"#page-top"
style=
"font-family:Gugi"
>
내툰
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div
class=
"collapse navbar-collapse"
id=
"bs-example-navbar-collapse-1"
>
<ul
class=
"nav navbar-nav navbar-right"
>
...
...
@@ -86,14 +51,15 @@
</div>
</nav>
</div>
<div
id=
"mylist"
>
<div
id=
"mylist"
>
<div
class=
"section-title text-center center"
>
<div
class=
"overlay"
>
<h2>
내툰
</h2>
<hr>
<p>
웹툰 담기를 통해 담은 웹툰들의 리스트입니다
</p>
<hr><p>
웹툰 담기를 통해 담은 웹툰들의 리스트입니다
</p>
</div>
</div>
<div
class=
"container"
>
<div
class=
"row"
>
<div
class=
"categories"
>
...
...
@@ -115,15 +81,13 @@
</thead>
</table>
</div>
<div
class =
"table100-body js-pscroll"
>
<table>
<
%if (mytoons.length==0){
%>
<
%if(mytoons.length==0){ %>
<th>
내툰리스트에 웹툰이 없습니다! 수정하기 버튼을 눌러서 추가하세요!
</th>
<
%}%>
<
% for(i=0;i
<mytoons
.
length
;
i
++){
%
>
<
% for(i=0;i
<mytoons
.
length
;
i
++){%
>
<tr>
<td
class=
"cell100 column1"
><image
src=
"<%= mytoons[i].thum_link%>"
/></td>
<td
class=
"cell100 column2"
>
<
%= mytoons[i].name %>
</td>
...
...
@@ -188,19 +152,17 @@
{ %>업데이트됨
<
%} %>
</td>
</tr>
<
% } %>
</table>
</div></br>
</div>
</br>
</div>
</div>
</div>
</div>
</body>
</div>
</div>
</div>
</div>
</body>
</html>
...
...
Please
register
or
login
to post a comment