This commit is contained in:
codepupper 2019-12-18 12:44:33 +01:00
commit 9f77e7cfe1
12 changed files with 2013 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules/*

102
assets/css/x.css Normal file
View File

@ -0,0 +1,102 @@
@import url("https://fonts.googleapis.com/css?family=Poppins&display=swap");
* {
margin: 0;
padding: 0;
}
body {
background-color: black;
color: white;
font-family: 'Poppins', sans-serif;
}
a:not(#yugen) {
color: white;
text-decoration: none;
border: transparent;
}
a {
color: white;
text-decoration: none;
border-bottom: 1vh solid #dadada;
border-right: 1vh solid #dadada;
border-left: 1vh solid #dadada;
border-top: 1vh solid #dadada;
}
section {
height: 100vh;
border-style: none;
}
h1 {
font-size: 7vw;
height: 100%;
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
-webkit-box-align: center;
-ms-flex-align: center;
align-items: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
justify-content: center;
}
#home {
background-color: black;
color: white;
font-style: italic;
}
#thaldrin {
background: #ff841f;
}
#kaito {
background: #96400e;
}
#Twitter {
background: #1DA1F2;
}
#homepage {
background: #d83333;
}
#yiff {
background: #e01653;
}
#portfolio {
background: #2022a0;
}
#yugen {
background: #ffffff;
color: #000;
padding: 2vw;
}
#yugen button {
background: #ffffff;
color: #000;
}
.buttons {
display: inline;
}
button {
font-size: 2vw;
border-style: none;
padding: 1vh;
background: white;
}
/*# sourceMappingURL=x.css.map */

9
assets/css/x.css.map Normal file
View File

@ -0,0 +1,9 @@
{
"version": 3,
"mappings": "AAAA,OAAO,CAAC,mEAAI;AAEZ,AAAA,CAAC,CAAC;EACE,MAAM,EAAE,CAAC;EACT,OAAO,EAAE,CAAC;CAAG;;AAGjB,AAAA,IAAI,CAAC;EACD,gBAAgB,EAAE,KAAK;EACvB,KAAK,EAAE,KAAK;EACZ,WAAW,EAAE,qBAAqB;CAAG;;AAEzC,AAAA,CA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CAAG;;AAEtB,AAAA,MAAM,CAAC;EACC,SAAS,EAAE,GAAG;EACd,YAAY,EAAE,IAAI;EAClB,OAAO,EAAE,GAAG;EACZ,UAAU,EAAE,KAAK;CAAG",
"sources": [
"x.sass"
],
"names": [],
"file": "x.css"
}

75
assets/css/x.sass Normal file
View File

