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
724d5a87
Commit
724d5a87
authored
Jul 24, 2019
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tcg_random
parents
82c5518b
0034cd03
Changes
8
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
484 additions
and
274 deletions
+484
-274
.dockerignore
.dockerignore
+37
-0
.gitignore
.gitignore
+1
-0
data/default_config.json
data/default_config.json
+3
-1
ygopro-server.coffee
ygopro-server.coffee
+140
-108
ygopro-server.js
ygopro-server.js
+176
-117
ygopro-tournament.js
ygopro-tournament.js
+1
-3
ygopro.coffee
ygopro.coffee
+45
-16
ygopro.js
ygopro.js
+81
-29
No files found.
.dockerignore
View file @
724d5a87
# ignore
jsconfig.json
coffeelint.json
.vscode/
password.json
config.*.json
config.user.bak
/bak
/config
/ygopro
/windbot
/decks
/decks_save*
/replays
/node_modules
/ssl
/ygosrv233
/challonge
/logs
/plugins
test*
*.heapsnapshot
*.tmp
*.bak
*.log
*.map
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
.DS_Store
.git*
.git*
.dockerignore
.dockerignore
Dockerfile*
Dockerfile*
...
...
.gitignore
View file @
724d5a87
...
@@ -24,6 +24,7 @@ ygopro-2pick
...
@@ -24,6 +24,7 @@ ygopro-2pick
/ygosrv233
/ygosrv233
/challonge
/challonge
/logs
/logs
/plugins
test*
test*
*.heapsnapshot
*.heapsnapshot
...
...
data/default_config.json
View file @
724d5a87
...
@@ -143,7 +143,9 @@
...
@@ -143,7 +143,9 @@
"post_detailed_score"
:
true
,
"post_detailed_score"
:
true
,
"post_score_midduel"
:
true
,
"post_score_midduel"
:
true
,
"cache_ttl"
:
60000
,
"cache_ttl"
:
60000
,
"api_key"
:
"123"
,
"options"
:
{
"apiKey"
:
"123"
},
"tournament_id"
:
"456"
,
"tournament_id"
:
"456"
,
"use_custom_module"
:
false
"use_custom_module"
:
false
},
},
...
...
ygopro-server.coffee
View file @
724d5a87
This diff is collapsed.
Click to expand it.
ygopro-server.js
View file @
724d5a87
This diff is collapsed.
Click to expand it.
ygopro-tournament.js
View file @
724d5a87
...
@@ -26,9 +26,7 @@ ssl_config = settings.modules.http.ssl;
...
@@ -26,9 +26,7 @@ ssl_config = settings.modules.http.ssl;
var
challonge
;
var
challonge
;
if
(
challonge_config
.
enabled
)
{
if
(
challonge_config
.
enabled
)
{
challonge
=
require
(
'
challonge
'
).
createClient
({
challonge
=
require
(
'
challonge
'
).
createClient
(
challonge_config
.
options
);
apiKey
:
challonge_config
.
api_key
});
}
}
//http长连接
//http长连接
...
...
ygopro.coffee
View file @
724d5a87
...
@@ -37,26 +37,55 @@ for name, declaration of structs_declaration
...
@@ -37,26 +37,55 @@ for name, declaration of structs_declaration
#消息跟踪函数 需要重构, 另暂时只支持异步, 同步没做.
#消息跟踪函数 需要重构, 另暂时只支持异步, 同步没做.
@
stoc_follows
=
{}
@
stoc_follows
=
{}
@
stoc_follows_before
=
{}
@
stoc_follows_after
=
{}
@
ctos_follows
=
{}
@
ctos_follows
=
{}
@
stoc_follow
=
(
proto
,
synchronous
,
callback
)
->
@
ctos_follows_before
=
{}
if
typeof
proto
==
'string'
@
ctos_follows_after
=
{}
for
key
,
value
of
@
constants
.
STOC
@
replace_proto
=
(
proto
,
tp
)
->
if
typeof
(
proto
)
!=
"string"
return
proto
changed_proto
=
proto
for
key
,
value
of
@
constants
[
tp
]
if
value
==
proto
if
value
==
proto
proto
=
key
changed_
proto
=
key
break
break
throw
"unknown proto"
if
!
@
constants
.
STOC
[
proto
]
throw
"unknown proto"
if
!
@
constants
[
tp
][
changed_proto
]
@
stoc_follows
[
proto
]
=
{
callback
:
callback
,
synchronous
:
synchronous
}
return
changed_proto
@
stoc_follow
=
(
proto
,
synchronous
,
callback
)
->
changed_proto
=
@
replace_proto
(
proto
,
"STOC"
)
@
stoc_follows
[
changed_proto
]
=
{
callback
:
callback
,
synchronous
:
synchronous
}
return
@
stoc_follow_before
=
(
proto
,
synchronous
,
callback
)
->
changed_proto
=
@
replace_proto
(
proto
,
"STOC"
)
if
!
@
stoc_follows_before
[
changed_proto
]
@
stoc_follows_before
[
changed_proto
]
=
[]
@
stoc_follows_before
[
changed_proto
].
push
({
callback
:
callback
,
synchronous
:
synchronous
})
return
@
stoc_follow_after
=
(
proto
,
synchronous
,
callback
)
->
changed_proto
=
@
replace_proto
(
proto
,
"STOC"
)
if
!
@
stoc_follows_after
[
changed_proto
]
@
stoc_follows_after
[
changed_proto
]
=
[]
@
stoc_follows_after
[
changed_proto
].
push
({
callback
:
callback
,
synchronous
:
synchronous
})
return
return
@
ctos_follow
=
(
proto
,
synchronous
,
callback
)
->
@
ctos_follow
=
(
proto
,
synchronous
,
callback
)
->
if
typeof
proto
==
'string'
changed_proto
=
@
replace_proto
(
proto
,
"CTOS"
)
for
key
,
value
of
@
constants
.
CTOS
@
ctos_follows
[
changed_proto
]
=
{
callback
:
callback
,
synchronous
:
synchronous
}
if
value
==
proto
return
proto
=
key
@
ctos_follow_before
=
(
proto
,
synchronous
,
callback
)
->
break
changed_proto
=
@
replace_proto
(
proto
,
"CTOS"
)
throw
"unknown proto"
if
!
@
constants
.
CTOS
[
proto
]
if
!
@
ctos_follows_before
[
changed_proto
]
@
ctos_follows
[
proto
]
=
{
callback
:
callback
,
synchronous
:
synchronous
}
@
ctos_follows_before
[
changed_proto
]
=
[]
@
ctos_follows_before
[
changed_proto
].
push
({
callback
:
callback
,
synchronous
:
synchronous
})
return
@
ctos_follow_after
=
(
proto
,
synchronous
,
callback
)
->
changed_proto
=
@
replace_proto
(
proto
,
"CTOS"
)
if
!
@
ctos_follows_after
[
changed_proto
]
@
ctos_follows_after
[
changed_proto
]
=
[]
@
ctos_follows_after
[
changed_proto
].
push
({
callback
:
callback
,
synchronous
:
synchronous
})
return
return
#消息发送函数,至少要把俩合起来....
#消息发送函数,至少要把俩合起来....
@
stoc_send
=
(
socket
,
proto
,
info
)
->
@
stoc_send
=
(
socket
,
proto
,
info
)
->
...
...
ygopro.js
View file @
724d5a87
...
@@ -58,48 +58,100 @@
...
@@ -58,48 +58,100 @@
this
.
stoc_follows
=
{};
this
.
stoc_follows
=
{};
this
.
stoc_follows_before
=
{};
this
.
stoc_follows_after
=
{};
this
.
ctos_follows
=
{};
this
.
ctos_follows
=
{};
this
.
stoc_follow
=
function
(
proto
,
synchronous
,
callback
)
{
this
.
ctos_follows_before
=
{};
var
key
,
ref
,
value
;
if
(
typeof
proto
===
'
string
'
)
{
this
.
ctos_follows_after
=
{};
ref
=
this
.
constants
.
STOC
;
this
.
replace_proto
=
function
(
proto
,
tp
)
{
var
changed_proto
,
key
,
ref
,
value
;
if
(
typeof
proto
!==
"
string
"
)
{
return
proto
;
}
changed_proto
=
proto
;
ref
=
this
.
constants
[
tp
];
for
(
key
in
ref
)
{
for
(
key
in
ref
)
{
value
=
ref
[
key
];
value
=
ref
[
key
];
if
(
value
===
proto
)
{
if
(
value
===
proto
)
{
proto
=
key
;
changed_
proto
=
key
;
break
;
break
;
}
}
}
}
if
(
!
this
.
constants
.
STOC
[
proto
])
{
if
(
!
this
.
constants
[
tp
][
changed_
proto
])
{
throw
"
unknown proto
"
;
throw
"
unknown proto
"
;
}
}
}
return
changed_proto
;
this
.
stoc_follows
[
proto
]
=
{
};
this
.
stoc_follow
=
function
(
proto
,
synchronous
,
callback
)
{
var
changed_proto
;
changed_proto
=
this
.
replace_proto
(
proto
,
"
STOC
"
);
this
.
stoc_follows
[
changed_proto
]
=
{
callback
:
callback
,
callback
:
callback
,
synchronous
:
synchronous
synchronous
:
synchronous
};
};
};
};
this
.
ctos_follow
=
function
(
proto
,
synchronous
,
callback
)
{
this
.
stoc_follow_before
=
function
(
proto
,
synchronous
,
callback
)
{
var
key
,
ref
,
value
;
var
changed_proto
;
if
(
typeof
proto
===
'
string
'
)
{
changed_proto
=
this
.
replace_proto
(
proto
,
"
STOC
"
);
ref
=
this
.
constants
.
CTOS
;
if
(
!
this
.
stoc_follows_before
[
changed_proto
])
{
for
(
key
in
ref
)
{
this
.
stoc_follows_before
[
changed_proto
]
=
[];
value
=
ref
[
key
];
if
(
value
===
proto
)
{
proto
=
key
;
break
;
}
}
}
if
(
!
this
.
constants
.
CTOS
[
proto
])
{
this
.
stoc_follows_before
[
changed_proto
].
push
({
throw
"
unknown proto
"
;
callback
:
callback
,
synchronous
:
synchronous
});
};
this
.
stoc_follow_after
=
function
(
proto
,
synchronous
,
callback
)
{
var
changed_proto
;
changed_proto
=
this
.
replace_proto
(
proto
,
"
STOC
"
);
if
(
!
this
.
stoc_follows_after
[
changed_proto
])
{
this
.
stoc_follows_after
[
changed_proto
]
=
[];
}
}
this
.
stoc_follows_after
[
changed_proto
].
push
({
callback
:
callback
,
synchronous
:
synchronous
});
};
this
.
ctos_follow
=
function
(
proto
,
synchronous
,
callback
)
{
var
changed_proto
;
changed_proto
=
this
.
replace_proto
(
proto
,
"
CTOS
"
);
this
.
ctos_follows
[
changed_proto
]
=
{
callback
:
callback
,
synchronous
:
synchronous
};
};
this
.
ctos_follow_before
=
function
(
proto
,
synchronous
,
callback
)
{
var
changed_proto
;
changed_proto
=
this
.
replace_proto
(
proto
,
"
CTOS
"
);
if
(
!
this
.
ctos_follows_before
[
changed_proto
])
{
this
.
ctos_follows_before
[
changed_proto
]
=
[];
}
}
this
.
ctos_follows
[
proto
]
=
{
this
.
ctos_follows
_before
[
changed_proto
].
push
(
{
callback
:
callback
,
callback
:
callback
,
synchronous
:
synchronous
synchronous
:
synchronous
});
};
};
this
.
ctos_follow_after
=
function
(
proto
,
synchronous
,
callback
)
{
var
changed_proto
;
changed_proto
=
this
.
replace_proto
(
proto
,
"
CTOS
"
);
if
(
!
this
.
ctos_follows_after
[
changed_proto
])
{
this
.
ctos_follows_after
[
changed_proto
]
=
[];
}
this
.
ctos_follows_after
[
changed_proto
].
push
({
callback
:
callback
,
synchronous
:
synchronous
});
};
};
this
.
stoc_send
=
function
(
socket
,
proto
,
info
)
{
this
.
stoc_send
=
function
(
socket
,
proto
,
info
)
{
...
...
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