Skip to content

Commit 4df997a

Browse files
committed
chore: added passwd toggle and defult to error log when no log level is given
1 parent 4f4eaad commit 4df997a

3 files changed

Lines changed: 17 additions & 3 deletions

File tree

cmd/web/options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func registerCommonFlags(fs *flag.FlagSet, cfg *options) {
3636
}
3737

3838
func parseServeOptions(args []string) (*options, error) {
39-
cfg := &options{}
39+
cfg := &options{LogLevel: logLevel{level: slog.LevelError}}
4040
fs := flag.NewFlagSet("serve", flag.ContinueOnError)
4141
fs.SetOutput(os.Stderr)
4242
registerCommonFlags(fs, cfg)

internal/assets/dist/index.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,4 +286,18 @@ document.addEventListener("click", (e) => {
286286
if (!tbody) return;
287287
if (tbody.querySelectorAll("tr").length === 0) addRow(tbody);
288288
});
289-
})();
289+
})();
290+
291+
// Password show/hide toggle
292+
// Trigger: <button data-pw-toggle="<input-id>">
293+
document.querySelectorAll("[data-pw-toggle]").forEach((btn) => {
294+
const input = document.getElementById(btn.dataset.pwToggle);
295+
if (!input) return;
296+
btn.addEventListener("click", function () {
297+
const isPassword = input.type === "password";
298+
input.type = isPassword ? "text" : "password";
299+
this.textContent = isPassword ? "Hide" : "Show";
300+
this.setAttribute("aria-pressed", isPassword ? "true" : "false");
301+
this.setAttribute("aria-label", isPassword ? "Hide password" : "Show password");
302+
});
303+
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{{ define "scripts" }}
22
<script type="module" src="/dist/components.js{{ if .Revision }}?revision={{ .Revision }}{{end}}" nonce="{{ .Nonce }}"></script>
3-
<script src="/dist/index.js{{ if .Revision }}?revision={{ .Revision }}{{end}}" nonce="{{ .Nonce }}"></script>
3+
<script src="/dist/index.js{{ if .Revision }}?revision={{ .Revision }}{{end}}" nonce="{{ .Nonce }}" defer></script>
44
<script src="/dist/htmx.min.js{{ if .Revision }}?revision={{ .Revision }}{{end}}" nonce="{{ .Nonce }}"></script>
55
{{ end }}

0 commit comments

Comments
 (0)