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) {
|
fn handle_frame(&mut self, ctx: &mut Context) {
|
||||||
clear_background(BEIGE);
|
clear_background(BEIGE);
|
||||||
|
|
||||||
|
let txt_size = measure_text("Starting up...", None, FontSize::Large.size(), 1.0);
|
||||||
|
|
||||||
draw_text(
|
draw_text(
|
||||||
"Starting up...",
|
"Starting up...",
|
||||||
screen_width() * 0.5,
|
screen_width() * 0.5 - txt_size.width * 0.5,
|
||||||
screen_height() * 0.5,
|
screen_height() * 0.5,
|
||||||
FontSize::Large.size() as f32,
|
FontSize::Large.size() as f32,
|
||||||
BLACK,
|
BLACK,
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
use macroquad::prelude::info;
|
||||||
|
|
||||||
pub fn refresh_page() {
|
pub fn refresh_page() {
|
||||||
let location = web_sys::window()
|
let location = web_sys::window()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
@ -10,14 +12,11 @@ pub fn refresh_page() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_ws_url() -> String {
|
pub fn get_ws_url() -> String {
|
||||||
let location = web_sys::window()
|
let location = web_sys::window().unwrap().location();
|
||||||
.unwrap()
|
|
||||||
.document()
|
|
||||||
.unwrap()
|
|
||||||
.location()
|
|
||||||
.unwrap();
|
|
||||||
|
|
||||||
let protocol = if location.protocol().unwrap() == "https" {
|
info!("Current protocol: {:?}", location.protocol().unwrap());
|
||||||
|
|
||||||
|
let protocol = if location.protocol().unwrap() == "https:" {
|
||||||
"wss"
|
"wss"
|
||||||
} else {
|
} else {
|
||||||
"ws"
|
"ws"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user