<commit_before><%inherit file="base.html"/>
<%namespace name="form" file="form.html"/>
<% settings = self.attr.settings %>
<div class="container-fluid">
    <div class="content maincontent">
        <h1 class="page-header page-title">Settings</h1>

        <div class="tabbable tabs-left">

            <ul class="nav nav-tabs">
                <li class="active"><a href="#general" data-toggle="tab">General</a></li>
                <li><a href="#dashboard" data-toggle="tab">Dashboard</a></li>
                <li><a href="#theme" data-toggle="tab">Theme</a></li>
                <li><a href="#other" data-toggle="tab">Other apps</a></li>
                <li><a href="#users" data-toggle="tab">User management</a></li>
                <li class="divider-tab"></li>
                % for m in sorted(htpc.MODULES, key=lambda d: d['name']):
                  % if m.get('isThirdParty') != False:
                  <li><a href="#${m.get('id')}" data-toggle="tab">${m.get('name')}</a></li>
                  % endif
                % endfor

            </ul>

            <div class="tab-content">
            ${form.buildForm(id='general', classes='form-horizontal tab-pane active', description='Most of these settings require a HTPC Manager restart after saving.', legend='General',  fields=[
                {'type':'text', 'label':'IP / Host *', 'name':'app_host', 'value':settings.get('app_host', '0.0.0.0')},
                {'type':'text', 'label':'Port *', 'name':'app_port', 'value':settings.get('app_port', 8085)},
                {'type':'text', 'label':'Webdir *', 'name':'app_webdir', 'value':settings.get('app_webdir', '/')},
                {'type':'text', 'label':'Username *', 'name':'app_username', 'value':settings.get('app_username')},
                {'type':'password', 'label':'Password *', 'name':'app_password', 'value':settings.get('app_password')},
                {'type':'bool', 'label':'Use ssl?', 'name':'app_use_ssl', 'value':settings.get('app_use_ssl'), 'desc': 'By enabling this and leaving SSL cert and key blank HTPC Manager will generate cert and key for you'},
                {'type':'text', 'label':'SSL Cert', 'name':'app_ssl_cert', 'value':settings.get('app_ssl_cert'), 'desc':''},
                {'type':'text', 'label':'SSL Key', 'name':'app_ssl_key', 'value':settings.get('app_ssl_key')},
                {'type':'select', 'label':'Log level', 'name':'app_loglevel', 'options':settings.get_loglvl(), 'desc':''},

                {'type':'text', 'label':'Git Path', 'name':'git_path', 'desc':'Only needed if OS is unable to locate git', 'value':settings.get('git_path', 'git')},
                {'type':'bool', 'label':'Git Cleanup?', 'name':'git_cleanup', 'desc':'Removes untracked files and performs a hard reset on git branch automatically to help resolve update issues', 'value':settings.get('git_cleanup')},
                {'type':'bool', 'label':'Use  rev proxy headers', 'name':'app_use_proxy_headers', 'desc':'','value':settings.get('app_use_proxy_headers')},
                {'type':'text', 'label':'Rev proxy headers basepath', 'name':'app_use_proxy_headers_basepath', 'desc':'Advanced option, should be left blank', 'value':settings.get('app_use_proxy_headers_basepath')},
                {'type': 'select', 'label': 'Branch', 'name': 'branch', 'options':''},
                {'type':'bool', 'label':'Open Browser', 'name':'openbrowser', 'desc':'Automatically open browser on HTPC Manager start', 'value':settings.get('openbrowser')},
                {'type':'bool', 'label':'Use robots.txt', 'name':'robots', 'desc':'Stop bots from indexing your site', 'value':settings.get('robots')},
                {'type':'bool', 'label':'Check for updates', 'name':'app_check_for_updates', 'desc':'HTPC checks for updates in the background', 'value':settings.get('app_check_for_updates')},
                {'type':'bool', 'label':'Auto update', 'name':'app_auto_update', 'desc':'By enabling this HTPC Manager will update automatically', 'value':settings.get('app_auto_update')},
                {'type':'bool', 'label':'Enable CDN', 'name':'app_use_cdn', 'desc':'Use CSS/JS files hosted on CDN', 'value':settings.get('app_use_cdn')}
                ], buttons=[
                        {'name':'Save', 'type':'submit', 'classes':'btn-primary'},
                        {'name':'Clear', 'type':'reset'},
                        {'name':'Delete cache folder', 'type':'button', 'classes':'delete_cache'},
                        {'name':'Force update', 'type':'button', 'classes':'force_update'}
            ])}

            % for m in htpc.MODULES:
                % if m.get('test'):
                    ${form.buildForm(action=m.get('action'), id=m.get('id'), description=m.get('description'), classes='form-horizontal tab-pane', legend=m.get('name'),
                                     fields=m.get('fields'), buttons=[
                                         {'name':'Save changes', 'type':'submit', 'classes':'btn-primary'},
                                         {'name':'Clear', 'type':'reset'},
                                         {'name':'Test', 'type':'button', 'classes':'btn-test', 'test':m.get('test')}])}
                % else:
                    ${form.buildForm(action=m.get('action'), id=m.get('id'), description=m.get('description'), classes='form-horizontal tab-pane', legend=m.get('name'),
                                     fields=m.get('fields'))}
                % endif
            % endfor
            ${form.buildForm(id='theme', classes='form-horizontal tab-pane', legend='Theme', fields=[
                {'type':'select', 'label':'Theme', 'name':'app_theme', 'options':settings.get_themes(), 'desc':'Changes the appearance of HTPC Manager'}
            ])}
            ${form.buildForm(id='dashboard', classes='form-horizontal tab-pane', legend='Dashboard', fields=[
                {'type':'bool', 'label':'Show recent movies from KODI', 'name':'dash_rec_movies',
                 'checked':bool(settings.get('dash_rec_movies', 0))},
                {'type':'bool', 'label':'Show recent episodes from KODI', 'name':'dash_rec_tv',
                 'checked':bool(settings.get('dash_rec_tv', 0))},
                {'type':'bool', 'label':'Show recent music from KODI', 'name':'dash_rec_music',
                 'checked':bool(settings.get('dash_rec_music', 0))},
                {'type':'bool', 'label':'Show recent movies from Plex', 'name':'dash_rec_movies_plex',
                 'checked':bool(settings.get('dash_rec_movies_plex', 0))},
                {'type':'bool', 'label':'Show recent shows  from Plex', 'name':'dash_rec_tv_plex',
                 'checked':bool(settings.get('dash_rec_tv_plex', 0))},
                {'type':'bool', 'label':'Show recent music from Plex', 'name':'dash_rec_music_plex',
                 'checked':bool(settings.get('dash_rec_music_plex', 0))},
                {'type':'bool', 'label':'Show Sick Beard', 'name':'dash_sickbeard',
                 'checked':bool(settings.get('dash_sickbeard', 0))},
                {'type':'bool', 'label':'Show Sonarr', 'name':'dash_sonarr',
                 'checked':bool(settings.get('dash_nzbdrone', 0))},
                {'type':'bool', 'label':'Show CouchPotato', 'name':'dash_couchpotato',
                 'checked':bool(settings.get('dash_couchpotato', 0))},
                {'type':'bool', 'label':'Show SABnzbd', 'name':'dash_sabnzbd',
                 'checked':bool(settings.get('dash_sabnzbd', 0))},
                {'type':'bool', 'label':'Show SickRage', 'name':'dash_sickrage',
                 'checked':bool(settings.get('dash_sickrage', 0))},
                {'type':'bool', 'label':'Show NZBGet', 'name':'dash_nzbget',
                 'checked':bool(settings.get('dash_nzbget', 0))},
                {'type':'bool', 'label':'Show System info', 'name':'dash_sysinfo',
                  'checked':bool(settings.get('dash_sysinfo', 0))},
                {'type':'bool', 'label':'Wanted Albums', 'name':'dash_wanted_albums',
                  'checked':bool(settings.get('dash_wanted_albums', 0))},
                {'type':'bool', 'label':'Show disks', 'name':'dash_disks',
                  'checked':bool(settings.get('dash_disks', 0))},
                {'type':'bool', 'label':'Show qBittorrent', 'name':'dash_qbit',
                  'checked':bool(settings.get('dash_qbit', 0))},
                {'type':'bool', 'label':'Show S.M.A.R.T. info', 'name':'dash_smart',
                  'checked':bool(settings.get('dash_smart', 0))}
            ])}

            <form class="form-horizontal tab-pane" id="other" method="POST">

                <fieldset>
                    <legend>Other apps</legend>
                    <blockquote>Are you using software that is not supported by HTPC Manager or want to have your self-made dashboard URL in the menubar? Add custom URLs to the menubar.
                    <BR /><BR />
                    <b>Tip: You can drag & drop items to reorder them</b>
                    </blockquote>
                    <button class="btn btn-small btn-primary add">New link</button>

                    <table class="table table-striped table-condensed">
                      <thead>
                        <tr>
                            <th class="span3">Name</th>
                            <th>Full url <small class="muted">including http://etc...</small</th>
                            <th class="span1">Actions</th>
                        </tr>
                      </thead>
                      <tbody id="reorder">
                        % for link in self.attr.settings.getUrls():
                        <tr>
                          <td><input type="text" value="${link['name']|h, entity}"name="name"></td>
                          <td><input type="text" value="${link['url']|h, entity}"name="url"></td>
                          <td><button class="btn btn-mini delete">Delete</button></td>
                        </tr>
                        % endfor
                      </tbody>
                    </table>

                    <div class="form-actions">
                        <button class="btn btn-primary save" type="submit">Save</button>
                        <button class="btn " type="reset">Clear</button>
                    </div>
                </fieldset>
            </form>
            </div>
        </div>
    </div>
