/
libReq.js
executable file
·57 lines (42 loc) · 1.39 KB
/
libReq.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
"use strict"
/******************************************************************************
* reqIndex
******************************************************************************/
app.reqIndex=async function() {
var {req, res}=this;
var Str=[];
Str.push(`<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<meta name='viewport' id='viewportMy' content='initial-scale=1'/>
<script type="module" src="client.js"></script>
<script>
var leafLoginBack=${JSON.stringify(leafLoginBack)};
var leafBE=${JSON.stringify(leafBE)};
var uRedir=${JSON.stringify(uRedir)};
var AppId=${JSON.stringify(AppId)};
var UrlOAuth=${JSON.stringify(UrlOAuth)};
</script>
</head>
<body>
</body></html>`);
var str=Str.join('\n'); res.writeHead(200, "OK", {'Content-Type': 'text/html'}); res.end(str);
}
/******************************************************************************
* reqLoginBack
******************************************************************************/
app.reqLoginBack=async function() {
var {req, res}=this;
var str=`<!DOCTYPE html>
<html lang="en"><head><meta name="robots" content="noindex"></head>
<body>
<script>
var {search:strQS, hash:strHash}=location;
window.opener.loginReturn(strQS,strHash);
window.close();
</script>
</body>
</html>`;
res.writeHead(200, "OK", {'Content-Type': 'text/html'}); res.end(str);
}