mirror of
https://github.com/narrrl/pl8list-rewind.git
synced 2026-11-19 09:25:03 +01:00
Timed comments on the waveform
Each comment sits as a dot under the moment it was left at. When the music gets there the dot pings and a bubble grows out of it on a spark, then drifts up and fades; a mouse over a dot peeks at it. The server fetches the newest 60 comments from pl8list on demand and keeps them for 15 minutes. A setting turns them off.
This commit is contained in:
1 parent
b290cd49e3
commit
b42780d24b
12 files changed
+579
-2
No files matched your search
@@ -28,6 +28,7 @@ use secrecy::SecretString;
|
||||
|
||||
use crate::{
|
||||
cache::Cache,
|
||||
comments::Comments,
|
||||
config::Config,
|
||||
crawler::Crawler,
|
||||
db::{self, Db, User},
|
||||
@@ -61,6 +62,8 @@ pub struct Limits {
|
||||
pub resync: RateLimiter,
|
||||
/// Guests made per IP: each is a row in the database.
|
||||
pub guests: RateLimiter,
|
||||
/// Comment fetches from pl8list, per user: only misses of the comment cache count.
|
||||
pub comments: RateLimiter,
|
||||
}
|
||||
|
||||
pub struct App {
|
||||
@@ -75,6 +78,7 @@ pub struct App {
|
||||
pub cookies: Cookies,
|
||||
pub segments: proxy::SegmentKeys,
|
||||
pub legal: legal::Pages,
|
||||
pub comments: Comments,
|
||||
}
|
||||
|
||||
pub type St = State<Arc<App>>;
|
||||
@@ -97,7 +101,9 @@ impl App {
|
||||
pl8_writes: RateLimiter::new(60, 600),
|
||||
resync: RateLimiter::new(1, 120),
|
||||
guests: RateLimiter::new(10, 3600),
|
||||
comments: RateLimiter::new(30, 300),
|
||||
},
|
||||
comments: Comments::default(),
|
||||
logins: auth::PendingLogins::default(),
|
||||
segments: proxy::SegmentKeys::default(),
|
||||
sync,
|
||||
@@ -119,7 +125,7 @@ impl App {
|
||||
}
|
||||
self.logins.prune();
|
||||
self.segments.prune();
|
||||
for l in [&self.limits.guests, &self.limits.reads, &self.limits.proxy, &self.limits.proxy_ip, &self.limits.events] {
|
||||
for l in [&self.limits.guests, &self.limits.reads, &self.limits.proxy, &self.limits.proxy_ip, &self.limits.events, &self.limits.comments] {
|
||||
l.prune();
|
||||
}
|
||||
}
|
||||
@@ -349,6 +355,7 @@ pub fn router(app: Arc<App>) -> Router {
|
||||
.route("/local/likes", get(app::likes))
|
||||
.route("/local/track", get(app::track))
|
||||
.route("/local/artist", get(app::artist))
|
||||
.route("/local/comments", get(app::comments))
|
||||
.route("/local/event", post(app::event))
|
||||
.route("/local/follow", post(app::follow))
|
||||
.route("/account/export", get(account::export))
|
||||
|
||||
Reference in new issue
Block a user