add: ProfileStyle products
This commit is contained in:
parent
077e9252e3
commit
95cb889080
19 changed files with 525 additions and 54 deletions
|
@ -101,11 +101,20 @@ pub struct User {
|
|||
/// already applied this purchase.
|
||||
#[serde(default)]
|
||||
pub checkouts: Vec<String>,
|
||||
/// The IDs of products to be applied to the user's profile.
|
||||
#[serde(default)]
|
||||
pub applied_configurations: Vec<(AppliedConfigType, usize)>,
|
||||
}
|
||||
|
||||
pub type UserConnections =
|
||||
HashMap<ConnectionService, (ExternalConnectionInfo, ExternalConnectionData)>;
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum AppliedConfigType {
|
||||
/// An HTML `<style>` snippet.
|
||||
StyleSnippet,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum ThemePreference {
|
||||
Auto,
|
||||
|
@ -417,6 +426,7 @@ impl User {
|
|||
ban_expire: 0,
|
||||
coins: 0,
|
||||
checkouts: Vec::new(),
|
||||
applied_configurations: Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,6 +10,10 @@ pub enum ProductFulfillmentMethod {
|
|||
///
|
||||
/// This will leave the [`CoinTransfer`] pending until you send this mail.
|
||||
ManualMail,
|
||||
/// A CSS snippet which can be applied to user profiles.
|
||||
///
|
||||
/// Only supporters can create products like this.
|
||||
ProfileStyle,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
|
@ -31,6 +35,8 @@ pub struct Product {
|
|||
pub stock: i32,
|
||||
/// If this product is limited to one purchase per person.
|
||||
pub single_use: bool,
|
||||
/// Data for this product. Only used by snippets.
|
||||
pub data: String,
|
||||
}
|
||||
|
||||
impl Product {
|
||||
|
@ -47,6 +53,7 @@ impl Product {
|
|||
price: 0,
|
||||
stock: 0,
|
||||
single_use: true,
|
||||
data: String::new(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue