detached e712186

Prior build bug fixes, move JS version check into custom.js

commit
e7121863f7977234041c52a54e8eb03b45d32d80
author
bnema · · 2023-11-06 10:21 UTC
parent
38cf05d
signature
unsigned
3 files · +44 -49
M internal/templating/models/html/fragments/menu.gohtml +1 -38
@@ -1,40 +1,3 @@
1-<script>
2- const updateStrTemplate =
3- "New version %VERSION% available, consider pulling the latest image";
4-
5- const checkVersion = (versionData) => {
6- const currentVersion = document
7- .getElementById("actual-version")
8- .textContent.trim();
9- const fetchedVersionNumber =
10- versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];
11-
12- if (currentVersion !== fetchedVersionNumber) {
13- const updateStr = updateStrTemplate.replace(
14- "%VERSION%",
15- fetchedVersionNumber
16- );
17- console.log(updateStr);
18- const updateElement = document.getElementById("update-available");
19- updateElement.title = updateStr; // Set the title attribute
20- updateElement.removeAttribute("hidden");
21- } else {
22- console.log(
23- "No new version. Current version is up-to-date:",
24- currentVersion
25- );
26- }
27- };
28-
29- const fetchVersionInfo = () => {
30- fetch("https://gordon-proxy.bnema.dev/version")
31- .then((response) => response.json())
32- .then(checkVersion)
33- .catch((error) => console.error("Error fetching version:", error));
34- };
35-
36- window.onload = fetchVersionInfo;
37-</script>
381 <div
392 id="menubar"
403 class="w-full h-12 md:h-16 fixed top-0 left-0 bg-gordonmascot-lblue flex flex-row justify-evenly items-center px-4 IBMPlexSans">
@@ -51,7 +14,7 @@
5114 <span
5215 hidden
5316 id="update-available"
54- class="text-green-300 text-xs md:text-sm JetBrainsMonoNF"
17+ class="text-green-300 text-xs md:text-sm JetBrainsMonoNF hidden"
5518 title=""
5619 ><a href="https://github.com/bnema/gordon/releases">󰨦</a>
5720 </span>
@@ -1,40 +1,3 @@
1-<script>
2- const updateStrTemplate =
3- "New version %VERSION% available, consider pulling the latest image";
4-
5- const checkVersion = (versionData) => {
6- const currentVersion = document
7- .getElementById("actual-version")
8- .textContent.trim();
9- const fetchedVersionNumber =
10- versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];
11-
12- if (currentVersion !== fetchedVersionNumber) {
13- const updateStr = updateStrTemplate.replace(
14- "%VERSION%",
15- fetchedVersionNumber
16- );
17- console.log(updateStr);
18- const updateElement = document.getElementById("update-available");
19- updateElement.title = updateStr; // Set the title attribute
20- updateElement.removeAttribute("hidden");
21- } else {
22- console.log(
23- "No new version. Current version is up-to-date:",
24- currentVersion
25- );
26- }
27- };
28-
29- const fetchVersionInfo = () => {
30- fetch("https://gordon-proxy.bnema.dev/version")
31- .then((response) => response.json())
32- .then(checkVersion)
33- .catch((error) => console.error("Error fetching version:", error));
34- };
35-
36- window.onload = fetchVersionInfo;
37-</script>
38 <div1 <div
39 id="menubar"2 id="menubar"
40 class="w-full h-12 md:h-16 fixed top-0 left-0 bg-gordonmascot-lblue flex flex-row justify-evenly items-center px-4 IBMPlexSans">3 class="w-full h-12 md:h-16 fixed top-0 left-0 bg-gordonmascot-lblue flex flex-row justify-evenly items-center px-4 IBMPlexSans">
@@ -51,7 +14,7 @@
51 <span14 <span
52 hidden15 hidden
53 id="update-available"16 id="update-available"
54- class="text-green-300 text-xs md:text-sm JetBrainsMonoNF"17+ class="text-green-300 text-xs md:text-sm JetBrainsMonoNF hidden"
55 title=""18 title=""
56 ><a href="https://github.com/bnema/gordon/releases">󰨦</a>19 ><a href="https://github.com/bnema/gordon/releases">󰨦</a>
57 </span>20 </span>
M internal/webui/public/assets/css/tailwind.css +0 -10
@@ -768,10 +768,6 @@ video {
768768 border-radius: 0.125rem;
769769 }
770770
771-.rounded-lg {
772- border-radius: 0.5rem;
773-}
774-
775771 .border {
776772 border-width: 1px;
777773 }
@@ -1132,8 +1128,6 @@ video {
11321128 }
11331129
11341130 #update-available {
1135- display: inline-block;
1136- /* Make sure the span is transformable */
11371131 animation: wiggle 1s ease-in-out infinite;
11381132 }
11391133
@@ -1169,10 +1163,6 @@ video {
11691163 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;
11701164 }
11711165
1172-.hover\:rounded-lg:hover {
1173- border-radius: 0.5rem;
1174-}
1175-
11761166 .hover\:bg-blue-700:hover {
11771167 --tw-bg-opacity: 1;
11781168 background-color: rgb(29 78 216 / var(--tw-bg-opacity));
@@ -768,10 +768,6 @@ video {
768 border-radius: 0.125rem;768 border-radius: 0.125rem;
769 }769 }
770 770
771-.rounded-lg {
772- border-radius: 0.5rem;
773-}
774-
775 .border {771 .border {
776 border-width: 1px;772 border-width: 1px;
777 }773 }
@@ -1132,8 +1128,6 @@ video {
1132 }1128 }
1133 1129
1134 #update-available {1130 #update-available {
1135- display: inline-block;
1136- /* Make sure the span is transformable */
1137 animation: wiggle 1s ease-in-out infinite;1131 animation: wiggle 1s ease-in-out infinite;
1138 }1132 }
1139 1133
@@ -1169,10 +1163,6 @@ video {
1169 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;1163 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;
1170 }1164 }
1171 1165
1172-.hover\:rounded-lg:hover {
1173- border-radius: 0.5rem;
1174-}
1175-
1176 .hover\:bg-blue-700:hover {1166 .hover\:bg-blue-700:hover {
1177 --tw-bg-opacity: 1;1167 --tw-bg-opacity: 1;
1178 background-color: rgb(29 78 216 / var(--tw-bg-opacity));1168 background-color: rgb(29 78 216 / var(--tw-bg-opacity));
M internal/webui/public/assets/js/custom.js +43 -1
@@ -1,1 +1,43 @@
1-// switched to hyperscript for the most part⏎̸
1+function initializeVersionCheck() {
2+ const updateStrTemplate =
3+ "New version %VERSION% available, consider pulling the latest image";
4+
5+ const checkVersion = (versionData) => {
6+ const currentVersion = document.getElementById("actual-version").textContent.trim();
7+ const fetchedVersionNumber = versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];
8+
9+ if (currentVersion !== fetchedVersionNumber) {
10+ const updateStr = updateStrTemplate.replace("%VERSION%", fetchedVersionNumber);
11+ console.log(updateStr);
12+ const updateElement = document.getElementById("update-available");
13+ updateElement.title = updateStr;
14+ updateElement.removeAttribute("hidden");
15+ } else {
16+ console.log("No new version. Current version is up-to-date:", currentVersion);
17+ }
18+ };
19+
20+ const fetchVersionInfo = () => {
21+ fetch("https://gordon-proxy.bnema.dev/version")
22+ .then((response) => response.json())
23+ .then(checkVersion)
24+ .catch((error) => console.error("Error fetching version:", error));
25+ };
26+
27+ const init = () => {
28+ const currentVersion = document.getElementById("actual-version").textContent.trim();
29+
30+ // If currentVersion is empty, assume dev mode and do not fetch version info
31+ if (!currentVersion) {
32+ console.log("Dev mode detected, skipping version check.");
33+ return;
34+ }
35+
36+ fetchVersionInfo();
37+ };
38+
39+ init();
40+}
41+
42+// Ensure the document is fully loaded before running the script
43+document.addEventListener('DOMContentLoaded', initializeVersionCheck);// switched to hyperscript for the most part⏎̸
@@ -1,1 +1,43 @@
1-// switched to hyperscript for the most part⏎̸1+function initializeVersionCheck() {
2+ const updateStrTemplate =
3+ "New version %VERSION% available, consider pulling the latest image";
4+
5+ const checkVersion = (versionData) => {
6+ const currentVersion = document.getElementById("actual-version").textContent.trim();
7+ const fetchedVersionNumber = versionData?.amd64?.name.match(/\d+\.\d+\.\d+/)?.[0];
8+
9+ if (currentVersion !== fetchedVersionNumber) {
10+ const updateStr = updateStrTemplate.replace("%VERSION%", fetchedVersionNumber);
11+ console.log(updateStr);
12+ const updateElement = document.getElementById("update-available");
13+ updateElement.title = updateStr;
14+ updateElement.removeAttribute("hidden");
15+ } else {
16+ console.log("No new version. Current version is up-to-date:", currentVersion);
17+ }
18+ };
19+
20+ const fetchVersionInfo = () => {
21+ fetch("https://gordon-proxy.bnema.dev/version")
22+ .then((response) => response.json())
23+ .then(checkVersion)
24+ .catch((error) => console.error("Error fetching version:", error));
25+ };
26+
27+ const init = () => {
28+ const currentVersion = document.getElementById("actual-version").textContent.trim();
29+
30+ // If currentVersion is empty, assume dev mode and do not fetch version info
31+ if (!currentVersion) {
32+ console.log("Dev mode detected, skipping version check.");
33+ return;
34+ }
35+
36+ fetchVersionInfo();
37+ };
38+
39+ init();
40+}
41+
42+// Ensure the document is fully loaded before running the script
43+document.addEventListener('DOMContentLoaded', initializeVersionCheck);// switched to hyperscript for the most part⏎̸

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close