@@ 16,6 16,11 @@ func getDomainPattern() string {
return fmt.Sprintf(".%s", config.FeluConfig.DNSPattern)
}
+func getUpdateACommand() string {
+ return fmt.Sprintf("curl \"https://%s/update/a?domain=THE_PART_YOU_DEFINE&apikey=THE_API_KEY\"",
+ config.FeluConfig.APIUrl)
+}
+
func Manage() templ.Component {
return templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
@@ 35,21 40,66 @@ func Manage() templ.Component {
templBuffer = templ.GetBuffer()
defer templ.ReleaseBuffer(templBuffer)
}
- _, err = templBuffer.WriteString("<div class=\"bg-teal-200\"><form class=\"flex flex-col p-2 gap-2\" hx-post=\"/manage/domains\" hx-target=\"#add_domain_error\"><label for=\"domain\">")
+ _, err = templBuffer.WriteString("<details class=\"bg-amber-200 p-2\"><summary class=\"list-none flex border p-2 items-center cursor-pointer select-none\"><div>")
if err != nil {
return err
}
- var_3 := `Domain`
+ var_3 := `Temp Docs, wip (click)`
_, err = templBuffer.WriteString(var_3)
if err != nil {
return err
}
+ _, err = templBuffer.WriteString("</div></summary><div class=\"p-2 flex flex-col\"><div class=\"flex flex-col\"><p class=\"font-bold\">")
+ if err != nil {
+ return err
+ }
+ var_4 := `Updating A Records automatically`
+ _, err = templBuffer.WriteString(var_4)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</p><div class=\"\"><p class=\"\">")
+ if err != nil {
+ return err
+ }
+ var_5 := `The following should be ran via some automation, like a cron job.`
+ _, err = templBuffer.WriteString(var_5)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString(" ")
+ if err != nil {
+ return err
+ }
+ var_6 := `You are on your own till real docs are made.`
+ _, err = templBuffer.WriteString(var_6)
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</p><code>")
+ if err != nil {
+ return err
+ }
+ var var_7 string = getUpdateACommand()
+ _, err = templBuffer.WriteString(templ.EscapeString(var_7))
+ if err != nil {
+ return err
+ }
+ _, err = templBuffer.WriteString("</code></div></div></div></details> <div class=\"bg-teal-200\"><form class=\"flex flex-col p-2 gap-2\" hx-post=\"/manage/domains\" hx-target=\"#add_domain_error\"><label for=\"domain\">")
+ if err != nil {
+ return err
+ }
+ var_8 := `Domain`
+ _, err = templBuffer.WriteString(var_8)
+ if err != nil {
+ return err
+ }
_, err = templBuffer.WriteString("</label><div><input class=\"border\" type=\"text\" placeholder=\"...\" name=\"domain\" id=\"domain\"><span>")
if err != nil {
return err
}
- var var_4 string = getDomainPattern()
- _, err = templBuffer.WriteString(templ.EscapeString(var_4))
+ var var_9 string = getDomainPattern()
+ _, err = templBuffer.WriteString(templ.EscapeString(var_9))
if err != nil {
return err
}
@@ 57,8 107,8 @@ func Manage() templ.Component {
if err != nil {
return err
}
- var_5 := `A Record`
- _, err = templBuffer.WriteString(var_5)
+ var_10 := `A Record`
+ _, err = templBuffer.WriteString(var_10)
if err != nil {
return err
}
@@ 66,8 116,8 @@ func Manage() templ.Component {
if err != nil {
return err
}
- var_6 := `Add`
- _, err = templBuffer.WriteString(var_6)
+ var_11 := `Add`
+ _, err = templBuffer.WriteString(var_11)
if err != nil {
return err
}
@@ 99,12 149,12 @@ func ManageUser(currentEmail string) templ.Component {
defer templ.ReleaseBuffer(templBuffer)
}
ctx = templ.InitializeContext(ctx)
- var_7 := templ.GetChildren(ctx)
- if var_7 == nil {
- var_7 = templ.NopComponent
+ var_12 := templ.GetChildren(ctx)
+ if var_12 == nil {
+ var_12 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- var_8 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
+ var_13 := templ.ComponentFunc(func(ctx context.Context, w io.Writer) (err error) {
templBuffer, templIsBuffer := w.(*bytes.Buffer)
if !templIsBuffer {
templBuffer = templ.GetBuffer()
@@ 114,8 164,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_9 := `Current Password`
- _, err = templBuffer.WriteString(var_9)
+ var_14 := `Current Password`
+ _, err = templBuffer.WriteString(var_14)
if err != nil {
return err
}
@@ 123,8 173,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_10 := `New Password`
- _, err = templBuffer.WriteString(var_10)
+ var_15 := `New Password`
+ _, err = templBuffer.WriteString(var_15)
if err != nil {
return err
}
@@ 132,8 182,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_11 := `Confirm`
- _, err = templBuffer.WriteString(var_11)
+ var_16 := `Confirm`
+ _, err = templBuffer.WriteString(var_16)
if err != nil {
return err
}
@@ 141,8 191,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_12 := `Update`
- _, err = templBuffer.WriteString(var_12)
+ var_17 := `Update`
+ _, err = templBuffer.WriteString(var_17)
if err != nil {
return err
}
@@ 150,8 200,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_13 := `Email`
- _, err = templBuffer.WriteString(var_13)
+ var_18 := `Email`
+ _, err = templBuffer.WriteString(var_18)
if err != nil {
return err
}
@@ 167,8 217,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_14 := `Update`
- _, err = templBuffer.WriteString(var_14)
+ var_19 := `Update`
+ _, err = templBuffer.WriteString(var_19)
if err != nil {
return err
}
@@ 176,8 226,8 @@ func ManageUser(currentEmail string) templ.Component {
if err != nil {
return err
}
- var_15 := `Delete Account`
- _, err = templBuffer.WriteString(var_15)
+ var_20 := `Delete Account`
+ _, err = templBuffer.WriteString(var_20)
if err != nil {
return err
}
@@ 190,7 240,7 @@ func ManageUser(currentEmail string) templ.Component {
}
return err
})
- err = ManageBase("Settings").Render(templ.WithChildren(ctx, var_8), templBuffer)
+ err = ManageBase("Settings").Render(templ.WithChildren(ctx, var_13), templBuffer)
if err != nil {
return err
}
@@ 13,6 13,9 @@ var FeluConfig *config
type config struct {
ServiceName string
+ // API url, where the API is served at (e.g. api.feluddns.tld)
+ APIUrl string
+
// Initial email for the admin user, only used if no admin account (e.g. first boot)
InitialAdminEmail string
// Initial password for the admin user, only used if no admin account (e.g. first boot)
@@ 37,6 40,8 @@ func InitConfig() {
FeluConfig = &config {
ServiceName: util.LoadEnvStr("FELU_SERVICE_NAME", "FeluDDNS"),
+ APIUrl: util.LoadEnvStr("FELU_API_URL", "MUST_SET"),
+
InitialAdminEmail: util.LoadEnvStr("FELU_INITIAL_ADMIN_EMAIL", "admin@example.com"),
InitialAdminPwd: util.LoadEnvStr("FELU_INITIAL_ADMIN_PWD", "feluadmin"),
@@ 534,6 534,10 @@ video {
--tw-backdrop-sepia: ;
}
+.m-2 {
+ margin: 0.5rem;
+}
+
.block {
display: block;
}
@@ 562,6 566,20 @@ video {
table-layout: auto;
}
+.cursor-pointer {
+ cursor: pointer;
+}
+
+.select-none {
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ user-select: none;
+}
+
+.list-none {
+ list-style-type: none;
+}
+
.flex-row-reverse {
flex-direction: row-reverse;
}
@@ 574,6 592,10 @@ video {
align-items: center;
}
+.gap-1 {
+ gap: 0.25rem;
+}
+
.gap-2 {
gap: 0.5rem;
}
@@ 582,10 604,6 @@ video {
gap: 1rem;
}
-.gap-1 {
- gap: 0.25rem;
-}
-
.border {
border-width: 1px;
}
@@ 620,6 638,11 @@ video {
background-color: rgb(254 240 138 / var(--tw-bg-opacity));
}
+.bg-amber-200 {
+ --tw-bg-opacity: 1;
+ background-color: rgb(253 230 138 / var(--tw-bg-opacity));
+}
+
.p-1 {
padding: 0.25rem;
}
@@ 661,7 684,3 @@ video {
.peer:checked ~ .peer-checked\:hidden {
display: none;
}
-
-.peer:disabled ~ .peer-disabled\:block {
- display: block;
-}