new portfolio link
This commit is contained in:
parent
a02e41f380
commit
723714f398
1 changed files with 154 additions and 106 deletions
158
server.js
158
server.js
|
@ -1,16 +1,16 @@
|
||||||
//! 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");
|
||||||
const UA = require('ua-parser-js');
|
const UA = require("ua-parser-js");
|
||||||
const exec = require('shell-exec');
|
const exec = require("shell-exec");
|
||||||
const simpleIcons = require('simple-icons');
|
const simpleIcons = require("simple-icons");
|
||||||
|
|
||||||
const con = require('./constants');
|
const con = require("./constants");
|
||||||
let { port, hostname } = {
|
let { port, hostname } = {
|
||||||
port: 3621
|
port: 3621
|
||||||
//hostname: '67.182.206.28'
|
//hostname: '67.182.206.28'
|
||||||
|
@ -19,10 +19,10 @@ let { port, hostname } = {
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
app.engine(
|
app.engine(
|
||||||
'hbs',
|
"hbs",
|
||||||
hbs({
|
hbs({
|
||||||
extname: 'hbs',
|
extname: "hbs",
|
||||||
defaultView: 'default',
|
defaultView: "default",
|
||||||
helpers: {
|
helpers: {
|
||||||
ifeq: function(a, b, options) {
|
ifeq: function(a, b, options) {
|
||||||
if (a === b) {
|
if (a === b) {
|
||||||
|
@ -33,10 +33,10 @@ app.engine(
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
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.set('view options', {
|
app.set("view options", {
|
||||||
layout: false
|
layout: false
|
||||||
});
|
});
|
||||||
app.use(express.json());
|
app.use(express.json());
|
||||||
|
@ -52,65 +52,113 @@ app.use(cors());
|
||||||
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(" ");
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
app.use('/portfolio', require('./routes/portfolio'));
|
app.use("/portfolio", require("./routes/portfolio"));
|
||||||
app.use('/p', require('./routes/p'));
|
app.use("/p", require("./routes/p"));
|
||||||
app.use('/lore', require('./routes/lore'));
|
app.use("/lore", require("./routes/lore"));
|
||||||
app.use('/art', require('./routes/art'));
|
app.use("/art", require("./routes/art"));
|
||||||
|
|
||||||
module.exports = (client) => {
|
module.exports = client => {
|
||||||
app.get('/', async (req, res) => {
|
app.get("/", async (req, res) => {
|
||||||
/* var ua = UA(req.headers['user-agent']);
|
res.render("index", {
|
||||||
console.log(ua) */
|
layout: "main",
|
||||||
res.render('index', {
|
|
||||||
layout: 'main',
|
|
||||||
name: con.name,
|
name: con.name,
|
||||||
host: req.hostname,
|
host: req.hostname,
|
||||||
item: [ { name: 'portfolio', source: 'https://shyzu.link' } ],
|
item: [{ name: "portfolio", source: "https://p.wrwlf.co" }],
|
||||||
social: [
|
social: [
|
||||||
{ name: 'Twitter', color: '1DA1F2', link: 'twitter.com/codepupper', icon: simpleIcons.Twitter },
|
|
||||||
{
|
{
|
||||||
name: 'Mastodon',
|
name: "Twitter",
|
||||||
color: '3088d4',
|
color: "1DA1F2",
|
||||||
link: 'pounced-on.me/@code',
|
link: "twitter.com/codepupper",
|
||||||
|
icon: simpleIcons.Twitter
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Mastodon",
|
||||||
|
color: "3088d4",
|
||||||
|
link: "pounced-on.me/@code",
|
||||||
icon: simpleIcons.Mastodon,
|
icon: simpleIcons.Mastodon,
|
||||||
verify: true
|
verify: true
|
||||||
},
|
},
|
||||||
{ name: 'Twitter', color: '1DA1F2', link: 'twitter.com/floofydev', icon: simpleIcons.Twitter },
|
{
|
||||||
{ name: 'Discord', color: '7289da', link: 'thaldr.in/discord', icon: simpleIcons.Discord },
|
name: "Twitter",
|
||||||
{ name: 'Twitch', color: '6441a4', link: 'twitch.tv/codepupper', icon: simpleIcons.Twitch },
|
color: "1DA1F2",
|
||||||
{ name: 'Keybase', color: '33a0ff', link: 'keybase.io/codepupper', icon: simpleIcons.Keybase },
|
link: "twitter.com/floofydev",
|
||||||
{ name: 'Gitdab', color: 'faacb7', link: 'gitdab.com/y', icon: simpleIcons.Git },
|
icon: simpleIcons.Twitter
|
||||||
{ name: 'Github', color: '333', link: 'github.com/codepupper', icon: simpleIcons.GitHub },
|
},
|
||||||
{ name: 'Gitlab', color: 'E24329', link: 'gitlab.com/codepupper', icon: simpleIcons.GitLab },
|
{
|
||||||
{ name: 'Ko-Fi', color: 'f16061', link: 'ko-fi.com/codepupper', icon: simpleIcons['Ko-fi'] },
|
name: "Discord",
|
||||||
{ name: 'Patreon', color: '6441a4', link: 'patreon.com/ryden', icon: simpleIcons.Patreon }
|
color: "7289da",
|
||||||
|
link: "thaldr.in/discord",
|
||||||
|
icon: simpleIcons.Discord
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Twitch",
|
||||||
|
color: "6441a4",
|
||||||
|
link: "twitch.tv/codepupper",
|
||||||
|
icon: simpleIcons.Twitch
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Keybase",
|
||||||
|
color: "33a0ff",
|
||||||
|
link: "keybase.io/codepupper",
|
||||||
|
icon: simpleIcons.Keybase
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Gitdab",
|
||||||
|
color: "faacb7",
|
||||||
|
link: "gitdab.com/y",
|
||||||
|
icon: simpleIcons.Git
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Github",
|
||||||
|
color: "333",
|
||||||
|
link: "github.com/codepupper",
|
||||||
|
icon: simpleIcons.GitHub
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Gitlab",
|
||||||
|
color: "E24329",
|
||||||
|
link: "gitlab.com/codepupper",
|
||||||
|
icon: simpleIcons.GitLab
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Ko-Fi",
|
||||||
|
color: "f16061",
|
||||||
|
link: "ko-fi.com/codepupper",
|
||||||
|
icon: simpleIcons["Ko-fi"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Patreon",
|
||||||
|
color: "6441a4",
|
||||||
|
link: "patreon.com/ryden",
|
||||||
|
icon: simpleIcons.Patreon
|
||||||
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/update', async (req, res) => {
|
app.get("/update", async (req, res) => {
|
||||||
//console.log(req.headers['user-agent']);
|
//console.log(req.headers['user-agent']);
|
||||||
if (req.headers.authorization === con.updateToken) {
|
if (req.headers.authorization === con.updateToken) {
|
||||||
await exec('git pull')
|
await exec("git pull")
|
||||||
.then((r) => {
|
.then(r => {
|
||||||
console.log('Pulled latest changes');
|
console.log("Pulled latest changes");
|
||||||
res.status(200).jsonp({
|
res.status(200).jsonp({
|
||||||
success: true,
|
success: true,
|
||||||
message: 'Successfully pulled latest changes'
|
message: "Successfully pulled latest changes"
|
||||||
});
|
});
|
||||||
process.exit();
|
process.exit();
|
||||||
//trying.edit('```fix\n' + r.stdout + '```');
|
//trying.edit('```fix\n' + r.stdout + '```');
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch(error => {
|
||||||
res.status(400).jsonp({
|
res.status(400).jsonp({
|
||||||
success: false,
|
success: false,
|
||||||
message: error.message
|
message: error.message
|
||||||
|
@ -120,7 +168,7 @@ module.exports = (client) => {
|
||||||
} else {
|
} else {
|
||||||
res.status(400).jsonp({
|
res.status(400).jsonp({
|
||||||
success: false,
|
success: false,
|
||||||
message: 'You are not authorized to access this Endpoint'
|
message: "You are not authorized to access this Endpoint"
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue