forked from ProjectSegfault/publapi
Fix syntax
Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
parent
d633ccfb25
commit
b1034bca16
1
main.go
1
main.go
@ -8,6 +8,7 @@ import (
|
|||||||
"github.com/gofiber/fiber/v2"
|
"github.com/gofiber/fiber/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// publapi is a simple API for Project Segfault's public shared server (pubnix).
|
||||||
func main() {
|
func main() {
|
||||||
app := fiber.New()
|
app := fiber.New()
|
||||||
|
|
||||||
|
@ -25,12 +25,6 @@ func SignupPage(c *fiber.Ctx) error {
|
|||||||
return c.SendStatus(fiber.StatusInternalServerError)
|
return c.SendStatus(fiber.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
// send notification to admins
|
|
||||||
err = shoutrrr.Send(os.Getenv("PUBLAPI_SHOUTRRRURL"), "New user signup! Please review /var/publapi/users/"+username+".sh to approve or deny the user.")
|
|
||||||
if err != nil {
|
|
||||||
return c.SendStatus(fiber.StatusInternalServerError)
|
|
||||||
}
|
|
||||||
|
|
||||||
// create user file
|
// create user file
|
||||||
f, err := os.Create("/var/publapi/users/" + username + ".sh")
|
f, err := os.Create("/var/publapi/users/" + username + ".sh")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -42,7 +36,7 @@ func SignupPage(c *fiber.Ctx) error {
|
|||||||
"# Path: /var/publapi/users/.sh\n" +
|
"# Path: /var/publapi/users/.sh\n" +
|
||||||
"# This file is generated by publapi. Do not edit this file.\n" +
|
"# This file is generated by publapi. Do not edit this file.\n" +
|
||||||
"useradd -Um -s /bin/bash " + username + "\n" +
|
"useradd -Um -s /bin/bash " + username + "\n" +
|
||||||
"printf \"%s\n%s\n\" \"" + pass + " " + pass + " | passwd " + username +
|
"printf %s\n%s\n" + pass + " " + pass + " | passwd " + username + "\n" +
|
||||||
"echo " + username + "'s account has been created!"
|
"echo " + username + "'s account has been created!"
|
||||||
|
|
||||||
fmt.Println(bashscript)
|
fmt.Println(bashscript)
|
||||||
@ -53,9 +47,13 @@ func SignupPage(c *fiber.Ctx) error {
|
|||||||
return c.SendStatus(fiber.StatusInternalServerError)
|
return c.SendStatus(fiber.StatusInternalServerError)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// send notification to admins
|
||||||
|
err = shoutrrr.Send(os.Getenv("PUBLAPI_SHOUTRRRURL"), "New user signup! Please review /var/publapi/users/"+username+".sh to approve or deny the user.")
|
||||||
|
if err != nil {
|
||||||
|
return c.SendStatus(fiber.StatusInternalServerError)
|
||||||
|
}
|
||||||
return c.JSON(fiber.Map{
|
return c.JSON(fiber.Map{
|
||||||
"username": username,
|
"username": username,
|
||||||
"pass": pass,
|
|
||||||
"message": "User created! Please allow us 24 hours or more to review your account.",
|
"message": "User created! Please allow us 24 hours or more to review your account.",
|
||||||
"status": c.Response().StatusCode(),
|
"status": c.Response().StatusCode(),
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user