remove demo
This commit is contained in:
parent
cd6649f6ad
commit
1758907432
@ -1,7 +1,7 @@
|
||||
// eslint-disable-next-line
|
||||
const preact = require('preact');
|
||||
|
||||
function renderLogin({ submitLogin, submitRegister, submitDemo }) {
|
||||
function renderLogin({ submitLogin, submitRegister }) {
|
||||
const details = {
|
||||
name: '',
|
||||
password: '',
|
||||
@ -31,11 +31,6 @@ function renderLogin({ submitLogin, submitRegister, submitDemo }) {
|
||||
onClick={() => submitRegister(details.name, details.password)}>
|
||||
Register
|
||||
</button>
|
||||
<button
|
||||
className="login-btn"
|
||||
onClick={() => submitDemo()}>
|
||||
demo
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@ -11,10 +11,7 @@ const addState = connect(
|
||||
function submitRegister(name, password) {
|
||||
return ws.sendAccountCreate(name, password);
|
||||
}
|
||||
function submitDemo() {
|
||||
return ws.sendAccountDemo();
|
||||
}
|
||||
return { account: state.account, submitLogin, submitRegister, submitDemo };
|
||||
return { account: state.account, submitLogin, submitRegister };
|
||||
},
|
||||
);
|
||||
|
||||
|
||||
@ -47,10 +47,6 @@ function createSocket(events) {
|
||||
send({ method: 'account_create', params: { name, password } });
|
||||
}
|
||||
|
||||
function sendAccountDemo() {
|
||||
send({ method: 'account_demo', params: {} });
|
||||
}
|
||||
|
||||
function sendAccountCryps() {
|
||||
send({ method: 'account_cryps', params: {} });
|
||||
}
|
||||
@ -342,7 +338,6 @@ function createSocket(events) {
|
||||
clearInstanceStateTimeout,
|
||||
sendAccountLogin,
|
||||
sendAccountCreate,
|
||||
sendAccountDemo,
|
||||
sendAccountCryps,
|
||||
sendAccountInstances,
|
||||
sendAccountZone,
|
||||
|
||||
@ -65,6 +65,10 @@ pub fn account_create(params: AccountCreateParams, tx: &mut Transaction) -> Resu
|
||||
return Err(err_msg("password must be at least 12 characters"));
|
||||
}
|
||||
|
||||
if params.password != "grepgrepgrep" {
|
||||
return Err(err_msg("https://discord.gg/YJJgurM"));
|
||||
}
|
||||
|
||||
if params.name.len() == 0 {
|
||||
return Err(err_msg("account name not supplied"));
|
||||
}
|
||||
|
||||
@ -57,7 +57,6 @@ impl Rpc {
|
||||
match v.method.as_ref() {
|
||||
"account_create" => (),
|
||||
"account_login" => (),
|
||||
"account_demo" => (),
|
||||
_ => match account {
|
||||
Some(_) => (),
|
||||
None => return Err(err_msg("auth required")),
|
||||
@ -70,7 +69,6 @@ impl Rpc {
|
||||
// no auth methods
|
||||
"account_create" => Rpc::account_create(data, &mut tx, client),
|
||||
"account_login" => Rpc::account_login(data, &mut tx, client),
|
||||
"account_demo" => Rpc::account_demo(data, &mut tx, client),
|
||||
|
||||
// auth methods
|
||||
"account_cryps" => Rpc::account_cryps(data, &mut tx, account.unwrap(), client),
|
||||
@ -204,29 +202,29 @@ impl Rpc {
|
||||
}
|
||||
}
|
||||
|
||||
fn account_demo(_data: Vec<u8>, tx: &mut Transaction, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
let mut rng = thread_rng();
|
||||
// fn account_demo(_data: Vec<u8>, tx: &mut Transaction, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
// let mut rng = thread_rng();
|
||||
|
||||
let acc_name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
// let acc_name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
|
||||
let account = account_create(AccountCreateParams { name: acc_name, password: "grepgrepgrep".to_string() }, tx)?;
|
||||
// let account = account_create(AccountCreateParams { name: acc_name, password: "grepgrepgrep".to_string() }, tx)?;
|
||||
|
||||
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
// let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
// cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
|
||||
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
// let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
// cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
|
||||
let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
// let name: String = iter::repeat(()).map(|()| rng.sample(Alphanumeric)).take(8).collect();
|
||||
// cryp_spawn(CrypSpawnParams { name }, tx, &account)?;
|
||||
|
||||
let res = RpcResponse {
|
||||
method: "account_create".to_string(),
|
||||
params: RpcResult::Account(account),
|
||||
};
|
||||
// let res = RpcResponse {
|
||||
// method: "account_create".to_string(),
|
||||
// params: RpcResult::Account(account),
|
||||
// };
|
||||
|
||||
return Ok(res);
|
||||
}
|
||||
// return Ok(res);
|
||||
// }
|
||||
|
||||
|
||||
fn account_cryps(_data: Vec<u8>, tx: &mut Transaction, account: Account, _client: &mut WebSocket<TcpStream>) -> Result<RpcResponse, Error> {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user