hytopia 0.10.10 → 0.10.11-prerelease
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/bin/scripts.js +8 -0
- package/package.json +1 -1
- package/server.mjs +1 -1
package/bin/scripts.js
CHANGED
@@ -80,6 +80,10 @@ async function build() {
|
|
80
80
|
conditions: ['import', 'node'],
|
81
81
|
banner: {
|
82
82
|
js: 'import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);'
|
83
|
+
},
|
84
|
+
define: {
|
85
|
+
'__dirname': 'import.meta.dirname',
|
86
|
+
'__filename': 'import.meta.filename',
|
83
87
|
}
|
84
88
|
});
|
85
89
|
}
|
@@ -117,6 +121,10 @@ function start() {
|
|
117
121
|
banner: {
|
118
122
|
js: 'import { createRequire as __cr } from "module"; const require = __cr(import.meta.url);'
|
119
123
|
},
|
124
|
+
define: {
|
125
|
+
'__dirname': 'import.meta.dirname',
|
126
|
+
'__filename': 'import.meta.filename',
|
127
|
+
},
|
120
128
|
plugins: [{
|
121
129
|
name: 'restart-after-build',
|
122
130
|
setup(build) {
|
package/package.json
CHANGED
package/server.mjs
CHANGED
@@ -447,7 +447,7 @@ qYGMwU/HBVHkLAn5XvT2a9xM0mzZ558d+ahbw8qAgRxg7BZ+2PW/bf7F2WRBUk1f
|
|
447
447
|
xauhAoGBALEspoxQozwohGQnP7EMF0/0JoKNpdNv0b0qCVvNiMo0+N297lI2mFQp
|
448
448
|
6xYlW/1l9afLokklF/J2IsyBrTCZoY7SaEk/lMMrQSyra+y0z71ogZ8A4ny9fxsj
|
449
449
|
0dDYJZGllL+3E/MQfd7k+KnOM/+A+cPoAnci76+L3vdkUb2P8SJk
|
450
|
-
-----END RSA PRIVATE KEY-----`;var Ef=process.env.PORT??8080,If="0.10.
|
450
|
+
-----END RSA PRIVATE KEY-----`;var Ef=process.env.PORT??8080,If="0.10.11-prerelease",_f;((Y)=>{Y.READY="WEBSERVER.READY";Y.STOPPED="WEBSERVER.STOPPED";Y.ERROR="WEBSERVER.ERROR";Y.UPGRADE="WEBSERVER.UPGRADE"})(_f||={});class F3 extends B0{static instance=new F3;_webserver=WU.default();_internalHttpServer;constructor(){super();this._webserver.use((Z,J,X)=>{J.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(Z,J)=>{J.json({status:"OK",version:If,runtime:"node"})}),this._webserver.use(WU.default.static("assets",{dotfiles:"allow"}));try{this._webserver.use(WU.default.static(La1.dirname(g.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js")),{dotfiles:"allow"}))}catch{}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?Ba1.createServer(this._webserver):ja1.createServer({key:KU.existsSync("assets/certs/localhost.key")?KU.readFileSync("assets/certs/localhost.key"):zY0,cert:KU.existsSync("assets/certs/localhost.crt")?KU.readFileSync("assets/certs/localhost.crt"):GY0},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else p.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Ef,this._onStarted),console.info(`WebServer.start(): Server running on port ${Ef}.`)}stop(){if(this._internalHttpServer)return new Promise((Z,J)=>{this._internalHttpServer.close((X)=>{if(X)J(X);else Z(!0)})});else return p.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(Z,J,X)=>{let $=Da1.parse(Z.url??"",!0).query,Y=$.connectionId?.toString(),Q=$.sessionToken?.toString()??"";if(Y&&M7.instance.isValidConnectionId(Y))Z.connectionId=Y;else{let K=await O4.instance.getPlayerSession(Q);if(K?.error){let W=`${K.error.code}: ${K.error.message}`;J.write(`HTTP/1.1 401 Unauthorized\r
|
451
451
|
Content-Type: text/plain\r
|
452
452
|
Content-Length: ${W.length}\r
|
453
453
|
Connection: close\r
|