diff --git a/ios/beartracks/bearTracks.xcodeproj/xcshareddata/xcschemes/sitckers StickerPackExtension.xcscheme b/ios/beartracks/bearTracks.xcodeproj/xcshareddata/xcschemes/sitckers StickerPackExtension.xcscheme index c9f94eb3..abb54317 100644 --- a/ios/beartracks/bearTracks.xcodeproj/xcshareddata/xcschemes/sitckers StickerPackExtension.xcscheme +++ b/ios/beartracks/bearTracks.xcodeproj/xcshareddata/xcschemes/sitckers StickerPackExtension.xcscheme @@ -29,8 +29,8 @@ buildForAnalyzing = "YES"> @@ -67,15 +67,6 @@ ReferencedContainer = "container:bearTracks.xcodeproj"> - - - - diff --git a/ios/beartracks/beartracks-scout/LoginView.swift b/ios/beartracks/beartracks-scout/LoginView.swift index 0baf84fa..0f037c14 100644 --- a/ios/beartracks/beartracks-scout/LoginView.swift +++ b/ios/beartracks/beartracks-scout/LoginView.swift @@ -136,7 +136,7 @@ struct LoginView: View { } else { if httpResponse.statusCode == 400 { alertMessage = - "you supplied some data the server didn't like very much. your username, full name, and/or password contained characters other than a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \\ _ [ _ ] { } | ? . ," + "you supplied some data the server didn't like very much. your username, full name, and/or password contained characters other than a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \\ _ { } | ? . ," } else if httpResponse.statusCode == 409 { alertMessage = "username taken" } else if httpResponse.statusCode == 403 { diff --git a/src/casino.rs b/src/casino.rs index 5fa522d5..bd6dff9c 100644 --- a/src/casino.rs +++ b/src/casino.rs @@ -333,16 +333,11 @@ impl BlackjackSession { // if player busts if self.game.player.score > 21 { result = "LB".to_string(); - tokio::spawn(async move { - credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, -10) - .await - .unwrap_or("bad".to_string()); - }); // if dealer busts } else if self.game.dealer.score > 21 { result = "WD".to_string(); tokio::spawn(async move { - credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 10) + credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 20) .await .unwrap_or("bad".to_string()); }); @@ -350,23 +345,18 @@ impl BlackjackSession { } else if self.game.player.score > self.game.dealer.score { result = "WN".to_string(); tokio::spawn(async move { - credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 10) + credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 20) .await .unwrap_or("bad".to_string()); }); // if dealer score is more than player score } else if self.game.player.score < self.game.dealer.score { result = "LS".to_string(); - tokio::spawn(async move { - credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, -10) - .await - .unwrap_or("bad".to_string()); - }); // draw } else { result = "DR".to_string(); tokio::spawn(async move { - credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 0) + credit_points(auth_pool_clone, transact_pool_clone, user_id_clone, 10) .await .unwrap_or("bad".to_string()); }); @@ -415,6 +405,12 @@ fn credit_points_run( // websocket route pub async fn websocket_route(req: HttpRequest, stream: web::Payload, db: web::Data, user: db_auth::User) -> Result { + let db_clones = db.clone(); + + credit_points(db_clones.auth.clone(), db_clones.transact.clone(), user.id.clone(), -10) + .await + .unwrap_or("bad".to_string()); + // start websocket connection with clean game state ws::start( BlackjackSession { diff --git a/static/public/js/create/create.js b/static/public/js/create/create.js index 87f836be..494efd1f 100644 --- a/static/public/js/create/create.js +++ b/static/public/js/create/create.js @@ -62,7 +62,7 @@ async function uploadForm() { .then(async (response) => { switch (response.status) { case "you_sketchy_motherfucker": { - errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ [ _ ] { } | ? . ,"; + errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ { } | ? . ,"; errorReload(); break; } diff --git a/static/public/js/create/create.min.js b/static/public/js/create/create.min.js index 69eb77bd..9f408a3e 100644 --- a/static/public/js/create/create.min.js +++ b/static/public/js/create/create.min.js @@ -1 +1 @@ -import{_post as e}from"../_modules/post/post.min.js";let codeBoxes=document.querySelectorAll("[kind=join]");function codeBoxKeyUp(e,r){let o=r.key;Array.from(Array(10).keys()).includes(Number(o))||"Backspace"===o?(1===r.target.value.length&&(4!==e?codeBoxes[e+1].focus():(r.target.blur(),document.querySelector("[name=access]").value=codeBoxes[0].value+codeBoxes[1].value+codeBoxes[2].value+codeBoxes[3].value+codeBoxes[4].value,document.querySelector("[name=full_name]").focus())),"Backspace"===o&&codeBoxes[e-1].focus()):r.target.value=""}function codeBoxFocus(e,r){for(var o=1;o{e.onkeyup=e=>{codeBoxKeyUp(r,e)},e.onfocus=e=>{codeBoxFocus(r,e)}});let errorElement=document.getElementById("error");async function errorReload(){errorElement.style.display="flex",await new Promise(e=>setTimeout(e,1500)),window.location.reload()}async function uploadForm(){let r={access:document.querySelector("[name=access]").value,full_name:document.querySelector("[name=full_name]").value,username:document.querySelector("[name=username]").value,password:document.querySelector("[name=password]").value};e("/api/v1/auth/create",errorElement.id,r).then(async e=>{switch(e.status){case"you_sketchy_motherfucker":errorElement.innerText="characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / _ [ _ ] { } | ? . ,",errorReload();break;case"username_taken":errorElement.innerText="username taken",errorReload();break;case"bad_access_key":errorElement.innerText="bad access key",errorReload();break;case"password_length":errorElement.innerText="password length bad ( 8 <= len <= 64 )",errorReload();break;case"success":window.location.href="/login";break;default:errorElement.innerText="internal server error",errorReload()}}).catch(e=>{errorElement.innerText="unknown error"})}document.getElementById("create_button").onclick=uploadForm; \ No newline at end of file +import{_post as e}from"../_modules/post/post.min.js";let codeBoxes=document.querySelectorAll("[kind=join]");function codeBoxKeyUp(e,r){let o=r.key;Array.from(Array(10).keys()).includes(Number(o))||"Backspace"===o?(1===r.target.value.length&&(4!==e?codeBoxes[e+1].focus():(r.target.blur(),document.querySelector("[name=access]").value=codeBoxes[0].value+codeBoxes[1].value+codeBoxes[2].value+codeBoxes[3].value+codeBoxes[4].value,document.querySelector("[name=full_name]").focus())),"Backspace"===o&&codeBoxes[e-1].focus()):r.target.value=""}function codeBoxFocus(e,r){for(var o=1;o{e.onkeyup=e=>{codeBoxKeyUp(r,e)},e.onfocus=e=>{codeBoxFocus(r,e)}});let errorElement=document.getElementById("error");async function errorReload(){errorElement.style.display="flex",await new Promise(e=>setTimeout(e,1500)),window.location.reload()}async function uploadForm(){let r={access:document.querySelector("[name=access]").value,full_name:document.querySelector("[name=full_name]").value,username:document.querySelector("[name=username]").value,password:document.querySelector("[name=password]").value};e("/api/v1/auth/create",errorElement.id,r).then(async e=>{switch(e.status){case"you_sketchy_motherfucker":errorElement.innerText="characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / _ { } | ? . ,",errorReload();break;case"username_taken":errorElement.innerText="username taken",errorReload();break;case"bad_access_key":errorElement.innerText="bad access key",errorReload();break;case"password_length":errorElement.innerText="password length bad ( 8 <= len <= 64 )",errorReload();break;case"success":window.location.href="/login";break;default:errorElement.innerText="internal server error",errorReload()}}).catch(e=>{errorElement.innerText="unknown error"})}document.getElementById("create_button").onclick=uploadForm; \ No newline at end of file diff --git a/static/public/js/create/create.ts b/static/public/js/create/create.ts index 24e6e272..6bb238a4 100644 --- a/static/public/js/create/create.ts +++ b/static/public/js/create/create.ts @@ -80,7 +80,7 @@ async function uploadForm() { .then(async (response: { status: String }) => { switch (response.status) { case "you_sketchy_motherfucker": { - errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ [ _ ] { } | ? . ,"; + errorElement.innerText = "characters must only include a-z 0-9 A-Z - ~ ! @ # $ % ^ & * ( ) = + / \ _ { } | ? . ,"; errorReload(); break; }