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

View File

@ -1,54 +1,48 @@
<!DOCTYPE html>
<!--
/\ | |--- | | |--- || |\ /|
/__\ | |-- |---| |-- || | \ / |
/ \ |___ | | | |___ || | \/ |
-->
<html lang="en">
<head>
<title>Alfheim</title>
<meta charset="utf-8" />
<meta name="description" content="A handcrafted economy and politics MMO." />
<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="viewport" content="width=device-width, initial-scale=1">
<style>
@font-face {
font-family: "Vollkorn";
src: url(/static/Vollkorn-VariableFont_wght.ttf);
}
</style>
<link href="/static/style.css" rel="stylesheet" />
</head>
<head>
<title>Alfheim</title>
<meta charset="utf-8" />
<meta name="description" content="A handcrafted economy and politics MMO." />
<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="viewport" content="width=device-width, initial-scale=1">
<style>
@font-face {
font-family: "Vollkorn";
src: url(/static/Vollkorn-VariableFont_wght.ttf);
}
</style>
<link href="/static/style.css" rel="stylesheet" />
</head>
<body>
<header>
<nav>
<a href="/"><h1 class="maintitle">Alfheim</h1></a>
<div class="navbuttons">
{{if not .ActiveSubscription}}
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
{{end}}
<body>
<header>
<nav>
<a href="/"><h1 class="maintitle">Alfheim</h1></a>
<div class="navbuttons">
{{if not .ActiveSubscription}}
<a href="/subscribe"><div class="loginbutton"><strong>Subscribe</strong></div></a>
{{end}}
{{if .AuthenticatedUser}}
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
{{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="/register"><div class="loginbutton"><strong>Register</strong></div></a>
{{end}}
</div>
</nav>
</header>
{{if .AuthenticatedUser}}
<a href="/account"><div class="loginbutton"><strong>Account</strong></div></a>
<a href="/logout"><div class="loginbutton"><strong>Log out</strong></div></a>
{{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="/register"><div class="loginbutton"><strong>Register</strong></div></a>
{{end}}
</div>
</nav>
</header>
<main>
{{template "body" .}}
</main>
<main>
{{template "body" .}}
</main>
<footer>
Alfheim &copy; 2024, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved.
</footer>
</body>
<footer>
Alfheim &copy; 2025, Vicente Ferrari Smith, Los Andes Games, Vienna, Austria. All rights reserved.
</footer>
</body>
</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 {
height: 100%;
padding: 8px;
/*background: no-repeat url(/static/image.png);
background-size: cover;
background-position: center;*/
background-color: black;
box-sizing: border-box;
height: 100%;
padding: 8px;
/*background: no-repeat url(/static/image.png);
background-size: cover;
background-position: center;*/
background-color: black;
box-sizing: border-box;
}
body {
background-color: #3475CB;
font-family: "Vollkorn";
color: white;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
margin-bottom: 0px;
min-height: 100%;
max-width: 900px;
background-color: #3475CB;
font-family: "Vollkorn";
color: white;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
margin-bottom: 0px;
display: flex;
flex-direction: column;
min-height: 100%;
max-width: 900px;
}
header {
max-width: 100%;
max-width: 100%;
}
nav {
padding-left: 8px;
padding-right: 8px;
display: flex;
align-items: center;
justify-content: space-between;
padding-left: 8px;
padding-right: 8px;
display: flex;
align-items: center;
justify-content: space-between;
}
.navbuttons a {
display: inline-block;
display: inline-block;
}
.maintitle {
margin: 0px;
font-size: 6rem;
color: white;
margin: 0px;
font-size: 6rem;
color: white;
}
@media (max-width: 1080px) {
.maintitle {
font-size: 4rem;
}
.maintitle {
font-size: 4rem;
}
}
.loginbutton {
align-self: center;
display: flex;
background-color: white;
padding-top: 15px;
padding-right: 20px;
padding-bottom: 15px;
padding-left: 20px;
border-radius: 5px;
color: black;
/*box-shadow: 10px 10px 5px lightblue;*/
align-self: center;
display: flex;
border: 12px solid;
border-image-source: url("/static/panel-000.png");
border-image-slice: 12 fill;
padding-top: 15px;
padding-right: 20px;
padding-bottom: 15px;
padding-left: 20px;
color: black;
/*box-shadow: 10px 10px 5px lightblue;*/
}
main {
margin: 0px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100%;
max-height: 100%;
margin-left: auto;
margin-right: auto;
padding: 5px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
min-height: 100%;
max-height: 100%;
margin-left: auto;
margin-right: auto;
}
p {
text-align: center;
font-size: 1rem;
text-align: center;
font-size: 1rem;
}
.account-wrapper {
background: transparent;
border: 2px solid white;
backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: 30px 40px;
font-size: 1.5rem;
background: transparent;
border: 2px solid white;
backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: 30px 40px;
font-size: 1.5rem;
}
.wrapper {
display: inline-block;
background: transparent;
border: 2px solid white;
backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: 30px 40px;
width: 80%;
text-align: center;
display: inline-block;
background: transparent;
border: 2px solid white;
backdrop-filter: blur(20px);
box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
border-radius: 15px;
padding: 30px 40px;
width: 80%;
text-align: center;
}
.wrapper h1 {
font-size: 1.5rem;
text-align: center;
font-size: 1.5rem;
text-align: center;
}
.wrapper .input-box {
width: 100%;
width: 100%;
}
.input-box input {
box-sizing: border-box;
background: transparent;
width: 100%;
height: 100%;
outline: none;
border: 2px solid rgba(255, 255, 255, .2);
border-radius: 25px;
padding: 10px 45px 10px 20px
box-sizing: border-box;
background: transparent;
width: 100%;
height: 100%;
outline: none;
border: 2px solid rgba(255, 255, 255, .2);
border-radius: 25px;
padding: 10px 45px 10px 20px
}
.input-box input::placeholder {
color: white;
color: white;
}
.wrapper .input-error {
width: 100%;
width: 100%;
}
.error {
color: rgba(240, 0, 0, .8);
color: rgba(240, 0, 0, .8);
}
.input-error input {
box-sizing: border-box;
background: transparent;
width: 100%;
height: 100%;
outline: none;
border: 2px solid rgba(255, 0, 0, .2);
border-radius: 25px;
padding: 10px 45px 10px 20px
box-sizing: border-box;
background: transparent;
width: 100%;
height: 100%;
outline: none;
border: 2px solid rgba(255, 0, 0, .2);
border-radius: 25px;
padding: 10px 45px 10px 20px
}
.input-error input::placeholder {
color: red;
color: red;
}
.login-btn-wrapper {
display: flex;
justify-content: center;
display: flex;
justify-content: center;
}
.wrapper .btn {
width: 100%;
outline: none;
border: none;
border-radius: 20px;
width: 100%;
outline: none;
border: none;
border-radius: 20px;
}
.wrapper .register-link {
display: flex;
justify-content: center;
display: flex;
justify-content: center;
}
input {
font-family: inherit;
font-family: inherit;
}
footer {
position: relative;
left: 0;
bottom: 0;
width: 100%;
background-color: #132123;
color: white;
text-align: center;
margin-top: auto;
width: 100%;
background-color: #132123;
color: white;
text-align: center;
}
a:link {
text-decoration: none;
text-decoration: none;
}
.wrapper a:link {
text-decoration: none;
text-decoration: none;
}
.wrapper a:visited {
text-decoration: none;
text-decoration: none;
}
.wrapper a:hover {
text-decoration: underline;
text-decoration: underline;
}
video {
width: 100%;
height: auto;
width: 100%;
height: auto;
}

View File

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

6
go.mod
View File

@ -7,12 +7,12 @@ require (
github.com/gorilla/sessions v1.2.2
github.com/lib/pq v1.10.9
github.com/stripe/stripe-go/v78 v78.7.0
golang.org/x/crypto v0.23.0
golang.org/x/crypto v0.33.0
)
require (
github.com/gorilla/securecookie v1.1.2 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.20.0 // indirect
golang.org/x/text v0.15.0 // indirect
golang.org/x/sys v0.30.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.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
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.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
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.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
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-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
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.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.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-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
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
import "log"
import "flag"
import "net/http"
import _ "github.com/lib/pq"
import "database/sql"
import "github.com/gorilla/sessions"
import "regexp"
import (
"flag"
"log"
"net/http"
"time"
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 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])?)*$/")
func main() {
addr := flag.String("addr", "127.0.0.1:8080", "HTTP network addr")
prodaddr := flag.String("prodaddr", "45.76.84.7:443", "HTTP network addr")
addr := flag.String("addr", "127.0.0.1:8080", "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")
_ = addr
flag.Parse()
log.Println("Hello, Sailor!")
production := flag.Bool("production", false, "Whether to use production port and TLS")
_ = addr
flag.Parse()
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")
if err != nil {
log.Fatal(err)
}
defer db.Close()
db, err := sql.Open("postgres", "postgres://elves_database:iK2SoVbDhdCki5n3LxGyP6zKpLspt4@80.240.25.87/elves_database")
if err != nil {
log.Fatal(err)
}
defer db.Close()
users = &Usermodel{db}
subscriptions = &SubscriptionModel{db}
users = &Usermodel{db}
subscriptions = &SubscriptionModel{db}
mux := http.NewServeMux()
mux := http.NewServeMux()
//rows, err := db.Query("SELECT * FROM accounts")
//if err != nil {
// log.Fatal(err)
//}
//defer rows.Close()
//rows, err := db.Query("SELECT * FROM accounts")
//if err != nil {
// log.Fatal(err)
//}
//defer rows.Close()
//accounts := make([]*Account, 0)
//for rows.Next() {
// acc := new(Account)
// err := rows.Scan(&acc.id, &acc.Username, &acc.password, &acc.Color)
// if err != nil {
// log.Fatal(err)
// }
// accounts = append(accounts, acc)
//}
//accounts := make([]*Account, 0)
//for rows.Next() {
// acc := new(Account)
// err := rows.Scan(&acc.id, &acc.Username, &acc.password, &acc.Color)
// if err != nil {
// log.Fatal(err)
// }
// accounts = append(accounts, acc)
//}
//if err = rows.Err() err != nil {
// log.Fatal(err)
//}
//if err = rows.Err() err != nil {
// log.Fatal(err)
//}
//for _, acc := range accounts {
// log.Println(acc)
//}
//for _, acc := range accounts {
// 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("/login", login)
mux.HandleFunc("/logout", logout)
mux.HandleFunc("/register", register)
mux.HandleFunc("/account", require_authenticated_user(account))
mux.HandleFunc("/deleteaccount", require_authenticated_user(deleteaccount))
mux.HandleFunc("/subscribe", require_authenticated_user(subscribe_stripe))
mux.HandleFunc("/managebilling", require_authenticated_user(managebilling))
mux.HandleFunc("/webhook", webhooks)
mux.HandleFunc("/", home)
mux.HandleFunc("/login", login)
mux.HandleFunc("/logout", logout)
mux.HandleFunc("/register", register)
mux.HandleFunc("/account", require_authenticated_user(account))
mux.HandleFunc("/deleteaccount", require_authenticated_user(deleteaccount))
mux.HandleFunc("/subscribe", require_authenticated_user(subscribe_stripe))
mux.HandleFunc("/managebilling", require_authenticated_user(managebilling))
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{
Addr: *prodaddr,
Handler: log_connection(secure_headers(mux)),
}
tlsConfig := &tls.Config{
GetCertificate: autocertManager.GetCertificate,
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"))
} else {
log.Fatal(http.ListenAndServe(*addr, log_connection(secure_headers(mux))))
}
log.Fatal(server.ListenAndServeTLS("", ""))
} else {
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 certbot
su - alfheim -c "mkdir cert"
su - alfheim -c "mkdir cert/lib"
su - alfheim -c "mkdir cert/config"
su - alfheim -c "mkdir cert/log"
su - alfheim -c "sudo certbot certonly --cert-path cert/ --work-dir cert/lib --config-dir cert/config/ --logs-dir cert/log/ --standalone"
su - alfheim -c "sudo chown -R alfheim:alfheim cert"
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/gpg.key' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg
curl -1sLf 'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt' | sudo tee /etc/apt/sources.list.d/caddy-stable.list
sudo apt update
sudo apt install caddy
# Add a DSN for connecting to the greenlight database to the system-wide environment
# variables in the /etc/environment file.

View File

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