fix ws/wss check
This commit is contained in:
parent
d08c0c0f5c
commit
d43da5fa6e
@ -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,
|
||||
|
@ -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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user