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
47e27eae
Commit
47e27eae
authored
Sep 28, 2023
by
Chunchi Che
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
支持233服
parent
f80a8f42
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
44 additions
and
19 deletions
+44
-19
neos.config.json
neos.config.json
+2
-1
neos.config.prod.json
neos.config.prod.json
+2
-1
src/infra/stream.ts
src/infra/stream.ts
+6
-2
src/middleware/socket.ts
src/middleware/socket.ts
+4
-2
src/ui/Match/MatchModal.tsx
src/ui/Match/MatchModal.tsx
+26
-13
src/ui/Match/ReplayModal.tsx
src/ui/Match/ReplayModal.tsx
+1
-0
src/ui/Match/index.tsx
src/ui/Match/index.tsx
+2
-0
src/ui/Match/util.ts
src/ui/Match/util.ts
+1
-0
No files found.
neos.config.json
View file @
47e27eae
...
...
@@ -4,7 +4,8 @@
{
"name"
:
"koishi"
,
"ip"
:
"koishi.momobako.com"
,
"port"
:
"7211"
"port"
:
"7211"
,
"ssl"
:
true
}
],
"assetsPath"
:
"/neos-assets"
,
...
...
neos.config.prod.json
View file @
47e27eae
...
...
@@ -4,7 +4,8 @@
{
"name"
:
"koishi"
,
"ip"
:
"koishi.momobako.com"
,
"port"
:
"7211"
"port"
:
"7211"
,
"ssl"
:
true
}
],
"assetsPath"
:
"/neos-assets"
,
...
...
src/infra/stream.ts
View file @
47e27eae
...
...
@@ -12,8 +12,12 @@ export class WebSocketStream {
public
ws
:
WebSocket
;
stream
:
ReadableStream
;
constructor
(
ip
:
string
,
onWsOpen
?:
(
ws
:
WebSocket
,
ev
:
Event
)
=>
any
)
{
this
.
ws
=
new
WebSocket
(
"
wss://
"
+
ip
);
constructor
(
ip
:
string
,
ssl
:
boolean
,
onWsOpen
?:
(
ws
:
WebSocket
,
ev
:
Event
)
=>
any
,
)
{
this
.
ws
=
new
WebSocket
((
ssl
?
"
wss://
"
:
"
ws://
"
)
+
ip
);
if
(
onWsOpen
)
{
this
.
ws
.
onopen
=
(
e
)
=>
onWsOpen
(
this
.
ws
,
e
);
}
...
...
src/middleware/socket.ts
View file @
47e27eae
...
...
@@ -25,6 +25,7 @@ export interface socketAction {
ip
:
string
;
player
:
string
;
passWd
:
string
;
ssl
:
boolean
;
};
isReplay
?:
boolean
;
// 是否是回放模式
replayInfo
?:
{
...
...
@@ -43,13 +44,14 @@ export default async function (action: socketAction) {
case
socketCmd
.
CONNECT
:
{
const
{
initInfo
:
info
,
isReplay
,
replayInfo
}
=
action
;
if
(
info
)
{
ws
=
new
WebSocketStream
(
info
.
ip
,
(
conn
,
_event
)
=>
ws
=
new
WebSocketStream
(
info
.
ip
,
info
.
ssl
,
(
conn
,
_event
)
=>
handleSocketOpen
(
conn
,
info
.
ip
,
info
.
player
,
info
.
passWd
),
);
await
ws
.
execute
(
handleSocketMessage
);
}
else
if
(
isReplay
&&
replayInfo
)
{
ws
=
new
WebSocketStream
(
replayInfo
.
Url
,
(
conn
,
_event
)
=>
{
// 回放模式必定支持ssl
ws
=
new
WebSocketStream
(
replayInfo
.
Url
,
true
,
(
conn
,
_event
)
=>
{
console
.
info
(
"
replay websocket open.
"
);
conn
.
binaryType
=
"
arraybuffer
"
;
conn
.
send
(
replayInfo
.
data
);
...
...
src/ui/Match/MatchModal.tsx
View file @
47e27eae
import
{
App
,
Button
,
Input
,
Modal
}
from
"
antd
"
;
import
{
App
,
Button
,
Checkbox
,
Input
,
Modal
,
Space
}
from
"
antd
"
;
import
{
CheckboxChangeEvent
}
from
"
antd/es/checkbox
"
;
import
React
,
{
ChangeEvent
,
useEffect
,
useState
}
from
"
react
"
;
import
{
useNavigate
}
from
"
react-router-dom
"
;
import
{
proxy
,
useSnapshot
}
from
"
valtio
"
;
...
...
@@ -36,22 +37,25 @@ export const MatchModal: React.FC = ({}) => {
const
[
server
,
setServer
]
=
useState
(
`
${
serverConfig
[
0
].
ip
}
:
${
serverConfig
[
0
].
port
}
`
,
);
const
[
ssl
,
setSSL
]
=
useState
(
true
);
const
[
confirmLoading
,
setConfirmLoading
]
=
useState
(
false
);
const
navigate
=
useNavigate
();
le
t
handlePlayerChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
cons
t
handlePlayerChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setPlayer
(
event
.
target
.
value
);
};
le
t
handleServerChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
cons
t
handleServerChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setServer
(
event
.
target
.
value
);
};
le
t
handlePasswdChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
cons
t
handlePasswdChange
=
(
event
:
ChangeEvent
<
HTMLInputElement
>
)
=>
{
setPasswd
(
event
.
target
.
value
);
};
const
handleSSLCheck
=
(
event
:
CheckboxChangeEvent
)
=>
setSSL
(
event
.
target
.
checked
);
const
handleSubmit
=
async
()
=>
{
setConfirmLoading
(
true
);
await
connectSrvpro
({
player
,
ip
:
server
,
passWd
:
passwd
});
await
connectSrvpro
({
player
,
ip
:
server
,
passWd
:
passwd
,
ssl
});
};
useEffect
(()
=>
{
...
...
@@ -99,6 +103,7 @@ export const MatchModal: React.FC = ({}) => {
onChange=
{
handlePlayerChange
}
required
/>
<
Space
.
Compact
>
<
Input
className=
{
styles
.
input
}
type=
"text"
...
...
@@ -107,6 +112,14 @@ export const MatchModal: React.FC = ({}) => {
onChange=
{
handleServerChange
}
required
/>
<
Checkbox
checked=
{
ssl
}
onChange=
{
handleSSLCheck
}
defaultChecked=
{
true
}
>
SSL
</
Checkbox
>
</
Space
.
Compact
>
<
Input
className=
{
styles
.
input
}
type=
"text"
...
...
src/ui/Match/ReplayModal.tsx
View file @
47e27eae
...
...
@@ -49,6 +49,7 @@ export const ReplayModal: React.FC = () => {
ip
:
""
,
player
:
""
,
passWd
:
""
,
ssl
:
true
,
replay
:
true
,
replayData
:
replay
,
});
...
...
src/ui/Match/index.tsx
View file @
47e27eae
...
...
@@ -55,6 +55,7 @@ export const Component: React.FC = () => {
ip
:
matchInfo
.
address
+
"
:
"
+
(
matchInfo
.
port
+
1
),
player
:
user
.
username
,
passWd
:
matchInfo
.
password
,
ssl
:
true
,
});
}
else
{
message
.
error
(
"
匹配失败T_T
"
);
...
...
@@ -71,6 +72,7 @@ export const Component: React.FC = () => {
ip
:
server
,
player
:
user
?.
name
??
"
Guest
"
,
passWd
:
"
AI
"
,
ssl
:
true
,
});
};
...
...
src/ui/Match/util.ts
View file @
47e27eae
...
...
@@ -12,6 +12,7 @@ export const connectSrvpro = async (params: {
ip
:
string
;
player
:
string
;
passWd
:
string
;
ssl
:
boolean
;
replay
?:
boolean
;
replayData
?:
ArrayBuffer
;
})
=>
{
...
...
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