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
4dcd7087
Commit
4dcd7087
authored
Aug 30, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'koishi' into ai-play
parents
5faacb7e
9178162a
Pipeline
#16269
passed with stages
in 9 minutes and 48 seconds
Changes
5
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
203 additions
and
193 deletions
+203
-193
.gitlab-ci.yml
.gitlab-ci.yml
+84
-137
data/default_config.json
data/default_config.json
+0
-1
ygopro-server.coffee
ygopro-server.coffee
+37
-10
ygopro-server.js
ygopro-server.js
+80
-44
ygopro-tournament.js
ygopro-tournament.js
+2
-1
No files found.
.gitlab-ci.yml
View file @
4dcd7087
stages
:
-
build
-
build2
-
combine
-
deploy
variables
:
GIT_DEPTH
:
"
1"
CONTAINER_TEST_IMAGE_FULL
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-full
CONTAINER_TEST_IMAGE_LITE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-lite
CONTAINER_TEST_IMAGE_X86_FULL
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-full
CONTAINER_TEST_IMAGE_X86_LITE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-lite
CONTAINER_TEST_IMAGE_ARM_FULL
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-full
CONTAINER_TEST_IMAGE_ARM_LITE
:
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-lite
CONTAINER_RELEASE_IMAGE
:
$CI_REGISTRY_IMAGE:latest
CONTAINER_RELEASE_IMAGE_FULL
:
$CI_REGISTRY_IMAGE:full
CONTAINER_RELEASE_IMAGE_LITE
:
$CI_REGISTRY_IMAGE:lite
build_lite_x86
:
stage
:
build
tags
:
-
docker
script
:
-
TARGET_IMAGE=$CONTAINER_TEST_IMAGE_X86_LITE
.docker-op
:
before_script
:
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker build --pull --no-cache -f ./Dockerfile.lite -t $TARGET_IMAGE .
-
docker push $TARGET_IMAGE
build_lite_arm
:
stage
:
build
tags
:
-
docker-arm
script
:
-
TARGET_IMAGE=$CONTAINER_TEST_IMAGE_ARM_LITE
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker build --pull --no-cache -f ./Dockerfile.lite -t $TARGET_IMAGE .
-
docker push $TARGET_IMAGE
build_full_
x86
:
stage
:
build2
.docker-
x86
:
extends
:
.docker-op
tags
:
-
docker
script
:
-
TARGET_IMAGE=$CONTAINER_TEST_IMAGE_X86_FULL
-
SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_X86_LITE
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker build --build-arg BASE_IMAGE=$SOURCE_IMAGE --pull --no-cache -t
$TARGET_IMAGE .
-
docker push $TARGET_IMAGE
build_full_arm
:
stage
:
build2
variables
:
ARCH
:
x86
.docker-arm
:
extends
:
.docker-op
tags
:
-
docker-arm
variables
:
ARCH
:
arm
.build_lite
:
stage
:
build
script
:
-
TARGET_IMAGE=$CONTAINER_TEST_IMAGE_ARM_FULL
-
SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_ARM_LITE
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker build --build-arg BASE_IMAGE=$SOURCE_IMAGE --pull --no-cache -t
$TARGET_IMAGE .
-
docker push $TARGET_IMAGE
combine_lite
:
-
docker build --pull --no-cache -f ./Dockerfile.lite -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite .
-
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite
build_lite_x86
:
extends
:
-
.docker-x86
-
.build_lite
build_lite_arm
:
extends
:
-
.docker-arm
-
.build_lite
.build_full
:
stage
:
build2
tags
:
-
docker
script
:
-
TARGET_IMAGE=$CONTAINER_TEST_IMAGE_LITE
-
SOURCE_IMAGE_2=$CONTAINER_TEST_IMAGE_ARM_LITE
-
SOURCE_IMAGE_1=$CONTAINER_TEST_IMAGE_X86_LITE
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker pull $SOURCE_IMAGE_1
-
docker pull $SOURCE_IMAGE_2
-
docker manifest create $TARGET_IMAGE --amend $SOURCE_IMAGE_1 --amend
$SOURCE_IMAGE_2
-
docker manifest push $TARGET_IMAGE
combine_full
:
stage
:
combine
tags
:
-
docker
script
:
-
TARGET_IMAGE=$CONTAINER_TEST_IMAGE_FULL
-
SOURCE_IMAGE_2=$CONTAINER_TEST_IMAGE_ARM_FULL
-
SOURCE_IMAGE_1=$CONTAINER_TEST_IMAGE_X86_FULL
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker pull $SOURCE_IMAGE_1
-
docker pull $SOURCE_IMAGE_2
-
docker manifest create $TARGET_IMAGE --amend $SOURCE_IMAGE_1 --amend
$SOURCE_IMAGE_2
-
docker manifest push $TARGET_IMAGE
#upload_stuff_to_minio:
# stage: deploy
# tags:
# - linux
# image: $CONTAINER_TEST_IMAGE_FULL
# script:
# - apt update ; apt -y install python3-pip
# - pip3 install -U -i https://mirrors.aliyun.com/pypi/simple/ awscli
# - cd /ygopro-server
# - mkdir /dist
# - tar zcfv /dist/ygopro-server.tar.gz ./*
# - aws s3 --endpoint=https://minio.mycard.moe:9000 cp /dist/ygopro-server.tar.gz s3://mycard/srvpro/ygopro-server.tar.gz
# only:
# - master
-
docker build --build-arg BASE_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-lite --pull --no-cache -t
$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-full .
-
docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-$ARCH-full
deploy_latest_full
:
build_full_x86
:
extends
:
-
.docker-x86
-
.build_full
build_full_arm
:
extends
:
-
.docker-arm
-
.build_full
.deploy_image
:
stage
:
deploy
tags
:
-
docker
extends
:
.docker-x86
script
:
-
TARGET_IMAGE_2=$CONTAINER_RELEASE_IMAGE
-
TARGET_IMAGE=$CONTAINER_RELEASE_IMAGE_FULL
-
SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_FULL
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker pull $SOURCE_IMAGE
-
docker tag $SOURCE_IMAGE $TARGET_IMAGE
-
docker push $TARGET_IMAGE
-
docker tag $SOURCE_IMAGE $TARGET_IMAGE_2
-
docker push $TARGET_IMAGE_2
only
:
-
master
-
docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-$DEPLOY_TYPE
-
docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-$DEPLOY_TYPE
-
docker manifest create $CI_REGISTRY_IMAGE:$DEPLOY_TAG $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-x86-$DEPLOY_TYPE $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG-arm-$DEPLOY_TYPE
-
docker manifest push $CI_REGISTRY_IMAGE:$DEPLOY_TAG
deploy_lite
:
extends
:
.deploy_image
variables
:
DEPLOY_TYPE
:
lite
DEPLOY_TAG
:
$CI_COMMIT_REF_SLUG-lite
deploy_full
:
extends
:
.deploy_image
variables
:
DEPLOY_TYPE
:
full
DEPLOY_TAG
:
$CI_COMMIT_REF_SLUG-full
deploy_branch
:
extends
:
.deploy_image
variables
:
DEPLOY_TYPE
:
full
DEPLOY_TAG
:
$CI_COMMIT_REF_SLUG
deploy_latest_lite
:
stage
:
deploy
tags
:
-
docker
script
:
-
TARGET_IMAGE=$CONTAINER_RELEASE_IMAGE_LITE
-
SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_LITE
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker pull $SOURCE_IMAGE
-
docker tag $SOURCE_IMAGE $TARGET_IMAGE
-
docker push $TARGET_IMAGE
extends
:
.deploy_image
variables
:
DEPLOY_TYPE
:
lite
DEPLOY_TAG
:
lite
only
:
-
master
deploy_tag_full
:
stage
:
deploy
tags
:
-
docker
script
:
-
TARGET_IMAGE_2=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
-
TARGET_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-full
-
SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_FULL
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker pull $SOURCE_IMAGE
-
docker tag $SOURCE_IMAGE $TARGET_IMAGE
-
docker push $TARGET_IMAGE
-
docker tag $SOURCE_IMAGE $TARGET_IMAGE_2
-
docker push $TARGET_IMAGE_2
deploy_latest_full
:
extends
:
.deploy_image
variables
:
DEPLOY_TYPE
:
full
DEPLOY_TAG
:
full
only
:
-
tags
deploy_tag_lite
:
stage
:
deploy
tags
:
-
docker
script
:
-
TARGET_IMAGE=$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG-lite
-
SOURCE_IMAGE=$CONTAINER_TEST_IMAGE_LITE
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker pull $SOURCE_IMAGE
-
docker tag $SOURCE_IMAGE $TARGET_IMAGE
-
docker push $TARGET_IMAGE
-
master
deploy_latest
:
extends
:
.deploy_image
variables
:
DEPLOY_TYPE
:
full
DEPLOY_TAG
:
latest
only
:
-
tags
-
master
data/default_config.json
View file @
4dcd7087
...
...
@@ -198,7 +198,6 @@
"enabled"
:
false
,
"deck_check"
:
true
,
"deck_path"
:
"./decks/"
,
"replay_safe"
:
true
,
"replay_path"
:
"./replays/"
,
"replay_archive_tool"
:
"7z"
,
"block_replay_to_player"
:
false
,
...
...
ygopro-server.coffee
View file @
4dcd7087
...
...
@@ -117,7 +117,19 @@ setting_save = global.setting_save = (settings) ->
log
.
warn
(
"setting save fail"
,
e
.
toString
())
return
setting_change
=
global
.
setting_change
=
(
settings
,
path
,
val
)
->
setting_get
=
global
.
setting_get
=
(
settings
,
path
)
->
path
=
path
.
split
(
':'
)
if
path
.
length
==
0
return
settings
[
path
[
0
]]
else
target
=
settings
while
path
.
length
>
1
key
=
path
.
shift
()
target
=
target
[
key
]
key
=
path
.
shift
()
return
target
[
key
]
setting_change
=
global
.
setting_change
=
(
settings
,
path
,
val
,
noSave
)
->
# path should be like "modules:welcome"
log
.
info
(
"setting changed"
,
path
,
val
)
if
_
.
isString
(
val
)
path
=
path
.
split
(
':'
)
...
...
@@ -130,7 +142,8 @@ setting_change = global.setting_change = (settings, path, val) ->
target
=
target
[
key
]
key
=
path
.
shift
()
target
[
key
]
=
val
await
setting_save
(
settings
)
if
!
noSave
await
setting_save
(
settings
)
return
VIP_generate_cdkeys
=
global
.
VIP_generate_cdkeys
=
(
key_type
,
count
)
->
...
...
@@ -384,6 +397,23 @@ init = () ->
delete
settings
.
modules
.
random_duel
.
blank_pass_match
imported
=
true
#finish
keysFromEnv
=
Object
.
keys
(
process
.
env
).
filter
((
key
)
=>
key
.
startsWith
(
'SRVPRO_'
))
if
keysFromEnv
.
length
>
0
log
.
info
(
'Migrating settings from environment variables.'
)
for
key
in
keysFromEnv
settingKey
=
key
.
slice
(
7
).
replace
(
/__/g
,
':'
)
val
=
process
.
env
[
key
]
valFromDefault
=
setting_get
(
defaultConfig
,
settingKey
)
if
Array
.
isArray
(
valFromDefault
)
val
=
val
.
split
(
','
)
valFromDefault
=
valFromDefault
[
0
]
if
typeof
valFromDefault
==
'number'
val
=
parseFloat
(
val
)
if
typeof
valFromDefault
==
'boolean'
val
=
(
val
!=
'false'
)
&&
(
val
!=
'0'
)
setting_change
(
settings
,
settingKey
,
val
,
true
)
imported
=
true
if
imported
log
.
info
(
'Saving migrated settings.'
)
await
setting_save
(
settings
)
...
...
@@ -3823,12 +3853,11 @@ ygopro.stoc_follow 'CHANGE_SIDE', false, (buffer, info, client, server, datas)->
ygopro
.
stoc_follow
'REPLAY'
,
true
,
(
buffer
,
info
,
client
,
server
,
datas
)
->
room
=
ROOM_all
[
client
.
rid
]
return
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
block_replay_to_player
or
settings
.
modules
.
replay_delay
unless
room
if
!
room
.
replays
[
room
.
duel_count
-
1
]
if
room
and
!
room
.
replays
[
room
.
duel_count
-
1
]
# console.log("Replay saved: ", room.duel_count - 1, client.pos)
room
.
replays
[
room
.
duel_count
-
1
]
=
buffer
if
settings
.
modules
.
mysql
.
enabled
or
room
.
has_ygopro_error
if
client
.
pos
==
0
if
settings
.
modules
.
mysql
.
enabled
or
room
.
has_ygopro_error
console
.
log
(
'save replay'
)
replay_filename
=
moment_now
.
format
(
"YYYY-MM-DD HH-mm-ss"
)
if
room
.
hostinfo
.
mode
!=
2
for
player
,
i
in
room
.
dueling_players
...
...
@@ -3860,11 +3889,9 @@ ygopro.stoc_follow 'REPLAY', true, (buffer, info, client, server, datas)->
}
)
dataManager
.
saveDuelLog
(
room
.
name
,
room
.
process_pid
,
room
.
cloud_replay_id
,
replay_filename
,
room
.
hostinfo
.
mode
,
room
.
duel_count
,
playerInfos
)
# no synchronize here because too slow
if
settings
.
modules
.
mysql
.
enabled
&&
settings
.
modules
.
cloud_replay
.
enabled
and
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
replay_safe
if
settings
.
modules
.
mysql
.
enabled
&&
settings
.
modules
.
cloud_replay
.
enabled
and
settings
.
modules
.
tournament_mode
.
enabled
ygopro
.
stoc_send_chat
(
client
,
"${cloud_replay_delay_part1}R#
#{
room
.
cloud_replay_id
}
${cloud_replay_delay_part2}"
,
ygopro
.
constants
.
COLORS
.
BABYBLUE
)
await
return
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
block_replay_to_player
or
settings
.
modules
.
replay_delay
and
room
.
hostinfo
.
mode
==
1
else
await
return
settings
.
modules
.
replay_delay
and
room
.
hostinfo
.
mode
==
1
await
return
settings
.
modules
.
tournament_mode
.
enabled
and
settings
.
modules
.
tournament_mode
.
block_replay_to_player
or
settings
.
modules
.
replay_delay
and
room
.
hostinfo
.
mode
==
1
# spawn windbot
windbot_looplimit
=
0
...
...
ygopro-server.js
View file @
4dcd7087
This diff is collapsed.
Click to expand it.
ygopro-tournament.js
View file @
4dcd7087
...
...
@@ -159,7 +159,8 @@ const UploadToChallonge = async function () {
await
axios
.
delete
(
`https://api.challonge.com/v1/tournaments/
${
challonge_config
.
tournament_id
}
/participants/clear.json`
,
{
params
:
{
api_key
:
challonge_config
.
api_key
}
},
validateStatus
:
()
=>
true
,
});
sendResponse
(
"
开始上传玩家列表至 Challonge。
"
);
for
(
const
chunk
of
_
.
chunk
(
player_list
,
10
))
{
...
...
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