aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--public/client.html42
-rw-r--r--webAO/client.ts19
-rw-r--r--webAO/styles/client.css11
3 files changed, 55 insertions, 17 deletions
diff --git a/public/client.html b/public/client.html
index db22df3..cf28ef6 100644
--- a/public/client.html
+++ b/public/client.html
@@ -20,13 +20,14 @@
<meta property="twitter:url" content="http://web.aceattorneyonline.com/">
<meta property="twitter:image" content="https://repository-images.githubusercontent.com/78860508/89fcba80-aafd-11e9-80db-c5b10c01aba9">
- <meta http-equiv="Content-Security-Policy" content="script-src-elem 'self' 'unsafe-inline' https://ajax.googleapis.com;
- style-src-elem 'self' 'unsafe-inline' https://golden-layout.com;
- script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ajax.googleapis.com;
- style-src 'self' 'unsafe-inline' https://golden-layout.com;
- img-src 'self' data: file: *;
- connect-src 'self' ws: file: *;
- media-src 'self' file: *;">
+ <meta http-equiv="Content-Security-Policy" content="
+ script-src-elem 'self' 'unsafe-inline' https://ajax.googleapis.com https://accounts.google.com/gsi/client;
+ style-src-elem 'self' 'unsafe-inline' https://golden-layout.com https://accounts.google.com/gsi/style;
+ script-src 'self' 'unsafe-inline' 'unsafe-eval' https://ajax.googleapis.com https://accounts.google.com/gsi/client;
+ style-src 'self' 'unsafe-inline' https://golden-layout.com https://accounts.google.com/gsi/style;
+ img-src 'self' data: file: *;
+ connect-src 'self' ws: file: *;
+ media-src 'self' file: *;">
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
<link rel="apple-touch-icon" href="logo-new.png"/>
@@ -37,10 +38,8 @@
<link type="text/css" rel="stylesheet" href="golden/css/goldenlayout.css" />
<link type="text/css" rel="stylesheet"
href="https://golden-layout.com/files/latest/css/goldenlayout-dark-theme.css" />
-
-
-
- <script src="lib/jdataview.min.js"></script>
+ <script src="https://accounts.google.com/gsi/client" async defer></script>
+ <script src="lib/jdataview.min.js" async defer></script>
</head>
<body>
@@ -52,6 +51,27 @@
</div>
<div id="client_charselect">
<p>Choose your character</p>
+ <div id="client_secondfactor" style="display: none">
+ <p>You need to authorize to continue</p>
+ <div id="g_id_onload"
+ data-client_id="107239014890-eo1vg90jdn2l7fgudsp9mdk8c1nraq0g"
+ data-context="use"
+ data-ux_mode="popup"
+ data-callback="handleCredentialResponse"
+ data-nonce=""
+ data-auto_select="true">
+ </div>
+
+
+ <div class="g_id_signin"
+ data-type="standard"
+ data-shape="rectangular"
+ data-theme="outline"
+ data-text="continue_with"
+ data-size="large"
+ data-logo_alignment="left">
+ </div>
+ </div>
<button onclick="pickChar(-1)">Or spectate</button>
<br><br>
<input id="client_charactersearch" placeholder="Search" oninput="chartable_filter(event)"></input>
diff --git a/webAO/client.ts b/webAO/client.ts
index 8ced37a..508a844 100644
--- a/webAO/client.ts
+++ b/webAO/client.ts
@@ -75,6 +75,7 @@ let hdid: string;
declare global {
interface Window {
+ handleCredentialResponse: (response: any) => void;
toggleShout: (shout: number) => void;
toggleMenu: (menu: number) => void;
updateBackgroundPreview: () => void;
@@ -237,7 +238,7 @@ class Client extends EventEmitter {
this.on('FM', this.handleFM.bind(this));
this.on('FA', this.handleFA.bind(this));
this.on('SM', this.handleSM.bind(this));
- this.on('MM', this.handleMM.bind(this));
+ this.on('2F', this.handle2F.bind(this));
this.on('BD', this.handleBD.bind(this));
this.on('BB', this.handleBB.bind(this));
this.on('KB', this.handleKB.bind(this));
@@ -493,8 +494,8 @@ class Client extends EventEmitter {
* to the server.
*/
joinServer() {
- this.sendServer(`HI#${hdid}#%`);
this.sendServer('ID#webAO#webAO#%');
+ this.sendServer(`HI#${hdid}#%`);
if (mode !== 'replay') { this.checkUpdater = setInterval(() => this.sendCheck(), 5000); }
}
@@ -1303,11 +1304,11 @@ class Client extends EventEmitter {
}
/**
- * Handles the "MusicMode" packet
+ * Handles 2 factor auth
* @param {Array} args packet arguments
*/
- handleMM(_args: string[]) {
- // It's unused nowadays, as preventing people from changing the music is now serverside
+ handle2F(_args: string[]) {
+ document.getElementById('client_secondfactor').style.display = 'block';
}
/**
@@ -3391,4 +3392,10 @@ export function toggleShout(shout: number) {
}
}
window.toggleShout = toggleShout;
-export default Client
+
+function handleCredentialResponse(response: any) {
+ client.sendServer(`2T#${response.credential}#%`);
+}
+window.handleCredentialResponse = handleCredentialResponse;
+
+export default Client \ No newline at end of file
diff --git a/webAO/styles/client.css b/webAO/styles/client.css
index 7f72eb1..e31a8e8 100644
--- a/webAO/styles/client.css
+++ b/webAO/styles/client.css
@@ -68,6 +68,17 @@
animation: error_blink 3s ease-in-out infinite;
}
+#client_secondfactor {
+ display: block;
+ flex-direction: column;
+ justify-content: center;
+ text-align: center;
+ align-items: center;
+ background: black;
+ color: lightgreen;
+ font-size: large;
+}
+
#client_waiting {
display: block;
flex-direction: column;