| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
mod git; |
| 7 |
mod health; |
| 8 |
|
| 9 |
pub use git::*; |
| 10 |
pub use health::*; |
| 11 |
|
| 12 |
use std::sync::Arc; |
| 13 |
|
| 14 |
use askama::Template; |
| 15 |
|
| 16 |
use crate::auth::SessionUser; |
| 17 |
use crate::types::*; |
| 18 |
|
| 19 |
use super::CsrfTokenOption; |
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
#[derive(Template)] |
| 27 |
#[template(path = "pages/sandbox.html")] |
| 28 |
pub struct SandboxTemplate { |
| 29 |
pub csrf_token: CsrfTokenOption, |
| 30 |
} |
| 31 |
|
| 32 |
|
| 33 |
#[derive(Template)] |
| 34 |
#[template(path = "pages/policy.html")] |
| 35 |
pub struct PolicyTemplate { |
| 36 |
|
| 37 |
pub csrf_token: CsrfTokenOption, |
| 38 |
|
| 39 |
pub session_user: Option<SessionUser>, |
| 40 |
} |
| 41 |
|
| 42 |
|
| 43 |
#[derive(Template)] |
| 44 |
#[template(path = "pages/index.html")] |
| 45 |
pub struct IndexTemplate { |
| 46 |
pub csrf_token: CsrfTokenOption, |
| 47 |
pub host_url: Arc<str>, |
| 48 |
pub total_creators: u32, |
| 49 |
pub total_items: u32, |
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
pub founder_window_open: bool, |
| 54 |
|
| 55 |
|
| 56 |
pub founder_slots_remaining: Option<u32>, |
| 57 |
pub tier_prices: crate::tier_prices::TierPrices, |
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
pub landing_carousel: Vec<super::CarouselFrame>, |
| 62 |
|
| 63 |
|
| 64 |
|
| 65 |
pub last_shipped: Option<LandingVelocity>, |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
pub struct LandingVelocity { |
| 70 |
|
| 71 |
pub title: String, |
| 72 |
|
| 73 |
pub date: String, |
| 74 |
|
| 75 |
pub href: String, |
| 76 |
} |
| 77 |
|
| 78 |
|
| 79 |
#[derive(Template)] |
| 80 |
#[template(path = "pages/library.html")] |
| 81 |
pub struct LibraryTemplate { |
| 82 |
pub csrf_token: CsrfTokenOption, |
| 83 |
pub session_user: Option<SessionUser>, |
| 84 |
pub purchases: Vec<crate::db::DbPurchaseRow>, |
| 85 |
pub subscriptions: Vec<UserSubscription>, |
| 86 |
pub has_mt_memberships: bool, |
| 87 |
} |
| 88 |
|
| 89 |
|
| 90 |
#[derive(Template)] |
| 91 |
#[template(path = "pages/cart.html")] |
| 92 |
pub struct CartTemplate { |
| 93 |
pub csrf_token: CsrfTokenOption, |
| 94 |
pub session_user: Option<SessionUser>, |
| 95 |
pub seller_groups: Vec<CartSellerGroup>, |
| 96 |
pub wishlist_suggestions: Vec<crate::db::wishlists::WishlistItem>, |
| 97 |
pub total_items: usize, |
| 98 |
|
| 99 |
pub checkout_status: String, |
| 100 |
} |
| 101 |
|
| 102 |
|
| 103 |
pub struct CartSellerGroup { |
| 104 |
pub seller_username: String, |
| 105 |
pub seller_id: String, |
| 106 |
pub stripe_ready: bool, |
| 107 |
pub items: Vec<crate::db::cart::CartItem>, |
| 108 |
pub subtotal_cents: i32, |
| 109 |
pub item_count: usize, |
| 110 |
|
| 111 |
pub savings_cents: i32, |
| 112 |
} |
| 113 |
|
| 114 |
impl CartSellerGroup { |
| 115 |
pub fn subtotal_display(&self) -> String { |
| 116 |
crate::formatting::format_revenue(self.subtotal_cents as i64) |
| 117 |
} |
| 118 |
|
| 119 |
pub fn savings_display(&self) -> String { |
| 120 |
crate::formatting::format_revenue(self.savings_cents as i64) |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
|
| 125 |
#[derive(Template)] |
| 126 |
#[template(path = "pages/login.html")] |
| 127 |
pub struct LoginTemplate { |
| 128 |
pub csrf_token: CsrfTokenOption, |
| 129 |
|
| 130 |
|
| 131 |
pub prefill_login: String, |
| 132 |
|
| 133 |
pub error: Option<String>, |
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
pub notice: Option<String>, |
| 138 |
|
| 139 |
|
| 140 |
|
| 141 |
pub sso_enabled: bool, |
| 142 |
} |
| 143 |
|
| 144 |
|
| 145 |
|
| 146 |
|
| 147 |
|
| 148 |
|
| 149 |
#[derive(Template)] |
| 150 |
#[template(path = "wizards/wizard_join.html")] |
| 151 |
pub struct WizardJoinTemplate { |
| 152 |
pub csrf_token: CsrfTokenOption, |
| 153 |
pub nav: Vec<super::StepNavItem>, |
| 154 |
pub invite_code: Option<String>, |
| 155 |
} |
| 156 |
|
| 157 |
|
| 158 |
#[derive(Template)] |
| 159 |
#[template(path = "wizards/steps/join/account.html")] |
| 160 |
pub struct WizardJoinAccountTemplate { |
| 161 |
pub nav: Vec<super::StepNavItem>, |
| 162 |
pub csrf_token: CsrfTokenOption, |
| 163 |
pub invite_code: Option<String>, |
| 164 |
} |
| 165 |
|
| 166 |
|
| 167 |
#[derive(Template)] |
| 168 |
#[template(path = "wizards/steps/join/profile.html")] |
| 169 |
pub struct WizardJoinProfileTemplate { |
| 170 |
pub nav: Vec<super::StepNavItem>, |
| 171 |
} |
| 172 |
|
| 173 |
|
| 174 |
#[derive(Template)] |
| 175 |
#[template(path = "wizards/steps/join/complete.html")] |
| 176 |
pub struct WizardJoinCompleteTemplate { |
| 177 |
pub nav: Vec<super::StepNavItem>, |
| 178 |
pub display_name: String, |
| 179 |
|
| 180 |
pub is_creator: bool, |
| 181 |
|
| 182 |
pub has_invite: bool, |
| 183 |
} |
| 184 |
|
| 185 |
|
| 186 |
#[derive(Template)] |
| 187 |
#[template(path = "pages/two_factor.html")] |
| 188 |
pub struct TwoFactorTemplate { |
| 189 |
pub csrf_token: CsrfTokenOption, |
| 190 |
pub session_user: Option<SessionUser>, |
| 191 |
pub error: Option<String>, |
| 192 |
} |
| 193 |
|
| 194 |
|
| 195 |
#[derive(Template)] |
| 196 |
#[template(path = "pages/oauth_authorize.html")] |
| 197 |
pub struct OAuthAuthorizeTemplate { |
| 198 |
pub csrf_token: CsrfTokenOption, |
| 199 |
pub session_user: Option<SessionUser>, |
| 200 |
pub app_name: String, |
| 201 |
pub client_id: String, |
| 202 |
pub redirect_uri: String, |
| 203 |
pub state: String, |
| 204 |
pub code_challenge: String, |
| 205 |
pub code_challenge_method: String, |
| 206 |
pub error_message: Option<String>, |
| 207 |
} |
| 208 |
|
| 209 |
|
| 210 |
#[derive(Template)] |
| 211 |
#[template(path = "pages/forgot_password.html")] |
| 212 |
pub struct ForgotPasswordTemplate { |
| 213 |
pub csrf_token: CsrfTokenOption, |
| 214 |
} |
| 215 |
|
| 216 |
|
| 217 |
#[derive(Template)] |
| 218 |
#[template(path = "pages/reset_password.html")] |
| 219 |
pub struct ResetPasswordTemplate { |
| 220 |
pub csrf_token: CsrfTokenOption, |
| 221 |
pub valid: bool, |
| 222 |
pub user_id: String, |
| 223 |
pub expires: String, |
| 224 |
pub sig: String, |
| 225 |
|
| 226 |
|
| 227 |
|
| 228 |
pub error: Option<String>, |
| 229 |
} |
| 230 |
|
| 231 |
|
| 232 |
#[derive(Template)] |
| 233 |
#[template(path = "pages/user.html")] |
| 234 |
#[allow(dead_code)] |
| 235 |
pub struct UserTemplate { |
| 236 |
pub csrf_token: CsrfTokenOption, |
| 237 |
pub session_user: Option<SessionUser>, |
| 238 |
pub user: User, |
| 239 |
pub custom_links: Vec<CustomLink>, |
| 240 |
pub projects: Vec<Project>, |
| 241 |
pub public_collections: Vec<Collection>, |
| 242 |
|
| 243 |
pub user_id: String, |
| 244 |
|
| 245 |
pub is_own_profile: bool, |
| 246 |
|
| 247 |
pub is_following: bool, |
| 248 |
|
| 249 |
pub follower_count: i64, |
| 250 |
|
| 251 |
pub host_url: Arc<str>, |
| 252 |
|
| 253 |
pub creator_paused: bool, |
| 254 |
|
| 255 |
pub tips_enabled: bool, |
| 256 |
|
| 257 |
pub creator_id: String, |
| 258 |
|
| 259 |
pub tip_project_id: Option<String>, |
| 260 |
} |
| 261 |
|
| 262 |
|
| 263 |
#[derive(Template)] |
| 264 |
#[template(path = "pages/collection.html")] |
| 265 |
#[allow(dead_code)] |
| 266 |
pub struct CollectionTemplate { |
| 267 |
pub csrf_token: CsrfTokenOption, |
| 268 |
pub session_user: Option<SessionUser>, |
| 269 |
pub collection: Collection, |
| 270 |
pub items: Vec<CollectionItem>, |
| 271 |
pub owner_username: String, |
| 272 |
pub owner_display_name: Option<String>, |
| 273 |
pub is_owner: bool, |
| 274 |
} |
| 275 |
|
| 276 |
|
| 277 |
#[derive(Template)] |
| 278 |
#[template(path = "pages/project.html")] |
| 279 |
#[allow(dead_code)] |
| 280 |
pub struct ProjectTemplate { |
| 281 |
pub csrf_token: CsrfTokenOption, |
| 282 |
pub session_user: Option<SessionUser>, |
| 283 |
pub project: Project, |
| 284 |
pub creator_username: String, |
| 285 |
pub items: Vec<Item>, |
| 286 |
|
| 287 |
pub project_id: String, |
| 288 |
|
| 289 |
pub is_following: bool, |
| 290 |
|
| 291 |
pub follower_count: i64, |
| 292 |
|
| 293 |
pub subscription_tiers: Vec<SubscriptionTier>, |
| 294 |
|
| 295 |
pub has_subscription: bool, |
| 296 |
|
| 297 |
pub host_url: Arc<str>, |
| 298 |
|
| 299 |
pub git_repos: Vec<(String, String)>, |
| 300 |
|
| 301 |
pub has_blog_posts: bool, |
| 302 |
|
| 303 |
pub community_url: Option<String>, |
| 304 |
|
| 305 |
pub tips_enabled: bool, |
| 306 |
|
| 307 |
pub creator_id: String, |
| 308 |
|
| 309 |
pub tip_project_id: Option<String>, |
| 310 |
|
| 311 |
pub is_owner: bool, |
| 312 |
|
| 313 |
pub sections: Vec<crate::types::ProjectSection>, |
| 314 |
|
| 315 |
|
| 316 |
pub gallery: Vec<super::CarouselFrame>, |
| 317 |
} |
| 318 |
|
| 319 |
|
| 320 |
#[derive(Template)] |
| 321 |
#[template(path = "pages/project_paywall.html")] |
| 322 |
pub struct ProjectPaywallTemplate { |
| 323 |
pub csrf_token: CsrfTokenOption, |
| 324 |
pub session_user: Option<SessionUser>, |
| 325 |
pub project: Project, |
| 326 |
pub creator_username: String, |
| 327 |
|
| 328 |
pub price_display: String, |
| 329 |
|
| 330 |
pub checkout_type: crate::pricing::CheckoutType, |
| 331 |
|
| 332 |
pub subscription_tiers: Vec<SubscriptionTier>, |
| 333 |
|
| 334 |
pub host_url: Arc<str>, |
| 335 |
} |
| 336 |
|
| 337 |
|
| 338 |
#[derive(Template)] |
| 339 |
#[template(path = "pages/item.html")] |
| 340 |
#[allow(dead_code)] |
| 341 |
pub struct ItemTemplate { |
| 342 |
pub csrf_token: CsrfTokenOption, |
| 343 |
pub session_user: Option<SessionUser>, |
| 344 |
pub item: Item, |
| 345 |
pub creator_username: String, |
| 346 |
pub project_title: String, |
| 347 |
pub project_slug: String, |
| 348 |
|
| 349 |
pub host_url: Arc<str>, |
| 350 |
|
| 351 |
pub discussion_url: Option<String>, |
| 352 |
|
| 353 |
pub discussion_count: Option<i64>, |
| 354 |
|
| 355 |
pub project_cover_image_url: Option<String>, |
| 356 |
|
| 357 |
pub bundle_items: Vec<Item>, |
| 358 |
|
| 359 |
pub containing_bundles: Vec<Item>, |
| 360 |
|
| 361 |
pub sections: Vec<ItemSection>, |
| 362 |
|
| 363 |
pub is_owner: bool, |
| 364 |
|
| 365 |
pub is_wishlisted: bool, |
| 366 |
|
| 367 |
pub in_cart: bool, |
| 368 |
|
| 369 |
pub collection_count: u32, |
| 370 |
|
| 371 |
|
| 372 |
pub has_access: bool, |
| 373 |
|
| 374 |
|
| 375 |
pub gallery: Vec<super::CarouselFrame>, |
| 376 |
} |
| 377 |
|
| 378 |
|
| 379 |
|
| 380 |
|
| 381 |
#[derive(Template)] |
| 382 |
#[template(path = "pages/library_downloads.html")] |
| 383 |
#[allow(dead_code)] |
| 384 |
pub struct LibraryDownloadsTemplate { |
| 385 |
pub csrf_token: CsrfTokenOption, |
| 386 |
pub session_user: Option<SessionUser>, |
| 387 |
pub item: Item, |
| 388 |
pub creator_username: String, |
| 389 |
pub project_title: String, |
| 390 |
pub project_slug: String, |
| 391 |
pub host_url: Arc<str>, |
| 392 |
pub versions: Vec<Version>, |
| 393 |
|
| 394 |
|
| 395 |
pub bundle_items: Vec<Item>, |
| 396 |
pub sections: Vec<ItemSection>, |
| 397 |
pub discussion_url: Option<String>, |
| 398 |
pub discussion_count: Option<i64>, |
| 399 |
pub is_owner: bool, |
| 400 |
} |
| 401 |
|
| 402 |
|
| 403 |
#[derive(Template)] |
| 404 |
#[template(path = "pages/library_locked.html")] |
| 405 |
#[allow(dead_code)] |
| 406 |
pub struct LibraryLockedTemplate { |
| 407 |
pub csrf_token: CsrfTokenOption, |
| 408 |
pub session_user: Option<SessionUser>, |
| 409 |
pub item: Item, |
| 410 |
pub creator_username: String, |
| 411 |
pub host_url: Arc<str>, |
| 412 |
|
| 413 |
pub containing_bundles: Vec<Item>, |
| 414 |
pub is_logged_in: bool, |
| 415 |
} |
| 416 |
|
| 417 |
|
| 418 |
#[derive(Template)] |
| 419 |
#[template(path = "pages/library_text.html")] |
| 420 |
#[allow(dead_code)] |
| 421 |
pub struct LibraryTextTemplate { |
| 422 |
pub csrf_token: CsrfTokenOption, |
| 423 |
pub session_user: Option<SessionUser>, |
| 424 |
pub item: Item, |
| 425 |
pub creator_username: String, |
| 426 |
pub creator_display_name: Option<String>, |
| 427 |
pub creator_avatar_initials: String, |
| 428 |
pub project_title: String, |
| 429 |
pub project_slug: String, |
| 430 |
|
| 431 |
pub body_html: Option<String>, |
| 432 |
pub reading_time: Option<String>, |
| 433 |
pub host_url: Arc<str>, |
| 434 |
pub discussion_url: Option<String>, |
| 435 |
pub discussion_count: Option<i64>, |
| 436 |
pub is_owner: bool, |
| 437 |
} |
| 438 |
|
| 439 |
|
| 440 |
#[derive(Template)] |
| 441 |
#[template(path = "pages/text_reader.html")] |
| 442 |
#[allow(dead_code)] |
| 443 |
pub struct TextReaderTemplate { |
| 444 |
pub csrf_token: CsrfTokenOption, |
| 445 |
pub session_user: Option<SessionUser>, |
| 446 |
pub item: Item, |
| 447 |
pub creator_username: String, |
| 448 |
pub creator_display_name: Option<String>, |
| 449 |
|
| 450 |
pub creator_avatar_initials: String, |
| 451 |
pub project_title: String, |
| 452 |
pub project_slug: String, |
| 453 |
|
| 454 |
pub is_free: bool, |
| 455 |
|
| 456 |
pub in_library: bool, |
| 457 |
|
| 458 |
pub has_access: bool, |
| 459 |
pub reading_time: Option<String>, |
| 460 |
|
| 461 |
pub excerpt: Option<String>, |
| 462 |
|
| 463 |
pub host_url: Arc<str>, |
| 464 |
|
| 465 |
pub discussion_url: Option<String>, |
| 466 |
|
| 467 |
pub discussion_count: Option<i64>, |
| 468 |
} |
| 469 |
|
| 470 |
|
| 471 |
|
| 472 |
#[derive(Template)] |
| 473 |
#[template(path = "pages/library_audio.html")] |
| 474 |
#[allow(dead_code)] |
| 475 |
pub struct LibraryAudioTemplate { |
| 476 |
pub csrf_token: CsrfTokenOption, |
| 477 |
pub session_user: Option<SessionUser>, |
| 478 |
pub item: Item, |
| 479 |
pub creator_username: String, |
| 480 |
pub creator_display_name: Option<String>, |
| 481 |
pub creator_avatar_initials: String, |
| 482 |
pub project_title: Option<String>, |
| 483 |
pub project_slug: String, |
| 484 |
pub audio_url: Option<String>, |
| 485 |
pub chapters: Vec<Chapter>, |
| 486 |
pub segments_json: String, |
| 487 |
|
| 488 |
pub versions: Vec<Version>, |
| 489 |
pub host_url: Arc<str>, |
| 490 |
pub discussion_url: Option<String>, |
| 491 |
pub discussion_count: Option<i64>, |
| 492 |
pub is_owner: bool, |
| 493 |
} |
| 494 |
|
| 495 |
|
| 496 |
#[derive(Template)] |
| 497 |
#[template(path = "pages/audio_player.html")] |
| 498 |
pub struct AudioPlayerTemplate { |
| 499 |
pub csrf_token: CsrfTokenOption, |
| 500 |
pub session_user: Option<SessionUser>, |
| 501 |
pub item: Item, |
| 502 |
pub creator_username: String, |
| 503 |
pub creator_display_name: Option<String>, |
| 504 |
|
| 505 |
pub creator_avatar_initials: String, |
| 506 |
pub project_title: Option<String>, |
| 507 |
pub project_slug: String, |
| 508 |
|
| 509 |
pub is_free: bool, |
| 510 |
|
| 511 |
pub in_library: bool, |
| 512 |
|
| 513 |
pub has_access: bool, |
| 514 |
|
| 515 |
pub host_url: Arc<str>, |
| 516 |
|
| 517 |
pub discussion_url: Option<String>, |
| 518 |
|
| 519 |
pub discussion_count: Option<i64>, |
| 520 |
} |
| 521 |
|
| 522 |
|
| 523 |
|
| 524 |
#[derive(Template)] |
| 525 |
#[template(path = "pages/library_video.html")] |
| 526 |
#[allow(dead_code)] |
| 527 |
pub struct LibraryVideoTemplate { |
| 528 |
pub csrf_token: CsrfTokenOption, |
| 529 |
pub session_user: Option<SessionUser>, |
| 530 |
pub item: Item, |
| 531 |
pub creator_username: String, |
| 532 |
pub creator_display_name: Option<String>, |
| 533 |
pub creator_avatar_initials: String, |
| 534 |
pub project_title: Option<String>, |
| 535 |
pub project_slug: String, |
| 536 |
pub video_url: Option<String>, |
| 537 |
pub chapters: Vec<Chapter>, |
| 538 |
pub segments_json: String, |
| 539 |
pub versions: Vec<Version>, |
| 540 |
pub host_url: Arc<str>, |
| 541 |
pub discussion_url: Option<String>, |
| 542 |
pub discussion_count: Option<i64>, |
| 543 |
pub is_owner: bool, |
| 544 |
} |
| 545 |
|
| 546 |
|
| 547 |
#[derive(Template)] |
| 548 |
#[template(path = "pages/video_player.html")] |
| 549 |
pub struct VideoPlayerTemplate { |
| 550 |
pub csrf_token: CsrfTokenOption, |
| 551 |
pub session_user: Option<SessionUser>, |
| 552 |
pub item: Item, |
| 553 |
pub creator_username: String, |
| 554 |
pub creator_display_name: Option<String>, |
| 555 |
pub creator_avatar_initials: String, |
| 556 |
pub project_title: Option<String>, |
| 557 |
pub project_slug: String, |
| 558 |
pub is_free: bool, |
| 559 |
pub in_library: bool, |
| 560 |
pub has_access: bool, |
| 561 |
pub host_url: Arc<str>, |
| 562 |
pub discussion_url: Option<String>, |
| 563 |
pub discussion_count: Option<i64>, |
| 564 |
} |
| 565 |
|
| 566 |
|
| 567 |
#[derive(Template)] |
| 568 |
#[template(path = "pages/discover.html")] |
| 569 |
pub struct DiscoverTemplate { |
| 570 |
pub csrf_token: CsrfTokenOption, |
| 571 |
pub session_user: Option<SessionUser>, |
| 572 |
pub items: Vec<DiscoverItem>, |
| 573 |
pub projects: Vec<DiscoverProject>, |
| 574 |
|
| 575 |
pub mode: String, |
| 576 |
|
| 577 |
pub type_filters: Vec<FilterCategory>, |
| 578 |
|
| 579 |
pub tag_filters: Vec<FilterCategory>, |
| 580 |
|
| 581 |
pub category_filters: Vec<FilterCategory>, |
| 582 |
pub price_filters: Vec<PriceFilter>, |
| 583 |
pub total_items: u32, |
| 584 |
pub current_page: u32, |
| 585 |
pub total_pages: u32, |
| 586 |
pub search_query: String, |
| 587 |
|
| 588 |
pub sort_by: String, |
| 589 |
|
| 590 |
pub current_type: String, |
| 591 |
|
| 592 |
pub current_tag: String, |
| 593 |
|
| 594 |
pub current_category: String, |
| 595 |
|
| 596 |
pub pagination_range: Vec<u32>, |
| 597 |
pub showing_start: u32, |
| 598 |
pub showing_end: u32, |
| 599 |
|
| 600 |
pub ai_tier_filters: Vec<FilterCategory>, |
| 601 |
|
| 602 |
pub current_ai_tier: String, |
| 603 |
|
| 604 |
pub has_source: bool, |
| 605 |
|
| 606 |
pub active_filter_count: u32, |
| 607 |
|
| 608 |
pub is_authenticated: bool, |
| 609 |
} |
| 610 |
|
| 611 |
|
| 612 |
#[derive(Template)] |
| 613 |
#[template(path = "pages/tag_tree.html")] |
| 614 |
pub struct TagTreeTemplate { |
| 615 |
pub csrf_token: CsrfTokenOption, |
| 616 |
pub session_user: Option<SessionUser>, |
| 617 |
pub categories: Vec<TagTreeNode>, |
| 618 |
pub breadcrumbs: Vec<TagBreadcrumb>, |
| 619 |
pub current_tag: Option<TagBreadcrumb>, |
| 620 |
} |
| 621 |
|
| 622 |
|
| 623 |
#[derive(Template)] |
| 624 |
#[template(path = "pages/purchase.html")] |
| 625 |
pub struct PurchaseTemplate { |
| 626 |
pub csrf_token: CsrfTokenOption, |
| 627 |
pub item: Item, |
| 628 |
pub creator_username: String, |
| 629 |
pub stripe_fee: String, |
| 630 |
pub creator_receives: String, |
| 631 |
|
| 632 |
pub promo_code: String, |
| 633 |
|
| 634 |
pub pwyw_enabled: bool, |
| 635 |
|
| 636 |
pub pwyw_min_cents: i32, |
| 637 |
|
| 638 |
pub suggested_price: String, |
| 639 |
|
| 640 |
pub pwyw_min_dollars: String, |
| 641 |
|
| 642 |
pub stripe_tax_enabled: bool, |
| 643 |
|
| 644 |
pub is_logged_in: bool, |
| 645 |
|
| 646 |
|
| 647 |
|
| 648 |
pub pending_started: String, |
| 649 |
} |
| 650 |
|
| 651 |
|
| 652 |
#[derive(Template)] |
| 653 |
#[template(path = "pages/buy.html")] |
| 654 |
pub struct BuyPageTemplate { |
| 655 |
pub item: Item, |
| 656 |
pub creator_username: String, |
| 657 |
pub creator_display_name: Option<String>, |
| 658 |
pub pwyw_enabled: bool, |
| 659 |
pub pwyw_min_dollars: String, |
| 660 |
pub suggested_price: String, |
| 661 |
pub host_url: Arc<str>, |
| 662 |
} |
| 663 |
|
| 664 |
|
| 665 |
#[derive(Template)] |
| 666 |
#[template(path = "pages/feed.html")] |
| 667 |
pub struct FeedTemplate { |
| 668 |
pub csrf_token: CsrfTokenOption, |
| 669 |
pub session_user: Option<SessionUser>, |
| 670 |
pub items: Vec<DiscoverItem>, |
| 671 |
pub total_items: u32, |
| 672 |
pub current_page: u32, |
| 673 |
pub total_pages: u32, |
| 674 |
pub pagination_range: Vec<u32>, |
| 675 |
pub showing_start: u32, |
| 676 |
pub showing_end: u32, |
| 677 |
} |
| 678 |
|
| 679 |
|
| 680 |
#[derive(Template)] |
| 681 |
#[template(path = "pages/stripe_disclaimer.html")] |
| 682 |
pub struct StripeConnectDisclaimerTemplate { |
| 683 |
pub csrf_token: CsrfTokenOption, |
| 684 |
} |
| 685 |
|
| 686 |
|
| 687 |
|
| 688 |
|
| 689 |
|
| 690 |
|
| 691 |
#[derive(Template)] |
| 692 |
#[template(path = "pages/fan_plus.html")] |
| 693 |
pub struct FanPlusTemplate { |
| 694 |
pub csrf_token: CsrfTokenOption, |
| 695 |
pub session_user: Option<SessionUser>, |
| 696 |
|
| 697 |
pub is_subscribed: bool, |
| 698 |
|
| 699 |
pub period_end: Option<String>, |
| 700 |
|
| 701 |
pub just_subscribed: bool, |
| 702 |
} |
| 703 |
|
| 704 |
|
| 705 |
|
| 706 |
|
| 707 |
|
| 708 |
|
| 709 |
#[derive(Template)] |
| 710 |
#[template(path = "pages/project_blog.html")] |
| 711 |
pub struct ProjectBlogTemplate { |
| 712 |
pub csrf_token: CsrfTokenOption, |
| 713 |
pub session_user: Option<SessionUser>, |
| 714 |
pub project: Project, |
| 715 |
pub creator_username: String, |
| 716 |
pub project_slug: String, |
| 717 |
pub posts: Vec<BlogPostSummary>, |
| 718 |
} |
| 719 |
|
| 720 |
|
| 721 |
#[derive(Template)] |
| 722 |
#[template(path = "pages/blog_post.html")] |
| 723 |
pub struct BlogPostTemplate { |
| 724 |
pub csrf_token: CsrfTokenOption, |
| 725 |
pub session_user: Option<SessionUser>, |
| 726 |
pub title: String, |
| 727 |
|
| 728 |
pub title_json: String, |
| 729 |
pub body_html: String, |
| 730 |
pub published_at: String, |
| 731 |
pub creator_username: String, |
| 732 |
pub creator_display_name: Option<String>, |
| 733 |
pub creator_avatar_initials: String, |
| 734 |
pub project_title: String, |
| 735 |
|
| 736 |
pub project_title_json: String, |
| 737 |
pub project_slug: String, |
| 738 |
|
| 739 |
pub post_slug: String, |
| 740 |
|
| 741 |
pub host_url: Arc<str>, |
| 742 |
|
| 743 |
pub project_cover_image_url: Option<String>, |
| 744 |
|
| 745 |
pub discussion_url: Option<String>, |
| 746 |
|
| 747 |
pub discussion_count: Option<i64>, |
| 748 |
} |
| 749 |
|
| 750 |
|
| 751 |
|
| 752 |
|
| 753 |
|
| 754 |
|
| 755 |
#[derive(Template)] |
| 756 |
#[template(path = "pages/doc.html")] |
| 757 |
pub struct DocTemplate { |
| 758 |
pub csrf_token: CsrfTokenOption, |
| 759 |
pub session_user: Option<SessionUser>, |
| 760 |
pub title: String, |
| 761 |
pub section: String, |
| 762 |
pub content: String, |
| 763 |
} |
| 764 |
|
| 765 |
|
| 766 |
pub struct DocSectionEntry { |
| 767 |
pub title: String, |
| 768 |
pub slug: String, |
| 769 |
} |
| 770 |
|
| 771 |
|
| 772 |
pub struct DocSubsection { |
| 773 |
pub label: String, |
| 774 |
pub entries: Vec<DocSectionEntry>, |
| 775 |
} |
| 776 |
|
| 777 |
|
| 778 |
pub struct DocSection { |
| 779 |
pub name: String, |
| 780 |
pub entries: Vec<DocSectionEntry>, |
| 781 |
pub subsections: Vec<DocSubsection>, |
| 782 |
} |
| 783 |
|
| 784 |
|
| 785 |
#[derive(Template)] |
| 786 |
#[template(path = "pages/doc_index.html")] |
| 787 |
pub struct DocIndexTemplate { |
| 788 |
pub csrf_token: CsrfTokenOption, |
| 789 |
pub session_user: Option<SessionUser>, |
| 790 |
pub sections: Vec<DocSection>, |
| 791 |
} |
| 792 |
|
| 793 |
|
| 794 |
|
| 795 |
|
| 796 |
|
| 797 |
|
| 798 |
#[derive(Template)] |
| 799 |
#[template(path = "pages/pricing.html")] |
| 800 |
pub struct PricingTemplate { |
| 801 |
pub csrf_token: CsrfTokenOption, |
| 802 |
pub tier_prices: crate::tier_prices::TierPrices, |
| 803 |
pub cost_allocation: crate::tier_prices::CostAllocation, |
| 804 |
} |
| 805 |
|
| 806 |
|
| 807 |
|
| 808 |
|
| 809 |
|
| 810 |
#[derive(Template)] |
| 811 |
#[template(path = "pages/economics.html")] |
| 812 |
#[allow(dead_code)] |
| 813 |
pub struct EconomicsTemplate { |
| 814 |
pub csrf_token: CsrfTokenOption, |
| 815 |
pub session_user: Option<SessionUser>, |
| 816 |
|
| 817 |
|
| 818 |
pub runway_config: crate::tier_prices::RunwayConfig, |
| 819 |
|
| 820 |
|
| 821 |
|
| 822 |
pub paying_creators: i64, |
| 823 |
|
| 824 |
|
| 825 |
|
| 826 |
pub trialing_or_grace: i64, |
| 827 |
} |
| 828 |
|
| 829 |
|
| 830 |
#[derive(Template)] |
| 831 |
#[template(path = "pages/use_cases.html")] |
| 832 |
pub struct UseCasesTemplate { |
| 833 |
pub csrf_token: CsrfTokenOption, |
| 834 |
pub session_user: Option<SessionUser>, |
| 835 |
pub tier_prices: crate::tier_prices::TierPrices, |
| 836 |
} |
| 837 |
|
| 838 |
|
| 839 |
#[derive(Template)] |
| 840 |
#[template(path = "pages/team.html")] |
| 841 |
pub struct TeamTemplate { |
| 842 |
pub csrf_token: CsrfTokenOption, |
| 843 |
pub session_user: Option<SessionUser>, |
| 844 |
} |
| 845 |
|
| 846 |
|
| 847 |
|
| 848 |
|
| 849 |
|
| 850 |
|
| 851 |
#[derive(Template)] |
| 852 |
#[template(path = "pages/creators.html")] |
| 853 |
pub struct CreatorsTemplate { |
| 854 |
pub csrf_token: CsrfTokenOption, |
| 855 |
pub session_user: Option<SessionUser>, |
| 856 |
pub waves: Vec<WaveStats>, |
| 857 |
pub total_creators: u32, |
| 858 |
pub waitlist_pending: u32, |
| 859 |
pub is_creator: bool, |
| 860 |
pub tier_prices: crate::tier_prices::TierPrices, |
| 861 |
} |
| 862 |
|
| 863 |
|
| 864 |
|
| 865 |
|
| 866 |
|
| 867 |
|
| 868 |
#[derive(Template)] |
| 869 |
#[template(path = "pages/email_result.html")] |
| 870 |
pub struct EmailResultTemplate { |
| 871 |
pub csrf_token: CsrfTokenOption, |
| 872 |
pub title: String, |
| 873 |
pub message: String, |
| 874 |
pub link_url: String, |
| 875 |
pub link_text: String, |
| 876 |
} |
| 877 |
|
| 878 |
|
| 879 |
#[derive(Template)] |
| 880 |
#[template(path = "pages/receipt.html")] |
| 881 |
pub struct ReceiptTemplate { |
| 882 |
pub csrf_token: CsrfTokenOption, |
| 883 |
pub session_user: Option<crate::auth::SessionUser>, |
| 884 |
pub transaction_id: String, |
| 885 |
pub item_id: String, |
| 886 |
pub item_title: String, |
| 887 |
pub seller_username: String, |
| 888 |
pub amount: String, |
| 889 |
pub is_free: bool, |
| 890 |
pub status: String, |
| 891 |
pub date: String, |
| 892 |
} |
| 893 |
|
| 894 |
|
| 895 |
#[derive(Template)] |
| 896 |
#[template(path = "pages/confirm_delete.html")] |
| 897 |
pub struct ConfirmDeleteTemplate { |
| 898 |
pub csrf_token: CsrfTokenOption, |
| 899 |
pub user: String, |
| 900 |
pub expires: String, |
| 901 |
pub sig: String, |
| 902 |
} |
| 903 |
|
| 904 |
|
| 905 |
#[derive(Template)] |
| 906 |
#[template(path = "pages/account-deleted.html")] |
| 907 |
pub struct AccountDeletedTemplate { |
| 908 |
pub csrf_token: CsrfTokenOption, |
| 909 |
} |
| 910 |
|
| 911 |
|
| 912 |
|