Skip to content

Commit 638399d

Browse files
committed
show hard coded path for now
1 parent 7498827 commit 638399d

File tree

2 files changed

+32
-96
lines changed

2 files changed

+32
-96
lines changed

addons/gst-web-core/nginx/footer.html

Lines changed: 16 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,40 +10,20 @@
1010
window.location.reload();
1111
});
1212
}
13-
function hideParentDirectoryLinkOnRoot() {
14-
const h1Element = document.querySelector('h1');
15-
let isAtListingRoot = false;
1613

17-
if (h1Element) {
18-
const displayedPathInH1 = h1Element.textContent.trim();
19-
// Check if H1 content indicates the root of this specific listing
20-
if (displayedPathInH1 === "/files/") { // Condition for user-added H1
21-
isAtListingRoot = true;
22-
}
23-
} else {
24-
// Fallback: If no H1, check for "Index of /files/" text node before the table
25-
// This assumes Nginx might output "Index of /files/" directly
26-
const tableElement = document.getElementById('list');
27-
if (tableElement) {
28-
let currentNode = tableElement.previousSibling;
29-
let foundPathText = null;
30-
while (currentNode) {
31-
if (currentNode.nodeType === Node.TEXT_NODE) {
32-
const text = currentNode.textContent.trim();
33-
if (text.startsWith("Index of /")) {
34-
foundPathText = text.replace(/<\/h1>$/i, '').trim();
35-
break;
36-
}
37-
}
38-
currentNode = currentNode.previousSibling;
39-
}
40-
if (foundPathText === "Index of /files/") { // Condition for Nginx-generated text
41-
isAtListingRoot = true;
42-
}
43-
}
14+
function processDirectoryListing() {
15+
const webPathPrefix = '/files/';
16+
const diskPathPrefix = '/config/Desktop/';
17+
const h1 = document.querySelector('h1');
18+
19+
if (h1) {
20+
const originalText = h1.textContent;
21+
const newText = originalText.replace(webPathPrefix, diskPathPrefix);
22+
h1.textContent = newText;
4423
}
4524

46-
if (isAtListingRoot) {
25+
const isAtRoot = window.location.pathname === webPathPrefix;
26+
if (isAtRoot) {
4727
const parentLink = document.querySelector('table#list td.link a[href="../"]');
4828
if (parentLink && parentLink.textContent.trim() === "Parent directory/") {
4929
const parentRow = parentLink.closest('tr');
@@ -55,21 +35,20 @@
5535
}
5636

5737
let attempts = 0;
58-
const maxAttempts = 20; // Try for 2 seconds
38+
const maxAttempts = 20;
5939
const intervalId = setInterval(function() {
6040
attempts++;
6141
const h1 = document.querySelector('h1');
6242
const table = document.getElementById('list');
6343

64-
if (h1 || table) { // If either H1 or table is present, attempt to run
44+
if (h1 && table) {
6545
clearInterval(intervalId);
66-
hideParentDirectoryLinkOnRoot();
46+
processDirectoryListing();
6747
} else if (attempts >= maxAttempts) {
6848
clearInterval(intervalId);
69-
// Attempt to run even if elements not detected by querySelector, as a last resort
70-
hideParentDirectoryLinkOnRoot();
49+
processDirectoryListing();
7150
}
72-
}, 100); // Check every 100ms
51+
}, 100);
7352

7453
</script>
7554
</body>

addons/gst-web-core/nginx/header.html

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,37 @@
2121
--font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
2222
--border-radius: 8px;
2323
}
24-
2524
* {
2625
margin: 0;
2726
padding: 0;
2827
box-sizing: border-box;
2928
}
30-
3129
body {
3230
font-family: var(--font-family);
3331
background-color: var(--page-bg);
3432
color: var(--text-color);
3533
line-height: 1.6;
36-
padding-top: 20px; /* Existing top padding */
34+
padding-top: 20px;
3735
padding-bottom: 60px;
3836
}
39-
4037
.page-container {
4138
max-width: var(--container-max-width);
4239
margin: 0 auto;
43-
padding: 0 20px; /* Existing horizontal padding */
44-
position: relative; /* Needed for absolute positioning of the reload button */
40+
padding: 0 20px;
41+
position: relative;
4542
}
46-
4743
h1 {
4844
color: var(--header-color);
4945
font-size: 2em;
5046
font-weight: 300;
5147
margin-bottom: 15px;
5248
padding-bottom: 15px;
5349
border-bottom: 1px solid var(--border-color);
54-
/* Ensure H1 doesn't overlap with absolutely positioned button if text is long */
55-
padding-right: 50px; /* Space for the reload button */
50+
padding-right: 50px;
5651
}
57-
5852
hr {
5953
display: none;
6054
}
61-
6255
table {
6356
width: 100%;
6457
border-collapse: collapse;
@@ -68,101 +61,81 @@
6861
overflow: hidden;
6962
box-shadow: 0 4px 10px var(--shadow-color);
7063
}
71-
7264
thead {
7365
background-color: var(--table-header-bg);
7466
}
75-
7667
th {
7768
color: var(--header-color);
7869
font-weight: 600;
7970
text-transform: uppercase;
8071
font-size: 0.85em;
8172
letter-spacing: 0.05em;
8273
}
83-
8474
th, td {
8575
padding: 12px 15px;
8676
text-align: left;
8777
border-bottom: 1px solid var(--border-color);
8878
}
89-
9079
tbody tr {
9180
transition: background-color 0.2s ease-in-out;
9281
}
93-
9482
tbody tr:hover {
9583
background-color: var(--table-row-hover-bg);
9684
}
97-
9885
tbody tr:last-child td {
9986
border-bottom: none;
10087
}
101-
10288
td a {
10389
color: var(--link-color);
10490
text-decoration: none;
10591
display: inline-flex;
10692
align-items: center;
10793
transition: color 0.2s ease-in-out;
10894
}
109-
11095
td a:hover {
11196
color: var(--link-hover-color);
11297
text-decoration: underline;
11398
}
114-
11599
th a {
116100
color: var(--link-color);
117101
text-decoration: none;
118102
transition: color 0.2s ease-in-out;
119103
}
120-
121104
th a:hover {
122105
color: var(--link-hover-color);
123106
text-decoration: underline;
124107
}
125-
126108
th a:visited {
127109
color: var(--link-color);
128110
}
129-
130111
th a:visited:hover {
131112
color: var(--link-hover-color);
132113
}
133-
134-
/* Styles for the Reload Button */
135114
#reload-page-button {
136115
position: absolute;
137-
/* Align with body's top padding and page-container's right padding */
138-
top: 0; /* Aligns with the top of the H1 content */
139-
right: 0; /* Aligns to the right padding edge of .page-container */
140-
background-color: transparent; /* Make it less obtrusive */
141-
color: var(--text-color); /* Icon color, can be --link-color too */
116+
top: 0;
117+
right: 0;
118+
background-color: transparent;
119+
color: var(--text-color);
142120
border: none;
143121
border-radius: var(--border-radius);
144-
padding: 8px; /* Clickable area */
122+
padding: 8px;
145123
cursor: pointer;
146124
display: inline-flex;
147125
align-items: center;
148126
justify-content: center;
149127
transition: color 0.2s ease-in-out, transform 0.2s ease-in-out;
150-
z-index: 10; /* Ensure it's above other elements if any overlap */
128+
z-index: 10;
151129
}
152-
153130
#reload-page-button:hover {
154-
color: var(--link-hover-color); /* Brighter on hover */
155-
transform: rotate(45deg); /* Simple hover effect */
131+
color: var(--link-hover-color);
132+
transform: rotate(45deg);
156133
}
157-
158134
#reload-page-button svg {
159-
width: 20px; /* Icon size */
135+
width: 20px;
160136
height: 20px;
161-
fill: currentColor; /* Icon inherits button's text color */
137+
fill: currentColor;
162138
}
163-
/* End of Reload Button Styles */
164-
165-
/* Column-specific styling */
166139
td:nth-child(1) {
167140
word-break: break-all;
168141
}
@@ -177,7 +150,6 @@
177150
white-space: nowrap;
178151
width: 100px;
179152
}
180-
181153
td a::before {
182154
display: inline-block;
183155
content: '';
@@ -190,19 +162,15 @@
190162
background-position: center;
191163
flex-shrink: 0;
192164
}
193-
194165
td a[href="../"]::before {
195166
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23abb2bf"><path d="M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z"/></svg>');
196167
}
197-
198168
td a[href$="/"]:not([href="../"])::before {
199169
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23abb2bf"><path d="M10 4H4c-1.11 0-2 .89-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2h-8l-2-2z"/></svg>');
200170
}
201-
202171
td a:not([href$="/"]):not([href="../"])::before {
203172
background-image: url('data:image/svg+xml;charset=UTF-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23abb2bf"><path d="M14 2H6c-1.11 0-2 .9-2 2v16c0 1.1.89 2 2 2h12c1.1 0 2-.9 2-2V8l-6-6zm2 16H8v-2h8v2zm0-4H8v-2h8v2zm-3-5V3.5L18.5 9H13z"/></svg>');
204173
}
205-
206174
footer {
207175
text-align: center;
208176
margin-top: 40px;
@@ -212,52 +180,42 @@
212180
color: var(--text-color);
213181
opacity: 0.7;
214182
}
215-
216183
footer p {
217184
margin: 0;
218185
}
219-
220186
@media (max-width: 768px) {
221187
body {
222188
font-size: 14px;
223189
padding-top: 10px;
224190
padding-bottom: 40px;
225191
}
226-
227192
.page-container {
228193
padding: 0 10px;
229194
}
230-
231195
h1 {
232196
font-size: 1.6em;
233-
padding-right: 40px; /* Adjust for smaller screens */
197+
padding-right: 40px;
234198
}
235-
236199
#reload-page-button {
237-
top: -2px; /* Fine-tune for smaller screens if needed */
200+
top: -2px;
238201
right: 0px;
239202
}
240-
241203
#reload-page-button svg {
242204
width: 18px;
243205
height: 18px;
244206
}
245-
246207
th, td {
247208
padding: 10px 8px;
248209
}
249-
250210
table {
251211
display: block;
252212
overflow-x: auto;
253213
white-space: nowrap;
254214
-webkit-overflow-scrolling: touch;
255215
}
256-
257216
th, td {
258217
white-space: nowrap;
259218
}
260-
261219
td:nth-child(1) {
262220
min-width: 200px;
263221
}
@@ -281,4 +239,3 @@
281239
</button>
282240

283241
<h1>
284-
<!-- Nginx fancyindex module will insert its H1 content (e.g., "Index of /files/"), then HR, and TABLE *after* this H1 element -->

0 commit comments

Comments
 (0)