Skip to content

Commit

Permalink
fixed server token in standalone mode
Browse files Browse the repository at this point in the history
  • Loading branch information
pmgl committed Nov 8, 2022
1 parent 986269d commit 04614fb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions server/webapp.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,7 @@ class @WebApp
res.send @serverbox_funk
user: user
server_url: server_url
standalone: @server.config.standalone == true
game:
name: project.slug
pathcode: pathcode
Expand Down
1 change: 1 addition & 0 deletions server/webapp.js
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ this.WebApp = class WebApp {
return res.send(this.serverbox_funk({
user: user,
server_url: server_url,
standalone: this.server.config.standalone === true,
game: {
name: project.slug,
pathcode: pathcode,
Expand Down
5 changes: 5 additions & 0 deletions templates/play/serverbox.pug
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ html

script.
window.url = "#{server_url}" ;
window.ms_standalone = !{standalone} ;

body.noselect.custom-cursor(oncontextmenu='return false;')
div(style="position: fixed ; top:0 ; bottom: 0 ; left: 0 ; right: 0 ;")
iframe(width="100%" height="100%" src=server_url style="border: none")
Expand All @@ -23,6 +25,9 @@ html
var data = JSON.parse(msg.data) ;
if (data.name == "get_token") {
var token = localStorage.getItem("token") ;
if (window.ms_standalone) {
token = "standalone" ;
}
if (token) {
console.info(token) ;
var socket = new WebSocket(location.origin.replace("http","ws")) ;
Expand Down

0 comments on commit 04614fb

Please sign in to comment.