Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
N
Neos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
2
Merge Requests
2
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
Neos
Commits
1920c417
Commit
1920c417
authored
Jul 24, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try entertain match
parent
83aa5aaa
Pipeline
#22773
passed with stages
in 14 minutes and 27 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
src/api/mycard/match.ts
src/api/mycard/match.ts
+5
-5
src/ui/Sso.tsx
src/ui/Sso.tsx
+15
-1
No files found.
src/api/mycard/match.ts
View file @
1920c417
...
...
@@ -2,18 +2,18 @@ import axios from "axios";
const
API_URL
=
"
https://sapi.moecube.com:444/ygopro/match
"
;
interface
MatchInfo
{
ip
:
string
;
export
interface
MatchInfo
{
address
:
string
;
port
:
number
;
password
:
string
;
}
export
async
function
match
(
user
N
ame
:
string
,
user
n
ame
:
string
,
extraId
:
number
,
arena
:
string
=
"
entertain
"
):
Promise
<
MatchInfo
|
undefined
>
{
const
headers
=
{
Authorization
:
"
Basic
"
+
btoa
(
user
N
ame
+
"
:
"
+
extraId
)
};
const
headers
=
{
Authorization
:
"
Basic
"
+
btoa
(
user
n
ame
+
"
:
"
+
extraId
)
};
const
response
=
await
axios
.
post
(
API_URL
,
undefined
,
{
headers
:
headers
,
...
...
@@ -28,5 +28,5 @@ export async function match(
return
undefined
;
});
return
response
?
JSON
.
parse
(
response
.
data
)
:
undefined
;
return
response
?
response
.
data
:
undefined
;
}
src/ui/Sso.tsx
View file @
1920c417
import
React
,
{
useEffect
}
from
"
react
"
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
{
match
,
MatchInfo
}
from
"
@/api
"
;
interface
SSOParams
{
id
:
string
;
...
...
@@ -7,6 +9,7 @@ interface SSOParams {
email
:
string
;
return_sso_url
:
string
;
token
:
string
;
external_id
:
number
;
}
const
Sso
:
React
.
FC
=
()
=>
{
...
...
@@ -14,6 +17,12 @@ const Sso: React.FC = () => {
const
ssoParams
:
SSOParams
|
undefined
=
sso
?
getSSOParams
(
new
URLSearchParams
(
atob
(
sso
)))
:
undefined
;
const
[
matchInfo
,
setMatchInfo
]
=
useState
<
MatchInfo
|
undefined
>
(
undefined
);
const
onMatch
=
async
()
=>
{
if
(
ssoParams
)
{
setMatchInfo
(
await
match
(
ssoParams
.
username
,
ssoParams
.
external_id
));
}
};
useEffect
(()
=>
{
if
(
!
sso
)
{
...
...
@@ -28,6 +37,11 @@ const Sso: React.FC = () => {
<
p
>
username=
{
ssoParams
?.
username
}
</
p
>
<
p
>
name=
{
ssoParams
?.
name
}
</
p
>
<
p
>
email=
{
ssoParams
?.
email
}
</
p
>
<
button
onClick=
{
onMatch
}
>
match
</
button
>
<
p
>
match info
</
p
>
<
p
>
address=
{
matchInfo
?.
address
}
</
p
>
<
p
>
port=
{
matchInfo
?.
port
}
</
p
>
<
p
>
password=
{
matchInfo
?.
password
}
</
p
>
</
div
>
);
};
...
...
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