@ -0,0 +1,75 @@
@import url('https://fonts.googleapis.com/css?family=Poppins&display=swap')
*
margin: 0
padding: 0
body
background-color: black
color: white
font-family: 'Poppins', sans-serif
a:not(#yugen)
color: white
text-decoration: none
border: transparent
a
color: white
text-decoration: none
border-bottom: 1vh solid #dadada
border-right: 1vh solid #dadada
border-left: 1vh solid #dadada
border-top: 1vh solid #dadada
section
height: 100vh
border-style: none
h1
font-size: 7vw
height: 100%
display: flex
flex-direction: column
align-items: center
justify-content: center
#home
background-color: black
color: white
font-style: italic
#thaldrin
background: #ff841f
#kaito
background: #96400e
#Twitter
background: #1DA1F2
#homepage
background: #d83333
#yiff
background: #e01653
#portfolio
background: #2022a0
#yugen
background: #ffffff
color: #000
padding: 2vw
button
background: #ffffff
color: #000
.buttons
display: inline
button
font-size: 2vw
border-style: none
padding: 1vh
background: white

76
assets/js/main.js Normal file
View File

@ -0,0 +1,76 @@
// ——————————————————————————————————————————————————
// TextScramble
// ——————————————————————————————————————————————————
class TextScramble {
constructor(el) {
this.el = el;
this.chars = '!<>-_\\/[]{}—=+*^?#________';
this.update = this.update.bind(this);
}
setText(newText) {
const oldText = this.el.innerText;
const length = Math.max(oldText.length, newText.length);
const promise = new Promise((resolve) => (this.resolve = resolve));
this.queue = [];
for (let i = 0; i < length; i++) {
const from = oldText[i] || '';
const to = newText[i] || '';
const start = Math.floor(Math.random() * 40);
const end = start + Math.floor(Math.random() * 40);
this.queue.push({ from, to, start, end });
}
cancelAnimationFrame(this.frameRequest);
this.frame = 0;
this.update();
return promise;
}
update() {
let output = '';
let complete = 0;
for (let i = 0, n = this.queue.length; i < n; i++) {
let { from, to, start, end, char } = this.queue[i];
if (this.frame >= end) {
complete++;
output += to;
} else if (this.frame >= start) {
if (!char || Math.random() < 0.28) {
char = this.randomChar();
this.queue[i].char = char;
}
output += `<span class="dud">${char}</span>`;
} else {
output += from;
}
}
this.el.innerHTML = output;
if (complete === this.queue.length) {
this.resolve();
} else {
this.frameRequest = requestAnimationFrame(this.update);
this.frame++;
}
}
randomChar() {
return this.chars[Math.floor(Math.random() * this.chars.length)];
}
}
// ——————————————————————————————————————————————————
// Example
// ——————————————————————————————————————————————————
const phrases = [ 'Portfolio', 'Discord', 'Twitter', 'Websites' ];
const el = document.querySelector('.text');
const fx = new TextScramble(el);
let counter = 0;
const next = () => {
fx.setText(phrases[counter]).then(() => {
setTimeout(next, 1000 * 1);
});
counter = (counter + 1) % phrases.length;
};
next();

3
index.js Normal file
View File

@ -0,0 +1,3 @@
let server = require('./server');
server();

1502
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

28
package.json Normal file
View File

@ -0,0 +1,28 @@
{
"name": "portfolio",
"version": "1.0.0",
"private": true,
"description": "",
"main": "index.js",
"dependencies": {
"chalk": "^2.4.2",
"compression": "^1.7.4",
"cors": "^2.8.5",
"express": "^4.17.1",
"express-handlebars": "^3.1.0",
"helmet": "^3.21.2",
"morgan": "^1.9.1",
"nodemon": "^2.0.2",
"shell-exec": "^1.0.2",
"simple-icons": "^1.20.0",
"ua-parser-js": "^0.7.20"
},
"devDependencies": {},
"scripts": {
"test": "nodemon run.js",
"start": "node run.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}

9
run.sh Executable file
View File

@ -0,0 +1,9 @@
#!/bin/bash
FILE=index
NODE=node
while true;
do
$NODE $(pwd)/$FILE.js
done

148
server.js Normal file
View File

@ -0,0 +1,148 @@
//! 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');
const UA = require('ua-parser-js');
const exec = require('shell-exec');
const simpleIcons = require('simple-icons');
//const con = require('./constants');
let { port, hostname } = {
port: 3621
//hostname: '67.182.206.28'
};
const app = express();
app.engine(
'hbs',
hbs({
extname: 'hbs',
defaultView: 'default',
helpers: {
ifeq: function(a, b, options) {
if (a === b) {
return options.fn(this);
}
}
}
})
);
app.set('view engine', 'hbs');
app.set('json spaces', 4);
app.use('/assets', express.static('./assets'));
app.set('view options', {
layout: false
});
app.use(express.json());
app.use(
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(' ');
})
);
/* app.use([ '/portfolio', '/p' ], require('./routes/portfolio'));
app.use('/lore', require('./routes/lore'));
app.use('/art', require('./routes/art')); */
//app.use('/p', require('./routes/p'));
module.exports = (client) => {
app.get('/', async (req, res) => {
res.render('index', {
layout: 'main',
name: `ry/`,
host: req.hostname,
portfolio: {
code: [
{
name: 'portfolio',
id: 'portfolio',
source: '/portfolio',
tags: [ 'Node', 'Handlebars', 'SASS' ]
},
{ name: 'homepage', id: 'homepage', source: '/homepage', tags: [ 'Node', 'Handlebars', 'SCSS' ] },
{ name: 'yugen.work', id: 'yugen', source: '/yugen', tags: [ 'Node', 'Handlebars', 'SCSS' ] },
{
name: 'thaldrin',
id: 'thaldrin',
source: '/thaldrin',
tags: [ 'Node', 'Handlebars', 'SCSS', 'Discord' ]
},
{ name: 'kaito', id: 'kaito', source: '/kaito', tags: [ 'Node', 'Twitter', 'Discord' ] },
{ name: 'yiff', id: 'yiff', source: '/yiff', tags: [ 'Node', 'NPM' ] }
]
}
});
});
app.get('/portfolio', async (req, res) => {
res.redirect('https://gitdab.com/y/shyzu');
});
app.get('/homepage', async (req, res) => {
res.redirect('https://gitdab.com/y/website');
});
app.get('/yugen', async (req, res) => {
res.redirect('https://yugen.work');
});
app.get('/thaldrin', async (req, res) => {
res.redirect('https://thaldr.in/source');
});
app.get('/kaito', async (req, res) => {
res.redirect('https://github.com/codepupper/kaito');
});
app.get('/yiff', async (req, res) => {
res.redirect('https://npm.im/yiff');
});
app.get('/update', async (req, res) => {
//console.log(req.headers['user-agent']);
if (req.headers.authorization === con.updateToken) {
await exec('git pull')
.then((r) => {
console.log('Pulled latest changes');
res.status(200).jsonp({
success: true,
message: 'Successfully pulled latest changes'
});
process.exit();
//trying.edit('```fix\n' + r.stdout + '```');
})
.catch((error) => {
res.status(400).jsonp({
success: false,
message: error.message
});
console.error(error);
});
} else {
res.status(400).jsonp({
success: false,
message: 'You are not authorized to access this Endpoint'
});
}
});
app.listen(port /* , hostname */, () => {
console.log(`${chalk.blue('[ Server ]')} Listening on ${port}`);
});
};

22
views/index.hbs Normal file
View File

@ -0,0 +1,22 @@
<body>
<section id="home">
<h1 class="title center">{{name}}<span class="text"></span></h1>
</section>
{{#each portfolio.code}}
<section id="{{this.name}}">
<h1><a class="{{this.name}} center" id="{{this.id}}" target="_blank" href="{{this.source}}">{{this.name}}</a>
<div class="buttons">
{{#each this.tags}}
<button class="{{this}}"><i><strong>{{this}}</strong></i></button>
{{/each}}
</div>
</section>
{{/each}}
<section id="Twitter">
<h1>
<a class="art" href="https://twitter.com/floofydev" target="_blank">@floofydev</a>
</h1>
</section>
</body>

38
views/layouts/main.hbs Normal file
View File

@ -0,0 +1,38 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="initial-scale=1.0">
<meta http-equiv="X-UA-Compatible">
<title>{{host}} | ry</title>
<script src="../assets/js/main.js" async></script>
<link rel="stylesheet" type="text/css" href="../assets/css/x.css" />
<meta name="msapplication-TileColor" content="#fcba03">
<meta name="theme-color" content="#fcba03">
<meta property="og:title" content="ry">
<meta property="og:type" content="website">
<meta property="og:url" content="https://{{host}}">
{{!-- <meta property="og:image"
content="https://raw.githubusercontent.com/EndlessHosting/assets/master/images/PFPs/code.png">
--}}
<meta property="og:description" content="Portfolio">
{{!-- <link rel="icon" type="image/png"
href="https://raw.githubusercontent.com/EndlessHosting/assets/master/images/PFPs/code.png" sizes="32x32">
<link rel="icon" type="image/png"
href="https://raw.githubusercontent.com/EndlessHosting/assets/master/images/PFPs/code.png" sizes="96x96">
<link rel="apple-touch-icon" sizes="180x180"
href="https://raw.githubusercontent.com/EndlessHosting/assets/master/images/PFPs/code.png"> --}}
<meta name="msapplication-TileColor" content="#ffffff">
<meta name="msapplication-TileImage" content="/mstile-144x144.png">
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body>
{{{body}}}
</body>
</html>