<nav id="navbar-example2" class="navbar bg-body-tertiary px-3 mb-3">
  <ul class="nav nav-pills">
    <li class="nav-item">
      <a class="nav-link" href="#scrollspyHeading1">Welcome</a>
    </li>
    <li class="nav-item">
      <a class="nav-link" href="#scrollspyHeading2">Register</a>
    </li>
    <li class="nav-item dropdown">
      <a class="nav-link dropdown-toggle" data-bs-toggle="dropdown" href="#" role="button" aria-expanded="false">More Topics</a>
      <ul class="dropdown-menu">
        <li><a class="dropdown-item" href="#scrollspyHeading3">Dashboard</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading4">Configuration</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading5">Start<>Stop Relay</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading6">Advanced Config</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading7">Backup<>Restore</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading8">Message Structure</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading9">Uninstallation</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading10">Server Settings</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading11">Firewall Settings</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading12">Reset a2d</a></li>
        <li><a class="dropdown-item" href="#scrollspyHeading13">Error Messages</a></li>
        <li><hr class="dropdown-divider"></li>
        <li><a class="dropdown-item" href="#scrollspyHeading14">License</a></li>
      </ul>
    </li>
  </ul>
</nav>

<div data-bs-spy="scroll" data-bs-target="#navbar-example2" data-bs-root-margin="0px 0px -40%" data-bs-smooth-scroll="true" 
class="scrollspy-example bg-body-tertiary p-3 rounded-2" tabindex="0" style="height: 580px;">

  <h4 id="scrollspyHeading1">Welcome to a2d!</h4>
  <p>Congratulations on installing a2d portal. Let's guide you through the initial steps:<br></p>
  <div class="alert alert-warning" role="alert">
    <h5>Prerequisites:</h5>
    <b>1. Ham Radio License:</b> Ensure you hold a valid HAM radio license with a callsign. Although running the software itself 
    doesn't require a license, transmitting signals complies with license regulations and local laws.<br><br>
    <b>2. APRS API Key:</b> Register on aprs.fi with your callsign to generate a confidential API Key for downloading APRS messages. 
    Keep this key private.<br><br>
    <b>3. DAPNET User and Password:</b> Create a secure account on hampager.de for DAPNET. Further steps might be needed if you 
    don't have DAPNET-approved pager or transmitter.
  </div><br>

  <h4 id="scrollspyHeading2">Register PIN and Passphrase:</h4>
  <p>Security is paramount in the a2d portal. Here's how to safeguard your access:<br><br>
    <b>PIN Registration:</b> Choose a personalized six-digit PIN. If this is your first time, select "Register" on the login page to 
    set your 6-digit PIN and Passphrase.<br><br>
    <b>Logging In:</b> After registration, use your assigned PIN to log in. If there's no user activity, the login session will 
    automatically expire in 20 min, ensuring the security of your data.<br><br>
    <b>PIN Recovery:</b> If you forget your PIN, utilize your Passphrase to create a new one. Click "Forgot PIN!" on the login page. 
    Verify with your Passphrase. Upon successful verification, proceed to the page for setting a new PIN and Passphrase.<br>
  </p>
  <div class="alert alert-danger" role="alert">
    <h5>Passphrase Reminder:</h5> Note: There's no Passphrase reset option. Removing and Reinstalling the a2d portal is the only 
    recourse to reset your Passphrase (Warning: You will loose all your a2d data). After uninstalling a2d, please use the following 
    command to remove any existing user configuration files before proceeding with the reinstallation.<br><br>
    <i>&nbsp;&nbsp;sudo rm -r /etc/a2d</i><br>
  </div><br>

  <h4 id="scrollspyHeading3">Dashboard Overview:</h4>
  <p>
    <b>Navigation Bar:</b> Links for navigating to Server, 
    Mode (Light, Dark and Auto), and 
    Options include 
    Configuration, 
    Advanced, 
    Backup/Restore, 
    Change PIN, 
    Information, and 
    Exit.<br><br>
    <b>Dashboard:</b> Displays Callsign, a2d Status, Run Interval, Last Run, Destination SSIDs, and Start<>Stop Relay buttons.<br><br>
    <b>System Health:</b> Displays CPU Temperature, Memory Usage, and CPU Load.<br><br>
    <b>APRS to DAPNET Transmits:</b> Shows logs of APRS to DAPNET transmitted messages.<br><br>

      a2d portal offers three screen modes with Bootstrap v5.3 support: light, dark, and auto.<br><br>
      <b>Light:</b> Provides a clean and bright interface for comfortable usage.<br>
      <b>Dark:</b> Offers a sleek, darker interface that's easy on the eyes, especially in low-light conditions.<br>
      <b>Auto:</b> Adapts to your local system settings, ensuring a seamless experience that aligns with your device's theme.<br><br>
      Choose the mode that suits your preferences and enhances your interaction with the a2d app.
    </p><br>

  <h4 id="scrollspyHeading4">Setup Configuration:</h4>
  <p>
    If it's your first time, the dashboard will show 'Setup Configuration' instead of your Callsign. Click "Configuration" in the 
    Options dropdown to begin.<br><br>
    <b>To complete setup:</b><br>
    1. Enter your HAM radio callsign in ALL CAPS without any SSID for Callsign (no ssid).<br>
    2. Input your APRS API Key from <a href='http://aprs.fi' target="_blank">aprs.fi</a>.<br>
    3. Provide your DAPNET account username and password.<br>
    4. Include your DAPNET transmitter group code. Each DAPNET transmitter belongs to a specific group. Find your code during 
    transmitter configuration. 
    You can find your transmitter group code when setting up your transmitter. If you're unsure, <a href='http://hampager.de' 
    target="_blank">hampager.de</a> provides support on finding your transmitter group.<br>
    5. Click "Set Config" to save.
    <div class="alert alert-info" role="alert">
    Your data is securely encrypted. In case of security concerns, regenerate keys on respective websites and update passwords.
    </div>
    </p><br>

  <h4 id="scrollspyHeading5">Start<>Stop Relay:</h4>
  <div class="alert alert-danger" role="alert">
    Setup Configuration before pressing 'Start Relay' button.
  </div>
  <p>After configuring, click "Start Relay" to begin and "Stop Relay" in the dashboard to halt.
    Once you stop the relay, a2d will not run even after system reboot.<br><br>
    The interval between each APRS to DAPNET transfer is managed by the crontab manager in your system. 
    If the transfer interval is set to 15 min, cron will trigger the transfer at 0, 15, 30, and 45 min past the hour.<br><br>
    a2d is designed to transfer only APRS messages received after its first run, preventing flooding DAPNET with a large number 
    of messages all at once.
  </p><br>

  <h4 id="scrollspyHeading6">Advanced Configuration:</h4>
  <div class="alert alert-primary" role="alert">
    APRS servers block requests under 2 min. Please set intervals > 5 min for optimal performance.<br>
    Defaults fetch APRS messages for all SSIDs (-0 to -15), delivering to DAPNET every 15 min.
  </div>
  <p>If needed, modify in Advanced Options via Options in the navigation bar and selecting Advanced.<br><br>
    <b>• Interval:</b> Set retrieval frequency. Default is 15 minutes. Avoid very short intervals (below 5 min). Setting 0 (min) 0 (h) 
    resets to 15 min (or) setting 1 (min) 0 (h) resets to 2 min.<br>
    <b>• Preferred APRS SSIDs:</b> Define target SSIDs for messages. -0 is your callsign without SSID. Find HAM APRS SSIDs on 
    <a href='http://www.aprs.org/aprs11/SSIDs.txt' target="_blank">APRS SSID list</a>.<br>
    <b>• Transmit logs:</b> Set displayed logs on dashboard.
  </p><br>

  <h4 id="scrollspyHeading7">Backup<>Restore Configuration:</h4>
  <p>Once you've set up your a2d configuration, you can use the backup/restore menu in the navigation bar to safeguard your settings. 
    Both actions—backup and restore—require Passphrase verification.<br><br>
    <b>Backup:</b> Create a backup of your a2d configuration files. The backup file's name will be "a2d_config_backup.bin." This file 
    is encoded binary and holds your API credentials. Store it securely.<br>
    <b>Restore:</b> If you want to revert to a previous configuration, use the backup file to restore. However, be cautious. If the 
    bin file has been tampered with, the restore won't work, and using a modified bin file is strongly discouraged.
  </p>
  <div class="alert alert-warning" role="alert">
    Safeguard your settings with backups and restorations, but secure your bin file from unauthorized access and exercise caution to 
    maintain the integrity of your a2d configuration.
  </div>
  <b>Errors while Backup<>Restore:</b><br><br>
  <p><b>Invalid Passphrase:</b> Retry with the correct Passphrase.<br>
    <b>Configuration files missing:</b> Set up Configuration.<br>
    <b>Invalid file:</b> During restore configuration, use the correct a2d_config_backup.bin file.<br>
    <b>Configuration file tampered:</b> If you spot this, avoid using the modified file as it could harm the a2d app.
  </p><br>

  <h4 id="scrollspyHeading8">Message Structure:</h4>
  <p>DAPNET paging messages are limited to 80 characters per message. To conserve space, a2d messages follow the structure below and 
    will be delivered to your pager:<br><br>
    SourceCall (DestinationSSID): Message<br><br>
    <b>SourceCall:</b> The sender's callsign.</b><br>
    <b>DestinationSSID:</b> Your callsign's SSID.</b><br>
    <b>Message:</b> The message content.</b><br>
  </p>
  <div class="alert alert-success" role="alert">
    NY3W-5(7): Hello OM!
  </div>
  <p>
    Here, `NY3W` is the sender's callsign, `7` is the SSID of the receiver's (your) callsign (e.g., NY3W-7), and `Hello OM!` is 
    the message.<br>
    If the DestinationSSID displays 0, it means the message is targeted for your callsign without any SSID.
  </p><br>

  <h4 id="scrollspyHeading9">Uninstallation:</h4>
  <p>Follow these steps to in your terminal to uninstall a2d from your system<br><br>
    For a thorough removal of user configuration files, it is advisable to uninstall the application after performing 
    a Factory Reset in the a2d portal (Check Reset a2d section). This ensures a clean removal of user-specific settings.<br><br>
    <i>&nbsp;&nbsp;sudo apt purge a2d</i><br><br>
    However, please note that this command won't remove the core Nginx server and other dependencies that were installed alongside a2d. 
    To completely remove all a2d dependencies, you can use the following commands:<br><br>
    <b>Remove Nginx and its associated files:</b>
    <i>&nbsp;&nbsp;sudo apt -y remove --purge nginx nginx-common nginx-full nginx-core</i><br>
    <b>Remove Nginx configuration files:</b>
    <i>&nbsp;&nbsp;sudo rm -rf /etc/nginx</i><br>
    <b>Remove Nginx default configuration:</b>
    <i>&nbsp;&nbsp;sudo rm -rf /etc/default/nginx</i><br>
    <b>Remove Nginx init.d script:</b>
    <i>&nbsp;&nbsp;sudo rm -rf /etc/init.d/nginx</i><br>
    <b>Remove Nginx log files:</b>
    <i>&nbsp;&nbsp;sudo rm -rf /var/log/nginx</i><br><br>
    <b>Delete the Nginx user and group:</b><br><br>
    <i>&nbsp;&nbsp;sudo deluser nginx</i><br>
    <i>&nbsp;&nbsp;sudo delgroup nginx</i><br><br>
    Finally, perform an autoremove to clean up any remaining dependencies:<br><br>
    <i>&nbsp;&nbsp;sudo apt autoremove</i></p></br>
  
  <h4 id="scrollspyHeading10">Server Settings:</h4>
  <p>
      a2d offers server settings and advanced options for users who want to customize their server. Make changes cautiously. 
      You can use a2d with its default settings for local access. If you want to access a2d from outside your network, you can do 
      so by making careful adjustments to your router's firewall settings.
    </p><br>
    <h4>Server Page Overview:</h4>
    <p>
    <b>Navigation Bar:</b> Access to sections like 
    Dashboard, 
    Mode (Light, Dark, and Auto), 
    Options, and 
    Exit.<br>
    The Options section includes 
    Server Configuration, 
    Self-Signed SSL, 
    CA Signed SSL, 
    Change PIN, 
    Reset Portal, 
    Exit, and 
    Information.<br><br>
    <b>Server Status:</b> Provides essential information, including the start time of Nginx and Gunicorn, Listen Port, Server Name, 
    SSL Status, and SSL Certificate details such as Common Name (CN), Organization Name (O), and Expiry Date.<br><br>
    <b>Network Health:</b> Displays the Round Trip Time (RTT) to APRS and DAPNET servers, indicating the speed at which data can 
    transfer between your system and their servers.<br><br>
    </p>
    
    <h4>Server Configuration:</h4>
    <p>
    The server configuration allows you to modify a2d's default server settings. a2d's default settings include Listen Port: 9331, 
    Server Name: _, and SSL disabled.<br>
    <div class="alert alert-danger" role="alert">
      These settings have the potential to override your existing NGINX configuration, particularly if NGINX is configured 
      for another application. If you are using NGINX for another application, it is strongly recommended to manually configure 
      NGINX for a2d.
    </div>
    
    <b>Desired Listen Port:</b> You can choose the port number for a2d access. For standard HTTP, it's port 80, and for HTTPS, 
    it's 443. Alternatively, you can select any other open port on your system. After changing the port, you'll need to access 
    a2d using the specified port.<br><br>
    <b>Desired Server Name:</b> You can set the server name to match your desired domain name. Ensure that the server name 
    corresponds to your domain name, especially if you've enabled SSL, as it should match the Common Name (CN) in the SSL certificate.<br><br>
    <b>Choosing SSL Certificates:</b> a2d offers the option to create and use either Self-Signed SSL or Certificate Authority (CA) 
    SSL certificates for your convenience. The difference between them is the appearance of a green lock symbol in the browser 
    when you access them. Ensure that your server name matches the CN in your certificate before making a choice. Before selecting 
    an SSL option, you need to create the certificates.<br><br>
    <b>Creating Self-Signed SSL Certificate:</b> In a2d, you can create and store one self-signed SSL certificate. There's no limit 
    to how many times you can create it. You can generate it through the Self Signed SSL link in the navigation bar or by clicking 
    the green "Self Signed SSL" button inside Server Configuration. Self-Signed SSL certificates are not verified, so you'll encounter 
    an SSL security warning when accessing a2d in a web browser. You'll need to bypass this warning to access a2d once Self-Signed SSL 
    is enabled. Once you enabled SSL certificate access a2d through HTTPS.<br><br>
    <b>Creating CA SSL Certificate:</b> a2d offers the option to create CA SSL certificates directly through certbot and Let's Encrypt 
    within the a2d portal. You can create them via the CA Signed SSL link in the navigation bar or by clicking the green "CA Signed SSL" 
    button inside Server Configuration. You can generate as many CA Signed SSL certificates as needed. Ensure that the Common Name (CN) 
    matches your domain name. Once you've created your desired SSL certificate, you can return to Server Configuration to set it for a2d. 
    After certificate creation, a2d uses certbot for auto-renewal. If you no longer need CA SSL certificates, a2d provides an option to 
    delete them by clicking "Delete CA SSL" in the CA Signed SSL and selecting the certificate to remove.<br><br>
    <div class="alert alert-warning" role="alert">
    Please note that Let's Encrypt has a limit on duplicate certificates. For more details, refer to 
    <a href='https://letsencrypt.org/docs/duplicate-certificate-limit/' target="_blank">Let's Encrypt's page</a>
    </div>
    </p><br>

  <h4 id="scrollspyHeading11">Firewall Settings:</h4>
  <p>
    Understanding your firewall settings is crucial. Carefully open the necessary ports on your router to achieve the following:<br><br>
    1. Access a2d from outside your network.<br>
    2. Generate CA SSL certificates. Let's Encrypt will use ports 80 and 443 to validate your server before issuing the certificate. 
    If you have both IPv4 and IPv6, it's strongly recommended to open required ports for both IPv4 and IPv6. After generating 
    certificates you can safely close them and leave 443 open if you want remove access to a2d outside of your network.<br><br>
    
    In case you are unable to open the ports for some reason and cannot generate Let's Encrypt certificates using the a2d portal, 
    you can perform these tasks via the command line and adjust your DNS settings on your provider's website. For details vist the 
    <a href='https://eff-certbot.readthedocs.io/en/stable/using.html' target="_blank">Certbot user guide</a><br>
    </p><br>

  <h4 id="scrollspyHeading12">Resetting a2d portal:</h4>
  <p>    
    a2d provides a Reset Portal option that allows you to reset the portal and delete SSL certificates, if desired. You need to 
    enter correct Passphrase to reset the portal. You can choose to retain the SSL certificates during the factory reset. The 
    Reset Portal option is available in the server page's Options. This action will delete all user files, configurations, and data. 
    If you are accessing a2d via SSL during the reset, the server settings will revert to the default a2d settings, and you will 
    need to access a2d through HTTP port 9331 after the reset.
    </p><br>
  
  <h4 id="scrollspyHeading13">Error Messages:</h4>
  <p>Error messages play a crucial role in guiding you through issues. They appear in two places:</p><br>
  <h5>1. Relay Status Container in the Dashboard:</h5>
  <p>If you encounter any of these errors, you'll see them next to "Status" in the Relay Status container. To resolve, ensure 
    accurate information in your configuration and restart the relay.
  </p><br>
  <p><b>• Invalid APRS API key</b>
  <b>• Incorrect APRS API key</b>
  <b>• Incorrect DAPNET username or password</b>
  <b>• Incorrect DAPNET callsign or txgroup</b></p>
  <div class="alert alert-primary" role="alert">
    DAPNET-related errors appear only when a new APRS message is received and a2d attempts to transmit it to DAPNET.
  </div><br>

  <h5>2. Error Messages Triggered by Click on the Dashboard:</h5>
  <p>
    For these errors, you'll see messages upon clicking. Solutions are provided below:<br><br>
    <b>Invalid PIN:</b> Retry with the correct PIN.<br>
    <b>Invalid Passphrase:</b> Retry with the correct Passphrase.<br>
    <b>Configuration files missing:</b> Set up Configuration.<br>
    <b>Invalid file:</b> During restore configuration, use the correct a2d_config_backup.bin file.<br>
    <b>Configuration file tampered:</b> If you spot this, avoid using the modified file as it could harm the a2d app.
  </p><br>

  <h5>3. Error Messages during Server Settings and SSL Certificates</h5>
  <p>
    <b>Create Self-Signed SSL Certificate before Enabling:</b> Ensure that you have created the required SSL certificates 
    before configuring the server for SSL.</br>
    <b>Server and Common Name Mismatch:</b> Verify that your server name matches the Common Name (CN) of the certificate and 
    corresponds to your domain name.</br>
    <b>CA SSL Certificate Already Exists:</b> Try deleting the CA SSL certificate before attempting to create a duplicate certificate.</br>
    <b>CA SSL Does Not Exist:</b> The SSL certificate you are trying to delete does not exist. Try refreshing the page.</br>
    <b>Selected CA SSL or Server Name in Use:</b> Do not delete an SSL certificate while it is in use. First, change the SSL 
    settings in the server, and then attempt to delete it.</br>
    <b>Unknown Response from the Server:</b> This issue could be due to network problems, firewall blocking specific ports, or 
    reaching Let's Encrypt's SSL certificate limits.</br>
    <b>Failed to Update Server:</b> Your server may be offline or unreachable.</br>
  </p><br>
  
  <h5>Other Unknown Errors and Troubleshooting:</h5>
  <p>
    If new messages aren't reaching your DAPNET pager:<br></p>
    <div class="alert alert-info" role="alert">
      <b>Potential Causes:</b> Too frequent APRS requests, or issues with APRS or DAPNET servers.<br><br>
    <b>Resolution:</b> Confirm server functionality and your Configuration setup. If the problem persists, wait for a couple of 
    runs, as a2d self-heals the database. If the issue continues, reinstall a2d to fix message database corruption.
    </div>
    <p>Database corruption may occur during message read/write interruptions, such as power outages, memory loss, or system failures.</p><br>

  <h4 id="scrollspyHeading14">License:</h4>
  <p>MIT License<br><br>

    Copyright (c) 2023 NGC2023<br><br>
    
    a2d/static/bootstrap/css/cdn_bootstrap_5-3_min.css<br>
    Copyright: 2011-2023 The Bootstrap Authors<br>
    License: MIT<br><br>

    a2d/static/bootstrap/js/cdn_bootstrap_5-3.js<br>
    Copyright: 2011-2023 The Bootstrap Authors<br>
    License: MIT<br><br>

    Permission is hereby granted, free of charge, to any person obtaining a copy
    of this software and associated documentation files (the "Software"), to deal
    in the Software without restriction, including without limitation the rights
    to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    copies of the Software, and to permit persons to whom the Software is
    furnished to do so, subject to the following conditions:<br><br>
    
    The above copyright notice and this permission notice shall be included in all
    copies or substantial portions of the Software.<br><br>
    
    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
    SOFTWARE.</p><br>
    <p>
    License: CC-BY-3.0<br><br>

    a2d/static/bootstrap/css/bootstrap_docs_5-3.css<br>
    Copyright: 2011-2023 The Bootstrap Authors<br>
    License: CC-BY-3.0<br><br>

    a2d/static/bootstrap/js/bootstrap_5-3_mode.js<br>
    Copyright: 2011-2023 The Bootstrap Authors<br>
    License: CC-BY-3.0<br><br>
   
    We have made modifications to a portion of the Bootstrap code to suit
    our project's requirements. These minor modifications enables the
    Color mode toggler from Bootstrap's docs to work with a2d.
    Licensed under the Creative Commons Attribution 3.0 Unported License.
    For details, see https://creativecommons.org/licenses/by/3.0/.
    </p>
</div>
