Skip to content

Commit 91ef40e

Browse files
committed
feat(dashboard): subpath support
1 parent cb89dd3 commit 91ef40e

1 file changed

Lines changed: 31 additions & 1 deletion

File tree

assets/dashboard.html

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,17 @@ <h1 class="modal-title fs-5">Create/Update Bin</h1>
167167
</div>
168168
</div>
169169

170+
<!-- Subpath Rule -->
171+
<div class="mb-3">
172+
<label class="form-label">Subpath Rule</label>
173+
<select class="form-select" x-model="updatingBin.subpath">
174+
<template x-for="subpathRule in validSubpathRules">
175+
<option :value="subpathRule" x-text="subpathRule"
176+
:selected="updatingBin.subpath == subpathRule"></option>
177+
</template>
178+
</select>
179+
</div>
180+
170181
<!-- Allowed IP Settings -->
171182
<div class="mb-2">
172183
<div class="form-check form-switch">
@@ -314,6 +325,10 @@ <h1 class="modal-title fs-5">Create/Update Bin</h1>
314325
data-bs-placement="top" data-bs-title="Capture Query">Query</span>
315326
<span class="badge text-bg-primary" x-show="activeBin.headers" data-bs-toggle="tooltip"
316327
data-bs-placement="top" data-bs-title="Capture Headers">Headers</span>
328+
<span class="badge text-bg-info" x-show="activeBin.subpath === 'ignore'" data-bs-toggle="tooltip"
329+
data-bs-placement="top" data-bs-title="Ignore Subpath">*Subpath</span>
330+
<span class="badge text-bg-success" x-show="activeBin.subpath === 'accept'" data-bs-toggle="tooltip"
331+
data-bs-placement="top" data-bs-title="Capture Subpath">Subpath</span>
317332
<template x-for="method in (activeBin.methods ?? ['ANY'])">
318333
<span>
319334
<span class="badge text-bg-secondary" x-text="method" data-bs-toggle="tooltip"
@@ -454,8 +469,14 @@ <h5 class="mb-3">Body Template</h5>
454469
<div class="accordion-collapse collapse" :id="$id('capture-detail', capture.id)">
455470
<div class="accordion-body pt-3 pb-1">
456471
<div class="row">
457-
<!-- Left Grid (Headers & Query) -->
472+
<!-- Left Grid (Subpath & Headers & Query) -->
458473
<div class="col-lg-6">
474+
<!-- Subpath -->
475+
<h5 class="mb-3">Subpath</h5>
476+
<div class="border px-3 py-2 mb-3 rounded">
477+
<pre class="mb-0" x-text="capture.subpath ? capture.subpath : 'No subpath'"></pre>
478+
</div>
479+
459480
<!-- Headers -->
460481
<h5 class="mb-3">Headers</h5>
461482
<ul class="list-group mb-3" style="font-size: .9rem" x-data="{ headers: null }"
@@ -590,6 +611,7 @@ <h5 class="mb-3">Body</h5>
590611
* @property {boolean} body
591612
* @property {boolean} query
592613
* @property {boolean} headers
614+
* @property {"reject" | "ignore" | "accept"} subpath
593615
* @property {string[]?} ips
594616
* @property {string[]?} methods
595617
* @property {Responding} responding
@@ -602,6 +624,7 @@ <h5 class="mb-3">Body</h5>
602624
* @property {boolean} body
603625
* @property {boolean} query
604626
* @property {boolean} headers
627+
* @property {"reject" | "ignore" | "accept"} subpath
605628
* @property {boolean} allowAnyIP
606629
* @property {string[]} ips
607630
* @property {string} newIP
@@ -620,6 +643,7 @@ <h5 class="mb-3">Body</h5>
620643
* @property {string} remote_addr
621644
* @property {any} headers
622645
* @property {any} query
646+
* @property {string} subpath
623647
* @property {string?} body
624648
* @property {number} time
625649
*/
@@ -650,6 +674,9 @@ <h5 class="mb-3">Body</h5>
650674
/** @type {string[]} */
651675
/** @constant */
652676
const validResponseTypes = ["capture", "template"];
677+
/** @type {string[]} */
678+
/** @constant */
679+
const validSubpathRules = ["reject", "ignore", "accept"];
653680

654681
const app = () => ({
655682
/** @type {boolean} */
@@ -937,6 +964,7 @@ <h5 class="mb-3">Body</h5>
937964
body: bin.body,
938965
query: bin.query,
939966
headers: bin.headers,
967+
subpath: bin.subpath,
940968
allowAnyIP: bin.ips === null,
941969
ips: bin.ips !== null ? [...bin.ips] : [],
942970
allowAnyMethod: bin.methods === null,
@@ -953,6 +981,7 @@ <h5 class="mb-3">Body</h5>
953981
body: true,
954982
query: true,
955983
headers: true,
984+
subpath: "reject",
956985
allowAnyIP: true,
957986
ips: [],
958987
allowAnyMethod: true,
@@ -1027,6 +1056,7 @@ <h5 class="mb-3">Body</h5>
10271056
body: updatingBin.body,
10281057
query: updatingBin.query,
10291058
headers: updatingBin.headers,
1059+
subpath: updatingBin.subpath,
10301060
ips: updatingBin.allowAnyIP ? null : updatingBin.ips,
10311061
methods: updatingBin.allowAnyMethod ? null : updatingBin.methods,
10321062
responding,

0 commit comments

Comments
 (0)