{% extends "base.html" %}
{% block content %}
<div class="container mt-4">
    <div class="row">
        <div class="col-12 text-center mb-5">
            <h1>Welcome to <strong>My Pastebin</strong></h1>
            <p class="lead">Easily create, share, and manage your pastes with syntax highlighting and powerful APIs.</p>
        </div>
    </div>
    <!-- Tabs Navigation -->
    <ul class="nav nav-tabs" id="mainTabs" role="tablist">
        <li class="nav-item" role="presentation">
            <button class="nav-link active" id="bash-tab" data-bs-toggle="tab" data-bs-target="#bash" type="button" role="tab" aria-controls="bash" aria-selected="true">
                Bash Client
            </button>
        </li>
        <li class="nav-item" role="presentation">
            <button class="nav-link" id="curl-tab" data-bs-toggle="tab" data-bs-target="#curl" type="button" role="tab" aria-controls="curl" aria-selected="false">
                Curl Examples
            </button>
        </li>
    </ul>
    <!-- Tabs Content -->
    <div class="tab-content mt-4" id="mainTabsContent">
        <!-- Bash Client -->
        <div class="tab-pane fade show active" id="bash" role="tabpanel" aria-labelledby="bash-tab">
            <div class="card mb-4">
                <div class="card-body">
                    <h2 class="card-title">Bash Client</h2>
                    <p>The Bash client simplifies interaction with the service. Download it here:</p>
                    <p>
                        <a href="https://gitlab.com/teraflops/mypastebin/-/blob/main/pastebin_client.sh" target="_blank">Download Bash Client</a> |
                        <a href="https://gitlab.com/teraflops/mypastebin" target="_blank">GitLab Repository</a>
                    </p>
                    <h3>Examples</h3>
                    <ul class="list-group">
                        <li class="list-group-item"><strong>Authentication:</strong>
                            <pre><code>./pastebin_client.sh login admin password123</code></pre>
 <li class="list-group-item"><strong>Create a Paste (with expiration and privacy):</strong>
    <pre><code>echo "Hello World" | ./pastebin_client.sh create plaintext yes no</code></pre>
    <p>Creates a paste in <code>plaintext</code> format that expires in 1 day and is public.  
       Use <code>yes</code> for a private paste.</p>
</li>

<li class="list-group-item"><strong>Upload a File (with expiration and privacy):</strong>
    <pre><code>./pastebin_client.sh upload script.py python yes no</code></pre>
    <p>Uploads <code>script.py</code> as a Python paste that expires in 1 day and is public.  
       Use <code>yes</code> as the last argument for a private paste.</p>
</li>


                        <li class="list-group-item"><strong>View a Paste:</strong>
                            <pre><code>./pastebin_client.sh view 1</code></pre>
                        </li>
                        <li class="list-group-item"><strong>View Raw Content:</strong>
                            <pre><code>./pastebin_client.sh view_raw 1</code></pre>
                        </li>
                        <li class="list-group-item"><strong>List Pastes:</strong>
                            <pre><code>./pastebin_client.sh list</code></pre>
                        </li>
                        <li class="list-group-item"><strong>Delete a Paste:</strong>
                            <pre><code>./pastebin_client.sh delete 1</code></pre>
                        </li>
                        <li class="list-group-item"><strong>Search Paste Contents:</strong>
                            <pre><code>./pastebin_client.sh search "search term"</code></pre>
                        </li>
                        <li class="list-group-item"><strong>User Details:</strong>
                            <pre><code>./pastebin_client.sh details</code></pre>
                        </li>
                        <li class="list-group-item"><strong>Mark a Paste as Favorite:</strong>
    <pre><code>./pastebin_client.sh favorite 1</code></pre>
</li>
<li class="list-group-item"><strong>Remove a Paste from Favorites:</strong>
    <pre><code>./pastebin_client.sh unfavorite 1</code></pre>
</li>
<li class="list-group-item"><strong>Download a Paste:</strong>
    <pre><code>./pastebin_client.sh download 1</code></pre>
</li>
                        <li class="list-group-item"><strong>List Favorites:</strong>
    <pre><code>./pastebin_client.sh list_favorites</code></pre>
</li>
<li class="list-group-item"><strong>List Pastes Shared With Others:</strong>
    <pre><code>./pastebin_client.sh shared_with_others</code></pre>
</li>
<li class="list-group-item"><strong>List Pastes Shared With Me:</strong>
    <pre><code>./pastebin_client.sh shared_with_me</code></pre>
</li>
<li class="list-group-item"><strong>Share a Paste:</strong>
    <pre><code>./pastebin_client.sh share 1 username true</code></pre>
    <p>Shares paste with ID 1 with <code>username</code>, allowing edit if <code>true</code> is passed.</p>
</li>
<li class="list-group-item"><strong>Unshare a Paste:</strong>
    <pre><code>./pastebin_client.sh unshare 1 test</code></pre>
</li>
<li class="list-group-item"><strong>Edit a Paste (via Editor):</strong>
    <pre><code>./pastebin_client.sh edit 1</code></pre>
    <p>Opens paste with ID 1 in your default editor. Upon saving and exiting, the updated content is sent to the server.</p>
</li>
<li class="list-group-item"><strong>Remove GPS Metadata from an Image:</strong>
    <pre><code>./pastebin_client.sh remove_gps 1</code></pre>
    <p>Removes GPS metadata from the image associated with paste ID 1.</p>
</li>


                    </ul>
                </div>
            </div>
        </div>
        <!-- Curl Examples -->
        <div class="tab-pane fade" id="curl" role="tabpanel" aria-labelledby="curl-tab">
            <div class="card mb-4">
                <div class="card-body">
                    <h2 class="card-title">Curl Examples</h2>
                    <p>Interact directly with the service using <code>curl</code>.</p>
                    <ul class="list-group">
                        <li class="list-group-item"><strong>Authentication:</strong>
                            <pre><code>curl -X POST {{ request.host_url }}api/token \
                -H "Content-Type: application/json" \
                -d '{"username":"admin","password":"password123"}'</code></pre>
                                        </li>
<li class="list-group-item"><strong>Create a Paste (with expiration and privacy):</strong>
    <pre><code>echo "Hello World" | curl -X POST {{ request.host_url }}paste \
        -H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
        -F "c=@-" \
        -F "expire=yes" \
        -F "private=no"</code></pre>
    <p>Creates a paste that expires in 1 day and is public.  
       Use <code>private=yes</code> to make it private.</p>
</li>

<li class="list-group-item"><strong>Upload a File (with expiration and privacy):</strong>
    <pre><code>curl -X POST {{ request.host_url }}paste \
        -H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
        -F "c=@script.py" \
        -F "expire=yes" \
        -F "private=no"</code></pre>
    <p>Uploads <code>script.py</code> that expires in 1 day and is public.  
       Use <code>private=yes</code> to make it private.</p>
</li>

                                               <li class="list-group-item"><strong>View a Paste:</strong>
                            <pre><code>curl {{ request.host_url }}paste/1/json \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
                        </li>
                        <li class="list-group-item"><strong>View Raw Content:</strong>
                            <pre><code>curl {{ request.host_url }}paste/1/raw \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
                        </li>
                        <li class="list-group-item"><strong>List Pastes:</strong>
                            <pre><code>curl -H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" {{ request.host_url }}pastes</code></pre>
                        </li>
                        <li class="list-group-item"><strong>Delete a Paste:</strong>
                            <pre><code>curl -X DELETE {{ request.host_url }}paste/1 \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
                        </li>
                        <li class="list-group-item"><strong>Search Paste Contents:</strong>
                            <pre><code>curl -X GET {{ request.host_url }}pastes/search?q="search term" \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
                        </li>
                        <li class="list-group-item"><strong>User Details:</strong>
                            <pre><code>curl -X GET {{ request.host_url }}user/details \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
                        </li>
                        <li class="list-group-item"><strong>Mark a Paste as Favorite:</strong>
    <pre><code>curl -X POST {{ request.host_url }}api/paste/1/favorite \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
</li>
<li class="list-group-item"><strong>Remove a Paste from Favorites:</strong>
    <pre><code>curl -X POST {{ request.host_url }}api/paste/1/unfavorite \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
</li>
<li class="list-group-item"><strong>Download a Paste:</strong>
    <pre><code>curl -X GET {{ request.host_url }}api/paste/1/download \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
-J -O</code></pre>
</li>
                        <li class="list-group-item"><strong>List Favorites:</strong>
    <pre><code>curl -X GET {{ request.host_url }}api/favorites \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
</li>
<li class="list-group-item"><strong>List Pastes Shared With Others:</strong>
    <pre><code>curl -X GET {{ request.host_url }}api/shared_with_others \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
</li>
<li class="list-group-item"><strong>List Pastes Shared With Me:</strong>
    <pre><code>curl -X GET {{ request.host_url }}api/shared_with_me \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;"</code></pre>
</li>
<li class="list-group-item"><strong>Share a Paste:</strong>
    <pre><code>curl -X POST {{ request.host_url }}api/paste/1/share \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
-H "Content-Type: application/json" \
-d '{
  "username": "test_user",
  "can_edit": true
}'</code></pre>
    <p>Shares paste with ID 1 with <code>test_user</code>, allowing edit if <code>can_edit</code> is <code>true</code>.</p>
</li>
<li class="list-group-item"><strong>Unshare a Paste:</strong>
    <pre><code>curl -X POST {{ request.host_url }}api/paste/1/unshare \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
-H "Content-Type: application/json" \
-d '{
  "username": "test"
}'</code></pre>
</li>
<li class="list-group-item"><strong>Edit a Paste:</strong>
    <pre><code>curl -X PUT {{ request.host_url }}api/paste/1 \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
-H "Content-Type: application/json" \
-d '{
  "content": "Updated content here"
}'</code></pre>
    <p>Overwrites the content of paste with ID 1 using JSON. Make sure the authenticated user has edit permission.</p>
</li>
<li class="list-group-item"><strong>Remove GPS Metadata from an Image:</strong>
    <pre><code>curl -X POST {{ request.host_url }}api/removegps \
-H "Authorization: Bearer &lt;YOUR_TOKEN&gt;" \
-H "Content-Type: application/json" \
-d '{
  "paste_id": 1
}'</code></pre>
    <p>Removes GPS metadata from the image associated with paste ID 1.</p>
</li>


                    </ul>
                </div>
            </div>
        </div>
    </div>
    <!-- Footer -->
</div>
{% endblock %}
        {% block footer %}
  {{ super() }} <!-- Esto conserva el contenido original del footer -->
{% endblock %}
