change some error messages, readme, zlib decoding
This commit is contained in:
parent
1e0dea7135
commit
6e7550927f
4 changed files with 27 additions and 18 deletions
23
readme.md
23
readme.md
|
@ -32,14 +32,15 @@ i've run out of ideas.
|
||||||
|
|
||||||
## todo
|
## todo
|
||||||
|
|
||||||
- account settings page
|
- User icons in account management pages
|
||||||
- better web design
|
- Account settings page
|
||||||
- user icons in the account management + settings (gdicon.oat.zone? selfhost?) ideally we find a legal way to do this (i cant distribute the plist+asset files directly) but doing this illegally is always an option
|
- Better web design
|
||||||
- use chrono
|
- Use chrono for dates in database, add recent
|
||||||
- 2.2 friends only unlisted
|
- 2.2's friends only unlisted
|
||||||
- add dailies, events, weekly
|
- Dailies, weeklies, events(?)
|
||||||
- moderation utilities
|
- Moderation utilities
|
||||||
- better song support
|
- Better song support
|
||||||
- authentication caching
|
- Cache authentication
|
||||||
- use log instead of println
|
- Panic less
|
||||||
- make a proper rank system (reuploading, uploading music, rating, etc.)
|
- Make a proper rank system (reuploading, uploading music, rating, etc.)
|
||||||
|
- Swap to a better web framework
|
|
@ -195,8 +195,19 @@ pub fn decode(level_data: String) -> Vec<HashMap<String, String>> {
|
||||||
|
|
||||||
let mut decoder = GzDecoder::new(&decoded_bytes[..]);
|
let mut decoder = GzDecoder::new(&decoded_bytes[..]);
|
||||||
|
|
||||||
let mut uncompressed_data = String::new();
|
let uncompressed_data = String::from_utf8(if decoded_bytes.starts_with(&[0x1F, 0x8B]) {
|
||||||
decoder.read_to_string(&mut uncompressed_data).expect("err unzipping level");
|
// gzip!!
|
||||||
|
let mut decompressed_data = Vec::new();
|
||||||
|
decoder.read_to_end(&mut decompressed_data).expect("err uncompressing level");
|
||||||
|
decompressed_data
|
||||||
|
} else if decoded_bytes.starts_with(&[0x78]) {
|
||||||
|
// zlib!!
|
||||||
|
let mut decompressed_data = Vec::new();
|
||||||
|
decoder.read_to_end(&mut decompressed_data).expect("err uncompressing level");
|
||||||
|
decompressed_data
|
||||||
|
} else {
|
||||||
|
panic!("invalid compression method")
|
||||||
|
}).expect("invalid utf-8 sequence");
|
||||||
|
|
||||||
return parse(uncompressed_data.as_str())
|
return parse(uncompressed_data.as_str())
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,6 @@ pub fn init() {
|
||||||
Ok(reupload_acc_id) => {
|
Ok(reupload_acc_id) => {
|
||||||
let mut write_lock = REUPLOAD_ACCOUNT_ID.write().expect("poisoned lock!!");
|
let mut write_lock = REUPLOAD_ACCOUNT_ID.write().expect("poisoned lock!!");
|
||||||
*write_lock = reupload_acc_id;
|
*write_lock = reupload_acc_id;
|
||||||
|
|
||||||
println!("reupload account found, id: {}", reupload_acc_id);
|
|
||||||
},
|
},
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
let new_account = NewAccount {
|
let new_account = NewAccount {
|
||||||
|
@ -35,7 +33,7 @@ pub fn init() {
|
||||||
let inserted_account = diesel::insert_into(accounts::table)
|
let inserted_account = diesel::insert_into(accounts::table)
|
||||||
.values(&new_account)
|
.values(&new_account)
|
||||||
.get_result::<Account, >(connection)
|
.get_result::<Account, >(connection)
|
||||||
.expect("Fatal error saving the new account");
|
.expect("error saving the new account");
|
||||||
|
|
||||||
let reupload_acc_id = inserted_account.id;
|
let reupload_acc_id = inserted_account.id;
|
||||||
|
|
||||||
|
@ -48,7 +46,7 @@ pub fn init() {
|
||||||
diesel::insert_into(users::table)
|
diesel::insert_into(users::table)
|
||||||
.values(&new_user)
|
.values(&new_user)
|
||||||
.get_result::<User, >(connection)
|
.get_result::<User, >(connection)
|
||||||
.expect("Fatal error saving the new user");
|
.expect("error saving the new user");
|
||||||
|
|
||||||
let mut write_lock = REUPLOAD_ACCOUNT_ID.write().expect("poisoned lock!!");
|
let mut write_lock = REUPLOAD_ACCOUNT_ID.write().expect("poisoned lock!!");
|
||||||
*write_lock = reupload_acc_id;
|
*write_lock = reupload_acc_id;
|
||||||
|
|
|
@ -38,7 +38,6 @@ pub fn post_login(cookies: &CookieJar<'_>, input: Form<FormLogin>) -> Template {
|
||||||
"blackmail_data",
|
"blackmail_data",
|
||||||
format!("{}:{}:{}", account_id_username_val.1, account_id_user_id_val.0, account_id_user_id_val.1))
|
format!("{}:{}:{}", account_id_username_val.1, account_id_user_id_val.0, account_id_user_id_val.1))
|
||||||
.path("/")
|
.path("/")
|
||||||
// should probably make this true when we get into production
|
|
||||||
.secure(false)
|
.secure(false)
|
||||||
.http_only(true)
|
.http_only(true)
|
||||||
.max_age(Duration::days(365))
|
.max_age(Duration::days(365))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue