aceberg/ForAuth

View on GitHub
internal/web/templates/config.html

Summary

Maintainability
Test Coverage
{{ define "config.html" }}

<body>
  <div class="container-lg mt-4">
    <div class="row">
      <div class="col-md mb-4">
        <div class="card border-primary">
          <div class="card-header">Config</div>
          <div class="card-body table-responsive">
            <table class="table table-borderless">
            <form action="/config/" method="post">
              <tr>
                <td>Proxy Host</td>
                <td><input name="host" type="text" class="form-control" value="{{ .Config.Host }}"></td>
              </tr>
              <tr>
                <td>Proxy Port</td>
                <td><input name="port" type="text" class="form-control" value="{{ .Config.Port }}"></td>
              </tr>
              <tr>
                <td>Config Port</td>
                <td><input name="portconf" type="text" class="form-control" value="{{ .Config.PortConf }}"></td>
              </tr>
              <tr>
                <td>Target (host:port)</td>
                <td><input name="target" type="text" class="form-control" value="{{ .Config.Target }}"></td>
              </tr>
              <tr>
                <td>Theme</td>
                <td><select name="theme" class="form-select">
                    <option selected>{{ .Config.Theme }}</option>
                    {{ range .Themes }}
                        <option value="{{ . }}">{{ . }}</option>
                    {{ end }}
                </select></td>
              </tr>
              <tr>
                <td>Color mode</td>
                <td><select name="color" class="form-select">
                  <option selected>{{ .Config.Color }}</option>
                  <option value="light">light</option>
                  <option value="dark">dark</option>
                </select></td>
              </tr>
              <tr>
                <td>Node path</td>
                <td><input name="nodepath" type="text" class="form-control" value="{{ .Config.NodePath }}"></td>
              </tr>
              <tr>
                <td>Notify URL</td>
                <td>
                  <textarea name="notify" class="form-control" style="width: 100%;" rows="3" wrap="soft">{{ .Config.Notify }}</textarea>
                </td>
              </tr>
              <tr>
                <td><button type="submit" class="btn btn-primary">Save</button></td>
                <td></td>
              </tr>
            </form>
            </table>
          </div>
      </div>
    </div>
    <div class="col-md">
      <div class="card border-primary mb-4">
        <div class="card-header">Auth</div>
        <div class="card-body table-responsive">
          <table class="table table-borderless">
          <form action="/config/auth" method="post">
            <tr>
              <td>Enable</td>
              <td>
                <div class="form-check form-switch">
                  {{ if .Auth.Auth }}
                  <input class="form-check-input" type="checkbox" name="auth" checked>
                  {{ else }}
                  <input class="form-check-input" type="checkbox" name="auth">
                  {{ end }}
                </div>
              </td>
            </tr>
            <tr>
              <td>Expire after</td>
              <td><input name="expire" type="text" class="form-control" value="{{ .Auth.ExpStr }}"></td>
            </tr>
            <tr>
              <td>Login</td>
              <td><input name="user" type="text" class="form-control" value="{{ .Auth.User }}"></td>
            </tr>
            <tr>
              <td>New password</td>
              <td><input name="password" type="password" class="form-control"></td>
            </tr>
            <tr>
              <td><button type="submit" class="btn btn-primary">Save</button></td>
              <td>
                <a href="http://{{ .Config.Host }}:{{ .Config.PortConf }}/logout"><button type="button" class="btn btn-success">LogOut</button></a>
              </td>
            </tr>
          </form>
          </table>
        </div>
      </div>
      <div class="card border-primary mb-4">
        <div class="card-header">About (<a href="https://github.com/aceberg/ForAuth/releases/tag/{{ .Version }}" target="_blank">{{ .Version }}</a>)</div>
        <div class="card-body">
          <p>If you find this app useful, please, <a href="https://github.com/aceberg#donate" target="_blank">donate</a></p>
          <p>Commission you own app (Golang, HTML/JS). Contact and prices <a href="https://github.com/aceberg" target="_blank">here</a></p>
        </div>
      </div>
    </div>
  </div>
        

{{ template "footer.html" }}
{{ end }}