update dependicies, fix profile page

This commit is contained in:
Tyler Murphy 2023-02-12 16:44:45 -05:00
parent 3d71da4909
commit 98f612774c
5 changed files with 25 additions and 14 deletions

8
Cargo.lock generated
View file

@ -134,9 +134,9 @@ checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610"
[[package]] [[package]]
name = "bytes" name = "bytes"
version = "1.3.0" version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dfb24e866b15a1af2a1b663f10c6b6b8f397a84aadb828f12e5b289ec23a3a3c" checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be"
[[package]] [[package]]
name = "cc" name = "cc"
@ -1302,9 +1302,9 @@ dependencies = [
[[package]] [[package]]
name = "tokio" name = "tokio"
version = "1.24.2" version = "1.25.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "597a12a59981d9e3c38d216785b0c37399f6e415e8d0712047620f189371b0bb" checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af"
dependencies = [ dependencies = [
"autocfg", "autocfg",
"bytes", "bytes",

View file

@ -4,7 +4,7 @@ version = "0.0.1"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
tokio = { version = "1.23.0", features = ["full"] } tokio = { version = "1.25.0", features = ["full"] }
axum = { version = "0.6.4", features = ["headers", "query"] } axum = { version = "0.6.4", features = ["headers", "query"] }
tower-http = { version = "0.3.5", features = ["fs"] } tower-http = { version = "0.3.5", features = ["fs"] }
tower_governor = "0.0.4" tower_governor = "0.0.4"
@ -12,11 +12,11 @@ tower-cookies = "0.8.0"
tower = "0.4.13" tower = "0.4.13"
tracing = "0.1.37" tracing = "0.1.37"
tracing-subscriber = "0.3.16" tracing-subscriber = "0.3.16"
bytes = "1.3.0" bytes = "1.4"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = { version = "1.0", features = ["std"] } serde_json = { version = "1", features = ["std"] }
rusqlite = { version = "0.28.0", features = ["bundled"] } rusqlite = { version = "0.28.0", features = ["bundled"] }
rand = "0.8.5" rand = "0.8.5"
time = "0.3.17" time = "0.3.17"
lazy_static = "1.4.0" lazy_static = "1.4"
image = "0.24.3" image = "0.24.5"

View file

@ -66,6 +66,7 @@ export function form(attrs, ...children) {
} }
export function img(attrs, ...children) { export function img(attrs, ...children) {
attrs['onerror'] = (event) => event.target.remove()
return createElement("img", attrs, ...children) return createElement("img", attrs, ...children)
} }
@ -102,7 +103,7 @@ export function pfp(id) {
} }
export function banner(id) { export function banner(id) {
return img({src: `/image/banner?user_id=${id}`, onerror: () => {this.remove()}}) return img({src: `/image/banner?user_id=${id}`})
} }
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',

View file

@ -198,9 +198,15 @@ async function load(id) {
} }
const posts = (await loadusersposts(id, page)).json const posts = (await loadusersposts(id, page)).json
if (posts == undefined) {
posts = []
}
if (posts.length < 1) { if (posts.length < 1) {
document.getElementsByClassName('loadp')[0].remove() let el = document.getElementsByClassName('loadp')[0]
if (el) {
el.remove()
}
return [] return []
} else { } else {
page++ page++
@ -213,7 +219,11 @@ async function load(id) {
} }
if (batch.length != 0) { if (batch.length != 0) {
const users = await loadusers(batch).json const users = (await loadusers(batch)).json
if (users == undefined) {
users = []
}
for (const user of users) { for (const user of users) {
data.users[user.user_id] = user data.users[user.user_id] = user
} }