add: option_source_password and option_view_password
This commit is contained in:
parent
a49efdd238
commit
2de840f50d
5 changed files with 158 additions and 13 deletions
22
src/model.rs
22
src/model.rs
|
@ -95,6 +95,15 @@ pub struct EntryMetadata {
|
|||
/// If this entry shows up in search engines.
|
||||
#[serde(default, alias = "OPTION_DISABLE_SEARCH_ENGINE")]
|
||||
pub option_disable_search_engine: bool,
|
||||
/// The password that is required to view this entry.
|
||||
#[serde(default, alias = "OPTION_VIEW_PASSWORD")]
|
||||
pub option_view_password: String,
|
||||
/// The password that is required to view the source of the entry.
|
||||
///
|
||||
/// If no password is provided but a view password IS provided, the view
|
||||
/// password will be used.
|
||||
#[serde(default, alias = "OPTION_SOURCE_PASSWORD")]
|
||||
pub option_source_password: String,
|
||||
/// The theme that is automatically used when this entry is viewed.
|
||||
#[serde(default, alias = "ACCESS_RECOMMENDED_THEME")]
|
||||
pub access_recommended_theme: RecommendedTheme,
|
||||
|
@ -388,6 +397,17 @@ macro_rules! metadata_css {
|
|||
}
|
||||
};
|
||||
|
||||
($selector:expr, $property:literal !important, $field:ident->$output:ident) => {
|
||||
if !$field.is_empty() {
|
||||
$output.push_str(&format!(
|
||||
"{} {{ {}: {} !important; }}\n",
|
||||
$selector,
|
||||
$property,
|
||||
EntryMetadata::css_escape(&$field)
|
||||
));
|
||||
}
|
||||
};
|
||||
|
||||
($selector:expr, $property:literal, $format:literal, $self:ident.$field:ident->$output:ident) => {
|
||||
if !$self.$field.is_empty() {
|
||||
$output.push_str(&format!(
|
||||
|
@ -404,7 +424,7 @@ macro_rules! text_size {
|
|||
($selector:literal, $split:ident, $idx:literal, $output:ident) => {
|
||||
if let Some(x) = $split.get($idx) {
|
||||
if *x != "default" && *x != "0" {
|
||||
metadata_css!($selector, "font-size", x->$output);
|
||||
metadata_css!($selector, "font-size" !important, x->$output);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue