Toggle navigation
Toggle navigation
This project
Loading...
Sign in
HyeonJun Jeon
/
Extended-Calendar
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
박시진
2022-06-05 06:57:23 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1367d540f455723073c2141a968140286fc7e360
1367d540
1 parent
2e83e2c6
[Modify]Response&/Global Object
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
18 deletions
server/libs/E_Campus.js
server/routers/login.js
server/libs/E_Campus.js
View file @
1367d54
...
...
@@ -4,7 +4,7 @@ Info = {
id
:
"null"
,
pw
:
"null"
,
peed
:
"null"
,
subjects
:
[]
subjects
:
{}
}
function
setTimeoutPromise
(
ms
)
{
...
...
@@ -63,7 +63,10 @@ async function login(id, pw) {
Info
.
pw
=
pw
;
})
await
page
.
goto
(
"https://khcanvas.khu.ac.kr/"
);
return
page
;
page
=
await
getPeed
(
page
);
await
getSubjects
(
page
);
await
browser
.
close
();
return
Info
;
}
}
catch
(
err
)
{
console
.
log
(
err
);
...
...
@@ -123,6 +126,10 @@ async function getSubjects(page) {
// promise1.then(value => {
// Info.data = value;
// })
const
promise3
=
Promise
.
resolve
(
data
);
promise3
.
then
(
value
=>
{
Info
.
subjects
=
value
;
})
return
data
;
}
...
...
@@ -152,23 +159,20 @@ async function getOne(page, index) {
//}
// if your account is incorrect, value = [ '', '', 'Incorrect user ID or password.' ]
//
exports.login = login;
exports
.
login
=
login
;
// exports.getPeed = getPeed;
// exports.getSubjects = getSubjects;
//console test
async
function
runrun
()
{
page
=
await
login
(
"lorem"
,
"lorem"
);
await
getPeed
(
page
);
// await getPeed(page).then((value => {
// console.log(value.link);
// }));
// await getSubjects(page);
console
.
log
(
Info
);
// async function runrun() {
// page = await login("lorem", "lorem");
// await getPeed(page);
// await getSubjects(page);
// console.log(Info);
}
runrun
();
//
}
//
runrun();
...
...
server/routers/login.js
View file @
1367d54
...
...
@@ -5,16 +5,16 @@ const { getPeed, getSubjects, login } = require("../libs/E_Campus.js");
router
.
post
(
"/"
,
async
(
req
,
res
)
=>
{
console
.
log
(
`listened /login
${
req
.
body
.
id
}
${
req
.
body
.
pw
}
`
);
const
page
=
await
login
(
req
.
body
.
id
,
req
.
body
.
pw
);
if
(
page
)
{
const
Info
=
await
login
(
req
.
body
.
id
,
req
.
body
.
pw
);
if
(
Info
.
id
!=
"null"
)
{
try
{
const
peed
=
await
getPeed
(
page
);
res
.
send
(
peed
);
//
const peed = await getPeed(page);
res
.
send
(
"success"
);
}
catch
(
e
)
{
console
.
log
(
e
);
res
.
send
(
"error"
);
}
}
else
res
.
send
(
"
login
failed"
);
}
else
res
.
send
(
"failed"
);
});
module
.
exports
=
router
;
...
...
Please
register
or
login
to post a comment