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