Rename Status packet to Summary; limit handles to 24 characters; remove guidelines section from about page.

This commit is contained in:
yukirij 2024-10-13 10:27:34 -07:00
parent a4293a0236
commit 8c6a3c3993
10 changed files with 26 additions and 24 deletions

View File

@ -263,7 +263,7 @@ impl App {
use tokio_tungstenite::tungstenite::Message; use tokio_tungstenite::tungstenite::Message;
use futures::SinkExt; use futures::SinkExt;
let mut response = PacketStatusResponse::new(); let mut response = PacketSummaryResponse::new();
if let Some(user) = self.get_user_by_id(user_id).cloned() { if let Some(user) = self.get_user_by_id(user_id).cloned() {
@ -296,7 +296,7 @@ impl App {
let mut socket = conn.stream.write().await; let mut socket = conn.stream.write().await;
socket.send(Message::Binary( socket.send(Message::Binary(
encode_response(CODE_STATUS, response.encode()) encode_response(CODE_SUMMARY, response.encode())
)).await.ok(); )).await.ok();
conn_id = conn.next; conn_id = conn.next;

View File

@ -143,7 +143,7 @@ pub async fn thread_system(mut app:App, bus:Bus<protocol::QRPacket>)
let mut is_valid = true; let mut is_valid = true;
if request.code != crate::config::REGISTER_CODE.as_bytes() { response.status = STATUS_BAD_CODE; is_valid = false; } if request.code != crate::config::REGISTER_CODE.as_bytes() { response.status = STATUS_BAD_CODE; is_valid = false; }
if is_valid && request.handle.len() == 0 { response.status = STATUS_BAD_HANDLE; is_valid = false; } if is_valid && request.handle.len() == 0 && request.handle.chars().count() <= 24 { response.status = STATUS_BAD_HANDLE; is_valid = false; }
if is_valid && request.secret.len() == 0 { response.status = STATUS_BAD_SECRET; is_valid = false; } if is_valid && request.secret.len() == 0 { response.status = STATUS_BAD_SECRET; is_valid = false; }
if is_valid { if is_valid {

View File

@ -29,7 +29,7 @@ pub const CODE_AUTH :u16 = 0x0011;
pub const CODE_AUTH_RESUME :u16 = 0x0012; pub const CODE_AUTH_RESUME :u16 = 0x0012;
pub const CODE_AUTH_REVOKE :u16 = 0x0013; pub const CODE_AUTH_REVOKE :u16 = 0x0013;
pub const CODE_STATUS :u16 = 0x001F; pub const CODE_SUMMARY :u16 = 0x001F;
pub const CODE_SESSION_LIST :u16 = 0x0020; pub const CODE_SESSION_LIST :u16 = 0x0020;
pub const CODE_SESSION_JOIN :u16 = 0x0021; pub const CODE_SESSION_JOIN :u16 = 0x0021;

View File

@ -1,4 +1,4 @@
use crate::util::pack::{pack_u16, unpack_u16}; use crate::util::pack::{pack_u8, pack_u16, unpack_u16};
use super::Packet; use super::Packet;
@ -58,6 +58,7 @@ pub struct PacketAuthResponse {
pub status:u16, pub status:u16,
pub token:[u8; 8], pub token:[u8; 8],
pub secret:[u8; 16], pub secret:[u8; 16],
pub handle:String,
} }
impl PacketAuthResponse { impl PacketAuthResponse {
pub fn new() -> Self pub fn new() -> Self
@ -66,6 +67,7 @@ impl PacketAuthResponse {
status:0, status:0,
token:[0; 8], token:[0; 8],
secret:[0; 16], secret:[0; 16],
handle:String::new(),
} }
} }
} }
@ -74,10 +76,13 @@ impl Packet for PacketAuthResponse {
fn encode(&self) -> Vec<u8> fn encode(&self) -> Vec<u8>
{ {
let handle_bytes = self.handle.as_bytes().to_vec();
[ [
pack_u16(self.status), pack_u16(self.status),
self.token.to_vec(), self.token.to_vec(),
self.secret.to_vec(), self.secret.to_vec(),
pack_u8(handle_bytes.len() as u8),
handle_bytes,
].concat() ].concat()
} }
} }

View File

@ -5,7 +5,7 @@ mod register; pub use register::*;
mod auth; pub use auth::*; mod auth; pub use auth::*;
mod resume; pub use resume::*; mod resume; pub use resume::*;
mod status; pub use status::*; mod summary; pub use summary::*;
mod session_list; pub use session_list::*; mod session_list; pub use session_list::*;
//mod session_create; pub use session_create::*; //mod session_create; pub use session_create::*;

View File

@ -3,11 +3,11 @@ use crate::util::pack::pack_u16;
use super::Packet; use super::Packet;
#[derive(Clone)] #[derive(Clone)]
pub struct PacketStatusResponse { pub struct PacketSummaryResponse {
pub challenge:u16, pub challenge:u16,
pub resume:u16, pub resume:u16,
} }
impl PacketStatusResponse { impl PacketSummaryResponse {
pub fn new() -> Self pub fn new() -> Self
{ {
Self { Self {
@ -16,7 +16,7 @@ impl PacketStatusResponse {
} }
} }
} }
impl Packet for PacketStatusResponse { impl Packet for PacketSummaryResponse {
type Data = Self; type Data = Self;
fn encode(&self) -> Vec<u8> fn encode(&self) -> Vec<u8>

View File

@ -37,7 +37,7 @@ const OpCode = {
Resume :0x0012, Resume :0x0012,
Deauthenticate :0x0013, Deauthenticate :0x0013,
Status :0x001F, Summary :0x001F,
SessionList :0x0020, SessionList :0x0020,
//SessionJoin :0x0021, //SessionJoin :0x0021,
@ -54,6 +54,10 @@ const OpCode = {
ChallengeList :0x0062, ChallengeList :0x0062,
UserList :0x0100, UserList :0x0100,
UserInfo :0x0101,
AccountManage :0x1000,
AccountCommit :0x1001,
TestResult :0xFFFF, TestResult :0xFFFF,
}; };

View File

@ -142,8 +142,12 @@ const SCENES = {
let container = document.createElement("section"); let container = document.createElement("section");
let form = document.createElement("form"); let form = document.createElement("form");
let tb_handle = UI.textbox("handle", "");
tb_handle.setAttribute("maxlength", 18);
form.appendChild(UI.table(null, [ form.appendChild(UI.table(null, [
[ UI.label(LANG("handle"), "handle"), UI.textbox("handle", "") ], [ UI.label(LANG("handle"), "handle"), tb_handle ],
[ UI.label(LANG("secret"), "secret"), UI.password("secret") ], [ UI.label(LANG("secret"), "secret"), UI.password("secret") ],
])); ]));

View File

@ -131,8 +131,8 @@ function MESSAGE(event) {
console.log("RECV Deauthenticate"); console.log("RECV Deauthenticate");
} break; } break;
case OpCode.Status: { case OpCode.Summary: {
console.log("RECV Status"); console.log("RECV Summary");
if(bytes.length - index == 4) { if(bytes.length - index == 4) {
// Challenge count // Challenge count

View File

@ -11,17 +11,6 @@ Dzura is a work of [Project Kirisame](https://kirisame.com).
© 2024 Yukiri Corporation © 2024 Yukiri Corporation
## Guidelines
1. Be polite, respectful, and honorable.
### Bots
1. Bots are generally permitted, provided they abide by these rules.
2. While not manidatory, we prefer that bots be labeled as such (e.g. in their handles).
3. Bots should not initiate games or send challenges.
## User Privacy ## User Privacy
This website does not collect any information beyond that used to implement user accounts and gameplay. This website does not collect any information beyond that used to implement user accounts and gameplay.