mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-05-15 08:22:39 +00:00
19a1a077c5
* Add a blocklist for URLs. * Fix SQL format * Make clippy happy. * Use regex for URL matching. * Escape regex chars in URLs. * Use post for modification. * Make URL block regex static and remove API routes. * Add date fields to table and use transaction. * Use Cache for blocklist. * Rename check_links + move list to parameters of process_markdown. * SQL format. * Format, again. * Remove println. * Add API test. * Set a shorter lifetime for regex in debug mode. * Add missing macro. * Update lemmy-js-client * Update api_test/pnpm-lock.yaml * Don't break other tests * Use different URL for test --------- Co-authored-by: Dessalines <dessalines@users.noreply.github.com> Co-authored-by: Nutomic <me@nutomic.com>
29 lines
981 B
Rust
29 lines
981 B
Rust
#[cfg(feature = "full")]
|
|
use crate::schema::local_site_url_blocklist;
|
|
use chrono::{DateTime, Utc};
|
|
use serde::{Deserialize, Serialize};
|
|
use serde_with::skip_serializing_none;
|
|
#[cfg(feature = "full")]
|
|
use ts_rs::TS;
|
|
|
|
#[skip_serializing_none]
|
|
#[derive(Clone, PartialEq, Eq, Debug, Serialize, Deserialize)]
|
|
#[cfg_attr(feature = "full", derive(Queryable, Selectable, Identifiable, TS))]
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_site_url_blocklist))]
|
|
#[cfg_attr(feature = "full", diesel(check_for_backend(diesel::pg::Pg)))]
|
|
#[cfg_attr(feature = "full", ts(export))]
|
|
pub struct LocalSiteUrlBlocklist {
|
|
pub id: i32,
|
|
pub url: String,
|
|
pub published: DateTime<Utc>,
|
|
pub updated: Option<DateTime<Utc>>,
|
|
}
|
|
|
|
#[derive(Default, Clone)]
|
|
#[cfg_attr(feature = "full", derive(Insertable, AsChangeset))]
|
|
#[cfg_attr(feature = "full", diesel(table_name = local_site_url_blocklist))]
|
|
pub struct LocalSiteUrlBlocklistForm {
|
|
pub url: String,
|
|
pub updated: Option<DateTime<Utc>>,
|
|
}
|