Compare commits

..

No commits in common. "f77033ef8a9781fb36e300a3e72e9238762a9a9d" and "26e962e77fbca2d6b0a94163efb87d159cb2d2f6" have entirely different histories.

7 changed files with 19 additions and 31 deletions

View file

@ -0,0 +1 @@
<p>Sorry! This room is already full. Maybe try another one?</p>

View file

@ -23,7 +23,7 @@ struct Args {
// Port number for server
#[clap(short, long, default_value_t = 8000)]
port: u16,
#[clap(short, long, default_value = "http://127.0.0.1:8000")]
#[clap(short, long, default_value = "localhost")]
base_url: String,
}
@ -39,8 +39,6 @@ fn rocket() -> _ {
#[get("/?<roomname>")]
async fn index(mut roomname: String) -> Template {
// remove whitespace from roomname
roomname = roomname.split_whitespace().collect();
// generate roomname if there is none yet
if roomname.chars().count() == 0 {
roomname = names::get_random_name().await;
@ -72,7 +70,7 @@ async fn index(mut roomname: String) -> Template {
}
}
#[get("/room?<roomname>&<token>&<player1>")]
async fn room(roomname: &str, token: usize, player1: bool) -> String{
#[get("/room?<roomname>&<token>")]
async fn room(roomname: &str, token: usize) -> String{
"hey gamer".to_string()
}

View file

@ -8,12 +8,10 @@ pub struct Room {
impl Room {
pub fn new() -> Room {
// generate room token
let tok: usize = thread_rng().gen();
// flip coin to see who starts
let random: usize = thread_rng().gen();
Room {
full: false,
token: tok,
token: random,
}
}
}

View file

@ -2,6 +2,8 @@ use std::collections::HashMap;
use rocket_dyn_templates::Template;
use clap::Parser;
lazy_static! {
static ref ARGS: Args = Args::parse();
}
@ -9,7 +11,7 @@ lazy_static! {
#[derive(Parser, Debug)]
#[clap(about, version, author)]
struct Args {
#[clap(short, long, default_value = "http://127.0.0.1:8000")]
#[clap(short, long, default_value = "localhost")]
base_url: String,
}
@ -19,13 +21,13 @@ pub fn get_back_to_home(roomname: &str) -> Template {
pub fn join_new_room(roomname: &str, token: usize) -> Template {
let message = format!("your room is \"{}\"! copy your link and send it to a friend to let them join", roomname);
let link_url = link_url_from(roomname, token, true);
let link_url = link_url_from(roomname, token);
join_template_from(&message, "let me in!", &link_url, "url_button", roomname)
}
pub fn join_room(roomname: &str, token: usize) -> Template {
let message = format!("your room is \"{}\"! someone is already waiting in this room!", roomname);
let link_url = link_url_from(roomname, token, false);
let link_url = link_url_from(roomname, token);
join_template_from(&message, "let me in!", &link_url, "hidden", roomname)
}
@ -40,6 +42,6 @@ fn join_template_from(message: &str, link: &str, link_url: &str, hide_url_button
Template::render("join", context)
}
fn link_url_from(roomname: &str, token: usize, player1: bool) -> String{
format!("./room?roomname={}&token={}&player1={}", roomname, token, player1)
fn link_url_from(roomname: &str, token: usize) -> String{
format!("./room?roomname={}&token={}", roomname, token)
}

View file

@ -2,10 +2,8 @@ function copyURI(evt) {
evt.preventDefault();
navigator.clipboard.writeText(evt.target.getAttribute('href')).then(() => {
/* clipboard successfully set */
document.getElementById("urlForCopy").innerHTML = "copied";
}, () => {
/* clipboard write failed */
document.getElementById("urlForCopy").innerHTML = "failed to copy :\(";
});
}

View file

@ -7,11 +7,6 @@
--accent1: #accce4;
}
* {
margin: 0;
padding: 0;
}
body,
html {
color: var(--text);
@ -24,10 +19,8 @@ html {
justify-content: center;
width: 100%;
height: 100%;
size: 100%;
margin: 0;
padding: 0;
scrollbar-color: var(--accent1);
}
::selection {
@ -52,12 +45,12 @@ footer {
overflow: visible;
left: 0;
display: flex;
height: 10%;
bottom: 0;
width: 100%;
font-size: 16pt;
font-size: 3em;
justify-content: center;
align-items: center;
height: 10%;
}
.contentdiv {
@ -65,9 +58,8 @@ footer {
flex-direction: column;
align-items: center;
align-self: center;
min-height: 90%;
height: 90%;
justify-content: center;
width: 100%;
}
button,
@ -76,8 +68,8 @@ a,
p {
line-height: 1.84em;
border-radius: 0.48em;
font-size: 24pt;
margin-top: 0.5em;
font-size: 32pt;
margin: 0.5em;
text-align: center;
font-family: "Sen", sans-serif;
line-break: anywhere;
@ -87,10 +79,10 @@ a,
button,
input {
outline: none;
padding: 2%;
background-color: var(--background);
color: var(--text);
border: 0.12em solid var(--text);
width: 90%;
}
input {

View file

@ -16,7 +16,6 @@
<div class="contentdiv">
<p>{{message}}</p><br />
<a
title="copy to clipboard"
onclick="copyURI(event)"
id="urlForCopy"
class="{{hide_url_button}}"