forked from nutomic/lemmy
commit
bc91163467
9 changed files with 48 additions and 7 deletions
|
@ -1,6 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
export DATABASE_URL=postgres://rrr:rrr@localhost/rrr
|
||||||
|
|
||||||
cd ui
|
cd ui
|
||||||
yarn
|
yarn
|
||||||
yarn build
|
yarn build
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
name = "server"
|
name = "server"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
authors = ["Dessalines <happydooby@gmail.com>"]
|
authors = ["Dessalines <happydooby@gmail.com>"]
|
||||||
|
autobins = false
|
||||||
|
|
||||||
[[bin]]
|
[[bin]]
|
||||||
name = "lemmy"
|
name = "lemmy"
|
||||||
|
|
|
@ -92,6 +92,7 @@ pub struct Register {
|
||||||
password: String,
|
password: String,
|
||||||
password_verify: String,
|
password_verify: String,
|
||||||
admin: bool,
|
admin: bool,
|
||||||
|
spam_timeri: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
@ -789,6 +790,10 @@ impl Perform for Register {
|
||||||
return Err(self.error("Passwords do not match."))?
|
return Err(self.error("Passwords do not match."))?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.spam_timeri < 1142 {
|
||||||
|
return Err(self.error("Too fast"))?
|
||||||
|
}
|
||||||
|
|
||||||
if has_slurs(&self.username) {
|
if has_slurs(&self.username) {
|
||||||
return Err(self.error("No slurs"))?
|
return Err(self.error("No slurs"))?
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ export class Communities extends Component<any, CommunitiesState> {
|
||||||
|
|
||||||
let listCommunitiesForm: ListCommunitiesForm = {
|
let listCommunitiesForm: ListCommunitiesForm = {
|
||||||
sort: SortType[SortType.TopAll],
|
sort: SortType[SortType.TopAll],
|
||||||
limit: 9999,
|
limit: 100,
|
||||||
}
|
}
|
||||||
|
|
||||||
WebSocketService.Instance.listCommunities(listCommunitiesForm);
|
WebSocketService.Instance.listCommunities(listCommunitiesForm);
|
||||||
|
|
|
@ -120,7 +120,10 @@ export class CommunityForm extends Component<CommunityFormProps, CommunityFormSt
|
||||||
if (i.props.community) {
|
if (i.props.community) {
|
||||||
WebSocketService.Instance.editCommunity(i.state.communityForm);
|
WebSocketService.Instance.editCommunity(i.state.communityForm);
|
||||||
} else {
|
} else {
|
||||||
WebSocketService.Instance.createCommunity(i.state.communityForm);
|
|
||||||
|
setTimeout(function(){
|
||||||
|
WebSocketService.Instance.createCommunity(i.state.communityForm);
|
||||||
|
}, 10000);
|
||||||
}
|
}
|
||||||
i.setState(i.state);
|
i.setState(i.state);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,6 +10,7 @@ interface State {
|
||||||
registerForm: RegisterForm;
|
registerForm: RegisterForm;
|
||||||
loginLoading: boolean;
|
loginLoading: boolean;
|
||||||
registerLoading: boolean;
|
registerLoading: boolean;
|
||||||
|
spamNada: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,9 +27,11 @@ export class Login extends Component<any, State> {
|
||||||
password: undefined,
|
password: undefined,
|
||||||
password_verify: undefined,
|
password_verify: undefined,
|
||||||
admin: false,
|
admin: false,
|
||||||
|
spam_timeri: undefined,
|
||||||
},
|
},
|
||||||
loginLoading: false,
|
loginLoading: false,
|
||||||
registerLoading: false
|
registerLoading: false,
|
||||||
|
spamNada: undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(props: any, context: any) {
|
constructor(props: any, context: any) {
|
||||||
|
@ -100,6 +103,7 @@ export class Login extends Component<any, State> {
|
||||||
return (
|
return (
|
||||||
<form onSubmit={linkEvent(this, this.handleRegisterSubmit)}>
|
<form onSubmit={linkEvent(this, this.handleRegisterSubmit)}>
|
||||||
<h5>Sign Up</h5>
|
<h5>Sign Up</h5>
|
||||||
|
<input type="text" class="no-s-hows" value={this.state.spamNada} onInput={linkEvent(this, this.handleSpamNada)} />
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<label class="col-sm-2 col-form-label">Username</label>
|
<label class="col-sm-2 col-form-label">Username</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
|
@ -124,6 +128,7 @@ export class Login extends Component<any, State> {
|
||||||
<input type="password" value={this.state.registerForm.password_verify} onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)} class="form-control" required />
|
<input type="password" value={this.state.registerForm.password_verify} onInput={linkEvent(this, this.handleRegisterPasswordVerifyChange)} class="form-control" required />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<input type="hidden" value={this.state.registerForm.spam_timeri} />
|
||||||
<div class="form-group row">
|
<div class="form-group row">
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<button type="submit" class="btn btn-secondary">{this.state.registerLoading ?
|
<button type="submit" class="btn btn-secondary">{this.state.registerLoading ?
|
||||||
|
@ -157,11 +162,26 @@ export class Login extends Component<any, State> {
|
||||||
i.state.registerLoading = true;
|
i.state.registerLoading = true;
|
||||||
i.setState(i.state);
|
i.setState(i.state);
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
WebSocketService.Instance.register(i.state.registerForm);
|
|
||||||
|
let endTimer = new Date().getTime();
|
||||||
|
let elapsed = endTimer - i.state.registerForm.spam_timeri;
|
||||||
|
|
||||||
|
i.state.registerForm.spam_timeri = elapsed;
|
||||||
|
if (elapsed > 1423 && i.state.spamNada == undefined) {
|
||||||
|
WebSocketService.Instance.register(i.state.registerForm);
|
||||||
|
} else {
|
||||||
|
window.location.href = "https://github.com/dessalines/lemmy";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleRegisterUsernameChange(i: Login, event: any) {
|
handleRegisterUsernameChange(i: Login, event: any) {
|
||||||
i.state.registerForm.username = event.target.value;
|
i.state.registerForm.username = event.target.value;
|
||||||
|
i.state.registerForm.spam_timeri = new Date().getTime();
|
||||||
|
i.setState(i.state);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSpamNada(i: Login, event: any) {
|
||||||
|
i.state.spamNada = event.target.value;
|
||||||
i.setState(i.state);
|
i.setState(i.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
import { Component } from 'inferno';
|
import { Component } from 'inferno';
|
||||||
|
|
||||||
let general =
|
let general =
|
||||||
["Eduardo Cavazos"];
|
[
|
||||||
|
"Nathan J. Goode",
|
||||||
|
"Eduardo Cavazos"
|
||||||
|
];
|
||||||
// let highlighted = [];
|
// let highlighted = [];
|
||||||
// let silver = [];
|
// let silver = [];
|
||||||
// let gold = [];
|
// let gold = [];
|
||||||
|
@ -43,10 +46,10 @@ export class Sponsors extends Component<any, any> {
|
||||||
}
|
}
|
||||||
sponsors() {
|
sponsors() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div class="container">
|
||||||
<h5>Sponsors</h5>
|
<h5>Sponsors</h5>
|
||||||
<p>General Sponsors are those that pledged $10 to $39 to Lemmy.</p>
|
<p>General Sponsors are those that pledged $10 to $39 to Lemmy.</p>
|
||||||
<div class="">
|
<div class="row card-columns">
|
||||||
{general.map(s =>
|
{general.map(s =>
|
||||||
<div class="card col-12 col-md-2">
|
<div class="card col-12 col-md-2">
|
||||||
<div>{s}</div>
|
<div>{s}</div>
|
||||||
|
|
|
@ -100,3 +100,9 @@ blockquote {
|
||||||
max-height: 50px;
|
max-height: 50px;
|
||||||
max-width: 50px;
|
max-width: 50px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-s-hows {
|
||||||
|
position: absolute !important;
|
||||||
|
top: -9999px !important;
|
||||||
|
left: -9999px !important;
|
||||||
|
}
|
||||||
|
|
|
@ -330,6 +330,7 @@ export interface RegisterForm {
|
||||||
email?: string;
|
email?: string;
|
||||||
password: string;
|
password: string;
|
||||||
password_verify: string;
|
password_verify: string;
|
||||||
|
spam_timeri: number;
|
||||||
admin: boolean;
|
admin: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue