fix ws/wss check

This commit is contained in:
Joey Hines 2025-06-13 19:16:02 -06:00
parent d08c0c0f5c
commit d43da5fa6e
Signed by: joeyahines
GPG Key ID: 38BA6F25C94C9382
2 changed files with 9 additions and 8 deletions

View File

@ -36,9 +36,11 @@ impl Screen for LoginScreen {
fn handle_frame(&mut self, ctx: &mut Context) {
clear_background(BEIGE);
let txt_size = measure_text("Starting up...", None, FontSize::Large.size(), 1.0);
draw_text(
"Starting up...",
screen_width() * 0.5,
screen_width() * 0.5 - txt_size.width * 0.5,
screen_height() * 0.5,
FontSize::Large.size() as f32,
BLACK,

View File

@ -1,3 +1,5 @@
use macroquad::prelude::info;
pub fn refresh_page() {
let location = web_sys::window()
.unwrap()
@ -10,14 +12,11 @@ pub fn refresh_page() {
}
pub fn get_ws_url() -> String {
let location = web_sys::window()
.unwrap()
.document()
.unwrap()
.location()
.unwrap();
let location = web_sys::window().unwrap().location();
let protocol = if location.protocol().unwrap() == "https" {
info!("Current protocol: {:?}", location.protocol().unwrap());
let protocol = if location.protocol().unwrap() == "https:" {
"wss"
} else {
"ws"