강현태

웹툰 보기 링크 추가.

......@@ -3,10 +3,8 @@
<component name="ChangeListManager">
<list default="true" id="ffe1a490-8fdb-4611-8537-4d1c03c40b8d" name="Default" comment="">
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/routes/index.js" afterPath="$PROJECT_DIR$/routes/index.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/app.js" afterPath="$PROJECT_DIR$/app.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/routes/mytoons.js" afterPath="$PROJECT_DIR$/routes/mytoons.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/routes/setting.js" afterPath="$PROJECT_DIR$/routes/setting.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/views/index.ejs" afterPath="$PROJECT_DIR$/views/index.ejs" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/views/mytoons.ejs" afterPath="$PROJECT_DIR$/views/mytoons.ejs" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/views/setting.ejs" afterPath="$PROJECT_DIR$/views/setting.ejs" />
</list>
......@@ -62,8 +60,8 @@
<file leaf-file-name="mytoons.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/routes/mytoons.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-210">
<caret line="34" column="76" lean-forward="false" selection-start-line="34" selection-start-column="76" selection-end-line="34" selection-end-column="76" />
<state relative-caret-position="179">
<caret line="42" column="14" lean-forward="false" selection-start-line="42" selection-start-column="14" selection-end-line="42" selection-end-column="14" />
<folding />
</state>
</provider>
......@@ -72,8 +70,8 @@
<file leaf-file-name="index.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/routes/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="267">
<caret line="149" column="0" lean-forward="false" selection-start-line="149" selection-start-column="0" selection-end-line="149" selection-end-column="0" />
<state relative-caret-position="292">
<caret line="58" column="0" lean-forward="false" selection-start-line="58" selection-start-column="0" selection-end-line="58" selection-end-column="0" />
<folding>
<element signature="n#!!block;n#getLatestToon#0" expanded="false" />
<element signature="n#!!block;n#getAllToons#0" expanded="false" />
......@@ -85,7 +83,7 @@
<file leaf-file-name="index.ejs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/views/index.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-161">
<state relative-caret-position="-111">
<caret line="0" column="15" lean-forward="true" selection-start-line="0" selection-start-column="15" selection-end-line="0" selection-end-column="15" />
<folding>
<marker date="1512610222312" expanded="true" signature="211:1032" ph="..." />
......@@ -94,21 +92,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="mytoons.ejs" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/views/mytoons.ejs">
<file leaf-file-name="toonviewer.ejs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/views/toonviewer.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="22" column="11" lean-forward="true" selection-start-line="22" selection-start-column="11" selection-end-line="22" selection-end-column="11" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="setting.ejs" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/views/setting.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-8">
<caret line="24" column="12" lean-forward="false" selection-start-line="24" selection-start-column="12" selection-end-line="24" selection-end-column="12" />
<state relative-caret-position="150">
<caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
<folding />
</state>
</provider>
......@@ -117,8 +105,8 @@
<file leaf-file-name="setting.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/routes/setting.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="49" lean-forward="false" selection-start-line="6" selection-start-column="49" selection-end-line="6" selection-end-column="49" />
<state relative-caret-position="75">
<caret line="41" column="22" lean-forward="false" selection-start-line="41" selection-start-column="22" selection-end-line="41" selection-end-column="22" />
<folding />
</state>
</provider>
......@@ -127,16 +115,26 @@
<file leaf-file-name="app.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="570">
<caret line="38" column="0" lean-forward="false" selection-start-line="38" selection-start-column="0" selection-end-line="38" selection-end-column="0" />
<state relative-caret-position="120">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="33" />
<folding>
<element signature="e#1750#1822#0" expanded="false" />
<element signature="e#1881#2127#0" expanded="false" />
<element signature="e#1834#1906#0" expanded="false" />
<element signature="e#1965#2211#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
</file>
<file leaf-file-name="toonviewer.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/routes/toonviewer.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="237">
<caret line="45" column="28" lean-forward="false" selection-start-line="45" selection-start-column="28" selection-end-line="45" selection-end-column="28" />
<folding />
</state>
</provider>
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
......@@ -165,6 +163,7 @@
<find>패밀리</find>
<find>console</find>
<find>query</find>
<find>br</find>
</findStrings>
<dirStrings>
<dir>$PROJECT_DIR$/views</dir>
......@@ -199,12 +198,15 @@
<option value="$PROJECT_DIR$/package.json" />
<option value="$APPLICATION_CONFIG_DIR$/consoles/db/01265fc0-37d6-481f-ac14-42262cda0ac3/console.sql" />
<option value="$PROJECT_DIR$/views/index.ejs" />
<option value="$PROJECT_DIR$/app.js" />
<option value="$PROJECT_DIR$/routes/index.js" />
<option value="$PROJECT_DIR$/views/setting.ejs" />
<option value="$PROJECT_DIR$/routes/mytoons.js" />
<option value="$PROJECT_DIR$/views/toonviewer.html" />
<option value="$PROJECT_DIR$/routes/setting.js" />
<option value="$PROJECT_DIR$/views/mytoons.ejs" />
<option value="$PROJECT_DIR$/app.js" />
<option value="$PROJECT_DIR$/routes/mytoons.js" />
<option value="$PROJECT_DIR$/views/toonviewer.ejs" />
<option value="$PROJECT_DIR$/routes/toonviewer.js" />
</list>
</option>
</component>
......@@ -387,7 +389,7 @@
<updated>1512173581551</updated>
<workItem from="1512173589576" duration="1873000" />
<workItem from="1512179289398" duration="128771000" />
<workItem from="1512609885662" duration="20679000" />
<workItem from="1512609885662" duration="29466000" />
</task>
<task id="LOCAL-00001" summary="초기 commit by intellij">
<created>1512174269218</created>
......@@ -407,7 +409,7 @@
<servers />
</component>
<component name="TimeTrackingManager">
<option name="totallyTimeSpent" value="151323000" />
<option name="totallyTimeSpent" value="160110000" />
</component>
<component name="TodoView">
<todo-panel id="selected-file">
......@@ -436,7 +438,7 @@
<window_info id="Capture Tool" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.16523606" sideWeight="0.48880598" order="0" side_tool="false" content_ui="combo" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.29613733" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Database" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.29613733" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.24964234" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="UI Designer" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
......@@ -521,7 +523,7 @@
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
<option name="time" value="211" />
<option name="time" value="245" />
</breakpoint-manager>
<watches-manager />
</component>
......@@ -584,6 +586,7 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="212">
<caret line="43" column="10" lean-forward="false" selection-start-line="43" selection-start-column="10" selection-end-line="43" selection-end-column="10" />
<folding />
</state>
</provider>
</entry>
......@@ -695,66 +698,82 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/index.js">
<entry file="file://$PROJECT_DIR$/views/setting.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="267">
<caret line="149" column="0" lean-forward="false" selection-start-line="149" selection-start-column="0" selection-end-line="149" selection-end-column="0" />
<folding>
<element signature="n#!!block;n#getLatestToon#0" expanded="false" />
<element signature="n#!!block;n#getAllToons#0" expanded="false" />
</folding>
<state relative-caret-position="-104">
<caret line="13" column="10" lean-forward="false" selection-start-line="13" selection-start-column="10" selection-end-line="13" selection-end-column="10" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/index.ejs">
<entry file="file://$PROJECT_DIR$/views/mytoons.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-161">
<caret line="0" column="15" lean-forward="true" selection-start-line="0" selection-start-column="15" selection-end-line="0" selection-end-column="15" />
<folding>
<marker date="1512610222312" expanded="true" signature="211:1032" ph="..." />
</folding>
<state relative-caret-position="222">
<caret line="40" column="10" lean-forward="true" selection-start-line="40" selection-start-column="10" selection-end-line="40" selection-end-column="10" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/setting.ejs">
<entry file="file://$PROJECT_DIR$/routes/setting.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-8">
<caret line="24" column="12" lean-forward="false" selection-start-line="24" selection-start-column="12" selection-end-line="24" selection-end-column="12" />
<state relative-caret-position="75">
<caret line="41" column="22" lean-forward="false" selection-start-line="41" selection-start-column="22" selection-end-line="41" selection-end-column="22" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="292">
<caret line="58" column="0" lean-forward="false" selection-start-line="58" selection-start-column="0" selection-end-line="58" selection-end-column="0" />
<folding>
<element signature="n#!!block;n#getLatestToon#0" expanded="false" />
<element signature="n#!!block;n#getAllToons#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/app.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="570">
<caret line="38" column="0" lean-forward="false" selection-start-line="38" selection-start-column="0" selection-end-line="38" selection-end-column="0" />
<state relative-caret-position="120">
<caret line="8" column="0" lean-forward="false" selection-start-line="8" selection-start-column="0" selection-end-line="8" selection-end-column="33" />
<folding>
<element signature="e#1750#1822#0" expanded="false" />
<element signature="e#1881#2127#0" expanded="false" />
<element signature="e#1834#1906#0" expanded="false" />
<element signature="e#1965#2211#0" expanded="false" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/setting.js">
<entry file="file://$PROJECT_DIR$/routes/mytoons.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="90">
<caret line="6" column="49" lean-forward="false" selection-start-line="6" selection-start-column="49" selection-end-line="6" selection-end-column="49" />
<state relative-caret-position="179">
<caret line="42" column="14" lean-forward="false" selection-start-line="42" selection-start-column="14" selection-end-line="42" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/mytoons.js">
<entry file="file://$PROJECT_DIR$/views/toonviewer.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-210">
<caret line="34" column="76" lean-forward="false" selection-start-line="34" selection-start-column="76" selection-end-line="34" selection-end-column="76" />
<state relative-caret-position="150">
<caret line="10" column="1" lean-forward="false" selection-start-line="10" selection-start-column="1" selection-end-line="10" selection-end-column="1" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/views/mytoons.ejs">
<entry file="file://$PROJECT_DIR$/views/index.ejs">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-111">
<caret line="0" column="15" lean-forward="true" selection-start-line="0" selection-start-column="15" selection-end-line="0" selection-end-column="15" />
<folding>
<marker date="1512610222312" expanded="true" signature="211:1032" ph="..." />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/routes/toonviewer.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="330">
<caret line="22" column="11" lean-forward="true" selection-start-line="22" selection-start-column="11" selection-end-line="22" selection-end-column="11" />
<state relative-caret-position="237">
<caret line="45" column="28" lean-forward="false" selection-start-line="45" selection-start-column="28" selection-end-line="45" selection-end-column="28" />
<folding />
</state>
</provider>
......
......@@ -14,6 +14,7 @@ var mytoons = require('./routes/mytoons');
var passport = require('passport');
var setting = require('./routes/setting');
var session = require('express-session');
var toonviewer = require('./routes/toonviewer')
passport.serializeUser(function(user, done) {
console.log('serialized');
......@@ -58,6 +59,7 @@ app.use('/', index);
app.use('/users', users);
app.use('/mytoons', mytoons);
app.use('/setting', setting);
app.use('/toonviewer', toonviewer);
//app.use(express.static('views'));
......
......@@ -32,7 +32,7 @@ function getUpdatedToons(cb){
}
function getMyToons(id,cb){
var sqlquery = 'SELECT name, thum_link, webtoon_link, week, last, latest FROM user u, user_toon_relation ur, toon t WHERE u.id=? && u.id=ur.user_id && t.toon_index=ur.toon_index;';
var sqlquery = 'SELECT name, thum_link, webtoon_link, week, last, latest, t.toon_index AS toon_index FROM user u, user_toon_relation ur, toon t WHERE u.id=? && u.id=ur.user_id && t.toon_index=ur.toon_index;';
var mylist = new Array();
connection.query(sqlquery,id,function(err,rows,result){
if(!err){
......@@ -40,7 +40,7 @@ function getMyToons(id,cb){
cb(mylist);
}else{
console.log("내 웹툰 리스트 가져오는데 실패했습니다!");
throw err;
//throw err;
}
});
}
......
var express = require('express');
var router = express.Router();
var request = require('request');
var cheerio = require('cheerio');
var async = require('async');
function updateLastWebtoon(toon_index, user_id, num,cb){
var sql_query = "UPDATE user_toon_relation SET last=? WHERE user_id=? && toon_index=?";
connection.query(sql_query,[num, user_id,toon_index],function(err){
if(!err){
cb();
}
});
}
function getToonImages(toon_index, num, cb){
var imageList = [];
var toonUrl = "http://comic.naver.com/webtoon/detail.nhn?titleId=" + toon_index + "&no=" + num;
request(toonUrl, function(err, res, html){
if(!err){
var $ = cheerio.load(html);
var p = Promise.resolve();
var eachs = $("div.wt_viewer > img").each(function(index, element) {
p = p.then(function() {
var toonHref = $(element).attr('src');
imageList.push(toonHref);
});
});
p.then(function(){
cb(imageList);
});
}else{
console.log("웹툰 이미지 못가져왔습니다.");
}
});
}
router.get('/:toon_index/:num',function(req,res){
if(!req.isAuthenticated()){
res.redirect('/');
return;
}
updateLastWebtoon(req.params.toon_index, req.user.user_id, req.params.num, function(){
var toonUrl = "http://comic.naver.com/webtoon/detail.nhn?titleId=" + req.params.toon_index + "&no=" + req.params.num;
res.redirect(toonUrl);
/*
getToonImages(req.params.toon_index, req.params.num, function(imageList){
res.render('toonviewer',{
title: "zzz",
images: imageList
});
});
*/
})
});
module.exports = router;
\ No newline at end of file
......@@ -27,11 +27,8 @@
</head>
<h1>내툰</h1>
<p>추가한 리스트</p>
<a href="/auth/logout/kakao">로그아웃</a>
<a href="/setting/">세팅</a>
</br>
<table>
<tr>
<th>썸네일</th>
......@@ -44,11 +41,10 @@
%><tr>
<td class="toon_thumbnail"><image src="<%= mytoons[i].thum_link%>"/></td>
<td class="toon_name"><%= mytoons[i].name %></td>
<td class="toon_last"><%= mytoons[i].last %>화</td>
<td class="toon_next"><%= mytoons[i].last +1 %>화</td>
<td class="toon_latest"><%= mytoons[i].latest %>화</td>
<td class="toon_last"><a href="/toonviewer/<%= mytoons[i].toon_index %>/<%= mytoons[i].last %>"><%= mytoons[i].last %>화</a></td>
<td class="toon_next"><% if(mytoons[i].last+1 <= mytoons[i].latest){ %> <a href="/toonviewer/<%= mytoons[i].toon_index %>/<%= mytoons[i].last+1 %>"><%= mytoons[i].last +1 %>화</a><% } %></td>
<td class="toon_latest"><a href="/toonviewer/<%= mytoons[i].toon_index %>/<%= mytoons[i].latest %>"><%= mytoons[i].latest %>화</a></td>
</tr>
<br>
<% } %>
</table>
......
......@@ -11,7 +11,7 @@
</head>
<h1>내툰</h1>
<p>추가하거나 제거할 웹툰을 선택해주세요.</p>
<a href="/mytoons">뒤로</a>
<table>
<%
var current = "";
......
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title><%= title %></title>
</head>
<body>
<%
for(image in images){
%>
<img src="<%= images[image] %>" alt=""/>
<%
}
%>
</body>
</html>
\ No newline at end of file