Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mycard Mobile
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
MyCard
Mycard Mobile
Commits
269944bb
Commit
269944bb
authored
Dec 28, 2025
by
nanahira
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'patch-u16secret'
parents
ae590fcf
e53ef745
Pipeline
#42197
passed with stages
in 9 minutes and 37 seconds
Changes
3
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
13 deletions
+45
-13
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
src/app/match-dialog/match-dialog.component.ts
src/app/match-dialog/match-dialog.component.ts
+9
-5
src/app/ygopro.service.ts
src/app/ygopro.service.ts
+35
-7
No files found.
.gitlab-ci.yml
View file @
269944bb
...
@@ -7,10 +7,10 @@ variables:
...
@@ -7,10 +7,10 @@ variables:
build
:
build
:
stage
:
build
stage
:
build
image
:
node:16
dependencies
:
[]
dependencies
:
[]
tags
:
tags
:
-
linux
-
linux
image
:
node:16
script
:
script
:
-
npm ci
-
npm ci
-
npm run build
-
npm run build
...
...
src/app/match-dialog/match-dialog.component.ts
View file @
269944bb
...
@@ -4,7 +4,7 @@ import { Subscription, timer } from 'rxjs';
...
@@ -4,7 +4,7 @@ import { Subscription, timer } from 'rxjs';
import
{
LoginService
}
from
'
../login.service
'
;
import
{
LoginService
}
from
'
../login.service
'
;
import
{
map
}
from
'
rxjs/internal/operators
'
;
import
{
map
}
from
'
rxjs/internal/operators
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
HttpClient
}
from
'
@angular/common/http
'
;
import
{
MatchResponse
}
from
'
../ygopro.service
'
;
import
{
MatchResponse
,
YGOProService
}
from
'
../ygopro.service
'
;
const
second
=
1000
;
const
second
=
1000
;
const
offset
=
new
Date
().
getTimezoneOffset
()
*
60
*
second
;
const
offset
=
new
Date
().
getTimezoneOffset
()
*
60
*
second
;
...
@@ -27,14 +27,16 @@ export class MatchDialogComponent implements OnInit, OnDestroy {
...
@@ -27,14 +27,16 @@ export class MatchDialogComponent implements OnInit, OnDestroy {
@
Inject
(
MAT_DIALOG_DATA
)
public
arena
:
string
,
@
Inject
(
MAT_DIALOG_DATA
)
public
arena
:
string
,
private
dialogRef
:
MatDialogRef
<
MatchDialogComponent
>
,
private
dialogRef
:
MatDialogRef
<
MatchDialogComponent
>
,
private
http
:
HttpClient
,
private
http
:
HttpClient
,
private
login
:
LoginService
private
login
:
LoginService
,
private
ygopro
:
YGOProService
,
)
{}
)
{}
ngOnInit
()
{
async
ngOnInit
()
{
const
u16Secret
=
await
this
.
ygopro
.
getUserU16Secret
();
this
.
matching
=
this
.
http
this
.
matching
=
this
.
http
.
post
<
MatchResponse
>
(
'
https://sapi.moecube.com:444/ygopro/match
'
,
null
,
{
.
post
<
MatchResponse
>
(
'
https://sapi.moecube.com:444/ygopro/match
'
,
null
,
{
headers
:
{
headers
:
{
Authorization
:
'
Basic
'
+
Buffer
.
from
(
this
.
login
.
user
.
username
+
'
:
'
+
this
.
login
.
user
.
external_id
).
toString
(
'
base64
'
)
Authorization
:
'
Basic
'
+
Buffer
.
from
(
this
.
login
.
user
.
username
+
'
:
'
+
u16Secret
).
toString
(
'
base64
'
)
},
},
params
:
{
arena
:
this
.
arena
,
locale
:
'
zh-CN
'
}
params
:
{
arena
:
this
.
arena
,
locale
:
'
zh-CN
'
}
})
})
...
@@ -50,6 +52,8 @@ export class MatchDialogComponent implements OnInit, OnDestroy {
...
@@ -50,6 +52,8 @@ export class MatchDialogComponent implements OnInit, OnDestroy {
}
}
ngOnDestroy
()
{
ngOnDestroy
()
{
if
(
this
.
matching
)
{
this
.
matching
.
unsubscribe
();
this
.
matching
.
unsubscribe
();
}
}
}
}
}
src/app/ygopro.service.ts
View file @
269944bb
...
@@ -275,7 +275,32 @@ export class YGOProService {
...
@@ -275,7 +275,32 @@ export class YGOProService {
}
}
}
}
create_room
(
room
:
Room
,
host_password
:
string
)
{
async
getUserU16Secret
()
{
const
bad
=
(
msg
:
string
)
=>
{
alert
(
`获取用户密钥失败:
${
msg
}
,请尝试重新登录`
);
throw
new
Error
(
msg
);
}
const
token
=
this
.
login
.
user
.
token
;
if
(
!
token
)
{
return
bad
(
'
token not found
'
);
}
try
{
const
res
=
await
this
.
http
.
get
<
{
u16Secret
:
number
}
>
(
'
https://sapi.moecube.com:444/accounts/authUser
'
,
{
headers
:
{
Authorization
:
`Bearer
${
token
}
`
}
})
.
toPromise
();
return
res
.
u16Secret
;
}
catch
(
e
)
{
return
bad
(
e
.
message
||
'
unknown error
'
);
}
}
async
create_room
(
room
:
Room
,
host_password
:
string
)
{
const
options_buffer
=
Buffer
.
alloc
(
6
);
const
options_buffer
=
Buffer
.
alloc
(
6
);
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
// 建主密码 https://docs.google.com/document/d/1rvrCGIONua2KeRaYNjKBLqyG9uybs9ZI-AmzZKNftOI/edit
options_buffer
.
writeUInt8
(((
room
.
private
?
2
:
1
)
<<
4
)
|
(
room
.
options
.
duel_rule
<<
1
)
|
(
room
.
options
.
auto_death
?
0x1
:
0
),
1
);
options_buffer
.
writeUInt8
(((
room
.
private
?
2
:
1
)
<<
4
)
|
(
room
.
options
.
duel_rule
<<
1
)
|
(
room
.
options
.
auto_death
?
0x1
:
0
),
1
);
...
@@ -294,7 +319,8 @@ export class YGOProService {
...
@@ -294,7 +319,8 @@ export class YGOProService {
}
}
options_buffer
.
writeUInt8
(
checksum
&
0xff
,
0
);
options_buffer
.
writeUInt8
(
checksum
&
0xff
,
0
);
const
secret
=
(
this
.
login
.
user
.
external_id
%
65535
)
+
1
;
const
u16Secret
=
await
this
.
getUserU16Secret
();
const
secret
=
(
u16Secret
%
65535
)
+
1
;
for
(
let
i
=
0
;
i
<
options_buffer
.
length
;
i
+=
2
)
{
for
(
let
i
=
0
;
i
<
options_buffer
.
length
;
i
+=
2
)
{
options_buffer
.
writeUInt16LE
(
options_buffer
.
readUInt16LE
(
i
)
^
secret
,
i
);
options_buffer
.
writeUInt16LE
(
options_buffer
.
readUInt16LE
(
i
)
^
secret
,
i
);
}
}
...
@@ -312,7 +338,7 @@ export class YGOProService {
...
@@ -312,7 +338,7 @@ export class YGOProService {
this
.
join
(
password
,
this
.
currentServer
);
this
.
join
(
password
,
this
.
currentServer
);
}
}
join_room
(
room
:
Room
)
{
async
join_room
(
room
:
Room
)
{
const
options_buffer
=
new
Buffer
(
6
);
const
options_buffer
=
new
Buffer
(
6
);
options_buffer
.
writeUInt8
(
3
<<
4
,
1
);
options_buffer
.
writeUInt8
(
3
<<
4
,
1
);
let
checksum
=
0
;
let
checksum
=
0
;
...
@@ -321,7 +347,8 @@ export class YGOProService {
...
@@ -321,7 +347,8 @@ export class YGOProService {
}
}
options_buffer
.
writeUInt8
(
checksum
&
0xff
,
0
);
options_buffer
.
writeUInt8
(
checksum
&
0xff
,
0
);
const
secret
=
(
this
.
login
.
user
.
external_id
%
65535
)
+
1
;
const
u16Secret
=
await
this
.
getUserU16Secret
();
const
secret
=
(
u16Secret
%
65535
)
+
1
;
for
(
let
i
=
0
;
i
<
options_buffer
.
length
;
i
+=
2
)
{
for
(
let
i
=
0
;
i
<
options_buffer
.
length
;
i
+=
2
)
{
options_buffer
.
writeUInt16LE
(
options_buffer
.
readUInt16LE
(
i
)
^
secret
,
i
);
options_buffer
.
writeUInt16LE
(
options_buffer
.
readUInt16LE
(
i
)
^
secret
,
i
);
}
}
...
@@ -331,7 +358,7 @@ export class YGOProService {
...
@@ -331,7 +358,7 @@ export class YGOProService {
this
.
join
(
name
,
room
.
server
!
);
this
.
join
(
name
,
room
.
server
!
);
}
}
join_private
(
password
:
string
)
{
async
join_private
(
password
:
string
)
{
const
options_buffer
=
new
Buffer
(
6
);
const
options_buffer
=
new
Buffer
(
6
);
options_buffer
.
writeUInt8
(
5
<<
4
,
1
);
options_buffer
.
writeUInt8
(
5
<<
4
,
1
);
let
checksum
=
0
;
let
checksum
=
0
;
...
@@ -340,7 +367,8 @@ export class YGOProService {
...
@@ -340,7 +367,8 @@ export class YGOProService {
}
}
options_buffer
.
writeUInt8
(
checksum
&
0xff
,
0
);
options_buffer
.
writeUInt8
(
checksum
&
0xff
,
0
);
const
secret
=
(
this
.
login
.
user
.
external_id
%
65535
)
+
1
;
const
u16Secret
=
await
this
.
getUserU16Secret
();
const
secret
=
(
u16Secret
%
65535
)
+
1
;
for
(
let
i
=
0
;
i
<
options_buffer
.
length
;
i
+=
2
)
{
for
(
let
i
=
0
;
i
<
options_buffer
.
length
;
i
+=
2
)
{
options_buffer
.
writeUInt16LE
(
options_buffer
.
readUInt16LE
(
i
)
^
secret
,
i
);
options_buffer
.
writeUInt16LE
(
options_buffer
.
readUInt16LE
(
i
)
^
secret
,
i
);
}
}
...
...
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