detached 1a9b0aa

Switch from iconoir icons to nerdfont icons to reduce binary size and improve load times

commit
1a9b0aa829c7d723199aa65066654300e26e2211
author
bnema · · 2023-10-21 07:59 UTC
parent
f5cd8ac
signature
unsigned
8 files · +44 -74

this diff is incomplete: 1 file is too large to show. the totals above count everything; clone the repository to read the rest.

M internal/httpserve/middleware/requirelogin.go +27 -28
@@ -1,14 +1,13 @@
11 package middleware
22
33 import (
4- "fmt"
54 "log"
65 "net/http"
76 "time"
87
98 "github.com/bnema/gordon/internal/app"
109 "github.com/bnema/gordon/internal/db/queries"
11- "github.com/labstack/echo-contrib/session"
10+ // "github.com/labstack/echo-contrib/session"
1211 "github.com/labstack/echo/v4"
1312 )
1413
@@ -25,32 +24,32 @@ func RequireLogin(a *app.App) echo.MiddlewareFunc {
2524 }
2625
2726 func validateSessionAndUser(c echo.Context, a *app.App) error {
28- sess, err := session.Get("session", c)
29- if err != nil {
30- return err
31- }
32-
33- if cookieExpired, err := isCookieExpired(c); err != nil || cookieExpired {
34- return err
35- }
36-
37- accountID, ok := sess.Values["accountID"].(string)
38- if !ok {
39- return fmt.Errorf("invalid account ID type")
40- }
41-
42- sessionID, ok := sess.Values["sessionID"].(string)
43- if !ok {
44- return fmt.Errorf("invalid session ID type")
45- }
46-
47- if accountCheck, err := isAccountIDInDB(a, accountID); err != nil || !accountCheck {
48- return err
49- }
50-
51- if sessionExpired, err := isSessionExpiredInDB(a, accountID, sessionID); err != nil || sessionExpired {
52- return err
53- }
27+ // sess, err := session.Get("session", c)
28+ // if err != nil {
29+ // return err
30+ // }
31+
32+ // if cookieExpired, err := isCookieExpired(c); err != nil || cookieExpired {
33+ // return err
34+ // }
35+
36+ // accountID, ok := sess.Values["accountID"].(string)
37+ // if !ok {
38+ // return fmt.Errorf("invalid account ID type")
39+ // }
40+
41+ // sessionID, ok := sess.Values["sessionID"].(string)
42+ // if !ok {
43+ // return fmt.Errorf("invalid session ID type")
44+ // }
45+
46+ // if accountCheck, err := isAccountIDInDB(a, accountID); err != nil || !accountCheck {
47+ // return err
48+ // }
49+
50+ // if sessionExpired, err := isSessionExpiredInDB(a, accountID, sessionID); err != nil || sessionExpired {
51+ // return err
52+ // }
5453
5554 return nil
5655 }
@@ -1,14 +1,13 @@
1 package middleware1 package middleware
2 2
3 import (3 import (
4- "fmt"
5 "log"4 "log"
6 "net/http"5 "net/http"
7 "time"6 "time"
8 7
9 "github.com/bnema/gordon/internal/app"8 "github.com/bnema/gordon/internal/app"
10 "github.com/bnema/gordon/internal/db/queries"9 "github.com/bnema/gordon/internal/db/queries"
11- "github.com/labstack/echo-contrib/session"10+ // "github.com/labstack/echo-contrib/session"
12 "github.com/labstack/echo/v4"11 "github.com/labstack/echo/v4"
13 )12 )
14 13
@@ -25,32 +24,32 @@ func RequireLogin(a *app.App) echo.MiddlewareFunc {
25 }24 }
26 25
27 func validateSessionAndUser(c echo.Context, a *app.App) error {26 func validateSessionAndUser(c echo.Context, a *app.App) error {
28- sess, err := session.Get("session", c)27+ // sess, err := session.Get("session", c)
29- if err != nil {28+ // if err != nil {
30- return err29+ // return err
31- }30+ // }
32-31+
33- if cookieExpired, err := isCookieExpired(c); err != nil || cookieExpired {32+ // if cookieExpired, err := isCookieExpired(c); err != nil || cookieExpired {
34- return err33+ // return err
35- }34+ // }
36-35+
37- accountID, ok := sess.Values["accountID"].(string)36+ // accountID, ok := sess.Values["accountID"].(string)
38- if !ok {37+ // if !ok {
39- return fmt.Errorf("invalid account ID type")38+ // return fmt.Errorf("invalid account ID type")
40- }39+ // }
41-40+
42- sessionID, ok := sess.Values["sessionID"].(string)41+ // sessionID, ok := sess.Values["sessionID"].(string)
43- if !ok {42+ // if !ok {
44- return fmt.Errorf("invalid session ID type")43+ // return fmt.Errorf("invalid session ID type")
45- }44+ // }
46-45+
47- if accountCheck, err := isAccountIDInDB(a, accountID); err != nil || !accountCheck {46+ // if accountCheck, err := isAccountIDInDB(a, accountID); err != nil || !accountCheck {
48- return err47+ // return err
49- }48+ // }
50-49+
51- if sessionExpired, err := isSessionExpiredInDB(a, accountID, sessionID); err != nil || sessionExpired {50+ // if sessionExpired, err := isSessionExpiredInDB(a, accountID, sessionID); err != nil || sessionExpired {
52- return err51+ // return err
53- }52+ // }
54 53
55 return nil54 return nil
56 }55 }
M internal/templating/models/html/fragments/containerlist.gohtml +4 -4
@@ -40,7 +40,7 @@
4040 hx-swap="outerHTML"
4141 class="py-2 px-4"
4242 >
43- <span title="Start the container" class="iconoir-play text-xl text-blue-600 font-bold hover:text-gordonmascot-hblue"></span>
43+ <span title="Start the container" class="iconf text-xl text-blue-600 hover:text-gordonmascot-hblue"></span>
4444 </button>
4545 <!-- EDIT -->
4646 <button
@@ -52,7 +52,7 @@
5252 class="py-2 px-4"
5353 data-active="false"
5454 >
55- <span title="Edit the container" class="iconoir-edit text-xl text-blue-600 font-bold hover:text-gordonmascot-hblue"></span>
55+ <span title="Edit the container" class="iconf text-2xl text-blue-600 hover:text-gordonmascot-hblue">󱩽</span>
5656 </button>
5757 <!-- stop -->
5858 <button
@@ -64,7 +64,7 @@
6464 hx-confirm="{{index $Lang "manager" "content" "confirm-container-stop"}}"
6565 class="py-2 px-4"
6666 >
67- <span title="Stop the container" class="iconoir-system-shut text-xl text-red-600 font-bold hover:text-red-900"></span>
67+ <span title="Stop the container" class="iconf text-xl text-red-600 hover:text-red-900"></span>
6868 </button>
6969 <!-- REMOVE -->
7070 <button
@@ -77,7 +77,7 @@
7777 class="py-2 px-4"
7878 >
7979 <!-- iconoir trash -->
80- <span title="Remove the container" class="iconoir-trash text-xl text-red-600 font-bold hover:text-red-900"></span>
80+ <span title="Remove the container" class="iconf text-xl text-red-600 hover:text-red-900"></span>
8181 </button>
8282 </td>
8383 </tr>
@@ -40,7 +40,7 @@
40 hx-swap="outerHTML"40 hx-swap="outerHTML"
41 class="py-2 px-4"41 class="py-2 px-4"
42 >42 >
43- <span title="Start the container" class="iconoir-play text-xl text-blue-600 font-bold hover:text-gordonmascot-hblue"></span>43+ <span title="Start the container" class="iconf text-xl text-blue-600 hover:text-gordonmascot-hblue"></span>
44 </button>44 </button>
45 <!-- EDIT -->45 <!-- EDIT -->
46 <button46 <button
@@ -52,7 +52,7 @@
52 class="py-2 px-4"52 class="py-2 px-4"
53 data-active="false"53 data-active="false"
54 >54 >
55- <span title="Edit the container" class="iconoir-edit text-xl text-blue-600 font-bold hover:text-gordonmascot-hblue"></span>55+ <span title="Edit the container" class="iconf text-2xl text-blue-600 hover:text-gordonmascot-hblue">󱩽</span>
56 </button>56 </button>
57 <!-- stop -->57 <!-- stop -->
58 <button58 <button
@@ -64,7 +64,7 @@
64 hx-confirm="{{index $Lang "manager" "content" "confirm-container-stop"}}"64 hx-confirm="{{index $Lang "manager" "content" "confirm-container-stop"}}"
65 class="py-2 px-4"65 class="py-2 px-4"
66 >66 >
67- <span title="Stop the container" class="iconoir-system-shut text-xl text-red-600 font-bold hover:text-red-900"></span>67+ <span title="Stop the container" class="iconf text-xl text-red-600 hover:text-red-900"></span>
68 </button>68 </button>
69 <!-- REMOVE -->69 <!-- REMOVE -->
70 <button70 <button
@@ -77,7 +77,7 @@
77 class="py-2 px-4"77 class="py-2 px-4"
78 >78 >
79 <!-- iconoir trash -->79 <!-- iconoir trash -->
80- <span title="Remove the container" class="iconoir-trash text-xl text-red-600 font-bold hover:text-red-900"></span>80+ <span title="Remove the container" class="iconf text-xl text-red-600 hover:text-red-900"></span>
81 </button>81 </button>
82 </td>82 </td>
83 </tr>83 </tr>
M internal/templating/models/html/fragments/header.gohtml +0 -8
@@ -11,12 +11,4 @@
1111 <script defer src="/libs/hyperscript.min.js"></script>
1212 <script defer src="/assets/js/custom.js"></script>
1313 <!-- script wait for the page to be loaded and insert <link rel="stylesheet" href="/libs/iconoir.css" /> -->
14- <script>
15- document.addEventListener("DOMContentLoaded", function () {
16- var linkElement = document.createElement("link");
17- linkElement.setAttribute("rel", "stylesheet");
18- linkElement.setAttribute("href", "/libs/iconoir.css");
19- document.head.appendChild(linkElement);
20- });
21- </script>
2214 </head>
@@ -11,12 +11,4 @@
11 <script defer src="/libs/hyperscript.min.js"></script>11 <script defer src="/libs/hyperscript.min.js"></script>
12 <script defer src="/assets/js/custom.js"></script>12 <script defer src="/assets/js/custom.js"></script>
13 <!-- script wait for the page to be loaded and insert <link rel="stylesheet" href="/libs/iconoir.css" /> -->13 <!-- script wait for the page to be loaded and insert <link rel="stylesheet" href="/libs/iconoir.css" /> -->
14- <script>
15- document.addEventListener("DOMContentLoaded", function () {
16- var linkElement = document.createElement("link");
17- linkElement.setAttribute("rel", "stylesheet");
18- linkElement.setAttribute("href", "/libs/iconoir.css");
19- document.head.appendChild(linkElement);
20- });
21- </script>
22 </head>14 </head>
M internal/templating/models/html/fragments/imagelist.gohtml +5 -4
@@ -8,10 +8,11 @@
88 hx-get="/htmx/upload-image"
99 hx-target="#upload-image"
1010 hx-swap="innerHTML"
11+ title="Manually upload a .tar container image"
1112 _="on click toggle between .visible and .hidden on #upload-image then add .hidden to #create-container"
1213 >
1314
14- <span class="iconoir-upload text-xl align-middle"></span>
15+ <span class="iconf text-xl align-middle">󰭾 </span>
1516 Upload
1617 </button>
1718 </div>
@@ -39,7 +40,7 @@
3940 class="py-2 px-4"
4041 _="on click toggle between .visible and .hidden on #create-container then add .hidden to #upload-image"
4142 >
42- <span title="Deploy a container using this image" class="iconoir-add-circle text-xl text-blue-800 font-bold"></span>
43+ <span title="Deploy a container using this image" class="iconf text-xl text-blue-600 hover:text-gordonmascot-hblue"></span>
4344 </button>
4445
4546 <button
@@ -51,7 +52,7 @@
5152 hx-confirm="Are you sure you want to delete this container image?"
5253 class="py-2 px-4"
5354 >
54- <span title="Remove this image" class="iconoir-trash text-xl text-red-600 font-bold"></span>
55+ <span title="Remove this image" class="iconf text-xl text-red-600 hover:text-red-900"></span>
5556 </button>
5657 </td>
5758 </tr>
@@ -71,4 +72,4 @@
7172 </table>
7273 <div id="upload-image"></div>
7374 <div id="create-container"></div>
74-</div>⏎̸
75+</div>
@@ -8,10 +8,11 @@
8 hx-get="/htmx/upload-image"8 hx-get="/htmx/upload-image"
9 hx-target="#upload-image"9 hx-target="#upload-image"
10 hx-swap="innerHTML"10 hx-swap="innerHTML"
11+ title="Manually upload a .tar container image"
11 _="on click toggle between .visible and .hidden on #upload-image then add .hidden to #create-container"12 _="on click toggle between .visible and .hidden on #upload-image then add .hidden to #create-container"
12 >13 >
13 14
14- <span class="iconoir-upload text-xl align-middle"></span>15+ <span class="iconf text-xl align-middle">󰭾 </span>
15 Upload16 Upload
16 </button>17 </button>
17 </div>18 </div>
@@ -39,7 +40,7 @@
39 class="py-2 px-4"40 class="py-2 px-4"
40 _="on click toggle between .visible and .hidden on #create-container then add .hidden to #upload-image"41 _="on click toggle between .visible and .hidden on #create-container then add .hidden to #upload-image"
41 >42 >
42- <span title="Deploy a container using this image" class="iconoir-add-circle text-xl text-blue-800 font-bold"></span>43+ <span title="Deploy a container using this image" class="iconf text-xl text-blue-600 hover:text-gordonmascot-hblue"></span>
43 </button>44 </button>
44 45
45 <button46 <button
@@ -51,7 +52,7 @@
51 hx-confirm="Are you sure you want to delete this container image?"52 hx-confirm="Are you sure you want to delete this container image?"
52 class="py-2 px-4"53 class="py-2 px-4"
53 >54 >
54- <span title="Remove this image" class="iconoir-trash text-xl text-red-600 font-bold"></span>55+ <span title="Remove this image" class="iconf text-xl text-red-600 hover:text-red-900"></span>
55 </button>56 </button>
56 </td>57 </td>
57 </tr>58 </tr>
@@ -71,4 +72,4 @@
71 </table>72 </table>
72 <div id="upload-image"></div>73 <div id="upload-image"></div>
73 <div id="create-container"></div>74 <div id="create-container"></div>
74-</div>⏎̸75+</div>
M internal/templating/models/html/fragments/menu.gohtml +4 -4
@@ -27,13 +27,13 @@
2727 <a
2828 href="/admin/settings"
2929 title="User settings"
30- class="iconoir-settings text-gordonmascot-mblue text-lg md:text-2xl"
31- ></a>
30+ class="iconf text-gordonmascot-mblue text-lg md:text-xl"
31+ ></a>
3232 <a
3333 href="/admin/logout"
3434 title="Logout"
35- class="iconoir-log-out text-gordonmascot-mblue text-lg md:text-2xl"
36- ></a>
35+ class="iconf text-gordonmascot-mblue text-lg md:text-xl"
36+ >󰍃</a>
3737 </div>
3838 </div>
3939
@@ -27,13 +27,13 @@
27 <a27 <a
28 href="/admin/settings"28 href="/admin/settings"
29 title="User settings"29 title="User settings"
30- class="iconoir-settings text-gordonmascot-mblue text-lg md:text-2xl"30+ class="iconf text-gordonmascot-mblue text-lg md:text-xl"
31- ></a>31+ ></a>
32 <a32 <a
33 href="/admin/logout"33 href="/admin/logout"
34 title="Logout"34 title="Logout"
35- class="iconoir-log-out text-gordonmascot-mblue text-lg md:text-2xl"35+ class="iconf text-gordonmascot-mblue text-lg md:text-xl"
36- ></a>36+ >󰍃</a>
37 </div>37 </div>
38 </div>38 </div>
39 39
M internal/webui/public/assets/css/custom.css +2 -2
@@ -103,10 +103,10 @@
103103 font-family: "IBMPlexSans-Regular", sans-serif;
104104 }
105105
106-.JetBrainsMonoNF {
106+.JetBrainsMonoNF, .iconf{
107107 font-family: "JetBrainsMono-Nerd-Font-Regular", sans-serif;
108108 }
109109
110-.JetBrainsMonoBoldNF {
110+.JetBrainsMonoBoldNF, .iconfb{
111111 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;
112112 }
@@ -103,10 +103,10 @@
103 font-family: "IBMPlexSans-Regular", sans-serif;103 font-family: "IBMPlexSans-Regular", sans-serif;
104 }104 }
105 105
106-.JetBrainsMonoNF {106+.JetBrainsMonoNF, .iconf{
107 font-family: "JetBrainsMono-Nerd-Font-Regular", sans-serif;107 font-family: "JetBrainsMono-Nerd-Font-Regular", sans-serif;
108 }108 }
109 109
110-.JetBrainsMonoBoldNF {110+.JetBrainsMonoBoldNF, .iconfb{
111 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;111 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;
112 }112 }
M internal/webui/public/assets/css/tailwind.css +2 -2
@@ -1156,11 +1156,11 @@ video {
11561156 font-family: "IBMPlexSans-Regular", sans-serif;
11571157 }
11581158
1159-.JetBrainsMonoNF {
1159+.JetBrainsMonoNF, .iconf{
11601160 font-family: "JetBrainsMono-Nerd-Font-Regular", sans-serif;
11611161 }
11621162
1163-.JetBrainsMonoBoldNF {
1163+.JetBrainsMonoBoldNF, .iconfb{
11641164 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;
11651165 }
11661166
@@ -1156,11 +1156,11 @@ video {
1156 font-family: "IBMPlexSans-Regular", sans-serif;1156 font-family: "IBMPlexSans-Regular", sans-serif;
1157 }1157 }
1158 1158
1159-.JetBrainsMonoNF {1159+.JetBrainsMonoNF, .iconf{
1160 font-family: "JetBrainsMono-Nerd-Font-Regular", sans-serif;1160 font-family: "JetBrainsMono-Nerd-Font-Regular", sans-serif;
1161 }1161 }
1162 1162
1163-.JetBrainsMonoBoldNF {1163+.JetBrainsMonoBoldNF, .iconfb{
1164 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;1164 font-family: "JetBrainsMono-Nerd-Font-Bold", sans-serif;
1165 }1165 }
1166 1166
D internal/webui/public/libs/iconoir.css +0 -22 too large to show in the browser

too large to show in the browser

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