Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
srvpro
Commits
e1b0a06d
Commit
e1b0a06d
authored
Mar 27, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support ssl for all dashboards
parent
820ce5ca
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
10 deletions
+52
-10
ygopro-pre.js
ygopro-pre.js
+17
-3
ygopro-tournament.js
ygopro-tournament.js
+18
-4
ygopro-update.js
ygopro-update.js
+17
-3
No files found.
ygopro-pre.js
View file @
e1b0a06d
...
...
@@ -8,6 +8,7 @@
TODO:带参数运行时执行对应操作后退出
*/
var
http
=
require
(
'
http
'
);
var
https
=
require
(
'
https
'
);
var
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
var
fs
=
require
(
'
fs
'
);
var
execSync
=
require
(
'
child_process
'
).
execSync
;
...
...
@@ -22,7 +23,8 @@ var auth = require('./ygopro-auth.js');
var
constants
=
loadJSON
(
'
./data/constants.json
'
);
var
settings
=
loadJSON
(
'
./config/config.json
'
);
config
=
settings
.
modules
.
pre_util
;
config
=
settings
.
modules
.
pre_util
;
ssl_config
=
settings
.
modules
.
http
.
ssl
;
//全卡HTML列表
var
cardHTMLs
=
[];
...
...
@@ -403,7 +405,7 @@ var packDatas = function () {
}
//建立一个http服务器,接收API操作
http
.
createServer
(
function
(
req
,
res
)
{
function
requestListener
(
req
,
res
)
{
var
u
=
url
.
parse
(
req
.
url
,
true
);
if
(
!
auth
.
auth
(
u
.
query
.
username
,
u
.
query
.
password
,
"
pre_dashboard
"
,
"
pre_dashboard
"
))
{
...
...
@@ -463,4 +465,16 @@ http.createServer(function (req, res) {
res
.
end
(
"
400
"
);
}
}).
listen
(
config
.
port
);
}
if
(
ssl_config
.
enabled
)
{
const
ssl_cert
=
fs
.
readFileSync
(
ssl_config
.
cert
);
const
ssl_key
=
fs
.
readFileSync
(
ssl_config
.
key
);
const
options
=
{
cert
:
ssl_cert
,
key
:
ssl_key
}
https
.
createServer
(
options
,
requestListener
).
listen
(
config
.
port
);
}
else
{
http
.
createServer
(
requestListener
).
listen
(
config
.
port
);
}
ygopro-tournament.js
View file @
e1b0a06d
...
...
@@ -7,6 +7,7 @@
不带参数运行时,会建立一个服务器,调用API执行对应操作
*/
var
http
=
require
(
'
http
'
);
var
https
=
require
(
'
https
'
);
var
fs
=
require
(
'
fs
'
);
var
url
=
require
(
'
url
'
);
var
request
=
require
(
'
request
'
);
...
...
@@ -19,8 +20,9 @@ var loadJSON = require('load-json-file').sync;
var
auth
=
require
(
'
./ygopro-auth.js
'
);
var
settings
=
loadJSON
(
'
./config/config.json
'
);
config
=
settings
.
modules
.
tournament_mode
;
challonge_config
=
settings
.
modules
.
challonge
;
config
=
settings
.
modules
.
tournament_mode
;
challonge_config
=
settings
.
modules
.
challonge
;
ssl_config
=
settings
.
modules
.
http
.
ssl
;
var
challonge
;
if
(
challonge_config
.
enabled
)
{
...
...
@@ -214,7 +216,7 @@ var receiveDecks = function(files) {
}
//建立一个http服务器,接收API操作
http
.
createServer
(
function
(
req
,
res
)
{
function
requestListener
(
req
,
res
)
{
var
u
=
url
.
parse
(
req
.
url
,
true
);
/*if (u.query.password !== config.password) {
...
...
@@ -315,4 +317,16 @@ http.createServer(function (req, res) {
res
.
end
(
"
400
"
);
}
}).
listen
(
config
.
port
);
}
if
(
ssl_config
.
enabled
)
{
const
ssl_cert
=
fs
.
readFileSync
(
ssl_config
.
cert
);
const
ssl_key
=
fs
.
readFileSync
(
ssl_config
.
key
);
const
options
=
{
cert
:
ssl_cert
,
key
:
ssl_key
}
https
.
createServer
(
options
,
requestListener
).
listen
(
config
.
port
);
}
else
{
http
.
createServer
(
requestListener
).
listen
(
config
.
port
);
}
ygopro-update.js
View file @
e1b0a06d
...
...
@@ -8,6 +8,7 @@
TODO:带参数运行时执行对应操作后退出
*/
var
http
=
require
(
'
http
'
);
var
https
=
require
(
'
https
'
);
var
sqlite3
=
require
(
'
sqlite3
'
).
verbose
();
var
fs
=
require
(
'
fs
'
);
var
execSync
=
require
(
'
child_process
'
).
execSync
;
...
...
@@ -23,7 +24,8 @@ var auth = require('./ygopro-auth.js');
var
constants
=
loadJSON
(
'
./data/constants.json
'
);
var
settings
=
loadJSON
(
'
./config/config.json
'
);
config
=
settings
.
modules
.
update_util
;
config
=
settings
.
modules
.
update_util
;
ssl_config
=
settings
.
modules
.
http
.
ssl
;
//全卡名称列表
var
cardNames
=
{};
...
...
@@ -208,7 +210,7 @@ var pushHTMLs = function() {
//建立一个http服务器,接收API操作
http
.
createServer
(
function
(
req
,
res
)
{
function
requestListener
(
req
,
res
)
{
var
u
=
url
.
parse
(
req
.
url
,
true
);
if
(
!
auth
.
auth
(
u
.
query
.
username
,
u
.
query
.
password
,
"
update_dashboard
"
,
"
update_dashboard
"
))
{
...
...
@@ -271,4 +273,16 @@ http.createServer(function (req, res) {
res
.
end
(
"
400
"
);
}
}).
listen
(
config
.
port
);
}
if
(
ssl_config
.
enabled
)
{
const
ssl_cert
=
fs
.
readFileSync
(
ssl_config
.
cert
);
const
ssl_key
=
fs
.
readFileSync
(
ssl_config
.
key
);
const
options
=
{
cert
:
ssl_cert
,
key
:
ssl_key
}
https
.
createServer
(
options
,
requestListener
).
listen
(
config
.
port
);
}
else
{
http
.
createServer
(
requestListener
).
listen
(
config
.
port
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment