git-svn-id: svn://losandesgames.com/alfheim-website@38 15359d88-9307-4e75-a9c1-e5686e5897df

This commit is contained in:
Vicente Ferrari Smith 2025-02-17 12:50:13 +00:00
parent c911550021
commit 7efedae78f
16 changed files with 431 additions and 409 deletions

7
Caddyfile Normal file
View File

@ -0,0 +1,7 @@
{
email vicenteferrarismith@gmail.com
}
alfheimgame.com {
reverse_proxy localhost:4000
}

View File

@ -16,4 +16,5 @@ deploy:
.PHONY: service .PHONY: service
service: service:
rsync -P alfheimgame.service alfheim@alfheimgame.com:/home/alfheim rsync -P alfheimgame.service alfheim@alfheimgame.com:/home/alfheim
ssh -t alfheim@alfheimgame.com 'sudo mv /home/alfheim/alfheimgame.service /etc/systemd/system && sudo systemctl enable alfheimgame && sudo systemctl restart alfheimgame' rsync -P Caddyfile alfheim@alfheimgame.com:/home/alfheim
ssh -t root@alfheimgame.com 'mv /home/alfheim/alfheimgame.service /etc/systemd/system && mv /home/alfheim/Caddyfile /etc/caddy && systemctl enable alfheimgame && systemctl restart alfheimgame'

7
bin/Caddyfile Normal file
View File

@ -0,0 +1,7 @@
{
email vicenteferrarismith@gmail.com
}
alfheimgame.com {
reverse_proxy localhost:4000
}

View File

