commit
f58129f8a1
14 changed files with 795 additions and 0 deletions
@ -0,0 +1,309 @@ |
|||||||
|
/* Reset and Base Styles */ |
||||||
|
* { |
||||||
|
margin: 0; |
||||||
|
padding: 0; |
||||||
|
box-sizing: border-box; |
||||||
|
} |
||||||
|
|
||||||
|
body { |
||||||
|
font-family: Arial, sans-serif; |
||||||
|
line-height: 1.6; |
||||||
|
color: #fff; |
||||||
|
} |
||||||
|
|
||||||
|
.container { |
||||||
|
width: 90%; |
||||||
|
max-width: 1200px; |
||||||
|
margin: 0 auto; |
||||||
|
padding: 0 20px; |
||||||
|
} |
||||||
|
|
||||||
|
a { |
||||||
|
text-decoration: none; |
||||||
|
color: #333; |
||||||
|
} |
||||||
|
|
||||||
|
ul { |
||||||
|
list-style: none; |
||||||
|
} |
||||||
|
|
||||||
|
/* Header Styles */ |
||||||
|
header { |
||||||
|
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1); |
||||||
|
position: sticky; |
||||||
|
top: 0; |
||||||
|
z-index: 100; |
||||||
|
background-color: #2A7B9B; |
||||||
|
} |
||||||
|
|
||||||
|
header .container { |
||||||
|
display: flex; |
||||||
|
justify-content: space-between; |
||||||
|
align-items: center; |
||||||
|
padding: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
.logo h1 { |
||||||
|
font-size: 24px; |
||||||
|
color: #ffffff; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul { |
||||||
|
display: flex; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul li { |
||||||
|
margin-left: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul li a { |
||||||
|
padding: 5px; |
||||||
|
transition: color 0.3s; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul li a:hover { |
||||||
|
color: #3498db; |
||||||
|
} |
||||||
|
|
||||||
|
/* Button Styles */ |
||||||
|
.btn { |
||||||
|
display: inline-block; |
||||||
|
background-color: #ccdd33; |
||||||
|
font-weight: bold; |
||||||
|
color: #000; |
||||||
|
padding: 10px 20px; |
||||||
|
border: none; |
||||||
|
border-radius: 4px; |
||||||
|
cursor: pointer; |
||||||
|
transition: background-color 0.3s; |
||||||
|
} |
||||||
|
|
||||||
|
.btn:hover { |
||||||
|
background-color: #2980b9; |
||||||
|
} |
||||||
|
|
||||||
|
/* Hero Section */ |
||||||
|
.hero { |
||||||
|
padding: 80px 0; |
||||||
|
background-color: #fff; |
||||||
|
text-align: center; |
||||||
|
} |
||||||
|
|
||||||
|
.hero h1 { |
||||||
|
font-size: 36px; |
||||||
|
margin-bottom: 20px; |
||||||
|
color: #ffb630; |
||||||
|
} |
||||||
|
|
||||||
|
.hero p { |
||||||
|
font-size: 18px; |
||||||
|
margin-bottom: 30px; |
||||||
|
max-width: 700px; |
||||||
|
margin-left: auto; |
||||||
|
margin-right: auto; |
||||||
|
} |
||||||
|
|
||||||
|
/* Features Section */ |
||||||
|
.features { |
||||||
|
padding: 80px 0; |
||||||
|
background-color: #2A7B9B; |
||||||
|
} |
||||||
|
|
||||||
|
.features h2 { |
||||||
|
text-align: center; |
||||||
|
margin-bottom: 40px; |
||||||
|
color: #ffb630; |
||||||
|
} |
||||||
|
|
||||||
|
.feature-grid { |
||||||
|
display: grid; |
||||||
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); |
||||||
|
gap: 30px; |
||||||
|
} |
||||||
|
|
||||||
|
.feature { |
||||||
|
padding: 20px; |
||||||
|
border-radius: 5px; |
||||||
|
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1); |
||||||
|
transition: transform 0.3s; |
||||||
|
} |
||||||
|
|
||||||
|
.feature:hover { |
||||||
|
transform: translateY(-5px); |
||||||
|
} |
||||||
|
|
||||||
|
.feature h3 { |
||||||
|
margin-bottom: 15px; |
||||||
|
color: #ccdd33; |
||||||
|
} |
||||||
|
|
||||||
|
/* How It Works Section */ |
||||||
|
.how-it-works { |
||||||
|
padding: 80px 0; |
||||||
|
} |
||||||
|
|
||||||
|
.how-it-works h2 { |
||||||
|
text-align: center; |
||||||
|
margin-bottom: 40px; |
||||||
|
color: #2c3e50; |
||||||
|
} |
||||||
|
|
||||||
|
.steps { |
||||||
|
display: grid; |
||||||
|
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); |
||||||
|
gap: 30px; |
||||||
|
} |
||||||
|
|
||||||
|
.step { |
||||||
|
text-align: center; |
||||||
|
padding: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
.step-number { |
||||||
|
display: inline-block; |
||||||
|
width: 40px; |
||||||
|
height: 40px; |
||||||
|
background-color: #3498db; |
||||||
|
color: #fff; |
||||||
|
border-radius: 50%; |
||||||
|
line-height: 40px; |
||||||
|
margin-bottom: 15px; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
|
||||||
|
.step h3 { |
||||||
|
margin-bottom: 15px; |
||||||
|
color: #2c3e50; |
||||||
|
} |
||||||
|
|
||||||
|
/* Submit Project Section */ |
||||||
|
.submit-project { |
||||||
|
padding: 80px 0; |
||||||
|
} |
||||||
|
|
||||||
|
.submit-project h2 { |
||||||
|
text-align: center; |
||||||
|
margin-bottom: 40px; |
||||||
|
color: #2c3e50; |
||||||
|
} |
||||||
|
|
||||||
|
form { |
||||||
|
max-width: 700px; |
||||||
|
margin: 0 auto; |
||||||
|
} |
||||||
|
|
||||||
|
.form-group { |
||||||
|
margin-bottom: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
label { |
||||||
|
display: block; |
||||||
|
margin-bottom: 5px; |
||||||
|
font-weight: bold; |
||||||
|
} |
||||||
|
|
||||||
|
input, |
||||||
|
textarea { |
||||||
|
width: 100%; |
||||||
|
padding: 10px; |
||||||
|
border: 1px solid #ddd; |
||||||
|
border-radius: 4px; |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
|
||||||
|
textarea { |
||||||
|
resize: vertical; |
||||||
|
} |
||||||
|
|
||||||
|
.note { |
||||||
|
font-size: 14px; |
||||||
|
color: #777; |
||||||
|
margin-top: 5px; |
||||||
|
} |
||||||
|
|
||||||
|
/* Footer Styles */ |
||||||
|
footer { |
||||||
|
background-color: #2c3e50; |
||||||
|
color: #fff; |
||||||
|
padding: 50px 0 20px; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-content { |
||||||
|
display: grid; |
||||||
|
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); |
||||||
|
gap: 30px; |
||||||
|
margin-bottom: 30px; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-logo h2 { |
||||||
|
margin-bottom: 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-links h3, |
||||||
|
.footer-contact h3 { |
||||||
|
margin-bottom: 15px; |
||||||
|
font-size: 18px; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-links ul li { |
||||||
|
margin-bottom: 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-links ul li a { |
||||||
|
color: #ddd; |
||||||
|
transition: color 0.3s; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-links ul li a:hover { |
||||||
|
color: #3498db; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-contact p { |
||||||
|
margin-bottom: 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.footer-bottom { |
||||||
|
text-align: center; |
||||||
|
padding-top: 20px; |
||||||
|
border-top: 1px solid rgba(255, 255, 255, 0.1); |
||||||
|
} |
||||||
|
|
||||||
|
/* Responsive Styles */ |
||||||
|
@media (max-width: 768px) { |
||||||
|
header .container { |
||||||
|
flex-direction: column; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul { |
||||||
|
margin-top: 20px; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul li { |
||||||
|
margin: 0 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.hero h1 { |
||||||
|
font-size: 28px; |
||||||
|
} |
||||||
|
|
||||||
|
.hero p { |
||||||
|
font-size: 16px; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@media (max-width: 480px) { |
||||||
|
nav ul { |
||||||
|
flex-wrap: wrap; |
||||||
|
justify-content: center; |
||||||
|
} |
||||||
|
|
||||||
|
nav ul li { |
||||||
|
margin: 5px 10px; |
||||||
|
} |
||||||
|
|
||||||
|
.feature-grid, |
||||||
|
.steps, |
||||||
|
.footer-content { |
||||||
|
grid-template-columns: 1fr; |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
module codegrillathon |
||||||
|
|
||||||
|
go 1.22.2 |
||||||
|
|
||||||
|
require github.com/markbates/goth v1.81.0 |
||||||
|
|
||||||
|
require ( |
||||||
|
github.com/go-chi/chi/v5 v5.1.0 // indirect |
||||||
|
github.com/golang/protobuf v1.5.3 // indirect |
||||||
|
github.com/gorilla/context v1.1.1 // indirect |
||||||
|
github.com/gorilla/mux v1.6.2 // indirect |
||||||
|
github.com/gorilla/securecookie v1.1.1 // indirect |
||||||
|
github.com/gorilla/sessions v1.1.1 // indirect |
||||||
|
golang.org/x/oauth2 v0.17.0 // indirect |
||||||
|
google.golang.org/appengine v1.6.8 // indirect |
||||||
|
google.golang.org/protobuf v1.32.0 // indirect |
||||||
|
) |
||||||
@ -0,0 +1,60 @@ |
|||||||
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= |
||||||
|
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= |
||||||
|
github.com/go-chi/chi/v5 v5.1.0 h1:acVI1TYaD+hhedDJ3r54HyA6sExp3HfXq7QWEEY/xMw= |
||||||
|
github.com/go-chi/chi/v5 v5.1.0/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= |
||||||
|
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= |
||||||
|
github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= |
||||||
|
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= |
||||||
|
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= |
||||||
|
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= |
||||||
|
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38= |
||||||
|
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= |
||||||
|
github.com/gorilla/context v1.1.1 h1:AWwleXJkX/nhcU9bZSnZoi3h/qGYqQAGhq6zZe/aQW8= |
||||||
|
github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= |
||||||
|
github.com/gorilla/mux v1.6.2 h1:Pgr17XVTNXAk3q/r4CpKzC5xBM/qW1uVLV+IhRZpIIk= |
||||||
|
github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= |
||||||
|
github.com/gorilla/securecookie v1.1.1 h1:miw7JPhV+b/lAHSXz4qd/nN9jRiAFV5FwjeKyCS8BvQ= |
||||||
|
github.com/gorilla/securecookie v1.1.1/go.mod h1:ra0sb63/xPlUeL+yeDciTfxMRAA+MP+HVt/4epWDjd4= |
||||||
|
github.com/gorilla/sessions v1.1.1 h1:YMDmfaK68mUixINzY/XjscuJ47uXFWSSHzFbBQM0PrE= |
||||||
|
github.com/gorilla/sessions v1.1.1/go.mod h1:8KCfur6+4Mqcc6S0FEfKuN15Vl5MgXW92AE8ovaJD0w= |
||||||
|
github.com/markbates/goth v1.81.0 h1:XVcCkeGWokynPV7MXvgb8pd2s3r7DS40P7931w6kdnE= |
||||||
|
github.com/markbates/goth v1.81.0/go.mod h1:+6z31QyUms84EHmuBY7iuqYSxyoN3njIgg9iCF/lR1k= |
||||||
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= |
||||||
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= |
||||||
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= |
||||||
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= |
||||||
|
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= |
||||||
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= |
||||||
|
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= |
||||||
|
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= |
||||||
|
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= |
||||||
|
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= |
||||||
|
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= |
||||||
|
golang.org/x/oauth2 v0.17.0 h1:6m3ZPmLEFdVxKKWnKq4VqZ60gutO35zm+zrAHVmHyDQ= |
||||||
|
golang.org/x/oauth2 v0.17.0/go.mod h1:OzPDGQiuQMguemayvdylqddI7qcD9lnSDb+1FiwQ5HA= |
||||||
|
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||||
|
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= |
||||||
|
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= |
||||||
|
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= |
||||||
|
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
||||||
|
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
||||||
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= |
||||||
|
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/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= |
||||||
|
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= |
||||||
|
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= |
||||||
|
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= |
||||||
|
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= |
||||||
|
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||||
|
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= |
||||||
|
google.golang.org/appengine v1.6.8 h1:IhEN5q69dyKagZPYMSdIjS2HqprW324FRQZJcGqPAsM= |
||||||
|
google.golang.org/appengine v1.6.8/go.mod h1:1jJ3jBArFh5pcgW8gCtRJnepW8FzD1V44FJffLiz/Ds= |
||||||
|
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= |
||||||
|
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= |
||||||
|
google.golang.org/protobuf v1.32.0 h1:pPC6BG5ex8PDFnkbrGU3EixyhKcQ2aDuBS36lqK/C7I= |
||||||
|
google.golang.org/protobuf v1.32.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= |
||||||
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= |
||||||
|
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
||||||
@ -0,0 +1,35 @@ |
|||||||
|
package handlers |
||||||
|
|
||||||
|
import ( |
||||||
|
"github.com/markbates/goth/gothic" |
||||||
|
"net/http" |
||||||
|
) |
||||||
|
|
||||||
|
func (h *Handler) Login(w http.ResponseWriter, r *http.Request) { |
||||||
|
err := h.Template.ExecuteTemplate(w, "login.html", nil) |
||||||
|
if err != nil { |
||||||
|
http.Error(w, "Template rendering error", http.StatusInternalServerError) |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
func (h *Handler) Callback(w http.ResponseWriter, r *http.Request) { |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
|
func (h *Handler) Logout(w http.ResponseWriter, r *http.Request) { |
||||||
|
session, err := gothic.Store.Get(r, "_gothic-session") |
||||||
|
if err != nil { |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
// Clear the session data
|
||||||
|
session.Values = make(map[interface{}]interface{}) |
||||||
|
|
||||||
|
// Save the empty session
|
||||||
|
err = session.Save(r, w) |
||||||
|
if err != nil { |
||||||
|
return |
||||||
|
} |
||||||
|
|
||||||
|
//w.Redirect(http.StatusTemporaryRedirect, "/")
|
||||||
|
} |
||||||
@ -0,0 +1,17 @@ |
|||||||
|
package handlers |
||||||
|
|
||||||
|
import ( |
||||||
|
"html/template" |
||||||
|
"net/http" |
||||||
|
) |
||||||
|
|
||||||
|
type Handler struct { |
||||||
|
Template template.Template |
||||||
|
} |
||||||
|
|
||||||
|
func (h *Handler) Home(w http.ResponseWriter, r *http.Request) { |
||||||
|
err := h.Template.ExecuteTemplate(w, "index.html", nil) |
||||||
|
if err != nil { |
||||||
|
http.Error(w, "Template rendering error", http.StatusInternalServerError) |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,12 @@ |
|||||||
|
package handlers |
||||||
|
|
||||||
|
import ( |
||||||
|
"net/http" |
||||||
|
) |
||||||
|
|
||||||
|
func (h *Handler) Welcome(w http.ResponseWriter, r *http.Request) { |
||||||
|
err := h.Template.ExecuteTemplate(w, "index.html", nil) |
||||||
|
if err != nil { |
||||||
|
http.Error(w, "Template rendering error", http.StatusInternalServerError) |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,24 @@ |
|||||||
|
package docker |
||||||
|
|
||||||
|
import ( |
||||||
|
"log" |
||||||
|
"os" |
||||||
|
"os/exec" |
||||||
|
"strconv" |
||||||
|
) |
||||||
|
|
||||||
|
func MakeDockerImage(hackathonId int, imageName string, dir string) error { |
||||||
|
image := imageName + ":" + strconv.Itoa(hackathonId) + ":latest" |
||||||
|
dockerfileDir := "." |
||||||
|
|
||||||
|
cmd := exec.Command("docker", "build", "-t", image, dockerfileDir) |
||||||
|
cmd.Stdout = os.Stdout |
||||||
|
cmd.Stderr = os.Stderr |
||||||
|
|
||||||
|
if err := cmd.Run(); err != nil { |
||||||
|
log.Printf("error creating docker image: %v\n", err) |
||||||
|
return err |
||||||
|
} |
||||||
|
|
||||||
|
return nil |
||||||
|
} |
||||||
@ -0,0 +1,69 @@ |
|||||||
|
package main |
||||||
|
|
||||||
|
import ( |
||||||
|
"codegrillathon/handlers" |
||||||
|
"context" |
||||||
|
"fmt" |
||||||
|
"github.com/markbates/goth" |
||||||
|
"github.com/markbates/goth/providers/github" |
||||||
|
"github.com/markbates/goth/providers/twitch" |
||||||
|
"html/template" |
||||||
|
"net/http" |
||||||
|
"os" |
||||||
|
"os/signal" |
||||||
|
"syscall" |
||||||
|
"time" |
||||||
|
) |
||||||
|
|
||||||
|
func main() { |
||||||
|
tmpl, err := template.ParseGlob("templates/*.html") |
||||||
|
|
||||||
|
if err != nil { |
||||||
|
panic(fmt.Errorf("failed to parse templates: %w\n", err)) |
||||||
|
} |
||||||
|
|
||||||
|
h := handlers.Handler{Template: *tmpl} |
||||||
|
mux := http.NewServeMux() |
||||||
|
|
||||||
|
fs := http.FileServer(http.Dir("assets")) |
||||||
|
mux.Handle("/static/", http.StripPrefix("/static/", fs)) |
||||||
|
goth.UseProviders( |
||||||
|
twitch.New(os.Getenv("TWITCH_CLIENT_ID"), os.Getenv("TWITCH_SECRET"), "http://localhost:8080/auth/twitch/callback"), |
||||||
|
github.New(os.Getenv("GITHUB_KEY"), os.Getenv("GITHUB_SECRET"), "http://localhost:3000/auth/github/callback"), |
||||||
|
) |
||||||
|
|
||||||
|
// auth routes
|
||||||
|
mux.HandleFunc("/auth/login/:provider", auth.Login) |
||||||
|
mux.HandleFunc("/auth/:provider/callback", auth.Callback) |
||||||
|
mux.HandleFunc("/auth/logout/:provider", auth.Logout) |
||||||
|
|
||||||
|
mux.HandleFunc("/", h.Home) |
||||||
|
mux.HandleFunc("/welcome", h.Welcome) |
||||||
|
|
||||||
|
server := &http.Server{ |
||||||
|
Addr: ":8080", |
||||||
|
Handler: mux, |
||||||
|
} |
||||||
|
|
||||||
|
go func() { |
||||||
|
fmt.Println("Server started...") |
||||||
|
if err := server.ListenAndServe(); err != http.ErrServerClosed { |
||||||
|
fmt.Printf("Serve error: %v\n", err) |
||||||
|
} |
||||||
|
}() |
||||||
|
|
||||||
|
stop := make(chan os.Signal, 1) |
||||||
|
signal.Notify(stop, syscall.SIGINT, syscall.SIGTERM) |
||||||
|
|
||||||
|
<-stop |
||||||
|
fmt.Println("Shutting down server") |
||||||
|
|
||||||
|
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) |
||||||
|
defer cancel() |
||||||
|
|
||||||
|
if err := server.Shutdown(ctx); err != nil { |
||||||
|
fmt.Printf("Server force to shutdown: %v\n", err) |
||||||
|
} else { |
||||||
|
fmt.Println("Server exit gracefully") |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,119 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="en"> |
||||||
|
|
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<title>HackHost - Hackathon Platform</title> |
||||||
|
<link rel="stylesheet" href="/static/css/style.css"> |
||||||
|
</head> |
||||||
|
|
||||||
|
<body> |
||||||
|
<header> |
||||||
|
<div class="container"> |
||||||
|
<div class="logo"> |
||||||
|
<h1>Codegrillathon</h1> |
||||||
|
</div> |
||||||
|
<nav> |
||||||
|
<ul> |
||||||
|
<li><a href="#home">Home</a></li> |
||||||
|
<li><a href="#features">Features</a></li> |
||||||
|
<li><a href="#how-it-works">How It Works</a></li> |
||||||
|
<li><a href="#submit">Submit Project</a></li> |
||||||
|
</ul> |
||||||
|
</nav> |
||||||
|
</div> |
||||||
|
</header> |
||||||
|
|
||||||
|
<section id="home" class="hero"> |
||||||
|
<div class="container"> |
||||||
|
<h1>Host and Participate in Amazing Hackathons</h1> |
||||||
|
<p>A platform for developers to showcase their skills, collaborate, and win prizes.</p> |
||||||
|
<a href="#submit" class="btn">Join a hackathon today!</a> |
||||||
|
</div> |
||||||
|
</section> |
||||||
|
|
||||||
|
<section id="features" class="features"> |
||||||
|
<div class="container"> |
||||||
|
<h2>Platform Features</h2> |
||||||
|
<div class="feature-grid"> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Easy Submission</h3> |
||||||
|
<p>Submit your project with just a few clicks. Share your Git repository, project name, and any |
||||||
|
secrets needed to run your project.</p> |
||||||
|
</div> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Secure Environment</h3> |
||||||
|
<p>Your project secrets are stored securely and only shared with authorized judges.</p> |
||||||
|
</div> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Fair Judging</h3> |
||||||
|
<p>All projects are evaluated based on innovation, technical complexity, and presentation.</p> |
||||||
|
</div> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Global Reach</h3> |
||||||
|
<p>Participate in hackathons from anywhere in the world and connect with developers globally.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</section> |
||||||
|
|
||||||
|
<section id="how-it-works" class="how-it-works"> |
||||||
|
<div class="container"> |
||||||
|
<h2>How It Works</h2> |
||||||
|
<div class="steps"> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">1</div> |
||||||
|
<h3>Register for a Hackathon</h3> |
||||||
|
<p>Browse available hackathons and register for the ones that interest you.</p> |
||||||
|
</div> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">2</div> |
||||||
|
<h3>Build Your Project</h3> |
||||||
|
<p>Work on your project during the hackathon period, either solo or with a team.</p> |
||||||
|
</div> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">3</div> |
||||||
|
<h3>Submit Your Work</h3> |
||||||
|
<p>Submit your Git repository, project details, and any secrets needed to run your project.</p> |
||||||
|
</div> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">4</div> |
||||||
|
<h3>Get Evaluated</h3> |
||||||
|
<p>Judges will review your submission and provide feedback.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</section> |
||||||
|
|
||||||
|
<footer> |
||||||
|
<div class="container"> |
||||||
|
<div class="footer-content"> |
||||||
|
<div class="footer-logo"> |
||||||
|
<h2>HackHost</h2> |
||||||
|
<p>The ultimate hackathon platform</p> |
||||||
|
</div> |
||||||
|
<div class="footer-links"> |
||||||
|
<h3>Quick Links</h3> |
||||||
|
<ul> |
||||||
|
<li><a href="#home">Home</a></li> |
||||||
|
<li><a href="#features">Features</a></li> |
||||||
|
<li><a href="#how-it-works">How It Works</a></li> |
||||||
|
<li><a href="#submit">Submit Project</a></li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
<div class="footer-contact"> |
||||||
|
<h3>Contact Us</h3> |
||||||
|
<p>Email: info@hackhost.com</p> |
||||||
|
<p>Phone: (123) 456-7890</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="footer-bottom"> |
||||||
|
<p>© 2025 HackHost. All rights reserved.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</footer> |
||||||
|
|
||||||
|
</body> |
||||||
|
|
||||||
|
</html> |
||||||
@ -0,0 +1,119 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="en"> |
||||||
|
|
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
||||||
|
<title>HackHost - Hackathon Platform</title> |
||||||
|
<link rel="stylesheet" href="/static/css/style.css"> |
||||||
|
</head> |
||||||
|
|
||||||
|
<body> |
||||||
|
<header> |
||||||
|
<div class="container"> |
||||||
|
<div class="logo"> |
||||||
|
<h1>Codegrillathon</h1> |
||||||
|
</div> |
||||||
|
<nav> |
||||||
|
<ul> |
||||||
|
<li><a href="#home">Home</a></li> |
||||||
|
<li><a href="#features">Features</a></li> |
||||||
|
<li><a href="#how-it-works">How It Works</a></li> |
||||||
|
<li><a href="#submit">Submit Project</a></li> |
||||||
|
</ul> |
||||||
|
</nav> |
||||||
|
</div> |
||||||
|
</header> |
||||||
|
|
||||||
|
<section id="home" class="hero"> |
||||||
|
<div class="container"> |
||||||
|
<h1>Host and Participate in Amazing Hackathons</h1> |
||||||
|
<p>A platform for developers to showcase their skills, collaborate, and win prizes.</p> |
||||||
|
<a href="#submit" class="btn">Join a hackathon today!</a> |
||||||
|
</div> |
||||||
|
</section> |
||||||
|
|
||||||
|
<section id="features" class="features"> |
||||||
|
<div class="container"> |
||||||
|
<h2>Platform Features</h2> |
||||||
|
<div class="feature-grid"> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Easy Submission</h3> |
||||||
|
<p>Submit your project with just a few clicks. Share your Git repository, project name, and any |
||||||
|
secrets needed to run your project.</p> |
||||||
|
</div> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Secure Environment</h3> |
||||||
|
<p>Your project secrets are stored securely and only shared with authorized judges.</p> |
||||||
|
</div> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Fair Judging</h3> |
||||||
|
<p>All projects are evaluated based on innovation, technical complexity, and presentation.</p> |
||||||
|
</div> |
||||||
|
<div class="feature"> |
||||||
|
<h3>Global Reach</h3> |
||||||
|
<p>Participate in hackathons from anywhere in the world and connect with developers globally.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</section> |
||||||
|
|
||||||
|
<section id="how-it-works" class="how-it-works"> |
||||||
|
<div class="container"> |
||||||
|
<h2>How It Works</h2> |
||||||
|
<div class="steps"> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">1</div> |
||||||
|
<h3>Register for a Hackathon</h3> |
||||||
|
<p>Browse available hackathons and register for the ones that interest you.</p> |
||||||
|
</div> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">2</div> |
||||||
|
<h3>Build Your Project</h3> |
||||||
|
<p>Work on your project during the hackathon period, either solo or with a team.</p> |
||||||
|
</div> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">3</div> |
||||||
|
<h3>Submit Your Work</h3> |
||||||
|
<p>Submit your Git repository, project details, and any secrets needed to run your project.</p> |
||||||
|
</div> |
||||||
|
<div class="step"> |
||||||
|
<div class="step-number">4</div> |
||||||
|
<h3>Get Evaluated</h3> |
||||||
|
<p>Judges will review your submission and provide feedback.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</section> |
||||||
|
|
||||||
|
<footer> |
||||||
|
<div class="container"> |
||||||
|
<div class="footer-content"> |
||||||
|
<div class="footer-logo"> |
||||||
|
<h2>HackHost</h2> |
||||||
|
<p>The ultimate hackathon platform</p> |
||||||
|
</div> |
||||||
|
<div class="footer-links"> |
||||||
|
<h3>Quick Links</h3> |
||||||
|
<ul> |
||||||
|
<li><a href="#home">Home</a></li> |
||||||
|
<li><a href="#features">Features</a></li> |
||||||
|
<li><a href="#how-it-works">How It Works</a></li> |
||||||
|
<li><a href="#submit">Submit Project</a></li> |
||||||
|
</ul> |
||||||
|
</div> |
||||||
|
<div class="footer-contact"> |
||||||
|
<h3>Contact Us</h3> |
||||||
|
<p>Email: info@hackhost.com</p> |
||||||
|
<p>Phone: (123) 456-7890</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
<div class="footer-bottom"> |
||||||
|
<p>© 2025 HackHost. All rights reserved.</p> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</footer> |
||||||
|
|
||||||
|
</body> |
||||||
|
|
||||||
|
</html> |
||||||
@ -0,0 +1 @@ |
|||||||
|
exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1exit status 1 |
||||||
Binary file not shown.
Loading…
Reference in new issue