Compare commits

...

4 Commits

14 changed files with 9467 additions and 2 deletions

2
.dockerignore Normal file
View File

@ -0,0 +1,2 @@
node_modules
npm-debug.log

5
.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
# ignore the node_modules directory since this can be automatically generated
node_modules/
# ignore the generated CSS files (source files are SASS)
public/css/

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM node:16.8
WORKDIR /usr/src/minecraft-website
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run gulp sass
# expose node_modules as a volume so it stays within the container
VOLUME node_modules
EXPOSE 3000
CMD [ "npm", "run", "server" ]

View File

@ -1,3 +1,13 @@
# minecraft-website
# Bit Goblin <3 Minecraft
The source code for Bit Goblin's Minecraft info website
**This is not "Microsoft <3 Linux"... this is for real!**
The source code for Bit Goblin's Minecraft info website, built with express.js. I know the framework is rather old at this point, but who cares? It's stable and works well enough to serve a mostly static website.
Anyways, this is basically a simple website that displays the current Minecraft server info for the Bit Goblin community. This was originally made with Jekyll, but I had an idea for a cool little active players counter that required this be dynamically generated... or I could've used some javascript AJAX requests but no one wants that if it's not really necessary.
Feel free to clone this repository and get hacking on it! It's really nothing special but any help making the site better for the community or whatever will be greatly appreciated!
Featured in this repository are some scripts under `bin/` which will make your life easier if you wish to hack on this thing. Assuming your user has access to Docker, then you can simply run a `bin/docker-watch.sh` to get running with a simple node.js container that installs all dependencies and even watches for changes in the local directory (thank you nodemon!).
This code is open-source and available to all under the Apache license 2.0. All contributions to this codebase shall be made under the current license, and any future licenses this repository may change to. (e.g. if I decide to change to the BSD 2-Clause license, all code will then be under the BSD 2-Clause license)

61
assets/sass/camelot.sass Normal file
View File

@ -0,0 +1,61 @@
body
background: black
color: #eee
font-size: 16px
a
color: #2ecc71
text-decoration: none
transition: color 300ms ease-in-out
&:hover
color: darken(#2ecc71, 10%)
table
box-sizing: border-box
width: 100%
border: none
tr
&:not(:last-child)
td
border-bottom: 1px solid white
td
border: none
&:not(:last-child)
border-right: 1px solid white
#background-image
position: fixed
left: 0
top: 0
z-index: -1
width: 100%
max-height: 100%
// Add blur effect
filter: blur(5px) grayscale(30%) brightness(95%)
-webkit-filter: blur(5px) grayscale(30%) brightness(95%)
#main-container
max-width: 1050px
margin-top: 30px
margin-bottom: 50px
padding: 25px 45px
background: #333
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19)
#main-header
margin-bottom: 40px
.server-info
h3
text-align: center
text-decoration: underline
td
font-size: 2rem
#site-links
h5
font-weight: bold
text-decoration: underline
ul
list-style: none
font-size: 2rem

3
bin/docker-build-dev.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
docker build -t minecraft-website .

3
bin/docker-run-dev.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/sh
docker run -d --rm -p 3000:3000 -v "$(pwd)":/usr/src/minecraft-website --name minecraft-website minecraft-website

20
gulpfile.js Normal file
View File

@ -0,0 +1,20 @@
'use strict';
var gulp = require('gulp');
var sass = require('gulp-dart-sass');
// compile SASS stylesheets
function stylesheets() {
return gulp.src('./assets/sass/*.sass')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest('./public/css'));
}
// watch for assets that need compiling
function watch() {
gulp.watch('./assets/sass/*.sass', stylesheets);
}
// export commands
exports.sass = stylesheets;
exports.watch = watch;

9235
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

24
package.json Normal file
View File

@ -0,0 +1,24 @@
{
"name": "minecraft-website",
"description": "**This is not \"Microsoft <3 Linux\"... this is for real!**",
"version": "0.1.0",
"main": "server.js",
"scripts": {
"server": "node server.js",
"gulp": "gulp"
},
"repository": {
"type": "git",
"url": "gitea@git.metaunix.net:bitgoblin/minecraft-website.git"
},
"author": "Gregory Ballantine <gballantine@bitgoblin.tech>",
"license": "Apache-2.0",
"dependencies": {
"express": "^4.17.1",
"pug": "^3.0.2"
},
"devDependencies": {
"gulp": "^4.0.2",
"gulp-dart-sass": "^1.0.2"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

3
routes/site.js Normal file
View File

@ -0,0 +1,3 @@
exports.index = function(req, res){
res.render('index');
};

27
server.js Normal file
View File

@ -0,0 +1,27 @@
const express = require('express');
const app = express();
const port = 3000;
// load routes
var siteRoutes = require('./routes/site');
// load template engine
app.set('views', './views');
app.set('view engine', 'pug');
// logging middleware
app.use((req, res, next) => {
console.log(`${req.method}: ${req.url}`);
next();
});
// serve static files from the public/ directory
app.use(express.static('public'));
// register routes
app.get('/', siteRoutes.index);
// start the express.js server
app.listen(port, () => {
console.log(`Server started at port ${port}`);
});

55
views/index.pug Normal file
View File

@ -0,0 +1,55 @@
doctype=html
html
head
meta(name='viewport' content='width=device-width, initial-scale=1.0')
title Minecraft @ Bit Goblin
link(rel='stylesheet' href='https://cdnjs.cloudflare.com/ajax/libs/skeleton/2.0.4/skeleton.min.css')
link(rel='stylesheet' href='/css/camelot.css')
body
img#background-image(src='/img/minecraft-landscape-1.png')
div#main-container.container
header#main-header.row
.columns.twelve
img.u-max-full-width(src='https://i.imgur.com/XJQoBDx.png' alt='Minecraft java edition logo')
section.row
p Welcome to the Bit Goblin community Minecraft server! This is hosted free-of-charge for anyone who so pleases. I'm open to expanding how many/what servers are being hosted, so be sure to let me know any additions/changes you think should be made!
p The only rules for the server(s) are as follows: "Be excellent to each other." So go out and have fun, but please don't be a jerk!
hr
section.row
article.server-info.columns.twelve
h3 Server Info
table
tbody
tr
td Address
td mc1.bitgoblin.tech
tr
td Port
td 25565
tr
td Version
td 1.17.1
tr
td Mode
td Survival
tr
td Server Type
td Vanilla
hr
footer#main-footer.row
.columns.six
p Hosted by Bit Goblin, with love.
#site-links.columns.six
h5 Other Bit Goblin sites:
ul
li #[a(href='https://www.bitgoblin.tech') Main Website]
li #[a(href='https://youtube.com/BitGoblin') YouTube]
li #[a(href='https://twitch.tv/brotherballan') Twitch]