mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-11 20:32:12 +00:00
Fix build errors (couldn't run build on Linux due to SSL breaks)
This commit is contained in:
1 parent
1204ac5399
commit
14432e9808
1 file changed
+9
-6
@@ -33,12 +33,14 @@ pub struct AppFeature {
|
||||
/// Optional.
|
||||
/// Whether the feature is enabled.
|
||||
/// If a feature is associated with a number rather than a boolean on/off, this will be absent.
|
||||
pub is_enabled: Option<boolean>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub is_enabled: Option<bool>,
|
||||
|
||||
/// Optional.
|
||||
/// A quantity associated with the feature.
|
||||
/// Sometimes a feature may be associated with a number rather than an enabled flag,
|
||||
/// such as "number_of_models = 50".
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub quantity: Option<u64>,
|
||||
}
|
||||
|
||||
@@ -83,9 +85,6 @@ pub async fn get_app_plans_handler(
|
||||
http_request: HttpRequest,
|
||||
server_state: web::Data<Arc<ServerState>>) -> Result<HttpResponse, AppPlansError>
|
||||
{
|
||||
// TODO: Real features.
|
||||
let username = "";
|
||||
|
||||
let maybe_user = server_state
|
||||
.session_checker
|
||||
.maybe_get_user_session(&http_request, &server_state.mysql_pool)
|
||||
@@ -96,10 +95,12 @@ pub async fn get_app_plans_handler(
|
||||
})?;
|
||||
|
||||
let unlimited_time = maybe_user
|
||||
.as_ref()
|
||||
.map(|user| user.username.to_lowercase().starts_with("time"))
|
||||
.unwrap_or(false);
|
||||
|
||||
let model_count = maybe_user
|
||||
.as_ref()
|
||||
.map(|user| {
|
||||
let name = user.username.to_lowercase();
|
||||
if name.ends_with("some") {
|
||||
@@ -120,15 +121,17 @@ pub async fn get_app_plans_handler(
|
||||
// NB: Triggered by username!
|
||||
if unlimited_time {
|
||||
features.push(AppFeature {
|
||||
key: "no_time_limit",
|
||||
key: "no_time_limit".to_string(),
|
||||
is_enabled: Some(true),
|
||||
quantity: None,
|
||||
});
|
||||
}
|
||||
|
||||
// NB: Triggered by username!
|
||||
if model_count > 0 {
|
||||
features.push(AppFeature {
|
||||
key: "number_of_downloads_supported",
|
||||
key: "number_of_downloads_supported".to_string(),
|
||||
is_enabled: None,
|
||||
quantity: Some(model_count),
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user