github.com/e154/smart-home@v0.17.2-0.20240311175135-e530a6e5cd45/api/swagger-ui/index.html (about)

     1  <!--
     2    ~ This file is part of the Smart Home
     3    ~ Program complex distribution https://github.com/e154/smart-home
     4    ~ Copyright (C) 2023, Filippov Alex
     5    ~
     6    ~ This library is free software: you can redistribute it and/or
     7    ~ modify it under the terms of the GNU Lesser General Public
     8    ~ License as published by the Free Software Foundation; either
     9    ~ version 3 of the License, or (at your option) any later version.
    10    ~
    11    ~ This library is distributed in the hope that it will be useful,
    12    ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
    13    ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    14    ~ Library General Public License for more details.
    15    ~
    16    ~ You should have received a copy of the GNU Lesser General Public
    17    ~ License along with this library.  If not, see
    18    ~ <https://www.gnu.org/licenses/>.
    19    -->
    20  
    21  <!-- HTML for static distribution bundle build -->
    22  <!DOCTYPE html>
    23  <html lang="en">
    24  <head>
    25      <meta charset="UTF-8">
    26      <title>Swagger UI</title>
    27      <link rel="stylesheet" type="text/css" href="./swagger-ui.css"/>
    28      <link rel="stylesheet" type="text/css" href="./SwaggerDark.css"/>
    29      <link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32"/>
    30      <link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16"/>
    31      <style>
    32          html {
    33              box-sizing: border-box;
    34              overflow: -moz-scrollbars-vertical;
    35              overflow-y: scroll;
    36          }
    37  
    38          *,
    39          *:before,
    40          *:after {
    41              box-sizing: inherit;
    42          }
    43      </style>
    44  </head>
    45  
    46  <body>
    47  <div id="swagger-ui"></div>
    48  
    49  <script src="./swagger-ui-bundle.js" charset="UTF-8"></script>
    50  <script src="./swagger-ui-standalone-preset.js" charset="UTF-8"></script>
    51  <script>
    52    window.onload = function () {
    53      // Begin Swagger UI call region
    54      const ui = SwaggerUIBundle({
    55        url: "/api.swagger3.yaml",
    56        dom_id: '#swagger-ui',
    57        docExpansion: 'none',
    58        deepLinking: true,
    59        presets: [
    60          SwaggerUIBundle.presets.apis,
    61          SwaggerUIStandalonePreset
    62        ],
    63        plugins: [
    64          SwaggerUIBundle.plugins.DownloadUrl
    65        ],
    66        layout: "StandaloneLayout",
    67        requestInterceptor: function (req) {
    68          // access token
    69          if (!req.headers.Authorization) {
    70            try {
    71              let {v} = JSON.parse(localStorage.getItem('accessToken'))
    72              v = v.replaceAll("\"", "")
    73              req.headers.Authorization = v
    74            } catch (e) {
    75  
    76            }
    77          }
    78  
    79          // server id
    80          try {
    81            let {v} = JSON.parse(localStorage.getItem('serverId'))
    82            v = v.replaceAll("\"", "")
    83            if (v) {
    84              req.headers['X-SERVER-ID'] = v;
    85            }
    86          } catch (e) {
    87  
    88          }
    89          return req
    90        }
    91      });
    92      // End Swagger UI call region
    93  
    94      window.ui = ui;
    95    };
    96  </script>
    97  </body>
    98  </html>