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
0129e335
Commit
0129e335
authored
Jan 23, 2026
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix config type thing & srvpro http URL api
parent
88310c2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
25 deletions
+27
-25
ygopro-server.coffee
ygopro-server.coffee
+5
-2
ygopro-server.js
ygopro-server.js
+8
-5
ygopro-tournament.js
ygopro-tournament.js
+4
-7
ygopro-tournament.ts
ygopro-tournament.ts
+10
-11
No files found.
ygopro-server.coffee
View file @
0129e335
# 标准库
# 标准库
net
=
require
'net'
net
=
require
'net'
http
=
require
'http'
http
=
require
'http'
url
=
require
'url'
path
=
require
'path'
path
=
require
'path'
fs
=
require
'fs'
fs
=
require
'fs'
os
=
require
'os'
os
=
require
'os'
...
@@ -3847,7 +3846,11 @@ if true
...
@@ -3847,7 +3846,11 @@ if true
httpRequestListener
=
(
request
,
response
)
->
httpRequestListener
=
(
request
,
response
)
->
parseQueryString
=
true
parseQueryString
=
true
u
=
url
.
parse
(
request
.
url
,
parseQueryString
)
base
=
"http://
#{
request
.
headers
.
host
or
'localhost'
}
"
urlObj
=
new
URL
(
request
.
url
,
base
)
u
=
pathname
:
urlObj
.
pathname
query
:
Object
.
fromEntries
(
urlObj
.
searchParams
)
#pass_validated = u.query.pass == settings.modules.http.password
#pass_validated = u.query.pass == settings.modules.http.password
# Allow all CORS + PNA (Private Network Access) requests.
# Allow all CORS + PNA (Private Network Access) requests.
...
...
ygopro-server.js
View file @
0129e335
// Generated by CoffeeScript 2.7.0
// Generated by CoffeeScript 2.7.0
(
function
()
{
(
function
()
{
// 标准库
// 标准库
var
Aragami
,
CLIENT_get_absolute_pos
,
CLIENT_get_authorize_key
,
CLIENT_get_kick_reconnect_target
,
CLIENT_get_partner
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_kick_reconnect
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_banned_by_mc
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_kick_reconnect
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_replays
,
CLIENT_send_replays_and_kick
,
CLIENT_set_ip
,
PQueue
,
Q
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_pid
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_kick
,
ROOM_player_flee
,
ROOM_player_get_score
,
ROOM_player_lose
,
ROOM_player_win
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
ReplayParser
,
ResolveData
,
Room
,
SERVER_clear_disconnect
,
SERVER_kick
,
SOCKET_flush_data
,
YGOProDeck
,
_
,
_async
,
addCallback
,
aragami
,
aragami_classes
,
athleticChecker
,
auth
,
axios
,
badwordR
,
badwords
,
ban_user
,
bunyan
,
call_match_api
,
challonge
,
checkFileExists
,
createDirectoryIfNotExists
,
crypto
,
dataManager
,
deck_name_match
,
dialogues
,
disconnect_list
,
exec
,
execFile
,
extra_mode_list
,
fs
,
geoip
,
getDuelLogQueryFromQs
,
getRealIp
,
get_memory_usage
,
http
,
httpRequestListener
,
importOldConfig
,
import_datas
,
init
,
ip6addr
,
isTrustedProxy
,
lflists
,
loadJSON
,
loadJSONAsync
,
loadLFList
,
loadRemoteData
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
memory_usage
,
merge
,
moment
,
moment_long_ago_string
,
moment_now
,
moment_now_string
,
msg_polyfill
,
neosRequestListener
,
net
,
netRequestHandler
,
os
,
osu
,
path
,
qs
,
real_windbot_server_ip
,
release_disconnect
,
report_to_big_brother
,
request
,
roomlist
,
rooms_count
,
setting_change
,
setting_get
,
setting_save
,
settings
,
spawn
,
spawnSync
,
spawn_windbot
,
tips
,
toIpv4
,
toIpv6
,
u
rl
,
u
til
,
utility
,
wait_room_start
,
wait_room_start_arena
,
windbot_looplimit
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
var
Aragami
,
CLIENT_get_absolute_pos
,
CLIENT_get_authorize_key
,
CLIENT_get_kick_reconnect_target
,
CLIENT_get_partner
,
CLIENT_heartbeat_register
,
CLIENT_heartbeat_unregister
,
CLIENT_import_data
,
CLIENT_is_able_to_kick_reconnect
,
CLIENT_is_able_to_reconnect
,
CLIENT_is_banned_by_mc
,
CLIENT_is_player
,
CLIENT_kick
,
CLIENT_kick_reconnect
,
CLIENT_pre_reconnect
,
CLIENT_reconnect
,
CLIENT_reconnect_register
,
CLIENT_reconnect_unregister
,
CLIENT_send_pre_reconnect_info
,
CLIENT_send_reconnect_info
,
CLIENT_send_replays
,
CLIENT_send_replays_and_kick
,
CLIENT_set_ip
,
PQueue
,
Q
,
ROOM_all
,
ROOM_bad_ip
,
ROOM_ban_player
,
ROOM_clear_disconnect
,
ROOM_connected_ip
,
ROOM_find_by_name
,
ROOM_find_by_pid
,
ROOM_find_by_port
,
ROOM_find_by_title
,
ROOM_find_or_create_ai
,
ROOM_find_or_create_by_name
,
ROOM_find_or_create_random
,
ROOM_kick
,
ROOM_player_flee
,
ROOM_player_get_score
,
ROOM_player_lose
,
ROOM_player_win
,
ROOM_players_oppentlist
,
ROOM_unwelcome
,
ROOM_validate
,
ReplayParser
,
ResolveData
,
Room
,
SERVER_clear_disconnect
,
SERVER_kick
,
SOCKET_flush_data
,
YGOProDeck
,
_
,
_async
,
addCallback
,
aragami
,
aragami_classes
,
athleticChecker
,
auth
,
axios
,
badwordR
,
badwords
,
ban_user
,
bunyan
,
call_match_api
,
challonge
,
checkFileExists
,
createDirectoryIfNotExists
,
crypto
,
dataManager
,
deck_name_match
,
dialogues
,
disconnect_list
,
exec
,
execFile
,
extra_mode_list
,
fs
,
geoip
,
getDuelLogQueryFromQs
,
getRealIp
,
get_memory_usage
,
http
,
httpRequestListener
,
importOldConfig
,
import_datas
,
init
,
ip6addr
,
isTrustedProxy
,
lflists
,
loadJSON
,
loadJSONAsync
,
loadLFList
,
loadRemoteData
,
load_dialogues
,
load_tips
,
log
,
long_resolve_cards
,
memory_usage
,
merge
,
moment
,
moment_long_ago_string
,
moment_now
,
moment_now_string
,
msg_polyfill
,
neosRequestListener
,
net
,
netRequestHandler
,
os
,
osu
,
path
,
qs
,
real_windbot_server_ip
,
release_disconnect
,
report_to_big_brother
,
request
,
roomlist
,
rooms_count
,
setting_change
,
setting_get
,
setting_save
,
settings
,
spawn
,
spawnSync
,
spawn_windbot
,
tips
,
toIpv4
,
toIpv6
,
util
,
utility
,
wait_room_start
,
wait_room_start_arena
,
windbot_looplimit
,
windbot_process
,
windbots
,
ygopro
,
zlib
;
net
=
require
(
'
net
'
);
net
=
require
(
'
net
'
);
http
=
require
(
'
http
'
);
http
=
require
(
'
http
'
);
url
=
require
(
'
url
'
);
path
=
require
(
'
path
'
);
path
=
require
(
'
path
'
);
fs
=
require
(
'
fs
'
);
fs
=
require
(
'
fs
'
);
...
@@ -5164,9 +5162,14 @@
...
@@ -5164,9 +5162,14 @@
return
callback
+
"
(
"
+
text
+
"
);
"
;
return
callback
+
"
(
"
+
text
+
"
);
"
;
};
};
httpRequestListener
=
async
function
(
request
,
response
)
{
httpRequestListener
=
async
function
(
request
,
response
)
{
var
allowHeaders
,
archiveStream
,
b
uffer
,
death_room_found
,
duellog
,
e
,
err
,
error
,
filename
,
getpath
,
parseQueryString
,
pass_validated
,
requestHeaders
,
roomsjson
,
success
,
u
;
var
allowHeaders
,
archiveStream
,
b
ase
,
buffer
,
death_room_found
,
duellog
,
e
,
err
,
error
,
filename
,
getpath
,
parseQueryString
,
pass_validated
,
requestHeaders
,
roomsjson
,
success
,
u
,
urlObj
;
parseQueryString
=
true
;
parseQueryString
=
true
;
u
=
url
.
parse
(
request
.
url
,
parseQueryString
);
base
=
`http://
${
request
.
headers
.
host
||
'
localhost
'
}
`
;
urlObj
=
new
URL
(
request
.
url
,
base
);
u
=
{
pathname
:
urlObj
.
pathname
,
query
:
Object
.
fromEntries
(
urlObj
.
searchParams
)
};
//pass_validated = u.query.pass == settings.modules.http.password
//pass_validated = u.query.pass == settings.modules.http.password
// Allow all CORS + PNA (Private Network Access) requests.
// Allow all CORS + PNA (Private Network Access) requests.
...
...
ygopro-tournament.js
View file @
0129e335
...
@@ -63,7 +63,7 @@ const challonge = new challonge_1.Challonge(challonge_config);
...
@@ -63,7 +63,7 @@ const challonge = new challonge_1.Challonge(challonge_config);
const
ssl_config
=
settings
.
modules
.
http
.
ssl
;
const
ssl_config
=
settings
.
modules
.
http
.
ssl
;
//http长连接
//http长连接
let
responder
;
let
responder
;
config
.
wallpapers
=
[
""
];
let
wallpapers
=
[{
url
:
""
,
desc
:
""
}
];
axios_1
.
default
axios_1
.
default
.
get
(
"
http://www.bing.com/HPImageArchive.aspx
"
,
{
.
get
(
"
http://www.bing.com/HPImageArchive.aspx
"
,
{
params
:
{
params
:
{
...
@@ -82,14 +82,14 @@ axios_1.default
...
@@ -82,14 +82,14 @@ axios_1.default
console
.
log
(
"
wallpapers error
"
,
null
,
response
);
console
.
log
(
"
wallpapers error
"
,
null
,
response
);
}
}
else
{
else
{
config
.
wallpapers
=
[];
wallpapers
=
[];
for
(
const
i
in
body
.
images
)
{
for
(
const
i
in
body
.
images
)
{
const
wallpaper
=
body
.
images
[
i
];
const
wallpaper
=
body
.
images
[
i
];
const
img
=
{
const
img
=
{
url
:
"
http://s.cn.bing.net
"
+
wallpaper
.
urlbase
+
"
_768x1366.jpg
"
,
url
:
"
http://s.cn.bing.net
"
+
wallpaper
.
urlbase
+
"
_768x1366.jpg
"
,
desc
:
wallpaper
.
copyright
,
desc
:
wallpaper
.
copyright
,
};
};
config
.
wallpapers
.
push
(
img
);
wallpapers
.
push
(
img
);
}
}
}
}
})
})
...
@@ -301,10 +301,7 @@ async function requestListener(req, res) {
...
@@ -301,10 +301,7 @@ async function requestListener(req, res) {
return
;
return
;
}
}
res
.
writeHead
(
200
);
res
.
writeHead
(
200
);
res
.
end
(
u
.
query
.
callback
+
res
.
end
(
u
.
query
.
callback
+
"
(
"
+
JSON
.
stringify
(
wallpapers
[
Math
.
floor
(
Math
.
random
()
*
wallpapers
.
length
)])
+
"
);
"
);
"
(
"
+
JSON
.
stringify
(
config
.
wallpapers
[
Math
.
floor
(
Math
.
random
()
*
config
.
wallpapers
.
length
)])
+
"
);
"
);
}
}
else
if
(
u
.
pathname
===
"
/api/get_decks
"
)
{
else
if
(
u
.
pathname
===
"
/api/get_decks
"
)
{
if
(
!
(
await
auth
.
auth
(
u
.
query
.
username
,
u
.
query
.
password
,
"
deck_dashboard_read
"
,
"
get_decks
"
)))
{
if
(
!
(
await
auth
.
auth
(
u
.
query
.
username
,
u
.
query
.
password
,
"
deck_dashboard_read
"
,
"
get_decks
"
)))
{
...
...
ygopro-tournament.ts
View file @
0129e335
...
@@ -13,22 +13,24 @@ import * as url from "url";
...
@@ -13,22 +13,24 @@ import * as url from "url";
import
axios
from
"
axios
"
;
import
axios
from
"
axios
"
;
import
*
as
formidable
from
"
formidable
"
;
import
*
as
formidable
from
"
formidable
"
;
import
{
sync
as
loadJSON
}
from
"
load-json-file
"
;
import
{
sync
as
loadJSON
}
from
"
load-json-file
"
;
import
defaultConfig
from
"
./data/default_config.json
"
;
import
{
Challonge
}
from
"
./challonge
"
;
import
{
Challonge
}
from
"
./challonge
"
;
import
*
as
asyncLib
from
"
async
"
;
import
*
as
asyncLib
from
"
async
"
;
import
YGOProDeckEncode
from
"
ygopro-deck-encode
"
;
import
YGOProDeckEncode
from
"
ygopro-deck-encode
"
;
import
*
as
auth
from
"
./ygopro-auth
"
;
import
*
as
auth
from
"
./ygopro-auth
"
;
import
_
from
"
underscore
"
;
import
_
from
"
underscore
"
;
const
settings
=
loadJSON
(
"
./config/config.json
"
)
as
any
;
type
Settings
=
typeof
defaultConfig
;
const
config
=
settings
.
modules
.
tournament_mode
as
any
;
const
settings
=
loadJSON
(
"
./config/config.json
"
)
as
Settings
;
const
challonge_config
=
settings
.
modules
.
challonge
as
any
;
const
config
=
settings
.
modules
.
tournament_mode
;
const
challonge_config
=
settings
.
modules
.
challonge
;
const
challonge
=
new
Challonge
(
challonge_config
);
const
challonge
=
new
Challonge
(
challonge_config
);
const
ssl_config
=
settings
.
modules
.
http
.
ssl
as
any
;
const
ssl_config
=
settings
.
modules
.
http
.
ssl
;
//http长连接
//http长连接
let
responder
:
http
.
ServerResponse
|
null
;
let
responder
:
http
.
ServerResponse
|
null
;
config
.
wallpapers
=
[
""
];
let
wallpapers
:
Array
<
{
url
:
string
;
desc
:
string
}
>
=
[{
url
:
""
,
desc
:
""
}
];
axios
axios
.
get
(
"
http://www.bing.com/HPImageArchive.aspx
"
,
{
.
get
(
"
http://www.bing.com/HPImageArchive.aspx
"
,
{
params
:
{
params
:
{
...
@@ -45,14 +47,14 @@ axios
...
@@ -45,14 +47,14 @@ axios
}
else
if
(
!
body
)
{
}
else
if
(
!
body
)
{
console
.
log
(
"
wallpapers error
"
,
null
,
response
);
console
.
log
(
"
wallpapers error
"
,
null
,
response
);
}
else
{
}
else
{
config
.
wallpapers
=
[];
wallpapers
=
[];
for
(
const
i
in
body
.
images
)
{
for
(
const
i
in
body
.
images
)
{
const
wallpaper
=
body
.
images
[
i
];
const
wallpaper
=
body
.
images
[
i
];
const
img
=
{
const
img
=
{
url
:
"
http://s.cn.bing.net
"
+
wallpaper
.
urlbase
+
"
_768x1366.jpg
"
,
url
:
"
http://s.cn.bing.net
"
+
wallpaper
.
urlbase
+
"
_768x1366.jpg
"
,
desc
:
wallpaper
.
copyright
,
desc
:
wallpaper
.
copyright
,
};
};
config
.
wallpapers
.
push
(
img
);
wallpapers
.
push
(
img
);
}
}
}
}
})
})
...
@@ -295,10 +297,7 @@ async function requestListener(req: http.IncomingMessage, res: http.ServerRespon
...
@@ -295,10 +297,7 @@ async function requestListener(req: http.IncomingMessage, res: http.ServerRespon
}
}
res
.
writeHead
(
200
);
res
.
writeHead
(
200
);
res
.
end
(
res
.
end
(
u
.
query
.
callback
+
u
.
query
.
callback
+
"
(
"
+
JSON
.
stringify
(
wallpapers
[
Math
.
floor
(
Math
.
random
()
*
wallpapers
.
length
)])
+
"
);
"
"
(
"
+
JSON
.
stringify
(
config
.
wallpapers
[
Math
.
floor
(
Math
.
random
()
*
config
.
wallpapers
.
length
)])
+
"
);
"
);
);
}
else
if
(
u
.
pathname
===
"
/api/get_decks
"
)
{
}
else
if
(
u
.
pathname
===
"
/api/get_decks
"
)
{
if
(
!
(
await
auth
.
auth
(
u
.
query
.
username
as
string
,
u
.
query
.
password
as
string
,
"
deck_dashboard_read
"
,
"
get_decks
"
)))
{
if
(
!
(
await
auth
.
auth
(
u
.
query
.
username
as
string
,
u
.
query
.
password
as
string
,
"
deck_dashboard_read
"
,
"
get_decks
"
)))
{
...
...
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