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
2bb944ea
Commit
2bb944ea
authored
Aug 30, 2018
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into tcg_random
parents
c25b4a25
73568403
Changes
15
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
91 additions
and
21 deletions
+91
-21
Dockerfile
Dockerfile
+36
-0
config_build/config.json
config_build/config.json
+1
-1
config_tourney/config.json
config_tourney/config.json
+1
-1
data/entrypoint.sh
data/entrypoint.sh
+8
-0
data/i18n.json
data/i18n.json
+8
-1
docs/install_centos_6.sh
docs/install_centos_6.sh
+2
-1
docs/install_centos_7.sh
docs/install_centos_7.sh
+2
-1
docs/install_ubnutu_14.sh
docs/install_ubnutu_14.sh
+2
-1
docs/install_ubnutu_16.sh
docs/install_ubnutu_16.sh
+2
-1
docs/install_ubnutu_18.sh
docs/install_ubnutu_18.sh
+2
-1
restart.js
restart.js
+14
-0
struct.js
struct.js
+1
-1
ygopro-server.coffee
ygopro-server.coffee
+6
-6
ygopro-server.js
ygopro-server.js
+4
-4
ygopro.coffee
ygopro.coffee
+2
-2
No files found.
Dockerfile
0 → 100644
View file @
2bb944ea
FROM
node:stretch
RUN
ssh-keygen
-A
RUN
sed
-i
's/deb.debian.org/ftp.cn.debian.org/g'
/etc/apt/sources.list
RUN
apt update
RUN
apt
install
-y
openssh-server locales curl git vim
sudo
cron build-essential premake4 libevent-dev libsqlite3-dev liblua5.3-dev mono-complete sqlite3 p7zip-full redis-server
RUN
ln
-s
/usr/lib/x86_64-linux-gnu/liblua5.3.so /usr/lib/liblua.so
RUN
npm
install
pm2 coffeescript@1.12.7
-g
# 系统源
#RUN sed -i 's/deb.debian.org/ftp.cn.debian.org/g' /etc/apt/sources.list
#RUN apt update
# ssh
RUN
mkdir
-p
/var/run/sshd
RUN
mkdir
/root/.ssh
RUN
echo
'PermitRootLogin yes'
>>
/etc/ssh/sshd_config
# locale
RUN
echo
"zh_CN.UTF-8 UTF-8"
>
/etc/locale.gen
&&
\
ln
-sf
/usr/share/zoneinfo/Asia/Shanghai /etc/localtime
&&
\
locale-gen
&&
\
dpkg-reconfigure
-f
noninteractive locales tzdata
&&
\
/usr/sbin/update-locale
LANG
=
zh_CN.UTF-8
ENV
LANG=zh_CN.UTF-8
# declarations
EXPOSE
22
EXPOSE
7911
EXPOSE
7922
VOLUME
/root
WORKDIR
/root
COPY
data/entrypoint.sh /entrypoint.sh
RUN
chmod
+x /entrypoint.sh
CMD
[ "/entrypoint.sh" ]
config_build/config.json
View file @
2bb944ea
...
@@ -219,7 +219,7 @@
...
@@ -219,7 +219,7 @@
"command"
:
"xbuild"
,
"command"
:
"xbuild"
,
"args"
:
[
"args"
:
[
"/property:Configuration=Release"
,
"/property:Configuration=Release"
,
"/property:TargetFrameworkVersion=
\"
v4.5
\"
"
"/property:TargetFrameworkVersion=
v4.5
"
],
],
"path"
:
"./windbot/"
"path"
:
"./windbot/"
}
}
...
...
config_tourney/config.json
View file @
2bb944ea
...
@@ -218,7 +218,7 @@
...
@@ -218,7 +218,7 @@
"command"
:
"xbuild"
,
"command"
:
"xbuild"
,
"args"
:
[
"args"
:
[
"/property:Configuration=Release"
,
"/property:Configuration=Release"
,
"/property:TargetFrameworkVersion=
\"
v4.5
\"
"
"/property:TargetFrameworkVersion=
v4.5
"
],
],
"path"
:
"./windbot/"
"path"
:
"./windbot/"
}
}
...
...
data/entrypoint.sh
0 → 100644
View file @
2bb944ea
#!/bin/bash
if
[
-n
"
$authorized_keys
"
]
&&
[
!
-f
/root/.ssh/authorized_keys
]
;
then
mkdir
/root/.ssh
;
printenv
authorized_keys
>
/root/.ssh/authorized_keys
;
chmod
600 /root/.ssh/authorized_keys
;
fi
if
[
-n
"
$password
"
]
&&
passwd
--status
|
grep
-q
'L'
;
then
echo
"root:
$password
"
| chpasswd
;
fi
unset
authorized_keys
unset
password
if
[
-s
/root/.pm2/dump.pm2
]
;
then
pm2 resurrect
;
fi
/usr/sbin/sshd
-D
data/i18n.json
View file @
2bb944ea
...
@@ -146,7 +146,7 @@
...
@@ -146,7 +146,7 @@
"deck_incorrect_reconnect"
:
"Please pick your previous deck."
,
"deck_incorrect_reconnect"
:
"Please pick your previous deck."
,
"reconnect_failed"
:
"Reconnect failed."
,
"reconnect_failed"
:
"Reconnect failed."
,
"reconnecting_to_room"
:
"Reconnecting to server..."
,
"reconnecting_to_room"
:
"Reconnecting to server..."
,
"reconnect_kicked"
:
"You are kicked out because you're log
in
ed in on other devices."
,
"reconnect_kicked"
:
"You are kicked out because you're log
g
ed in on other devices."
,
"challonge_user_not_found"
:
"You are not a participant of the tournament."
,
"challonge_user_not_found"
:
"You are not a participant of the tournament."
,
"challonge_match_load_failed"
:
"Failed loading tournament info."
,
"challonge_match_load_failed"
:
"Failed loading tournament info."
,
"challonge_match_not_found"
:
"Your current match was not found."
,
"challonge_match_not_found"
:
"Your current match was not found."
,
...
@@ -312,6 +312,13 @@
...
@@ -312,6 +312,13 @@
"deck_incorrect_reconnect"
:
"Por favor, escoja tu Deck anterior."
,
"deck_incorrect_reconnect"
:
"Por favor, escoja tu Deck anterior."
,
"reconnect_failed"
:
"Fallo al reconectar."
,
"reconnect_failed"
:
"Fallo al reconectar."
,
"reconnecting_to_room"
:
"Reconectando al servidor..."
,
"reconnecting_to_room"
:
"Reconectando al servidor..."
,
"reconnect_kicked"
:
"Fuiste expulsado porque estás conectado a otros dispositivos."
,
"challonge_user_not_found"
:
"No eres participante del torneo."
,
"challonge_match_load_failed"
:
"Fallo al cargar información del torneo."
,
"challonge_match_not_found"
:
"No se pudo encontrar tu partida."
,
"challonge_match_already_finished"
:
"Tu partida actual ya ha terminado. Por favor, llama a un juez para ayuda."
,
"challonge_match_created"
:
"Una sala de sólo partidas creada. Tu oponente se unirá automáticamente."
,
"challonge_player_already_in"
:
"Por favor, no entres en la sala en la que ya estás."
,
"athletic_arena_tip"
:
"Durante una Partdida deportiva, un comportamiento de abandono se considera una rendición."
"athletic_arena_tip"
:
"Durante una Partdida deportiva, un comportamiento de abandono se considera una rendición."
},
},
"zh-cn"
:
{
"zh-cn"
:
{
...
...
docs/install_centos_6.sh
View file @
2bb944ea
...
@@ -84,6 +84,7 @@ cd ..
...
@@ -84,6 +84,7 @@ cd ..
pm2 start ygopro-server.js
pm2 start ygopro-server.js
pm2 start ygopro-webhook.js
pm2 start ygopro-webhook.js
pm2 start restart.js
pm2 save
pm2 save
sudo
-E
pm2 startup
pm2 startup
docs/install_centos_7.sh
View file @
2bb944ea
...
@@ -84,6 +84,7 @@ cd ..
...
@@ -84,6 +84,7 @@ cd ..
pm2 start ygopro-server.js
pm2 start ygopro-server.js
pm2 start ygopro-webhook.js
pm2 start ygopro-webhook.js
pm2 start restart.js
pm2 save
pm2 save
sudo
-E
pm2 startup
pm2 startup
docs/install_ubnutu_14.sh
View file @
2bb944ea
...
@@ -84,6 +84,7 @@ cd ..
...
@@ -84,6 +84,7 @@ cd ..
pm2 start ygopro-server.js
pm2 start ygopro-server.js
pm2 start ygopro-webhook.js
pm2 start ygopro-webhook.js
pm2 start restart.js
pm2 save
pm2 save
sudo
-E
pm2 startup
pm2 startup
docs/install_ubnutu_16.sh
View file @
2bb944ea
...
@@ -84,6 +84,7 @@ cd ..
...
@@ -84,6 +84,7 @@ cd ..
pm2 start ygopro-server.js
pm2 start ygopro-server.js
pm2 start ygopro-webhook.js
pm2 start ygopro-webhook.js
pm2 start restart.js
pm2 save
pm2 save
sudo
-E
pm2 startup
pm2 startup
docs/install_ubnutu_18.sh
View file @
2bb944ea
...
@@ -83,6 +83,7 @@ cd ..
...
@@ -83,6 +83,7 @@ cd ..
pm2 start ygopro-server.js
pm2 start ygopro-server.js
pm2 start ygopro-webhook.js
pm2 start ygopro-webhook.js
pm2 start restart.js
pm2 save
pm2 save
sudo
-E
pm2 startup
pm2 startup
restart.js
0 → 100644
View file @
2bb944ea
var
moment
=
require
(
'
moment
'
);
var
exec
=
require
(
'
child_process
'
).
exec
;
var
check
=
function
()
{
var
now
=
moment
();
if
(
now
.
hour
()
==
4
&&
now
.
minute
()
==
0
)
{
console
.
log
(
"
It is time NOW!
"
);
exec
(
"
pm2 restart all
"
);
}
else
{
console
.
log
(
now
.
format
());
setTimeout
(
check
,
10000
);
}
}
setTimeout
(
check
,
60000
);
struct.js
View file @
2bb944ea
...
@@ -251,7 +251,7 @@ function Struct() {
...
@@ -251,7 +251,7 @@ function Struct() {
this
.
allocate
=
function
()
{
this
.
allocate
=
function
()
{
applyClosures
(
priv
);
applyClosures
(
priv
);
priv
.
buf
=
new
Buffer
(
priv
.
len
);
priv
.
buf
=
Buffer
.
alloc
(
priv
.
len
);
allocateFields
();
allocateFields
();
priv
.
allocated
=
true
;
priv
.
allocated
=
true
;
return
this
;
return
this
;
...
...
ygopro-server.coffee
View file @
2bb944ea
...
@@ -1328,7 +1328,7 @@ net.createServer (client) ->
...
@@ -1328,7 +1328,7 @@ net.createServer (client) ->
ygopro
.
stoc_die
(
client
,
"${cloud_replay_no}"
)
ygopro
.
stoc_die
(
client
,
"${cloud_replay_no}"
)
return
return
redisdb
.
expire
(
"replay:"
+
replay
.
replay_id
,
60
*
60
*
48
)
redisdb
.
expire
(
"replay:"
+
replay
.
replay_id
,
60
*
60
*
48
)
buffer
=
new
Buffer
(
replay
.
replay_buffer
,
'binary'
)
buffer
=
Buffer
.
from
(
replay
.
replay_buffer
,
'binary'
)
zlib
.
unzip
buffer
,
(
err
,
replay_buffer
)
->
zlib
.
unzip
buffer
,
(
err
,
replay_buffer
)
->
if
err
if
err
log
.
info
"cloud replay unzip error: "
+
err
log
.
info
"cloud replay unzip error: "
+
err
...
@@ -1352,7 +1352,7 @@ net.createServer (client) ->
...
@@ -1352,7 +1352,7 @@ net.createServer (client) ->
room
=
ROOM_all
[
client
.
rid
]
room
=
ROOM_all
[
client
.
rid
]
room
.
watcher
.
write
ctos_buffer
if
room
room
.
watcher
.
write
ctos_buffer
if
room
else
else
#ctos_buffer =
new Buffer
(0)
#ctos_buffer =
Buffer.alloc
(0)
ctos_message_length
=
0
ctos_message_length
=
0
ctos_proto
=
0
ctos_proto
=
0
#ctos_buffer = Buffer.concat([ctos_buffer, data], ctos_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
#ctos_buffer = Buffer.concat([ctos_buffer, data], ctos_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
...
@@ -1420,7 +1420,7 @@ net.createServer (client) ->
...
@@ -1420,7 +1420,7 @@ net.createServer (client) ->
# 服务端到客户端(stoc)
# 服务端到客户端(stoc)
server
.
on
'data'
,
(
stoc_buffer
)
->
server
.
on
'data'
,
(
stoc_buffer
)
->
#stoc_buffer =
new Buffer
(0)
#stoc_buffer =
Buffer.alloc
(0)
stoc_message_length
=
0
stoc_message_length
=
0
stoc_proto
=
0
stoc_proto
=
0
#stoc_buffer = Buffer.concat([stoc_buffer, data], stoc_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
#stoc_buffer = Buffer.concat([stoc_buffer, data], stoc_buffer.length + data.length) #buffer的错误使用方式,好孩子不要学
...
@@ -1606,7 +1606,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1606,7 +1606,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
# struct.set("version", info.version)
# struct.set("version", info.version)
# buffer = struct.buffer
# buffer = struct.buffer
buffer
=
new
Buffer
(
info
.
pass
[
0
...
8
],
'base64'
)
buffer
=
Buffer
.
from
(
info
.
pass
[
0
...
8
],
'base64'
)
if
buffer
.
length
!=
6
if
buffer
.
length
!=
6
ygopro
.
stoc_die
(
client
,
'${invalid_password_payload}'
)
ygopro
.
stoc_die
(
client
,
'${invalid_password_payload}'
)
...
@@ -1709,7 +1709,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1709,7 +1709,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if
id
=
users_cache
[
client
.
name
]
if
id
=
users_cache
[
client
.
name
]
secret
=
id
%
65535
+
1
secret
=
id
%
65535
+
1
decrypted_buffer
=
new
Buffer
(
6
)
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
)
for
i
in
[
0
,
2
,
4
]
for
i
in
[
0
,
2
,
4
]
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
if
check
(
decrypted_buffer
)
if
check
(
decrypted_buffer
)
...
@@ -1728,7 +1728,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
...
@@ -1728,7 +1728,7 @@ ygopro.ctos_follow 'JOIN_GAME', false, (buffer, info, client, server)->
if
body
and
body
.
user
if
body
and
body
.
user
users_cache
[
client
.
name
]
=
body
.
user
.
id
users_cache
[
client
.
name
]
=
body
.
user
.
id
secret
=
body
.
user
.
id
%
65535
+
1
secret
=
body
.
user
.
id
%
65535
+
1
decrypted_buffer
=
new
Buffer
(
6
)
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
)
for
i
in
[
0
,
2
,
4
]
for
i
in
[
0
,
2
,
4
]
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
decrypted_buffer
.
writeUInt16LE
(
buffer
.
readUInt16LE
(
i
)
^
secret
,
i
)
if
check
(
decrypted_buffer
)
if
check
(
decrypted_buffer
)
...
...
ygopro-server.js
View file @
2bb944ea
...
@@ -1720,7 +1720,7 @@
...
@@ -1720,7 +1720,7 @@
return
;
return
;
}
}
redisdb
.
expire
(
"
replay:
"
+
replay
.
replay_id
,
60
*
60
*
48
);
redisdb
.
expire
(
"
replay:
"
+
replay
.
replay_id
,
60
*
60
*
48
);
buffer
=
new
Buffer
(
replay
.
replay_buffer
,
'
binary
'
);
buffer
=
Buffer
.
from
(
replay
.
replay_buffer
,
'
binary
'
);
zlib
.
unzip
(
buffer
,
function
(
err
,
replay_buffer
)
{
zlib
.
unzip
(
buffer
,
function
(
err
,
replay_buffer
)
{
if
(
err
)
{
if
(
err
)
{
log
.
info
(
"
cloud replay unzip error:
"
+
err
);
log
.
info
(
"
cloud replay unzip error:
"
+
err
);
...
@@ -2015,7 +2015,7 @@
...
@@ -2015,7 +2015,7 @@
ygopro
.
stoc_die
(
client
,
'
${invalid_password_length}
'
);
ygopro
.
stoc_die
(
client
,
'
${invalid_password_length}
'
);
return
;
return
;
}
}
buffer
=
new
Buffer
(
info
.
pass
.
slice
(
0
,
8
),
'
base64
'
);
buffer
=
Buffer
.
from
(
info
.
pass
.
slice
(
0
,
8
),
'
base64
'
);
if
(
buffer
.
length
!==
6
)
{
if
(
buffer
.
length
!==
6
)
{
ygopro
.
stoc_die
(
client
,
'
${invalid_password_payload}
'
);
ygopro
.
stoc_die
(
client
,
'
${invalid_password_payload}
'
);
return
;
return
;
...
@@ -2131,7 +2131,7 @@
...
@@ -2131,7 +2131,7 @@
};
};
if
(
id
=
users_cache
[
client
.
name
])
{
if
(
id
=
users_cache
[
client
.
name
])
{
secret
=
id
%
65535
+
1
;
secret
=
id
%
65535
+
1
;
decrypted_buffer
=
new
Buffer
(
6
);
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
);
ref3
=
[
0
,
2
,
4
];
ref3
=
[
0
,
2
,
4
];
for
(
m
=
0
,
len2
=
ref3
.
length
;
m
<
len2
;
m
++
)
{
for
(
m
=
0
,
len2
=
ref3
.
length
;
m
<
len2
;
m
++
)
{
i
=
ref3
[
m
];
i
=
ref3
[
m
];
...
@@ -2155,7 +2155,7 @@
...
@@ -2155,7 +2155,7 @@
if
(
body
&&
body
.
user
)
{
if
(
body
&&
body
.
user
)
{
users_cache
[
client
.
name
]
=
body
.
user
.
id
;
users_cache
[
client
.
name
]
=
body
.
user
.
id
;
secret
=
body
.
user
.
id
%
65535
+
1
;
secret
=
body
.
user
.
id
%
65535
+
1
;
decrypted_buffer
=
new
Buffer
(
6
);
decrypted_buffer
=
Buffer
.
allocUnsafe
(
6
);
ref4
=
[
0
,
2
,
4
];
ref4
=
[
0
,
2
,
4
];
for
(
n
=
0
,
len3
=
ref4
.
length
;
n
<
len3
;
n
++
)
{
for
(
n
=
0
,
len3
=
ref4
.
length
;
n
<
len3
;
n
++
)
{
i
=
ref4
[
n
];
i
=
ref4
[
n
];
...
...
ygopro.coffee
View file @
2bb944ea
...
@@ -80,7 +80,7 @@ for name, declaration of structs_declaration
...
@@ -80,7 +80,7 @@ for name, declaration of structs_declaration
break
break
throw
"unknown proto"
if
!
@
constants
.
STOC
[
proto
]
throw
"unknown proto"
if
!
@
constants
.
STOC
[
proto
]
header
=
new
Buffer
(
3
)
header
=
Buffer
.
allocUnsafe
(
3
)
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt8
proto
,
2
header
.
writeUInt8
proto
,
2
socket
.
write
header
socket
.
write
header
...
@@ -108,7 +108,7 @@ for name, declaration of structs_declaration
...
@@ -108,7 +108,7 @@ for name, declaration of structs_declaration
break
break
throw
"unknown proto"
if
!
@
constants
.
CTOS
[
proto
]
throw
"unknown proto"
if
!
@
constants
.
CTOS
[
proto
]
header
=
new
Buffer
(
3
)
header
=
Buffer
.
allocUnsafe
(
3
)
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt16LE
buffer
.
length
+
1
,
0
header
.
writeUInt8
proto
,
2
header
.
writeUInt8
proto
,
2
socket
.
write
header
socket
.
write
header
...
...
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