diff options
author | metamuffin <metamuffin@disroot.org> | 2024-06-20 16:08:57 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2024-06-20 16:08:57 +0200 |
commit | 270283eb61716fa51c0c9b96ef3e00d23eb94dc9 (patch) | |
tree | af50329912c2a699ef168f7915236f5d68a8a22e /src | |
parent | 9cfb8a07ad4f7413a37ec316f422938e672163f2 (diff) | |
download | meta-adservices-270283eb61716fa51c0c9b96ef3e00d23eb94dc9.tar meta-adservices-270283eb61716fa51c0c9b96ef3e00d23eb94dc9.tar.bz2 meta-adservices-270283eb61716fa51c0c9b96ef3e00d23eb94dc9.tar.zst |
add more info
Diffstat (limited to 'src')
-rw-r--r-- | src/info.rs | 16 | ||||
-rw-r--r-- | src/main.rs | 1 | ||||
-rw-r--r-- | src/state.rs | 8 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/info.rs b/src/info.rs index f0cda28..d082d4d 100644 --- a/src/info.rs +++ b/src/info.rs @@ -20,7 +20,9 @@ pub async fn r_index<'a>(state: &State<Arc<Logic>>) -> MyResult<Template<DynRend h1 { "meta adservices" } p { "meta adservices is the leading provider of useless images within iframes. " - "meta adservices is inspired by " a[href="https://john.citrons.xyz/"]{"johnvertisement"} + "meta adservices is inspired by " a[href="https://john.citrons.xyz/"]{"johnvertisement"} ". " + "the primary differences to john are that meta adservices serves properly compressed images, is free software and is bit more responsive in general. " + "check the source code on " a[href="https://codeberg.org/metamuffin/meta-adservices"]{"codeberg"} ". " } h2 { "sample ad" } iframe[src="/v1/embed?s=adservices.metamuffin.org", style="border:none;width:728px;height:90px;"] {} @@ -33,10 +35,11 @@ pub async fn r_index<'a>(state: &State<Arc<Logic>>) -> MyResult<Template<DynRend "Send mail to " a[href="mailto:metamuffin@disroot.org"]{"metamuffin@disroot.org"} "." br; "The mail MUST contain a ad name, ad image, URL to direct those who click it and optionally ad author name. " br; "Some ads will be rejected for any or no reason at all. " - "To create good ads, consider the following statements in the context of your ad: " + "To create good ads, consider the following statements in the context of your ad (you must not satisfy all): " ol { li { "It is funny, amusing or enigmatic in some way." } - li { "It doesn't break any laws." } + li { "It doesn't break any laws in germany." } + li { "The link promotes a personal page or free software project page." } li { "The image is compressed losslessly." } li { "The image has a resolution of exactly 728x90." } li { "The image uses the sRGB color space." } @@ -46,12 +49,12 @@ pub async fn r_index<'a>(state: &State<Arc<Logic>>) -> MyResult<Template<DynRend } h2 { "leaderboard" } table { - tr { th { "Domain" } th { "Impressions" } th { "Impression weight" } } + tr { th { "Domain" } th { "Impression weight" } th { "Impressions" } } @for (domain, raw, weighted) in &leaderboard { tr { td { @domain } - td { @raw } - td { @weighted.round() } + td { b { @weighted.round() } } + td { small { @raw } } } } } @@ -66,6 +69,7 @@ pub async fn r_index<'a>(state: &State<Arc<Logic>>) -> MyResult<Template<DynRend li { "Your IP address is used within a bloom filter in volatile memory." } li { "Your requests increments a persistent public counter per ad site (according to a weighting function)." } } + p { "in case of questions or request mail " a[href="mailto:metamuffin@disroot.org"]{"metamuffin@disroot.org"} } } } })) diff --git a/src/main.rs b/src/main.rs index f846715..79c3842 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,4 @@ #![feature(duration_constructors)] -#![feature(ip_bits)] pub mod embed; pub mod error; pub mod info; diff --git a/src/state.rs b/src/state.rs index a1d86c9..266199b 100644 --- a/src/state.rs +++ b/src/state.rs @@ -21,6 +21,7 @@ pub struct AdInfo { pub struct Config { bloom_filter_size: usize, impression_weight_falloff: f64, + leaderboard_weight_threshold: f64, pub image_base: PathBuf, database_path: PathBuf, pub port: u16, @@ -103,7 +104,12 @@ impl Logic { } d.sort_by_key(|(_, _, w)| OrdAnyway(-*w)); - while d.len() > 16 { + while d + .last() + .map(|l| l.2 < self.config.leaderboard_weight_threshold) + .unwrap_or_default() + || d.len() > 64 + { d.pop(); } |