</div>
<commit_msg>add desc<commit_after><%inherit file="base.html"/>
<%namespace name="form" file="form.html"/>
<% settings = self.attr.settings %>
<div class="container-fluid">
    <div class="content maincontent">
        <h1 class="page-header page-title">Settings</h1>

        <div class="tabbable tabs-left">

            <ul class="nav nav-tabs">
                <li class="active"><a href="#general" data-toggle="tab">General</a></li>
                <li><a href="#dashboard" data-toggle="tab">Dashboard</a></li>
                <li><a href="#theme" data-toggle="tab">Theme</a></li>
                <li><a href="#other" data-toggle="tab">Other apps</a></li>
                <li><a href="#users" data-toggle="tab">User management</a></li>
                <li class="divider-tab"></li>
                % for m in sorted(htpc.MODULES, key=lambda d: d['name']):
                  % if m.get('isThirdParty') != False:
                  <li><a href="#${m.get('id')}" data-toggle="tab">${m.get('name')}</a></li>
                  % endif
                % endfor

            </ul>

            <div class="tab-content">
            ${form.buildForm(id='general', classes='form-horizontal tab-pane active', description='Most of these settings require a HTPC Manager restart after saving.', legend='General',  fields=[
                {'type':'text', 'label':'IP / Host *', 'name':'app_host', 'value':settings.get('app_host', '0.0.0.0')},
                {'type':'text', 'label':'Port *', 'name':'app_port', 'value':settings.get('app_port', 8085)},
                {'type':'text', 'label':'Webdir *', 'name':'app_webdir', 'value':settings.get('app_webdir', '/')},
                {'type':'text', 'label':'Username *', 'name':'app_username', 'value':settings.get('app_username')},
                {'type':'password', 'label':'Password *', 'name':'app_password', 'value':settings.get('app_password')},
                {'type':'bool', 'label':'Use ssl?', 'name':'app_use_ssl', 'value':settings.get('app_use_ssl'), 'desc': 'By enabling this and leaving SSL cert and key blank HTPC Manager will generate cert and key for you'},
                {'type':'text', 'label':'SSL Cert', 'name':'app_ssl_cert', 'value':settings.get('app_ssl_cert'), 'desc':''},
                {'type':'text', 'label':'SSL Key', 'name':'app_ssl_key', 'value':settings.get('app_ssl_key')},
                {'type':'select', 'label':'Log level', 'name':'app_loglevel', 'options':settings.get_loglvl(), 'desc':'Use debug if you have issues with HTPC Manager'},
                {'type':'text', 'label':'Git Path', 'name':'git_path', 'desc':'Only needed if OS is unable to locate git', 'value':settings.get('git_path', 'git')},
                {'type':'bool', 'label':'Git Cleanup?', 'name':'git_cleanup', 'desc':'Removes untracked files and performs a hard reset on git branch automatically to help resolve update issues', 'value':settings.get('git_cleanup')},
                {'type':'bool', 'label':'Use  rev proxy headers', 'name':'app_use_proxy_headers', 'desc':'','value':settings.get('app_use_proxy_headers')},
                {'type':'text', 'label':'Rev proxy headers basepath', 'name':'app_use_proxy_headers_basepath', 'desc':'Advanced option, should be left blank', 'value':settings.get('app_use_proxy_headers_basepath')},
                {'type': 'select', 'label': 'Branch', 'name': 'branch', 'options':''},
                {'type':'bool', 'label':'Open Browser', 'name':'openbrowser', 'desc':'Automatically open browser on HTPC Manager start', 'value':settings.get('openbrowser')},
                {'type':'bool', 'label':'Use robots.txt', 'name':'robots', 'desc':'Stop bots from indexing your site', 'value':settings.get('robots')},
                {'type':'bool', 'label':'Check for updates', 'name':'app_check_for_updates', 'desc':'HTPC checks for updates in the background', 'value':settings.get('app_check_for_updates')},
                {'type':'bool', 'label':'Auto update', 'name':'app_auto_update', 'desc':'By enabling this HTPC Manager will update automatically', 'value':settings.get('app_auto_update')},
                {'type':'bool', 'label':'Enable CDN', 'name':'app_use_cdn', 'desc':'Use CSS/JS files hosted on CDN', 'value':settings.get('app_use_cdn')}
                ], buttons=[
                        {'name':'Save', 'type':'submit', 'classes':'btn-primary'},
                        {'name':'Clear', 'type':'reset'},
                        {'name':'Delete cache folder', 'type':'button', 'classes':'delete_cache'},
                        {'name':'Force update', 'type':'button', 'classes':'force_update'}
            ])}

            % for m in htpc.MODULES:
                % if m.get('test'):
                    ${form.buildForm(action=m.get('action'), id=m.get('id'), description=m.get('description'), classes='form-horizontal tab-pane', legend=m.get('name'),
                                     fields=m.get('fields'), buttons=[
                                         {'name':'Save changes', 'type':'submit', 'classes':'btn-primary'},
                                         {'name':'Clear', 'type':'reset'},
                                         {'name':'Test', 'type':'button', 'classes':'btn-test', 'test':m.get('test')}])}
                % else:
                    ${form.buildForm(action=m.get('action'), id=m.get('id'), description=m.get('description'), classes='form-horizontal tab-pane', legend=m.get('name'),
                                     fields=m.get('fields'))}
                % endif
            % endfor
            ${form.buildForm(id='theme', classes='form-horizontal tab-pane', legend='Theme', fields=[
                {'type':'select', 'label':'Theme', 'name':'app_theme', 'options':settings.get_themes(), 'desc':'Changes the appearance of HTPC Manager'}
            ])}
            ${form.buildForm(id='dashboard', classes='form-horizontal tab-pane', legend='Dashboard', fields=[
                {'type':'bool', 'label':'Show recent movies from KODI', 'name':'dash_rec_movies',
                 'checked':bool(settings.get('dash_rec_movies', 0))},
                {'type':'bool', 'label':'Show recent episodes from KODI', 'name':'dash_rec_tv',
                 'checked':bool(settings.get('dash_rec_tv', 0))},
                {'type':'bool', 'label':'Show recent music from KODI', 'name':'dash_rec_music',
                 'checked':bool(settings.get('dash_rec_music', 0))},
                {'type':'bool', 'label':'Show recent movies from Plex', 'name':'dash_rec_movies_plex',
                 'checked':bool(settings.get('dash_rec_movies_plex', 0))},
                {'type':'bool', 'label':'Show recent shows  from Plex', 'name':'dash_rec_tv_plex',
                 'checked':bool(settings.get('dash_rec_tv_plex', 0))},
                {'type':'bool', 'label':'Show recent music from Plex', 'name':'dash_rec_music_plex',
                 'checked':bool(settings.get('dash_rec_music_plex', 0))},
                {'type':'bool', 'label':'Show Sick Beard', 'name':'dash_sickbeard',
                 'checked':bool(settings.get('dash_sickbeard', 0))},
                {'type':'bool', 'label':'Show Sonarr', 'name':'dash_sonarr',
                 'checked':bool(settings.get('dash_nzbdrone', 0))},
                {'type':'bool', 'label':'Show CouchPotato', 'name':'dash_couchpotato',
                 'checked':bool(settings.get('dash_couchpotato', 0))},
                {'type':'bool', 'label':'Show SABnzbd', 'name':'dash_sabnzbd',
                 'checked':bool(settings.get('dash_sabnzbd', 0))},
                {'type':'bool', 'label':'Show SickRage', 'name':'dash_sickrage',
                 'checked':bool(settings.get('dash_sickrage', 0))},
                {'type':'bool', 'label':'Show NZBGet', 'name':'dash_nzbget',
                 'checked':bool(settings.get('dash_nzbget', 0))},
                {'type':'bool', 'label':'Show System info', 'name':'dash_sysinfo',
                  'checked':bool(settings.get('dash_sysinfo', 0))},
                {'type':'bool', 'label':'Wanted Albums', 'name':'dash_wanted_albums',
                  'checked':bool(settings.get('dash_wanted_albums', 0))},
                {'type':'bool', 'label':'Show disks', 'name':'dash_disks',
                  'checked':bool(settings.get('dash_disks', 0))},
                {'type':'bool', 'label':'Show qBittorrent', 'name':'dash_qbit',
                  'checked':bool(settings.get('dash_qbit', 0))},
                {'type':'bool', 'label':'Show S.M.A.R.T. info', 'name':'dash_smart',
                  'checked':bool(settings.get('dash_smart', 0))}
            ])}

            <form class="form-horizontal tab-pane" id="other" method="POST">

                <fieldset>
                    <legend>Other apps</legend>
                    <blockquote>Are you using software that is not supported by HTPC Manager or want to have your self-made dashboard URL in the menubar? Add custom URLs to the menubar.
                    <BR /><BR />
                    <b>Tip: You can drag & drop items to reorder them</b>
                    </blockquote>
                    <button class="btn btn-small btn-primary add">New link</button>

                    <table class="table table-striped table-condensed">
                      <thead>
                        <tr>
                            <th class="span3">Name</th>
                            <th>Full url <small class="muted">including http://etc...</small</th>
                            <th class="span1">Actions</th>
                        </tr>
                      </thead>
                      <tbody id="reorder">
                        % for link in self.attr.settings.getUrls():
                        <tr>
                          <td><input type="text" value="${link['name']|h, entity}"name="name"></td>
                          <td><input type="text" value="${link['url']|h, entity}"name="url"></td>
                          <td><button class="btn btn-mini delete">Delete</button></td>
                        </tr>
                        % endfor
                      </tbody>
                    </table>

                    <div class="form-actions">
                        <button class="btn btn-primary save" type="submit">Save</button>
                        <button class="btn " type="reset">Clear</button>
                    </div>
                </fieldset>
            </form>
            </div>
        </div>
    </div>
</div>

{'fraction_non_alphanumeric': 0.19108943705316983, 'fraction_numerical': 0.0027460820983854933, 'mean_word_length': 2.237584304107909, 'pattern_counts': {'":': 0, '<': 181, '<?xml version=': 0, '>': 179, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7042711', 'n_tokens_mistral': 6325, 'n_tokens_neox': 5695, 'n_words': 1145}