hytopia 0.11.6 → 0.11.7

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.mjs +1 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.11.6",
3
+ "version": "0.11.7",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",
package/server.mjs CHANGED
@@ -545,7 +545,7 @@ xkiy5MGE6Xbe6AybpI1Hg+ET8zOyO1c5GroDQ6w9AoGAKC+zMSn3ahj8Cobpt51M
545
545
  997nuSH5YQLe5+Bl5RXkZBSSNUHAczvgRHDgKi2SEHPLI2HoONLp1BvsKLQgXPJh
546
546
  T8Y+oVbsNcG8DraW9kEzVm8esk3IqJEKmH01U2LW4EsWFKyhKSr6Yr7Y97A8oNb5
547
547
  qyLISxkkFOndPeDIzSNnADk=
548
- -----END PRIVATE KEY-----`;var Si=process.env.PORT??8080,Ai="0.11.6",Ii;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Ii||={});class Xz extends $1{static instance=new Xz;_webserver=RC.default();_internalHttpServer;constructor(){super();if(this._webserver.use((J,$,X)=>{$.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(J,$)=>{$.json({status:"OK",version:Ai,runtime:"node"})}),this._webserver.use(RC.default.static("assets",{dotfiles:"allow"})),process.env.NODE_ENV!=="production"){let $=NX.dirname(e.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"));this._webserver.use((X,Y,Q)=>{let W=NX.join($,X.path);this._syncAssetsPackageAsset(W,$),Q()}),this._webserver.use(RC.default.static($,{dotfiles:"allow"}))}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?pP6.createServer(this._webserver):dP6.createServer({key:ON1,cert:NN1},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else $0.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Si,this._onStarted),console.info(`WebServer.start(): Server running on port ${Si}.`)}stop(){if(this._internalHttpServer)return new Promise((J,$)=>{this._internalHttpServer.close((X)=>{if(X)$(X);else J(!0)})});else return $0.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(J,$,X)=>{let Y=J.url??"",Q=Y.includes("?")?Y.slice(Y.indexOf("?")):"",W=new URLSearchParams(Q),K=W.get("connectionId")??void 0,Z=W.get("sessionToken")??"";if(K&&F3.instance.isValidConnectionId(K))J.connectionId=K;else{let G=await k7.instance.getPlayerSession(Z);if(G?.error){let V=`${G.error.code}: ${G.error.message}`;$.write(`HTTP/1.1 401 Unauthorized\r
548
+ -----END PRIVATE KEY-----`;var Si=process.env.PORT??8080,Ai="0.11.7",Ii;((Q)=>{Q.READY="WEBSERVER.READY";Q.STOPPED="WEBSERVER.STOPPED";Q.ERROR="WEBSERVER.ERROR";Q.UPGRADE="WEBSERVER.UPGRADE"})(Ii||={});class Xz extends $1{static instance=new Xz;_webserver=RC.default();_internalHttpServer;constructor(){super();if(this._webserver.use((J,$,X)=>{$.header("Access-Control-Allow-Origin","*"),X()}),this._webserver.get("/",(J,$)=>{$.json({status:"OK",version:Ai,runtime:"node"})}),this._webserver.use(RC.default.static("assets",{dotfiles:"allow"})),process.env.NODE_ENV!=="production"){let $=NX.dirname(e.resolve("/Users/arkdev/Desktop/HYTOPIA/hytopia/assets/release/index.js"));this._webserver.use((X,Y,Q)=>{let W=NX.join($,X.path);this._syncAssetsPackageAsset(W,$),Q()}),this._webserver.use(RC.default.static($,{dotfiles:"allow"}))}}start(){if(!this._internalHttpServer)this._internalHttpServer=process.env.NODE_ENV==="production"?pP6.createServer(this._webserver):dP6.createServer({key:ON1,cert:NN1},this._webserver),this._internalHttpServer.on("upgrade",this._onUpgrade),this._internalHttpServer.on("error",this._onError),this._internalHttpServer.on("close",this._onStopped);else $0.warning("WebServer.start(): server already started!");this._internalHttpServer.listen(Si,this._onStarted),console.info(`WebServer.start(): Server running on port ${Si}.`)}stop(){if(this._internalHttpServer)return new Promise((J,$)=>{this._internalHttpServer.close((X)=>{if(X)$(X);else J(!0)})});else return $0.warning("WebServer.stop(): server not started."),Promise.resolve(!1)}_onStarted=()=>{this.emitWithGlobal("WEBSERVER.READY",{})};_onUpgrade=async(J,$,X)=>{let Y=J.url??"",Q=Y.includes("?")?Y.slice(Y.indexOf("?")):"",W=new URLSearchParams(Q),K=W.get("connectionId")??void 0,Z=W.get("sessionToken")??"";if(K&&F3.instance.isValidConnectionId(K))J.connectionId=K;else{let G=await k7.instance.getPlayerSession(Z);if(G?.error){let V=`${G.error.code}: ${G.error.message}`;$.write(`HTTP/1.1 401 Unauthorized\r
549
549
  Content-Type: text/plain\r
550
550
  Content-Length: ${V.length}\r
551
551
  Connection: close\r