more links! also the thing I've been working on is working

This commit is contained in:
ry 2020-02-20 22:29:26 +01:00
parent 570505e0fc
commit 7071b531ab
6 changed files with 120 additions and 104 deletions

View file

@ -43,6 +43,10 @@ iframe {
color: #a865ff81; color: #a865ff81;
} }
.links {
display: inline-block;
}
a { a {
display: -webkit-box; display: -webkit-box;
display: -ms-flexbox; display: -ms-flexbox;

View file

@ -1,6 +1,6 @@
{ {
"version": 3, "version": 3,
"mappings": "AAAA,UAAU;EACN,WAAW,EAAE,QAAQ;EACrB,GAAG,EAAE,2CAA2C;;;AAEpD,AAAA,CAAC,CAAC;EACE,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;CAAG;;AAEjB,AAAA,IAAI,CAAC;EACD,WAAW,EAAE,oBAAoB;EACjC,gBAAgB,EAAE,+BAA+B;EACjD,eAAe,EAAE,KAAK;EACtB,qBAAqB,EAAE,KAAK;EAC5B,mBAAmB,EAAE,MAAM;EAC3B,iBAAiB,EAAE,SAAS;EAC5B,cAAc,EAAE,SAAS;CAAG;;AAEhC,AAAA,MAAM,CAAC;EACH,MAAM,EAAE,mBAAmB;CAAG;;AAElC,AAAA,QAAQ,CAAC;EACL,SAAS,EAAE,GAAG;EACd,IAAI,EAAE,CAAC;EACP,WAAW,EAAE,GAAG;EAChB,cAAc,EAAE,IAAI;EACpB,QAAQ,EAAE,QAAQ;EAClB,UAAU,EAAE,MAAM;EAClB,GAAG,EAAE,GAAG;EACR,KAAK,EAAE,IAAI;EACX,cAAc,EAAE,SAAS;CAOA;;AAhB7B,AAWI,QAXI,CAWJ,CAAC,CAAC;EACE,eAAe,EAAE,IAAI;EACrB,KAAK,EAAE,OAAO;CAAG;;AAbzB,AAeI,QAfI,CAeJ,CAAC,AAAA,MAAM,CAAC;EACJ,KAAK,EAAE,SAAS;CAAG;;AAE3B,AAAA,CAAC,CAAC;EACE,OAAO,EAAE,IAAI;EACb,eAAe,EAAE,aAAa;CAAG;;AAErC,AAAA,KAAK,CAAC;EACF,KAAK,E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;EACrB,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;EACV,KAAK,EAAE,OAAO;CAAG;;AAErB,AAAA,QAAQ,CAAC,CAAC,AAAA,MAAM,CAAC;EACb,KAAK,EAAE,SAAS;CAAG;;AAEvB,AAAA,KAAK,CAAC;EACF,KAAK,EAAE,IAAI;EACX,MAAM,EAAE,IAAI;EACZ,WAAW,EAAE,KAAK;CAAG;;AAEzB,AAAA,SAAS,CAAC;EACN,cAAc,EAAE,QAAQ;EACxB,kBAAkB,EAAE,EAAE;EACtB,yBAAyB,EAAE,QAAQ;EACnC,yBAAyB,EAAE,WAAW;CAAG;;AAE7C,UAAU,CAAV,QAAU;EACN,IAAI;IACA,SAAS,EAAE,iBAAkB;;EACjC,GAAG;IACC,SAAS,EAAE,kBAAkB;;EACjC,EAAE;IACE,SAAS,EAAE,iBAAkB",
"sources": [ "sources": [
"main.sass" "main.sass"
], ],

View file

@ -36,6 +36,9 @@ iframe
a:hover a:hover
color: #a865ff81 color: #a865ff81
.links
display: inline-block
a a
display: flex display: flex
justify-content: space-between justify-content: space-between

View file

@ -1,10 +1,11 @@
module.exports = { module.exports = {
socials: { socials: {
discord: 'https://discord.gg/eXST5gv', discord: "https://discord.gg/eXST5gv",
bandcamp: 'https://sorsor.bandcamp.com', bandcamp: "https://sorsor.bandcamp.com",
patreon: 'https://patreon.com/sorsor', patreon: "https://patreon.com/sorsor",
youtube: 'https://youtube.com/sorsor', youtube: "https://youtube.com/sorsor",
twitter: 'https://twitter.com/YaiSor', twitter: "https://twitter.com/YaiSor",
soundcloud: 'https://soundcloud.com/yaisor' soundcloud: "https://soundcloud.com/yaisor",
} spotify: "https://open.spotify.com/artist/2gR5b7EpjCvePrAZZ3KQPj"
} }
};

194
server.js
View file

@ -1,115 +1,125 @@
//! Deps //! Deps
const express = require('express'); const express = require("express");
const helmet = require('helmet'); const helmet = require("helmet");
const compression = require('compression'); const compression = require("compression");
const cors = require('cors'); const cors = require("cors");
const morgan = require('morgan'); const morgan = require("morgan");
const chalk = require('chalk'); const chalk = require("chalk");
const hbs = require('express-handlebars'); const hbs = require("express-handlebars");
let { let { port, hostname } = {
port, port: 50269
hostname
} = {
port: 50269
}; };
const con = require('./constants') const con = require("./constants");
const app = express(); const app = express();
app.engine( app.engine(
'hbs', "hbs",
hbs({ hbs({
extname: 'hbs', extname: "hbs",
defaultView: 'default' defaultView: "default"
}) })
); );
app.set('view engine', 'hbs'); app.set("view engine", "hbs");
app.set('json spaces', 4); app.set("json spaces", 4);
app.use('/assets', express.static('./assets')); app.use("/assets", express.static("./assets"));
app.use(express.json()); app.use(express.json());
app.use( app.use(
express.urlencoded({ express.urlencoded({
extended: true extended: true
}) })
); );
app.use(helmet()); app.use(helmet());
app.use(compression()); app.use(compression());
app.use(cors()); app.use(cors());
// Logging // Logging
app.use( app.use(
morgan((tokens, req, res) => { morgan((tokens, req, res) => {
return [ return [
chalk.hex('#34ace0').bold(`[ ${tokens.method(req, res)} ]`), chalk.hex("#34ace0").bold(`[ ${tokens.method(req, res)} ]`),
chalk.hex('#ffb142').bold(tokens.status(req, res)), chalk.hex("#ffb142").bold(tokens.status(req, res)),
chalk.hex('#ff5252').bold(req.hostname + tokens.url(req, res)), chalk.hex("#ff5252").bold(req.hostname + tokens.url(req, res)),
chalk.hex('#2ed573').bold(tokens['response-time'](req, res) + 'ms'), chalk.hex("#2ed573").bold(tokens["response-time"](req, res) + "ms"),
chalk.hex('#f78fb3').bold('@ ' + tokens.date(req, res)) chalk.hex("#f78fb3").bold("@ " + tokens.date(req, res))
].join(' '); ].join(" ");
}) })
); );
function breakSocials(social) { function breakSocials(social) {
// if (typeof social !== String) throw new Error('This social media is not a string :eyes:') // if (typeof social !== String) throw new Error('This social media is not a string :eyes:')
return social.split('') return social.split("");
} }
module.exports = async =>{ module.exports = async => {
app.get('/', async (req, res) => { app.get("/", async (req, res) => {
res.render('index', { res.render("index", {
layout: 'main', layout: "main",
name: con.name, name: con.name,
host: req.hostname, host: req.hostname,
social: [{ social: [
name: 'Twitter', {
link: 'twitter.com/yaisor', name: "Twitter",
character: breakSocials('Twitter') link: "sor.dog/twitter",
}, { character: breakSocials("Twitter")
name: 'Soundcloud', },
link: 'soundcloud.com/yaisor', {
character: breakSocials('Soundcloud') name: "Spotify",
}, { link: "sor.dog/spotify",
name: 'Patreon', character: breakSocials("Spotify")
link: 'patreon.com/sorsor', },
character: breakSocials('Patreon') {
}, { name: "Soundcloud",
name: 'Bandcamp', link: "sor.dog/soundcloud",
link: 'sorsor.bandcamp.com/', character: breakSocials("Soundcloud")
character: breakSocials('bandcamp') },
}, { {
name: 'Youtube', name: "Patreon",
link: 'youtube.com/sorsor', link: "sor.dog/patreon",
character: breakSocials('youtube') character: breakSocials("Patreon")
}, },
{ {
name: 'Discord', name: "Bandcamp",
link: 'sor.dog/discord', link: "sor.dog/bandcamp",
} character: breakSocials("Bandcamp")
},
{
name: "Youtube",
link: "sor.dog/youtube",
character: breakSocials("Youtube")
},
{
name: "Discord",
link: "sor.dog/discord",
character: breakSocials("Discord")
}
]
});
});
] app.get("/spotify", (req, res) => {
}); res.redirect(con.socials.spotify);
}); });
app.get("/twitter", (req, res) => {
res.redirect(con.socials.twitter);
});
app.get("/patreon", (req, res) => {
res.redirect(con.socials.patreon);
});
app.get("/bandcamp", (req, res) => {
res.redirect(con.socials.bandcamp);
});
app.get("/soundcloud", (req, res) => {
res.redirect(con.socials.soundcloud);
});
app.get("/youtube", (req, res) => {
res.redirect(con.socials.youtube);
});
app.get("/discord", (req, res) => {
res.redirect(con.socials.discord);
});
app.get('/twitter', (req, res) => { app.listen(port /* , hostname */, () => {
res.redirect(con.socials.twitter); console.log(`[ Server ] Listening on ${port}`);
}); });
app.get('/patreon', (req, res) => { };
res.redirect(con.socials.patreon);
});
app.get('/bandcamp', (req, res) => {
res.redirect(con.socials.bandcamp);
});
app.get('/soundcloud', (req, res) => {
res.redirect(con.socials.soundcloud);
});
app.get('/youtube', (req, res) => {
res.redirect(con.socials.youtube);
});
app.get('/discord', (req, res) => {
res.redirect(con.socials.discord);
});
app.listen(port /* , hostname */ , () => {
console.log(`[ Server ] Listening on ${port}`);
});
};

View file

@ -9,7 +9,6 @@
<br /> <br />
<div class="links"> <div class="links">
{{#each social}} {{#each social}}
<div id="{{name}}"> <div id="{{name}}">
<a href="https://{{link}}"> <a href="https://{{link}}">
@ -21,7 +20,6 @@
</a> </a>
</div> </div>
{{/each}} {{/each}}
</div> </div>
</section> </section>