Skip to content

Commit

Permalink
Merge pull request #206 from Troid-Tech/localhost-connect-string
Browse files Browse the repository at this point in the history
Localhost connect string
  • Loading branch information
stonedDiscord authored Nov 30, 2023
2 parents 4435a40 + 3efe706 commit 91a6fae
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 42 deletions.
62 changes: 30 additions & 32 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,22 @@
<meta http-equiv="X-WebKit-CSP"
content="default-src 'self' 'unsafe-inline' 'unsafe-eval' *.aceattorneyonline.com data:; frame-src http://servers.aceattorneyonline.com https://servers.aceattorneyonline.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self' http://servers.aceattorneyonline.com https://servers.aceattorneyonline.com ws:;">


<!-- Mobile Specifc Meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<!-- Bootstrap Integration -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Oswald%7CRoboto+Condensed%7CPoiret+One&display=swap" rel="stylesheet">
<!-- Mobile Specifc Meta -->
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">

<!-- Bootstrap Integration -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"
integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css?family=Oswald%7CRoboto+Condensed%7CPoiret+One&display=swap"
rel="stylesheet">

<!-- AOS -->
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">

<!-- AOS -->
<link href="https://unpkg.com/[email protected]/dist/aos.css" rel="stylesheet">


<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="logo-new.png" />
<link rel="stylesheet" type="text/css" href="styles/master.css">
Expand All @@ -71,28 +73,24 @@
<div class="container">
<div class="collapse navbar-collapse" id="navbarResponsive">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link" href="https://aceattorneyonline.com/index.html">HOME </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://aceattorneyonline.com/download.html">DOWNLOAD </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://aceattorneyonline.com/support.html">SUPPORT & FAQ </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://discord.gg/wWvQ3pw">DISCORD </a>
</li>
</ul>
<li class="nav-item">
<a class="nav-link" href="https://aceattorneyonline.com/index.html">HOME </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://aceattorneyonline.com/download.html">DOWNLOAD </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://aceattorneyonline.com/support.html">SUPPORT & FAQ </a>
</li>
<li class="nav-item">
<a class="nav-link" href="https://discord.gg/wWvQ3pw">DISCORD </a>
</li>
</ul>
</div>
</div>
</nav>
<form id="serverlist_container" class="monocle-enriched">
<h2>Server List</h2>
<div id="https_error" class="error" style="display: none; font-size: 50;">
<h1>https is not supported</h1>
<h2>Please <a href="http://web.aceattorneyonline.com/">click here</a> and if that doesn't work click into the address bar and remove the s from https at the beginning</h2>
</div>
<div id="ms_error" class="error" style="display: none;">
<p>Could not connect to the master server.</p>
<p>Showing saved list.</p>
Expand All @@ -103,17 +101,17 @@ <h2>Please <a href="http://web.aceattorneyonline.com/">click here</a> and if tha
</div>
</noscript>
<ul class="serverlist">
<li id="server-2" class="available" onmouseover="setServ(-2)">
<li id="server-2" onmouseover="setServ(-2)">
<p>Singleplayer (beta)</p>
<a class="button" href="client.html?mode=replay">Try</a>
</li>
</ul>
<ul class="serverlist" id="masterlist"></ul>
<ul class="serverlist">
<li id="server-1" class="unavailable" onmouseover="setServ(-1)">
<li id="server-1" onmouseover="setServ(-1)">
<p>Localhost</p>
<a class="button" href="client.html?mode=watch&ip=127.0.0.1:50001">Watch</a>
<a class="button" href="client.html?mode=join&ip=127.0.0.1:50001">Join</a>
<a class="button" href="client.html?mode=watch&connect=ws://127.0.0.1:50001">Watch</a>
<a class="button" href="client.html?mode=join&connect=ws://127.0.0.1:50001">Join</a>
</li>
</ul>
<div id="info_container">
Expand Down
19 changes: 9 additions & 10 deletions webAO/master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ interface AOServer {
description: string,
ip: string,
players: number,
online: string,
port?: number,
ws_port?: number,
wss_port?: number,
assets?: string,
online?: string,
}

const clientVersion = process.env.npm_package_version;
Expand All @@ -31,20 +31,19 @@ servers[-2] = {
name: 'Singleplayer',
description: 'Build cases, try out new things',
ip: '127.0.0.1',
port: 50001,
assets: '',
online: 'Online: 0/1',
players: 0,
};
online: 'Singleplayer',
port: 50001,
} as AOServer;

servers[-1] = {
name: 'Localhost',
description: 'This is your computer on port 50001',
ip: '127.0.0.1',
port: 50001,
assets: '',
online: 'Offline',
players: 0,
};
online: 'Localhost',
port: 50001,
} as AOServer;


function main() {
Expand Down Expand Up @@ -105,6 +104,7 @@ async function getServerlist(): Promise<AOServer[]> {
description: item.description,
ip: item.ip,
players: item.players || 0,
online: `Players: ${item.players}`,
}

if (item.ws_port) {
Expand Down Expand Up @@ -190,7 +190,6 @@ function processServerlist(serverlist: AOServer[]) {
const fullClientWatchURL = `${clientURL}?mode=watch&connect=${connect}&serverName=${serverName}`;
const fullClientJoinURL = `${clientURL}?mode=join&connect=${connect}&serverName=${serverName}`;

server.online = `Players: ${server.players}`;
servers.push(server);

document.getElementById('masterlist').innerHTML
Expand Down

0 comments on commit 91a6fae

Please sign in to comment.