quickpeep/quickpeep_structs/src/rake_entries.rs

51 lines
1.5 KiB
Rust

use bitflags::bitflags;
use bitflags_serde_shim::impl_serde_for_bitflags;
use quickpeep_densedoc::DenseDocument;
use serde::{Deserialize, Serialize};
bitflags! {
pub struct AnalysisAntifeatures: u8 {
/// Adverts are present on the page, according to a filter.
const ADVERTS = 0x01;
/// Some things are blocked due to privacy concerns, according to a filter.
const PRIVACY = 0x02;
/// Annoying cookie nags are present on this page, according to a cosmetic filter.
const COOKIE_NAG = 0x04;
/// Unspecified annoyances are present on this page, according to a cosmetic filter.
const ANNOYANCE = 0x08;
/// The web page was served over CloudFlare at the time of indexing, which is not in the
/// spirit of decentralisation.
const CLOUDFLARE = 0x10;
}
}
impl_serde_for_bitflags!(AnalysisAntifeatures);
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RakedPageEntry {
pub analysed_antifeatures: AnalysisAntifeatures,
pub document: DenseDocument,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RakedReferrerEntry {
pub references: Vec<RakedReference>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct RakedReference {
pub target: String,
pub kind: ReferenceKind,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub enum ReferenceKind {
CanonicalUrl,
Redirect,
Link,
HeaderLinkedFeed,
FeedEntry,
SitemapEntry,
}