{% extends "base.html" %}
{% load djacore_tags %}{% load comments_tags %}{% load default_tags %}{% load mptt_tags %}
{% load cache %}
{% load static %}
{% block meta %}
    {% with meta=obj.get_meta_tags %}
        <title>{% if meta.title %}{{ meta.title }}{% else %}{{ obj.title }}{% endif %}-{{ obj.category.name }}-{{ site_name }}</title>
        <meta name="description" content="{{ meta.description|slice:summary_length }}">
        <meta name="keywords" content="{{ meta.keywords }}">
        
        <!-- Open Graph -->
        <meta property="og:type" content="{{ meta.og.type }}">
        <meta property="og:title" content="{{ meta.og.title }}">
        <meta property="og:description" content="{{ meta.og.description }}">
        <meta property="og:url" content="{{site_url}}{{ meta.og.url }}">
        
        <!-- Twitter Card -->
        <meta name="twitter:card" content="{{ meta.twitter.card }}">
        <meta name="twitter:title" content="{{ meta.twitter.title }}">
        <meta name="twitter:description" content="{{ meta.twitter.description }}">
    {% endwith %}
{% endblock %}
{% block header %}
{% include "includes/header.html" %}
{% endblock %}
{% block breadcrumb %}
<nav aria-label="breadcrumb">
  <ol class="breadcrumb">
    <li class="breadcrumb-item"><a href="{% get_home_url %}">首页</a></li>
    {% ancestorsnode obj.category True as breadcrumb %}
    {% for item in breadcrumb %}
    <li class="breadcrumb-item"><a href="{{ item.get_absolute_url }}">{{ item.name }}</a></li>
    {% endfor %}
    <li class="breadcrumb-item active" aria-current="page">内容详情</li>
  </ol>
</nav>
{% endblock %}
{% block body_left_center %}
<div class="container py-5">
  <!-- 封面模块 -->
  <div class="card mb-4 shadow-sm">
    {% if obj.thumb_image %}
    <img src="{{ obj.thumb_image.url }}" class="card-img-top object-fit-cover" style="height: 300px" alt="封面图">
    {% else %}
    <div class="card-body text-center bg-light" style="height: 150px">
      <i class="bi bi-download display-4 text-secondary"></i>
    </div>
    {% endif %}
  </div>

  <!-- 元信息 -->
  <div class="row g-4 mb-4">
    <div class="col-md-8">
      <h1 class="fs-3 fw-bold">{{ obj.title }}</h1>
      <div class="d-flex gap-3 text-muted mb-3">
        <span class="badge bg-primary fs-6">{{ obj.version }}</span>
        <span class="badge bg-success">{{ obj.get_license_type_display }}</span>
      </div>
    </div>
    <div class="col-md-4">
      <div class="d-grid gap-2">
        {% if obj.file %}
        <a href="{{ obj.file.url }}" class="btn btn-danger btn-lg">
          <i class="bi bi-download me-2"></i>立即下载
        </a>
        {% endif %}
      </div>
    </div>
  </div>

  <!-- 平台要求 -->
  <div class="card mb-4">
    <div class="card-body">
      <h5 class="card-title"><i class="bi bi-windows me-2"></i>系统要求</h5>
      <div class="row row-cols-2 row-cols-lg-4 g-2">
        {% for platform in support_platforms %}
        <div class="col">
          <div class="card h-100 border-primary">
            <div class="card-body text-center">
              <i class="bi bi-{{ platform|lower }} fs-3 text-primary"></i>
              <h6 class="mt-2">{{ platform|title }}</h6>
            </div>
          </div>
        </div>
        {% endfor %}
      </div>
    </div>
  </div>
  <!-- 软件介绍 -->
   <div class="content my-3 border border-1 p-3 rounded ">
    <h2 class="fs-4 fw-bold">软件介绍</h2>
    <hr class="my-3">
    <div class="">{{obj.content|safe}}</div>
    
   </div>
  <!-- 下载渠道 -->
  <div class="row g-4 mb-4">
    {% for platform in platform_downloads %}
    <div class="col-md-6">
      <div class="card h-100">
        <div class="card-body">
          <div class="d-flex align-items-center gap-3 mb-3">
            <i class="bi bi-{{ platform.channel_type|cut:'_' }} fs-2 text-{{ platform.color }}"></i>
            <h5 class="mb-0">{{ platform.channel_type|title }}</h5>
          </div>
          <ul class="list-group list-group-flush">
            {% if platform.channel_type == 'aws_s3' %}
            <li class="list-group-item d-flex justify-content-between">
              <span>区域:</span>
              <span class="text-muted">{{ platform.config.region }}</span>
            </li>
            {% endif %}
            <li class="list-group-item">
              <button class="btn btn-outline-secondary w-100" 
                      data-bs-toggle="modal" 
                      data-bs-target="#downloadModal">
                生成下载链接
              </button>
            </li>
          </ul>
        </div>
      </div>
    </div>
    {% endfor %}
  </div>

  <!-- 安全验证 -->
  <div class="card mb-4">
    <div class="card-body">
      <h5 class="card-title"><i class="bi bi-shield-check me-2"></i>安全验证</h5>
      <div class="list-group">
        {% for label, value in security_hashes %}
        {% if value %}
        <div class="list-group-item">
          <div class="row">
            <div class="col-3 fw-bold">{{ label }}:</div>
            <div class="col-9">
              <code class="user-select-all">{{ value }}</code>
            </div>
          </div>
        </div>
        {% endif %}
        {% endfor %}
      </div>
    </div>
  </div>

  <!-- 更新日志 -->
  <div class="card">
    <div class="card-body">
      <h5 class="card-title"><i class="bi bi-journal-text me-2"></i>更新日志</h5>
      <div class="card-text">
        <pre class="bg-light p-3 rounded-2">{{ obj.update_log }}</pre>
      </div>
    </div>
  </div>
</div>

<!-- 模态框 -->
<div class="modal fade" id="downloadModal">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title">下载准备中</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal"></button>
      </div>
      <div class="modal-body">
        <div class="spinner-border text-primary" role="status">
          <span class="visually-hidden">Loading...</span>
        </div>
        <span class="ms-3">正在生成安全下载链接...</span>
      </div>
    </div>
  </div>
</div>




<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>



{% endblock %}


