more links! also the thing I've been working on is working
This commit is contained in:
		
							parent
							
								
									570505e0fc
								
							
						
					
					
						commit
						7071b531ab
					
				
					 6 changed files with 120 additions and 104 deletions
				
			
		| 
						 | 
				
			
			@ -43,6 +43,10 @@ iframe {
 | 
			
		|||
  color: #a865ff81;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.links {
 | 
			
		||||
  display: inline-block;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
a {
 | 
			
		||||
  display: -webkit-box;
 | 
			
		||||
  display: -ms-flexbox;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,6 @@
 | 
			
		|||
{
 | 
			
		||||
    "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;;AAb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KAAK,EAAE,KAAK;EACZ,UAAU,EAAE,MAAM;EAClB,OAAO,EAAE,aAAa;EACtB,OAAO,EAAE,GAAG;EACZ,QAAQ,EAAE,QAAQ;EAClB,GAAG,EAAE,GAAG;CAAG;;AAEf,AAAA,QAAQ,CAAC,CAAC,CAAC;EACP,eAAe,EAAE,IAAI;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": [
 | 
			
		||||
        "main.sass"
 | 
			
		||||
    ],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -36,6 +36,9 @@ iframe
 | 
			
		|||
    a:hover
 | 
			
		||||
        color: #a865ff81
 | 
			
		||||
 | 
			
		||||
.links
 | 
			
		||||
    display: inline-block
 | 
			
		||||
 | 
			
		||||
a
 | 
			
		||||
    display: flex
 | 
			
		||||
    justify-content: space-between
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										19
									
								
								constants.js
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								constants.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,10 +1,11 @@
 | 
			
		|||
module.exports = {
 | 
			
		||||
    socials: {
 | 
			
		||||
        discord: 'https://discord.gg/eXST5gv',
 | 
			
		||||
        bandcamp: 'https://sorsor.bandcamp.com',
 | 
			
		||||
        patreon: 'https://patreon.com/sorsor',
 | 
			
		||||
        youtube: 'https://youtube.com/sorsor',
 | 
			
		||||
        twitter: 'https://twitter.com/YaiSor',
 | 
			
		||||
        soundcloud: 'https://soundcloud.com/yaisor'
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
  socials: {
 | 
			
		||||
    discord: "https://discord.gg/eXST5gv",
 | 
			
		||||
    bandcamp: "https://sorsor.bandcamp.com",
 | 
			
		||||
    patreon: "https://patreon.com/sorsor",
 | 
			
		||||
    youtube: "https://youtube.com/sorsor",
 | 
			
		||||
    twitter: "https://twitter.com/YaiSor",
 | 
			
		||||
    soundcloud: "https://soundcloud.com/yaisor",
 | 
			
		||||
    spotify: "https://open.spotify.com/artist/2gR5b7EpjCvePrAZZ3KQPj"
 | 
			
		||||
  }
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										192
									
								
								server.js
									
										
									
									
									
								
							
							
						
						
									
										192
									
								
								server.js
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,115 +1,125 @@
 | 
			
		|||
//! Deps
 | 
			
		||||
const express = require('express');
 | 
			
		||||
const helmet = require('helmet');
 | 
			
		||||
const compression = require('compression');
 | 
			
		||||
const cors = require('cors');
 | 
			
		||||
const morgan = require('morgan');
 | 
			
		||||
const chalk = require('chalk');
 | 
			
		||||
const hbs = require('express-handlebars');
 | 
			
		||||
let {
 | 
			
		||||
    port,
 | 
			
		||||
    hostname
 | 
			
		||||
} = {
 | 
			
		||||
    port: 50269
 | 
			
		||||
const express = require("express");
 | 
			
		||||
const helmet = require("helmet");
 | 
			
		||||
const compression = require("compression");
 | 
			
		||||
const cors = require("cors");
 | 
			
		||||
const morgan = require("morgan");
 | 
			
		||||
const chalk = require("chalk");
 | 
			
		||||
const hbs = require("express-handlebars");
 | 
			
		||||
let { port, hostname } = {
 | 
			
		||||
  port: 50269
 | 
			
		||||
};
 | 
			
		||||
const con = require('./constants')
 | 
			
		||||
const con = require("./constants");
 | 
			
		||||
 | 
			
		||||
const app = express();
 | 
			
		||||
 | 
			
		||||
app.engine(
 | 
			
		||||
    'hbs',
 | 
			
		||||
    hbs({
 | 
			
		||||
        extname: 'hbs',
 | 
			
		||||
        defaultView: 'default'
 | 
			
		||||
    })
 | 
			
		||||
  "hbs",
 | 
			
		||||
  hbs({
 | 
			
		||||
    extname: "hbs",
 | 
			
		||||
    defaultView: "default"
 | 
			
		||||
  })
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
app.set('view engine', 'hbs');
 | 
			
		||||
app.set('json spaces', 4);
 | 
			
		||||
app.use('/assets', express.static('./assets'));
 | 
			
		||||
app.set("view engine", "hbs");
 | 
			
		||||
app.set("json spaces", 4);
 | 
			
		||||
app.use("/assets", express.static("./assets"));
 | 
			
		||||
app.use(express.json());
 | 
			
		||||
app.use(
 | 
			
		||||
    express.urlencoded({
 | 
			
		||||
        extended: true
 | 
			
		||||
    })
 | 
			
		||||
  express.urlencoded({
 | 
			
		||||
    extended: true
 | 
			
		||||
  })
 | 
			
		||||
);
 | 
			
		||||
app.use(helmet());
 | 
			
		||||
app.use(compression());
 | 
			
		||||
app.use(cors());
 | 
			
		||||
// Logging
 | 
			
		||||
app.use(
 | 
			
		||||
    morgan((tokens, req, res) => {
 | 
			
		||||
        return [
 | 
			
		||||
            chalk.hex('#34ace0').bold(`[ ${tokens.method(req, res)} ]`),
 | 
			
		||||
            chalk.hex('#ffb142').bold(tokens.status(req, res)),
 | 
			
		||||
            chalk.hex('#ff5252').bold(req.hostname + tokens.url(req, res)),
 | 
			
		||||
            chalk.hex('#2ed573').bold(tokens['response-time'](req, res) + 'ms'),
 | 
			
		||||
            chalk.hex('#f78fb3').bold('@ ' + tokens.date(req, res))
 | 
			
		||||
        ].join(' ');
 | 
			
		||||
    })
 | 
			
		||||
  morgan((tokens, req, res) => {
 | 
			
		||||
    return [
 | 
			
		||||
      chalk.hex("#34ace0").bold(`[ ${tokens.method(req, res)} ]`),
 | 
			
		||||
      chalk.hex("#ffb142").bold(tokens.status(req, res)),
 | 
			
		||||
      chalk.hex("#ff5252").bold(req.hostname + tokens.url(req, res)),
 | 
			
		||||
      chalk.hex("#2ed573").bold(tokens["response-time"](req, res) + "ms"),
 | 
			
		||||
      chalk.hex("#f78fb3").bold("@ " + tokens.date(req, res))
 | 
			
		||||
    ].join(" ");
 | 
			
		||||
  })
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
function breakSocials(social) {
 | 
			
		||||
    // if (typeof social !== String) throw new Error('This social media is not a string :eyes:')
 | 
			
		||||
    return social.split('')
 | 
			
		||||
  // if (typeof social !== String) throw new Error('This social media is not a string :eyes:')
 | 
			
		||||
  return social.split("");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = async =>{
 | 
			
		||||
    app.get('/', async (req, res) => {
 | 
			
		||||
        res.render('index', {
 | 
			
		||||
            layout: 'main',
 | 
			
		||||
            name: con.name,
 | 
			
		||||
            host: req.hostname,
 | 
			
		||||
            social: [{
 | 
			
		||||
                    name: 'Twitter',
 | 
			
		||||
                    link: 'twitter.com/yaisor',
 | 
			
		||||
                    character: breakSocials('Twitter')
 | 
			
		||||
                }, {
 | 
			
		||||
                    name: 'Soundcloud',
 | 
			
		||||
                    link: 'soundcloud.com/yaisor',
 | 
			
		||||
                    character: breakSocials('Soundcloud')
 | 
			
		||||
                }, {
 | 
			
		||||
                    name: 'Patreon',
 | 
			
		||||
                    link: 'patreon.com/sorsor',
 | 
			
		||||
                    character: breakSocials('Patreon')
 | 
			
		||||
                }, {
 | 
			
		||||
                    name: 'Bandcamp',
 | 
			
		||||
                    link: 'sorsor.bandcamp.com/',
 | 
			
		||||
                    character: breakSocials('bandcamp')
 | 
			
		||||
                }, {
 | 
			
		||||
                    name: 'Youtube',
 | 
			
		||||
                    link: 'youtube.com/sorsor',
 | 
			
		||||
                    character: breakSocials('youtube')
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    name: 'Discord',
 | 
			
		||||
                    link: 'sor.dog/discord',
 | 
			
		||||
                }
 | 
			
		||||
module.exports = async => {
 | 
			
		||||
  app.get("/", async (req, res) => {
 | 
			
		||||
    res.render("index", {
 | 
			
		||||
      layout: "main",
 | 
			
		||||
      name: con.name,
 | 
			
		||||
      host: req.hostname,
 | 
			
		||||
      social: [
 | 
			
		||||
        {
 | 
			
		||||
          name: "Twitter",
 | 
			
		||||
          link: "sor.dog/twitter",
 | 
			
		||||
          character: breakSocials("Twitter")
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: "Spotify",
 | 
			
		||||
          link: "sor.dog/spotify",
 | 
			
		||||
          character: breakSocials("Spotify")
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: "Soundcloud",
 | 
			
		||||
          link: "sor.dog/soundcloud",
 | 
			
		||||
          character: breakSocials("Soundcloud")
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: "Patreon",
 | 
			
		||||
          link: "sor.dog/patreon",
 | 
			
		||||
          character: breakSocials("Patreon")
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
          name: "Bandcamp",
 | 
			
		||||
          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) => {
 | 
			
		||||
        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.listen(port /* , hostname */ , () => {
 | 
			
		||||
        console.log(`[ Server ] Listening on ${port}`);
 | 
			
		||||
    });
 | 
			
		||||
  app.listen(port /* , hostname */, () => {
 | 
			
		||||
    console.log(`[ Server ] Listening on ${port}`);
 | 
			
		||||
  });
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -9,7 +9,6 @@
 | 
			
		|||
    <br />
 | 
			
		||||
 | 
			
		||||
    <div class="links">
 | 
			
		||||
 | 
			
		||||
      {{#each social}}
 | 
			
		||||
      <div id="{{name}}">
 | 
			
		||||
        <a href="https://{{link}}">
 | 
			
		||||
| 
						 | 
				
			
			@ -21,7 +20,6 @@
 | 
			
		|||
        </a>
 | 
			
		||||
      </div>
 | 
			
		||||
      {{/each}}
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
 | 
			
		||||
  </section>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue