prismarine-proxy 1.1.3 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +1 -1
- package/.github/workflows/commands.yml +22 -0
- package/.github/workflows/publish.yml +7 -5
- package/HISTORY.md +16 -0
- package/README.md +3 -3
- package/examples/instant_connect_example.js +5 -4
- package/index.d.ts +2 -2
- package/package.json +4 -3
- package/src/instant_connect_proxy.js +3 -4
package/.github/workflows/ci.yml
CHANGED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
name: Repo Commands
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
issue_comment: # Handle comment commands
|
|
5
|
+
types: [created]
|
|
6
|
+
pull_request: # Handle renamed PRs
|
|
7
|
+
types: [edited]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
comment-trigger:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
steps:
|
|
13
|
+
- name: Check out repository
|
|
14
|
+
uses: actions/checkout@v3
|
|
15
|
+
- name: Run command handlers
|
|
16
|
+
uses: PrismarineJS/prismarine-repo-actions@master
|
|
17
|
+
with:
|
|
18
|
+
# NOTE: You must specify a Personal Access Token (PAT) with repo access here. While you can use the default GITHUB_TOKEN, actions taken with it will not trigger other actions, so if you have a CI workflow, commits created by this action will not trigger it.
|
|
19
|
+
token: ${{ secrets.PAT_PASSWORD }}
|
|
20
|
+
# See `Options` section below for more info on these options
|
|
21
|
+
install-command: npm install
|
|
22
|
+
/fixlint.fix-command: npm run fix
|
|
@@ -3,6 +3,9 @@ on:
|
|
|
3
3
|
push:
|
|
4
4
|
branches:
|
|
5
5
|
- master # Change this to your default branch
|
|
6
|
+
permissions:
|
|
7
|
+
id-token: write
|
|
8
|
+
contents: write
|
|
6
9
|
jobs:
|
|
7
10
|
npm-publish:
|
|
8
11
|
name: npm-publish
|
|
@@ -13,13 +16,12 @@ jobs:
|
|
|
13
16
|
- name: Set up Node.js
|
|
14
17
|
uses: actions/setup-node@master
|
|
15
18
|
with:
|
|
16
|
-
node-version:
|
|
19
|
+
node-version: 24
|
|
20
|
+
registry-url: 'https://registry.npmjs.org'
|
|
17
21
|
- id: publish
|
|
18
|
-
uses: JS-DevTools/npm-publish@
|
|
19
|
-
with:
|
|
20
|
-
token: ${{ secrets.NPM_AUTH_TOKEN }}
|
|
22
|
+
uses: JS-DevTools/npm-publish@v4
|
|
21
23
|
- name: Create Release
|
|
22
|
-
if: steps.publish.outputs.type
|
|
24
|
+
if: ${{ steps.publish.outputs.type }}
|
|
23
25
|
id: create_release
|
|
24
26
|
uses: actions/create-release@v1
|
|
25
27
|
env:
|
package/HISTORY.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
## History
|
|
2
2
|
|
|
3
|
+
### 1.2.0
|
|
4
|
+
* [Update CI to Node 24 (#48)](https://github.com/PrismarineJS/prismarine-proxy/commit/b53a1a358ca13998b98dba71587fede8819fb82d) (thanks @rom1504)
|
|
5
|
+
* [Fix publish condition for npm-publish v4 (#47)](https://github.com/PrismarineJS/prismarine-proxy/commit/9ca382db63d45797d1fe0ce854ad5b6f3cec790d) (thanks @rom1504)
|
|
6
|
+
* [Switch to trusted publishing via OIDC (#46)](https://github.com/PrismarineJS/prismarine-proxy/commit/974c931e42c97a6da64fc8a916101b807cd4beba) (thanks @rom1504)
|
|
7
|
+
* [Fix version map and update example (#43)](https://github.com/PrismarineJS/prismarine-proxy/commit/83d9fb754e156b15c0ed678123e4ba017ce65399) (thanks @covyy)
|
|
8
|
+
* [Bump mocha from 10.8.2 to 11.0.1 (#41)](https://github.com/PrismarineJS/prismarine-proxy/commit/71990b2422c433f591307ce51df74b99b911417a) (thanks @dependabot[bot])
|
|
9
|
+
* [node 22 (#44)](https://github.com/PrismarineJS/prismarine-proxy/commit/693fc5eb83ce5d3ddcee7b1ad82b0949bbd5e6c1) (thanks @rom1504)
|
|
10
|
+
* [Add command gh workflow allowing to use release command in comments (#39)](https://github.com/PrismarineJS/prismarine-proxy/commit/cff8e92e38e4215ba6ab70dc5cdf76eb9b59fb6f) (thanks @rom1504)
|
|
11
|
+
* [Update to node 18.0.0 (#37)](https://github.com/PrismarineJS/prismarine-proxy/commit/e84f86e648a1306a0aa587c8d33573ae1ad33974) (thanks @rom1504)
|
|
12
|
+
* [emit start event only on first login (#33)](https://github.com/PrismarineJS/prismarine-proxy/commit/b63daa676f3fff1ab24193eb598eea2f94652987) (thanks @willocn)
|
|
13
|
+
* [Revise readme wording](https://github.com/PrismarineJS/prismarine-proxy/commit/881d9529a2bdec45794e97170ab69fb17ad9e66c) (thanks @u9g)
|
|
14
|
+
|
|
15
|
+
### 1.1.4
|
|
16
|
+
|
|
17
|
+
- Fix typescript types
|
|
18
|
+
|
|
3
19
|
### 1.1.3
|
|
4
20
|
|
|
5
21
|
- Use minecraft-data's login packet if one is not in minecraft-packets
|
package/README.md
CHANGED
|
@@ -32,11 +32,11 @@ This is a proxy that will allow you to instantly connect to the target, so you w
|
|
|
32
32
|
```js
|
|
33
33
|
const { InstantConnectProxy } = require('prismarine-proxy')
|
|
34
34
|
|
|
35
|
-
const login =
|
|
35
|
+
const login = 'my@email.com' // microsoft email or minecraft username
|
|
36
36
|
|
|
37
37
|
const proxy = new InstantConnectProxy({
|
|
38
38
|
loginHandler: (client) => { // client object has a username object, so you can store usernames with their respective logins
|
|
39
|
-
return { username: login
|
|
39
|
+
return { username: login, auth: 'microsoft' } // the login the proxy will connect to the server with
|
|
40
40
|
},
|
|
41
41
|
serverOptions: { // options for the local server shown to the vanilla client
|
|
42
42
|
version: '1.8.9'
|
|
@@ -58,4 +58,4 @@ proxy.on('outgoing', (data, meta, toClient, toServer) => { // packets outgoing f
|
|
|
58
58
|
})
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
Information about packets can be found [here](https://prismarinejs.github.io/minecraft-data/), make sure to select the minecraft version at the top, then click protocol.
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
const { InstantConnectProxy } = require('prismarine-proxy')
|
|
2
2
|
const proxy = new InstantConnectProxy({
|
|
3
3
|
loginHandler: (client) => {
|
|
4
|
-
if (client.username === 'U9G') return { username: 'john' }
|
|
5
|
-
else return { username: client.username }
|
|
4
|
+
if (client.username === 'U9G') return { username: 'john', auth: 'microsoft' }
|
|
5
|
+
else return { username: client.username, auth: 'microsoft' }
|
|
6
6
|
},
|
|
7
7
|
clientOptions: {
|
|
8
8
|
host: 'localhost',
|
|
9
|
-
version: '1.
|
|
9
|
+
version: '1.18.2'
|
|
10
10
|
},
|
|
11
11
|
serverOptions: {
|
|
12
|
-
version: '1.
|
|
12
|
+
version: '1.18.2',
|
|
13
|
+
port: 25566
|
|
13
14
|
}
|
|
14
15
|
})
|
|
15
16
|
|
package/index.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ interface ServerOptions {
|
|
|
10
10
|
serverOptions?: protocolServerOptions;
|
|
11
11
|
clientOptions?: Partial<protocolClientOptions>;
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
type ProxyEvents = {
|
|
14
14
|
incoming: (data: any, meta: PacketMeta, toClient: ServerClient, toServer: Client) => void;
|
|
15
15
|
outgoing: (data: any, meta: PacketMeta, toClient: ServerClient, toServer: Client) => void;
|
|
16
16
|
start: (toClient: ServerClient, toServer: Client) => void;
|
|
@@ -27,4 +27,4 @@ declare class InstantConnectProxy extends ProxyHandler_base {
|
|
|
27
27
|
clientIsOnline(client: ServerClient): boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
export { InstantConnectProxy }
|
|
30
|
+
export { InstantConnectProxy }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "prismarine-proxy",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "Provide features to build proxies using Prismarine modules",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/PrismarineJS/prismarine-proxy#readme",
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"mocha": "^
|
|
27
|
+
"mocha": "^11.0.1",
|
|
28
28
|
"prismarine-proxy": "file:.",
|
|
29
29
|
"standard": "^17.0.0"
|
|
30
30
|
},
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
"debug": "^4.3.1",
|
|
33
33
|
"minecraft-data": "^3.0.0",
|
|
34
34
|
"minecraft-packets": "^1.5.0",
|
|
35
|
-
"minecraft-protocol": "^1.13.0"
|
|
35
|
+
"minecraft-protocol": "^1.13.0",
|
|
36
|
+
"typed-emitter": "^2.1.0"
|
|
36
37
|
}
|
|
37
38
|
}
|
|
@@ -4,8 +4,7 @@ const packets = require('minecraft-packets').pc
|
|
|
4
4
|
const mcDataLoader = require('minecraft-data')
|
|
5
5
|
const PLAY_STATE = 'play'
|
|
6
6
|
const verMap = {
|
|
7
|
-
'1.8.
|
|
8
|
-
'1.8.9': '1.8'
|
|
7
|
+
'1.8.9': '1.8.8'
|
|
9
8
|
}
|
|
10
9
|
|
|
11
10
|
function getPacket (ver, name, mcData) {
|
|
@@ -13,7 +12,7 @@ function getPacket (ver, name, mcData) {
|
|
|
13
12
|
if (name === 'login') {
|
|
14
13
|
packet = packet ?? mcData.loginPacket
|
|
15
14
|
}
|
|
16
|
-
if (!packet) throw new Error(`Packets for version ${ver} aren't stored. This can be fixed by
|
|
15
|
+
if (!packet) throw new Error(`Packets for version ${ver} aren't stored. This can be fixed by adding them to the verMap if similar packets are stored.`)
|
|
17
16
|
return packet
|
|
18
17
|
}
|
|
19
18
|
|
|
@@ -45,7 +44,7 @@ class InstantConnectProxy extends EventEmitter {
|
|
|
45
44
|
|
|
46
45
|
this.toServerClients.set(toClient.id, toServer)
|
|
47
46
|
|
|
48
|
-
toServer.
|
|
47
|
+
toServer.once('login', (data) => {
|
|
49
48
|
if (!this.clientIsOnline(toClient)) return
|
|
50
49
|
this.emit('start', toClient, toServer)
|
|
51
50
|
// https://github.com/VelocityPowered/Velocity/blob/aa210b3544556c46776976cddc45deb4ace9bb68/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ClientPlaySessionHandler.java#L437
|