Support for supabase api
This commit is contained in:
+9
-6
@@ -11,8 +11,8 @@ use serde::{Deserialize, Serialize};
|
||||
use crate::types::{ClientMessage, WsMessage};
|
||||
|
||||
pub mod handshake {
|
||||
use base64::engine::general_purpose::STANDARD as Base64;
|
||||
use base64::Engine;
|
||||
use base64::engine::general_purpose::STANDARD as Base64;
|
||||
use sha1::{Digest, Sha1};
|
||||
use std::collections::HashMap;
|
||||
use std::io::{BufRead, BufReader, Write};
|
||||
@@ -100,7 +100,7 @@ pub mod handshake {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Client(TcpStream, Option<u32>, u64);
|
||||
pub struct Client(TcpStream, Option<String>, u64);
|
||||
|
||||
impl Client {
|
||||
/// Create a client with no timeouts
|
||||
@@ -324,12 +324,15 @@ impl Client {
|
||||
self.read_t()
|
||||
}
|
||||
|
||||
pub fn get_uuid(&self) -> crate::Result<u32> {
|
||||
self.1.ok_or(anyhow!("Invalid UUID"))
|
||||
pub fn get_uuid(&self) -> crate::Result<String> {
|
||||
match &self.1 {
|
||||
Some(v) => Ok(v.clone()),
|
||||
None => Err(anyhow!("Client ({}) UUID not set", self.2).into()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_uuid(&mut self, uuid: u32) {
|
||||
self.1 = Some(uuid)
|
||||
pub fn set_uuid(&mut self, uuid: &str) {
|
||||
self.1 = Some(uuid.to_string())
|
||||
}
|
||||
|
||||
#[deprecated]
|
||||
|
||||
Reference in New Issue
Block a user