updated DB requirements, moved DB execution to main, couple of css fixes

This commit is contained in:
tavo 2024-09-16 17:39:08 -06:00
parent 2fa63db322
commit 906b09eaf7
7 changed files with 54 additions and 19 deletions

View file

@ -10,11 +10,18 @@ GOMODS = github.com/joho/godotenv \
github.com/lib/pq \
gopkg.in/gomail.v2 \
all: ${BIN}
all: ${BIN} fmt
${BIN}: ${SRC} ${GOFILES}
(cd ${SRCDIR} && go build -o ../${BIN})
fmt: ${SRC}
@diff=$$(gofmt -d $^); \
if [ -n "$$diff" ]; then \
printf '%s\n' "$$diff"; \
exit 1; \
fi
${GOFILES}:
(cd ${SRCDIR} && go mod init ${BIN})
(cd ${SRCDIR} && go get ${GOMODS})

View file

@ -22,7 +22,7 @@ CREATE DATABASE iterone OWNER conex;
DROP TABLE IF EXISTS changes;
DROP TABLE IF EXISTS payments;
DROP TABLE IF EXISTS sites;
CREATE TABLE sites (
id SERIAL PRIMARY KEY,
folder VARCHAR(35) UNIQUE NOT NULL,
@ -33,6 +33,9 @@ CREATE TABLE sites (
email VARCHAR(100) NOT NULL,
phone VARCHAR(20),
code VARCHAR(2),
title VARCHAR(35) NOT NULL,
slogan VARCHAR(100) NOT NULL,
banner TEXT,
raw JSONB NOT NULL,
auth INTEGER,
valid TIMESTAMPTZ
@ -44,8 +47,8 @@ SELECT * FROM sites;
#+END_SRC
#+RESULTS:
| id | folder | status | due | name | sur | email | phone | code | raw | auth | valid |
|----+--------+--------+-----+------+-----+-------+-------+------+-----+------+-------|
| id | folder | status | due | name | sur | email | phone | code | title | slogan | banner | raw | auth | valid |
|----+--------+--------+-----+------+-----+-------+-------+------+-------+--------+--------+-----+------+-------|
** Payments table

View file

@ -14,12 +14,12 @@
<div class="banner">
<input type="file" id="imageUpload" accept="image/*">
<label for="imageUpload" class="upload-button">
<img src="/static/svg/edit.svg" alt="Edit Icon" class="icon">
<img src="/static/svg/image.svg" alt="Edit Icon" class="icon">
</label>
<img id="banner" name="banner" src="/static/svg/banner.svg" class="banner-image"/>
<div class="desc">
<input type="text" id="title" name="title" class="input-title" placeholder="[Nombre Ejemplo]">
<input type="text" id="slogan" name="slogan" class="input-slogan" placeholder="[Slogan llamativo o breve descripción]">
<textarea type="text" id="slogan" name="slogan" class="input-slogan" placeholder="[Slogan llamativo o breve descripción]"></textarea>
</div>
<div id="status-popup" class="status-popup">
<span class="close-popup" onclick="hidePopup()">×</span>

View file

@ -92,6 +92,7 @@ a {
}
.input-slogan {
font-family: var(--font-family);
text-align: center;
width: 100%;
background-color: #00000000;
@ -358,16 +359,15 @@ button {
}
.upload-button {
position: fixed;
top: 2%;
left: 2%;
display: inline-block;
position: absolute;
top: 0.8em;
left: 0.8em;
display: inline-flex;
width: 2em;
height: 2em;
border-radius: 10px;
border: 1px solid var(--hover-border);
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
transition: background-color 0.2s ease;

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
<svg fill="#ffffff" height="800px" width="800px" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
viewBox="0 0 489.4 489.4" xml:space="preserve">
<g>
<g>
<path stroke="#ffffff" stroke-width="30" d="M0,437.8c0,28.5,23.2,51.6,51.6,51.6h386.2c28.5,0,51.6-23.2,51.6-51.6V51.6c0-28.5-23.2-51.6-51.6-51.6H51.6
C23.1,0,0,23.2,0,51.6C0,51.6,0,437.8,0,437.8z M437.8,464.9H51.6c-14.9,0-27.1-12.2-27.1-27.1v-64.5l92.8-92.8l79.3,79.3
c4.8,4.8,12.5,4.8,17.3,0l143.2-143.2l107.8,107.8v113.4C464.9,452.7,452.7,464.9,437.8,464.9z M51.6,24.5h386.2
c14.9,0,27.1,12.2,27.1,27.1v238.1l-99.2-99.1c-4.8-4.8-12.5-4.8-17.3,0L205.2,333.8l-79.3-79.3c-4.8-4.8-12.5-4.8-17.3,0
l-84.1,84.1v-287C24.5,36.7,36.7,24.5,51.6,24.5z"/>
<path d="M151.7,196.1c34.4,0,62.3-28,62.3-62.3s-28-62.3-62.3-62.3s-62.3,28-62.3,62.3S117.3,196.1,151.7,196.1z M151.7,96
c20.9,0,37.8,17,37.8,37.8s-17,37.8-37.8,37.8s-37.8-17-37.8-37.8S130.8,96,151.7,96z"/>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -26,7 +26,7 @@ func AvailableSite(db *sql.DB, folder string) error {
var exists bool
if err := db.QueryRow(`
SELECT EXISTS(SELECT * FROM sites WHERE folder = $1)
`, folder).Scan(&exists) ; err != nil {
`, folder).Scan(&exists); err != nil {
return fmt.Errorf("error checking if folder exists: %v", err)
}

View file

@ -41,12 +41,22 @@ func main() {
var db *sql.DB
godotenv.Load()
if os.Getenv("BASE_URL") == "" ||
os.Getenv("CLIENT_ID") == "" ||
os.Getenv("CLIENT_SECRET") == "" ||
os.Getenv("RETURN_URL") == "" ||
os.Getenv("CANCEL_URL") == "" ||
os.Getenv("PORT") == "" {
var (
baseURL = os.Getenv("BASE_URL")
clientID = os.Getenv("CLIENT_ID")
clientSecret = os.Getenv("CLIENT_SECRET")
returnURL = os.Getenv("RETURN_URL")
cancelURL = os.Getenv("CANCEL_URL")
port = os.Getenv("PORT")
// price = os.Getenv("PRICE")
)
if baseURL == "" ||
clientID == "" ||
clientSecret == "" ||
returnURL == "" ||
cancelURL == "" ||
port == "" {
fatal(nil, errMissingCredentials)
}
@ -75,7 +85,6 @@ func main() {
stop := make(chan os.Signal, 1)
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM)
port := os.Getenv("PORT")
go func() {
msg(msgServerStart + ": " + port + "...")