Browse Source

Add better config page

master
stew3254 1 year ago
parent
commit
f2584bf67d
  1. 74
      html/configure.html
  2. 0
      html/css/buttons.css
  3. 38
      html/css/common.css
  4. 3
      html/css/configure.css
  5. 36
      html/css/index.css
  6. BIN
      html/imgs/hook.jpg
  7. 42
      html/index.html
  8. 2
      src/server.go

74
html/configure.html

@ -6,50 +6,60 @@
<!-- CSS only -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="/css/index.css">
<link rel="stylesheet" type="text/css" href="/css/common.css">
<link rel="stylesheet" type="text/css" href="/css/configure.css">
</head>
<body>
<!-- <div class="main container">
<div class="main container">
<div class="card w-100">
<div class="card-body">
<div id="header">
<h1 class="card-title font-weight-bold">Captain Hook</h1>
<h1 class="card-title font-weight-bold">Edit {{.Name}}</h1>
<h5 class="card-subtitle text-muted">
A webhook server written in Go.
The configuration page for your hook
</h5>
</div>
<h2>Create Hook</h2>
<div class="input-group">
<input class="form-control" type="text" name="create">
<div class="input-group-append">
<button type="submit" class="btn btn-success">Create</button>
<div class="body">
<div class="conditions">
<h2 class="card-title font-weight-bold">
Conditions
</h2>
<div class="dropdown">
<button class="btn btn-success dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Add Condition
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
<button class="dropdown-item" type="button">Method</button>
<button class="dropdown-item" type="button">Header</button>
<button class="dropdown-item" type="button">Parameter</button>
</div>
</div>
</div>
<div class="actions">
<h2 class="card-title font-weight-bold">
Actions
</h2>
<div class="dropdown">
<button class="btn btn-success dropdown-toggle" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Add Action
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenu2">
<button class="dropdown-item" type="button">Write</button>
<button class="dropdown-item" type="button">Shell</button>
<button class="dropdown-item" type="button">Web Request</button>
<button class="dropdown-item" type="button">Network Connection</button>
</div>
</div>
</div>
</div>
{{if . -}}
<h2>Currently available hooks</h2>
<ul class="list-group hooks">
{{range . -}}
<li class="list-group-item ">
<span class="hook-text">{{.Name}}</span>
<button type="submit" class="btn btn-primary" id="modify-{{.Name}}">Modify</button>
<button type="submit" class="btn btn-danger" id="delete-{{.Name}}">Delete</button>
</li>
{{- end}}
</ul>
{{- else}}
<h2>No hooks currently exist</h2>
{{- end}}
</div>
</div>
</div>
</div>
</div> -->
<p>This page is under construction</p>
<!-- Bootstrap JS -->
<!-- <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script> -->
<!-- <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.min.js" integrity="sha384-OgVRvuATP1z7JjHLkuOU7Xw704+h835Lr+6QL9UvYjZE3Ipu6Tp75j7Bh/kR0JKI" crossorigin="anonymous"></script> -->
<script src="/js/index.js"></script>
<!-- Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/js/bootstrap.bundle.min.js" crossorigin="anonymous"></script>
<script src="/js/index.js"></script>
</body>
</html>

0
html/css/buttons.css

38
html/css/common.css

@ -0,0 +1,38 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
background-color: #252525;
}
.main {
min-height: 100%;
width: 100%;
display: flex;
}
.main .card-title {
padding-bottom: 5vh;
background-color: #e0e0e0;
}
.main .card-body {
padding: 7vh 5vw;
background-color: #e0e0e0;
}
.main #header {
margin-bottom: 3rem;
}
.main h2 {
font-size: 1.25rem;
font-weight: bold;
margin-top: 2.5rem;
margin-bottom: 0vh;
}
.main button {
border: none;
}

3
html/css/configure.css

@ -0,0 +1,3 @@
.dropdown-toggle {
text-transform: uppercase;
}

36
html/css/index.css

@ -1,44 +1,8 @@
html,
body {
margin: 0;
padding: 0;
height: 100%;
background-color: #252525;
}
.main {
min-height: 100%;
width: 100%;
display: flex;
}
.main .card-title {
padding-bottom: 5vh;
background-color: #e0e0e0;
}
.main .card-body {
padding: 7vh 5vw;
background-color: #e0e0e0;
}
.main #header {
margin-bottom: 3rem;
}
.main h2 {
font-size: 1.25rem;
font-weight: bold;
margin-top: 2.5rem;
margin-bottom: 2vh;
}
.main button {
width: 100px;
font-size: 1.3remd;
text-transform: uppercase;
color: white;
border: none;
}
.hooks .list-group-item {

BIN
html/imgs/hook.jpg

After

Width: 378  |  Height: 491  |  Size: 19 KiB

42
html/index.html

@ -6,6 +6,7 @@
<!-- CSS only -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="/css/common.css">
<link rel="stylesheet" type="text/css" href="/css/index.css">
</head>
<body>
@ -13,32 +14,35 @@
<div class="card w-100">
<div class="card-body">
<div id="header">
<!-- <img src="imgs/hook.jpg" height="50" width="50"> -->
<h1 class="card-title font-weight-bold">Captain Hook</h1>
<h5 class="card-subtitle text-muted">
A webhook server written in Go.
</h5>
</div>
<h2>Create Hook</h2>
<div class="input-group">
<input class="form-control" type="text" name="create">
<div class="input-group-append">
<button type="submit" class="btn btn-success">Create</button>
<div class="body">
<h2>Create Hook</h2>
<div class="input-group">
<input class="form-control" type="text" name="create">
<div class="input-group-append">
<button type="submit" class="btn btn-success">Create</button>
</div>
</div>
</div>
{{if . -}}
<h2>Currently available hooks</h2>
<ul class="list-group hooks">
{{range . -}}
<li class="list-group-item ">
<span class="hook-text">{{.Name}}</span>
<button type="submit" class="btn btn-primary" id="modify-{{.Name}}">Modify</button>
<button type="submit" class="btn btn-danger" id="delete-{{.Name}}">Delete</button>
</li>
{{if . -}}
<h2>Currently available hooks</h2>
<ul class="list-group hooks">
{{range . -}}
<li class="list-group-item ">
<span class="hook-text">{{.Name}}</span>
<button type="submit" class="btn btn-primary" id="modify-{{.Name}}">Modify</button>
<button type="submit" class="btn btn-danger" id="delete-{{.Name}}">Delete</button>
</li>
{{- end}}
</ul>
{{- else}}
<h2>No hooks currently exist</h2>
{{- end}}
</ul>
{{- else}}
<h2>No hooks currently exist</h2>
{{- end}}
</div>
</div>
</div>
</div>

2
src/server.go

@ -133,7 +133,7 @@ func hookHandler(w http.ResponseWriter, r *http.Request) {
// Hook name
name := r.URL.String()[len("/hook/"):]
nameSplit := strings.Split(name, "/")
name = nameSplit[0]
name = strings.ToLower(nameSplit[0])
switch r.Method {
// Handle the hook

Loading…
Cancel
Save