@ -0,0 +1,7 @@
{
email vicenteferrarismith@gmail.com
}
alfheimgame.com {
reverse_proxy localhost:4000
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

View File

@ -1,200 +1,201 @@
html { html {
height: 100%; height: 100%;
padding: 8px; padding: 8px;
/*background: no-repeat url(/static/image.png); /*background: no-repeat url(/static/image.png);
background-size: cover; background-size: cover;
background-position: center;*/ background-position: center;*/
background-color: black; background-color: black;
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
background-color: #3475CB; background-color: #3475CB;
font-family: "Vollkorn"; font-family: "Vollkorn";
color: white; color: white;
margin-top: 0px; margin-top: 0px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-bottom: 0px; margin-bottom: 0px;
min-height: 100%; display: flex;
max-width: 900px; flex-direction: column;
min-height: 100%;
max-width: 900px;
} }
header { header {
max-width: 100%; max-width: 100%;
} }
nav { nav {
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.navbuttons a { .navbuttons a {
display: inline-block; display: inline-block;
} }
.maintitle { .maintitle {
margin: 0px; margin: 0px;
font-size: 6rem; font-size: 6rem;
color: white; color: white;
} }
@media (max-width: 1080px) { @media (max-width: 1080px) {
.maintitle { .maintitle {
font-size: 4rem; font-size: 4rem;
} }
} }
.loginbutton { .loginbutton {
align-self: center; align-self: center;
display: flex; display: flex;
background-color: white; border: 12px solid;
padding-top: 15px; border-image-source: url("/static/panel-000.png");
padding-right: 20px; border-image-slice: 12 fill;
padding-bottom: 15px; padding-top: 15px;
padding-left: 20px; padding-right: 20px;
border-radius: 5px; padding-bottom: 15px;
color: black; padding-left: 20px;
/*box-shadow: 10px 10px 5px lightblue;*/ color: black;
/*box-shadow: 10px 10px 5px lightblue;*/
} }
main { main {
margin: 0px; padding: 5px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 100%; min-height: 100%;
max-height: 100%; max-height: 100%;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
p { p {
text-align: center; text-align: center;
font-size: 1rem; font-size: 1rem;
} }
.account-wrapper { .account-wrapper {
background: transparent; background: transparent;
border: 2px solid white; border: 2px solid white;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px; border-radius: 15px;
padding: 30px 40px; padding: 30px 40px;
font-size: 1.5rem; font-size: 1.5rem;
} }
.wrapper { .wrapper {
display: inline-block; display: inline-block;
background: transparent; background: transparent;
border: 2px solid white; border: 2px solid white;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px; border-radius: 15px;
padding: 30px 40px; padding: 30px 40px;
width: 80%; width: 80%;
text-align: center; text-align: center;
} }
.wrapper h1 { .wrapper h1 {
font-size: 1.5rem; font-size: 1.5rem;
text-align: center; text-align: center;
} }
.wrapper .input-box { .wrapper .input-box {
width: 100%; width: 100%;
} }
.input-box input { .input-box input {
box-sizing: border-box; box-sizing: border-box;
background: transparent; background: transparent;
width: 100%; width: 100%;
height: 100%; height: 100%;
outline: none; outline: none;
border: 2px solid rgba(255, 255, 255, .2); border: 2px solid rgba(255, 255, 255, .2);
border-radius: 25px; border-radius: 25px;
padding: 10px 45px 10px 20px padding: 10px 45px 10px 20px
} }
.input-box input::placeholder { .input-box input::placeholder {
color: white; color: white;
} }
.wrapper .input-error { .wrapper .input-error {
width: 100%; width: 100%;
} }
.error { .error {
color: rgba(240, 0, 0, .8); color: rgba(240, 0, 0, .8);
} }
.input-error input { .input-error input {
box-sizing: border-box; box-sizing: border-box;
background: transparent; background: transparent;
width: 100%; width: 100%;
height: 100%; height: 100%;
outline: none; outline: none;
border: 2px solid rgba(255, 0, 0, .2); border: 2px solid rgba(255, 0, 0, .2);
border-radius: 25px; border-radius: 25px;
padding: 10px 45px 10px 20px padding: 10px 45px 10px 20px
} }
.input-error input::placeholder { .input-error input::placeholder {
color: red; color: red;
} }
.login-btn-wrapper { .login-btn-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.wrapper .btn { .wrapper .btn {
width: 100%; width: 100%;
outline: none; outline: none;
border: none; border: none;
border-radius: 20px; border-radius: 20px;
} }
.wrapper .register-link { .wrapper .register-link {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
input { input {
font-family: inherit; font-family: inherit;
} }
footer { footer {
position: relative; margin-top: auto;
left: 0; width: 100%;
bottom: 0; background-color: #132123;
width: 100%; color: white;
background-color: #132123; text-align: center;
color: white;
text-align: center;
} }
a:link { a:link {
text-decoration: none; text-decoration: none;
} }
.wrapper a:link { .wrapper a:link {
text-decoration: none; text-decoration: none;
} }
.wrapper a:visited { .wrapper a:visited {
text-decoration: none; text-decoration: none;
} }
.wrapper a:hover { .wrapper a:hover {
text-decoration: underline; text-decoration: underline;
} }
video { video {
width: 100%; width: 100%;
height: auto; height: auto;
} }

View File

@ -1,54 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html>
<!--
/\ | |--- | | |--- || |\ /|
/__\ | |-- |---| |-- || | \ / |
/ \ |___ | | | |___ || | \/ |
-->
<html lang="en"> <html lang="en">
<head> <head>
<title>Alfheim</title> <title>Alfheim</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="description" content="A handcrafted economy and politics MMO." /> <meta name="description" content="A handcrafted economy and politics MMO." />
<meta name="author" content="Vicente Ferrari Smith" /> <meta name="author" content="Vicente Ferrari Smith" />
<meta name="keywords" content="Alfheim, indie, video game, mmo, colony, colony simulator, vicente ferrari smith, game, economy, politics, alfheim" /> <meta name="keywords" content="Alfheim, indie, video game, mmo, colony, colony simulator, vicente ferrari smith, game, economy, politics, alfheim" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<style> <style>
@font-face { @font-face {
font-family: "Vollkorn"; font-family: "Vollkorn";
src: url(/static/Vollkorn-VariableFont_wght.ttf); src: url(/static/Vollkorn-VariableFont_wght.ttf);
} }
</style> </style>
<link href="/static/style.css" rel="stylesheet" /> <link href="/static/style.css" rel="stylesheet" />
</head> </head>
<body> <body>
<header> <header>
<nav> <nav>
<a href="/"><h1 class="maintitle">Alfheim</h1></a> <a href="/"><h1 class="maintitle">Alfheim</h1></a>
<div class="navbuttons"> <div class="navbuttons">
{{if not .ActiveSubscription}} {{if not .ActiveSubscription}}
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a> <a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
{{end}} {{end}}
{{if .AuthenticatedUser}} {{if .AuthenticatedUser}}
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a> <a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a> <a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
{{else}} {{else}}
<a href="/login"><div class="loginbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a> <a href="/login"><div class="loginbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a>
<a href="/register"><div class="loginbutton"><strong>Register</strong></div></a> <a href="/register"><div class="loginbutton"><strong>Register</strong></div></a>
{{end}} {{end}}
</div> </div>
</nav> </nav>
</header> </header>
<main> <main>
{{template "body" .}} {{template "body" .}}
</main> </main>
<footer> <footer>
Alfheim &copy; 2024, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved. Alfheim &copy; 2025, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved.
</footer> </footer>
</body> </body>
</html> </html>

BIN
bin/static/panel-000.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 173 B

View File

@ -1,200 +1,201 @@
html { html {
height: 100%; height: 100%;
padding: 8px; padding: 8px;
/*background: no-repeat url(/static/image.png); /*background: no-repeat url(/static/image.png);
background-size: cover; background-size: cover;
background-position: center;*/ background-position: center;*/
background-color: black; background-color: black;
box-sizing: border-box; box-sizing: border-box;
} }
body { body {
background-color: #3475CB; background-color: #3475CB;
font-family: "Vollkorn"; font-family: "Vollkorn";
color: white; color: white;
margin-top: 0px; margin-top: 0px;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
margin-bottom: 0px; margin-bottom: 0px;
min-height: 100%; display: flex;
max-width: 900px; flex-direction: column;
min-height: 100%;
max-width: 900px;
} }
header { header {
max-width: 100%; max-width: 100%;
} }
nav { nav {
padding-left: 8px; padding-left: 8px;
padding-right: 8px; padding-right: 8px;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
} }
.navbuttons a { .navbuttons a {
display: inline-block; display: inline-block;
} }
.maintitle { .maintitle {
margin: 0px; margin: 0px;
font-size: 6rem; font-size: 6rem;
color: white; color: white;
} }
@media (max-width: 1080px) { @media (max-width: 1080px) {
.maintitle { .maintitle {
font-size: 4rem; font-size: 4rem;
} }
} }
.loginbutton { .loginbutton {
align-self: center; align-self: center;
display: flex; display: flex;
background-color: white; border: 12px solid;
padding-top: 15px; border-image-source: url("/static/panel-000.png");
padding-right: 20px; border-image-slice: 12 fill;
padding-bottom: 15px; padding-top: 15px;
padding-left: 20px; padding-right: 20px;
border-radius: 5px; padding-bottom: 15px;
color: black; padding-left: 20px;
/*box-shadow: 10px 10px 5px lightblue;*/ color: black;
/*box-shadow: 10px 10px 5px lightblue;*/
} }
main { main {
margin: 0px; padding: 5px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
min-height: 100%; min-height: 100%;
max-height: 100%; max-height: 100%;
margin-left: auto; margin-left: auto;
margin-right: auto; margin-right: auto;
} }
p { p {
text-align: center; text-align: center;
font-size: 1rem; font-size: 1rem;
} }
.account-wrapper { .account-wrapper {
background: transparent; background: transparent;
border: 2px solid white; border: 2px solid white;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px; border-radius: 15px;
padding: 30px 40px; padding: 30px 40px;
font-size: 1.5rem; font-size: 1.5rem;
} }
.wrapper { .wrapper {
display: inline-block; display: inline-block;
background: transparent; background: transparent;
border: 2px solid white; border: 2px solid white;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2); box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px; border-radius: 15px;
padding: 30px 40px; padding: 30px 40px;
width: 80%; width: 80%;
text-align: center; text-align: center;
} }
.wrapper h1 { .wrapper h1 {
font-size: 1.5rem; font-size: 1.5rem;
text-align: center; text-align: center;
} }
.wrapper .input-box { .wrapper .input-box {
width: 100%; width: 100%;
} }
.input-box input { .input-box input {
box-sizing: border-box; box-sizing: border-box;
background: transparent; background: transparent;
width: 100%; width: 100%;
height: 100%; height: 100%;
outline: none; outline: none;
border: 2px solid rgba(255, 255, 255, .2); border: 2px solid rgba(255, 255, 255, .2);
border-radius: 25px; border-radius: 25px;
padding: 10px 45px 10px 20px padding: 10px 45px 10px 20px
} }
.input-box input::placeholder { .input-box input::placeholder {
color: white; color: white;
} }
.wrapper .input-error { .wrapper .input-error {
width: 100%; width: 100%;
} }
.error { .error {
color: rgba(240, 0, 0, .8); color: rgba(240, 0, 0, .8);
} }
.input-error input { .input-error input {
box-sizing: border-box; box-sizing: border-box;
background: transparent; background: transparent;
width: 100%; width: 100%;
height: 100%; height: 100%;
outline: none; outline: none;
border: 2px solid rgba(255, 0, 0, .2); border: 2px solid rgba(255, 0, 0, .2);
border-radius: 25px; border-radius: 25px;
padding: 10px 45px 10px 20px padding: 10px 45px 10px 20px
} }
.input-error input::placeholder { .input-error input::placeholder {
color: red; color: red;
} }
.login-btn-wrapper { .login-btn-wrapper {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
.wrapper .btn { .wrapper .btn {
width: 100%; width: 100%;
outline: none; outline: none;
border: none; border: none;
border-radius: 20px; border-radius: 20px;
} }
.wrapper .register-link { .wrapper .register-link {
display: flex; display: flex;
justify-content: center; justify-content: center;
} }
input { input {
font-family: inherit; font-family: inherit;
} }
footer { footer {
position: relative; margin-top: auto;
left: 0; width: 100%;
bottom: 0; background-color: #132123;
width: 100%; color: white;
background-color: #132123; text-align: center;
color: white;
text-align: center;
} }
a:link { a:link {
text-decoration: none; text-decoration: none;
} }
.wrapper a:link { .wrapper a:link {
text-decoration: none; text-decoration: none;
} }
.wrapper a:visited { .wrapper a:visited {
text-decoration: none; text-decoration: none;
} }
.wrapper a:hover { .wrapper a:hover {
text-decoration: underline; text-decoration: underline;
} }
video { video {
width: 100%; width: 100%;
height: auto; height: auto;
} }

View File

@ -1,54 +1,48 @@
<!DOCTYPE html> <!DOCTYPE html>
<!--
/\ | |--- | | |--- || |\ /|
/__\ | |-- |---| |-- || | \ / |
/ \ |___ | | | |___ || | \/ |
-->
<html lang="en"> <html lang="en">
<head> <head>
<title>Alfheim</title> <title>Alfheim</title>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="description" content="A handcrafted economy and politics MMO." /> <meta name="description" content="A handcrafted economy and politics MMO." />
<meta name="author" content="Vicente Ferrari Smith" /> <meta name="author" content="Vicente Ferrari Smith" />
<meta name="keywords" content="Alfheim, indie, video game, mmo, colony, colony simulator, vicente ferrari smith, game, economy, politics, alfheim" /> <meta name="keywords" content="Alfheim, indie, video game, mmo, colony, colony simulator, vicente ferrari smith, game, economy, politics, alfheim" />
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<style> <style>
@font-face { @font-face {
font-family: "Vollkorn"; font-family: "Vollkorn";
src: url(/static/Vollkorn-VariableFont_wght.ttf); src: url(/static/Vollkorn-VariableFont_wght.ttf);
} }
</style> </style>
<link href="/static/style.css" rel="stylesheet" /> <link href="/static/style.css" rel="stylesheet" />
</head> </head>
<body> <body>
<header> <header>
<nav> <nav>
<a href="/"><h1 class="maintitle">Alfheim</h1></a> <a href="/"><h1 class="maintitle">Alfheim</h1></a>
<div class="navbuttons"> <div class="navbuttons">
{{if not .ActiveSubscription}} {{if not .ActiveSubscription}}
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a> <a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
{{end}} {{end}}
{{if .AuthenticatedUser}} {{if .AuthenticatedUser}}
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a> <a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a> <a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
{{else}} {{else}}
<a href="/login"><div class="loginbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a> <a href="/login"><div class="loginbutton"><strong>Log in</strong><img src="/static/login_24dp_FILL0_wght400_GRAD0_opsz24.svg" alt=""/></div></a>
<a href="/register"><div class="loginbutton"><strong>Register</strong></div></a> <a href="/register"><div class="loginbutton"><strong>Register</strong></div></a>
{{end}} {{end}}
</div> </div>
</nav> </nav>
</header> </header>
<main> <main>
{{template "body" .}} {{template "body" .}}
</main> </main>
<footer> <footer>
Alfheim &copy; 2024, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved. Alfheim &copy; 2025, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved.
</footer> </footer>
</body> </body>
</html> </html>

6
go.mod
View File

@ -7,12 +7,12 @@ require (
github.com/gorilla/sessions v1.2.2 github.com/gorilla/sessions v1.2.2
github.com/lib/pq v1.10.9 github.com/lib/pq v1.10.9
github.com/stripe/stripe-go/v78 v78.7.0 github.com/stripe/stripe-go/v78 v78.7.0
golang.org/x/crypto v0.23.0 golang.org/x/crypto v0.33.0
) )
require ( require (
github.com/gorilla/securecookie v1.1.2 // indirect github.com/gorilla/securecookie v1.1.2 // indirect
golang.org/x/net v0.21.0 // indirect golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.20.0 // indirect golang.org/x/sys v0.30.0 // indirect
golang.org/x/text v0.15.0 // indirect golang.org/x/text v0.22.0 // indirect
) )

6
go.sum
View File

@ -23,6 +23,8 @@ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5y
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
golang.org/x/crypto v0.33.0 h1:IOBPskki6Lysi0lo9qQvbxiQ+FvsCC/YWOecCHAixus=
golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@ -47,6 +49,8 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.30.0 h1:QjkSwP/36a20jFYWkSue1YwXzLmsV5Gfq7Eiy72C1uc=
golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@ -61,6 +65,8 @@ golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.22.0 h1:bofq7m3/HAFvbF51jz3Q9wLg3jkvSPuiZu/pD1XwgtM=
golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=

153
main.go
View File

@ -4,15 +4,23 @@
package main package main
import "log" import (
import "flag" "flag"
import "net/http" "log"
import _ "github.com/lib/pq" "net/http"
import "database/sql" "time"
import "github.com/gorilla/sessions"
import "regexp"
import "github.com/stripe/stripe-go/v78" "database/sql"
"regexp"
"github.com/gorilla/sessions"
_ "github.com/lib/pq"
"github.com/stripe/stripe-go/v78"
"crypto/tls"
"golang.org/x/crypto/acme/autocert"
)
var users *Usermodel var users *Usermodel
var subscriptions *SubscriptionModel var subscriptions *SubscriptionModel
@ -23,77 +31,94 @@ var store = sessions.NewCookieStore(key)
var emailrx = regexp.MustCompile("/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/") var emailrx = regexp.MustCompile("/^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/")
func main() { func main() {
addr := flag.String("addr", "127.0.0.1:8080", "HTTP network addr") addr := flag.String("addr", "127.0.0.1:8080", "HTTP network addr")
prodaddr := flag.String("prodaddr", "45.76.84.7:443", "HTTP network addr") //prodaddr := flag.String("prodaddr", "127.0.0.1:4000", "HTTP network addr")
prodaddr := flag.String("prodaddr", "45.76.84.7:443", "HTTP network addr")
production := flag.Bool("production", false, "Whether to use production port and TLS") production := flag.Bool("production", false, "Whether to use production port and TLS")
_ = addr _ = addr
flag.Parse() flag.Parse()
log.Println("Hello, Sailor!") log.Println("Hello, Sailor!")
stripe.Key = "sk_test_51PGebgKUHKCjyTmc97rfDPcvew6EhqDz2qp3U7XoAMIilAU9IVo2NO4P7ylkTvbBafFVr94trha1VYY32jRWMw2K00Yq7YJXFf" stripe.Key = "sk_test_51PGebgKUHKCjyTmc97rfDPcvew6EhqDz2qp3U7XoAMIilAU9IVo2NO4P7ylkTvbBafFVr94trha1VYY32jRWMw2K00Yq7YJXFf"
store.MaxAge(0) store.MaxAge(0)
db, err := sql.Open("postgres", "postgres://elves_database:iK2SoVbDhdCki5n3LxGyP6zKpLspt4@80.240.25.87/elves_database") db, err := sql.Open("postgres", "postgres://elves_database:iK2SoVbDhdCki5n3LxGyP6zKpLspt4@80.240.25.87/elves_database")
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
defer db.Close() defer db.Close()
users = &Usermodel{db} users = &Usermodel{db}
subscriptions = &SubscriptionModel{db} subscriptions = &SubscriptionModel{db}
mux := http.NewServeMux() mux := http.NewServeMux()
//rows, err := db.Query("SELECT * FROM accounts") //rows, err := db.Query("SELECT * FROM accounts")
//if err != nil { //if err != nil {
// log.Fatal(err) // log.Fatal(err)
//} //}
//defer rows.Close() //defer rows.Close()
//accounts := make([]*Account, 0) //accounts := make([]*Account, 0)
//for rows.Next() { //for rows.Next() {
// acc := new(Account) // acc := new(Account)
// err := rows.Scan(&acc.id, &acc.Username, &acc.password, &acc.Color) // err := rows.Scan(&acc.id, &acc.Username, &acc.password, &acc.Color)
// if err != nil { // if err != nil {
// log.Fatal(err) // log.Fatal(err)
// } // }
// accounts = append(accounts, acc) // accounts = append(accounts, acc)
//} //}
//if err = rows.Err() err != nil { //if err = rows.Err() err != nil {
// log.Fatal(err) // log.Fatal(err)
//} //}
//for _, acc := range accounts { //for _, acc := range accounts {
// log.Println(acc) // log.Println(acc)
//} //}
mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static")))) mux.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir("static"))))
mux.HandleFunc("/favicon.ico", favicon) mux.HandleFunc("/favicon.ico", favicon)
mux.HandleFunc("/", home) mux.HandleFunc("/", home)
mux.HandleFunc("/login", login) mux.HandleFunc("/login", login)
mux.HandleFunc("/logout", logout) mux.HandleFunc("/logout", logout)
mux.HandleFunc("/register", register) mux.HandleFunc("/register", register)
mux.HandleFunc("/account", require_authenticated_user(account)) mux.HandleFunc("/account", require_authenticated_user(account))
mux.HandleFunc("/deleteaccount", require_authenticated_user(deleteaccount)) mux.HandleFunc("/deleteaccount", require_authenticated_user(deleteaccount))
mux.HandleFunc("/subscribe", require_authenticated_user(subscribe_stripe)) mux.HandleFunc("/subscribe", require_authenticated_user(subscribe_stripe))
mux.HandleFunc("/managebilling", require_authenticated_user(managebilling)) mux.HandleFunc("/managebilling", require_authenticated_user(managebilling))
mux.HandleFunc("/webhook", webhooks) mux.HandleFunc("/webhook", webhooks)
if *production { if *production {
autocertManager := autocert.Manager{
Prompt: autocert.AcceptTOS,
HostPolicy: autocert.HostWhitelist("alfheimgame.com"),
Email: "vicenteferrarismith@gmail.com",
Cache: autocert.DirCache("certs"),
}
server := &http.Server{ tlsConfig := &tls.Config{
Addr: *prodaddr, GetCertificate: autocertManager.GetCertificate,
Handler: log_connection(secure_headers(mux)), PreferServerCipherSuites: true,
} CurvePreferences: []tls.CurveID{tls.X25519, tls.CurveP256},
NextProtos: []string{"acme-tls/1"},
}
server := &http.Server{
Addr: *prodaddr,
Handler: log_connection(secure_headers(mux)),
TLSConfig: tlsConfig,
IdleTimeout: time.Minute,
ReadTimeout: 5 * time.Second,
WriteTimeout: 10 * time.Second,
}
log.Fatal(server.ListenAndServeTLS("/home/alfheim/cert/config/live/alfheimgame.com/fullchain.pem", "/home/alfheim/cert/config/live/alfheimgame.com/privkey.pem")) log.Fatal(server.ListenAndServeTLS("", ""))
} else { } else {
log.Fatal(http.ListenAndServe(*addr, log_connection(secure_headers(mux)))) log.Fatal(http.ListenAndServe(*addr, log_connection(secure_headers(mux))))
} }
} }

View File

@ -1,20 +0,0 @@
2024-04-30 13:18:48 - Neovide panicked with the message 'called `Result::unwrap()` on an `Err` value: Connection(IoError(Custom { kind: Other, error: UnknownError }))'. (File: /build/.cargo/registry/src/index.crates.io-6f17d22bba15001f/winit-0.29.10/src/platform_impl/linux/x11/window.rs; Line: 1316, Column: 14)
0: <unknown>
1: <unknown>
2: <unknown>
3: <unknown>
4: <unknown>
5: <unknown>
6: <unknown>
7: <unknown>
8: <unknown>
9: <unknown>
10: <unknown>
11: <unknown>
12: <unknown>
13: <unknown>
14: <unknown>
15: <unknown>
16: __libc_start_main
17: <unknown>

View File

@ -55,12 +55,11 @@ ufw --force enable
apt --yes install fail2ban apt --yes install fail2ban
apt --yes install certbot apt --yes install certbot
su - alfheim -c "mkdir cert" sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
su - alfheim -c "mkdir cert/lib" curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
su - alfheim -c "mkdir cert/config" curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
su - alfheim -c "mkdir cert/log" sudo apt update
su - alfheim -c "sudo certbot certonly --cert-path cert/ --work-dir cert/lib --config-dir cert/config/ --logs-dir cert/log/ --standalone" sudo apt install caddy
su - alfheim -c "sudo chown -R alfheim:alfheim cert"
# Add a DSN for connecting to the greenlight database to the system-wide environment # Add a DSN for connecting to the greenlight database to the system-wide environment
# variables in the /etc/environment file. # variables in the /etc/environment file.

View File

@ -65,7 +65,7 @@ nav {
} }
main { main {
margin: 0px; padding: 5px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;