1
0
Fork 0
mirror of https://github.com/dilllxd/gitfolio.git synced 2024-08-14 22:28:09 +00:00

Fixed Issues and added a UI

This commit is contained in:
imfunny 2019-08-13 15:24:14 +05:30 committed by GitHub
parent 39ffee2944
commit 870758aa69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 614 additions and 580 deletions

View file

@ -14,22 +14,22 @@ appearance, race, religion, or sexual identity and orientation.
Examples of behavior that contributes to creating a positive environment Examples of behavior that contributes to creating a positive environment
include: include:
* Using welcoming and inclusive language - Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences - Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism - Gracefully accepting constructive criticism
* Focusing on what is best for the community - Focusing on what is best for the community
* Showing empathy towards other community members - Showing empathy towards other community members
Examples of unacceptable behavior by participants include: Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or - The use of sexualized language or imagery and unwelcome sexual attention or
advances advances
* Trolling, insulting/derogatory comments, and personal or political attacks - Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment - Public or private harassment
* Publishing others' private information, such as a physical or electronic - Publishing others' private information, such as a physical or electronic
address, without explicit permission address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a - Other conduct which could reasonably be considered inappropriate in a
professional setting professional setting
## Our Responsibilities ## Our Responsibilities

View file

@ -1,6 +1,6 @@
<img src="https://i.imgur.com/eA6clZr.png"> <img src="https://i.imgur.com/eA6clZr.png">
# Gitfolio [![Tweet](https://img.shields.io/twitter/url/https/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=personal%20website%20and%20a%20blog%20for%20every%20github%20user%20@imfunnieee%20&url=https://github.com/imfunniee/gitfolio) ![GitHub release](https://img.shields.io/github/release/imfunniee/gitfolio.svg?style=popout-square) ![npm](https://img.shields.io/npm/dm/gitfolio.svg?style=popout-square) ![GitHub top language](https://img.shields.io/github/languages/top/imfunniee/gitfolio.svg?style=popout-square) ![GitHub last commit](https://img.shields.io/github/last-commit/imfunniee/gitfolio.svg?style=popout-square) ![GitHub](https://img.shields.io/github/license/imfunniee/gitfolio.svg?style=popout-square) # Gitfolio [![Tweet](https://img.shields.io/twitter/url/https/shields.io.svg?style=social)](https://twitter.com/intent/tweet?text=personal%20website%20and%20a%20blog%20for%20every%20github%20user%20@imfunnieee%20&url=https://github.com/imfunniee/gitfolio) ![GitHub release](https://img.shields.io/github/release/imfunniee/gitfolio.svg?style=popout-square) ![npm](https://img.shields.io/npm/dm/gitfolio.svg?style=popout-square) ![GitHub top language](https://img.shields.io/github/languages/top/imfunniee/gitfolio.svg?style=popout-square) ![GitHub last commit](https://img.shields.io/github/last-commit/imfunniee/gitfolio.svg?style=popout-square) ![GitHub](https://img.shields.io/github/license/imfunniee/gitfolio.svg?style=popout-square) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettier)
### personal website + blog for every github user ### personal website + blog for every github user

66
api.js Normal file
View file

@ -0,0 +1,66 @@
const got = require("got");
/**
* The defaults here are the same as the API
* @see https://developer.github.com/v3/repos/#list-user-repositories
* @param {string} username
* @param {Object} opts
* @param {('all' | 'owner' | 'member')[]} [opts.types]
* @param {'created' | 'updated' | 'pushed' | 'full_name' | 'star'} [opts.sort]
* @param {'desc' | 'asc'} [opts.order]
*/
async function getRepos(username, opts = {}) {
let tempRepos;
let page = 1;
let repos = [];
const sort = opts.sort;
const order = opts.order || (sort === "full_name" ? "asc" : "desc");
const types = opts.types || [];
let type = "all";
if (
types.includes("all") ||
(types.includes("owner") && types.includes("member"))
) {
type = "all";
} else if (types.includes("member")) {
type = "member";
}
do {
let requestUrl = `https://api.github.com/users/${username}/repos?per_page=100&page=${page++}&type=${type}`;
if (sort && sort !== "star") {
requestUrl += `&sort=${sort}&direction=${order}`;
}
tempRepos = await got(requestUrl);
tempRepos = JSON.parse(tempRepos.body);
repos = repos.concat(tempRepos);
} while (tempRepos.length == 100);
if (sort == "star") {
repos = repos.sort(function(a, b) {
if (order == "desc") {
return b.stargazers_count - a.stargazers_count;
} else {
return a.stargazers_count - b.stargazers_count;
}
});
}
return repos;
}
/**
* @see https://developer.github.com/v3/users/#get-a-single-user
* @param {string} username
*/
async function getUser(username) {
const res = await got(`https://api.github.com/users/${username}`);
return JSON.parse(res.body);
}
module.exports = {
getRepos,
getUser
};

View file

@ -1 +1 @@
[] []

View file

@ -103,9 +103,9 @@
icon.setAttribute("href", user[0].userimg); icon.setAttribute("href", user[0].userimg);
icon.setAttribute("type", "image/png"); icon.setAttribute("type", "image/png");
document.getElementsByTagName("head")[0].appendChild(icon); document.getElementsByTagName("head")[0].appendChild(icon);
document.getElementById("profile_img_blog").style.background = `url('${ document.getElementById(
user[0].userimg "profile_img_blog"
}') center center`; ).style.background = `url('${user[0].userimg}') center center`;
document.getElementById( document.getElementById(
"username_blog" "username_blog"
).innerHTML = `<span style="display:${ ).innerHTML = `<span style="display:${

View file

@ -1,547 +1,547 @@
@import url('https://fonts.googleapis.com/css?family=Poppins'); @import url("https://fonts.googleapis.com/css?family=Poppins");
@import url('https://fonts.googleapis.com/css?family=Questrial'); @import url("https://fonts.googleapis.com/css?family=Questrial");
body { body {
margin: 0%; margin: 0%;
padding: 0%; padding: 0%;
width: 100vw; width: 100vw;
background: var(--bg-color); background: var(--bg-color);
color: var(--text-color); color: var(--text-color);
max-width: 100vw; max-width: 100vw;
overflow-x: hidden; overflow-x: hidden;
align-items: center; align-items: center;
font-family: 'Poppins', sans-serif; font-family: "Poppins", sans-serif;
} }
#loading { #loading {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
position: fixed; position: fixed;
background: var(--bg-color); background: var(--bg-color);
z-index: 999; z-index: 999;
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
top: 0; top: 0;
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
} }
#spinner { #spinner {
animation: rotate 0.5s infinite linear; animation: rotate 0.5s infinite linear;
width: 50px; width: 50px;
height: 50px; height: 50px;
border: 2px solid var(--bg-color); border: 2px solid var(--bg-color);
border-bottom: 2px solid var(--text-color); border-bottom: 2px solid var(--text-color);
border-radius: 50%; border-radius: 50%;
margin: 0; margin: 0;
} }
@keyframes rotate { @keyframes rotate {
0% { 0% {
transform: rotate(0deg); transform: rotate(0deg);
} }
100% { 100% {
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
#profile { #profile {
width: 24vw; width: 24vw;
padding: 4vh 3vw; padding: 4vh 3vw;
height: 92vh; height: 92vh;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
text-align: left; text-align: left;
background: var(--background-image) center center; background: var(--background-image) center center;
background-size: cover !important; background-size: cover !important;
background-repeat: no-repeat; background-repeat: no-repeat;
position: fixed; position: fixed;
color: #fff !important; color: #fff !important;
} }
#display { #display {
width: 64vw; width: 64vw;
padding: 4vh 3vw; padding: 4vh 3vw;
height: 92vh; height: 92vh;
display: inline-block; display: inline-block;
padding-left: 33vw; padding-left: 33vw;
} }
#display h1 { #display h1 {
font-size: 50px; font-size: 50px;
color: var(--text-color); color: var(--text-color);
font-weight: bold; font-weight: bold;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
} }
.emoji { .emoji {
width: 18px; width: 18px;
height: 18px; height: 18px;
} }
#profile_img_blog { #profile_img_blog {
border-radius: 50%; border-radius: 50%;
width: 90px; width: 90px;
height: 90px; height: 90px;
background-size: cover !important; background-size: cover !important;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
#username_blog { #username_blog {
font-size: 18px; font-size: 18px;
color: var(--text-color); color: var(--text-color);
font-family: 'Poppins', sans-serif; font-family: "Poppins", sans-serif;
font-weight: bold; font-weight: bold;
} }
#username_blog span { #username_blog span {
font-size: 24px; font-size: 24px;
font-family: 'Questrial', sans-serif !important; font-family: "Questrial", sans-serif !important;
} }
#username_blog b { #username_blog b {
font-size: 12px; font-size: 12px;
font-family: 'Poppins', sans-serif; font-family: "Poppins", sans-serif;
font-weight: bold; font-weight: bold;
} }
#blog-display { #blog-display {
width: 60vw; width: 60vw;
margin: 0px 20vw; margin: 0px 20vw;
text-align: left; text-align: left;
margin-top: 3vh; margin-top: 3vh;
z-index: 1; z-index: 1;
} }
#profile_blog { #profile_blog {
width: 60vw; width: 60vw;
margin: 0px 20vw; margin: 0px 20vw;
margin-top: 34vh; margin-top: 34vh;
text-align: left; text-align: left;
z-index: 1; z-index: 1;
} }
#background_overlay { #background_overlay {
width: 100vw; width: 100vw;
height: 55vh; height: 55vh;
position: absolute; position: absolute;
z-index: -1; z-index: -1;
top: 0; top: 0;
left: 0; left: 0;
} }
#background { #background {
width: 100vw; width: 100vw;
height: 55vh; height: 55vh;
background-size: cover !important; background-size: cover !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
position: absolute; position: absolute;
z-index: -2; z-index: -2;
top: 0; top: 0;
left: 0; left: 0;
} }
#blog-display h1 { #blog-display h1 {
font-size: 50px; font-size: 50px;
color: var(--text-color); color: var(--text-color);
font-weight: bold; font-weight: bold;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
} }
#blog-display h2 { #blog-display h2 {
color: var(--blog-gray-color); color: var(--blog-gray-color);
} }
#blog-display { #blog-display {
padding: 1vh 0px; padding: 1vh 0px;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
} }
#blog p { #blog p {
font-size: 17px; font-size: 17px;
line-height: 25px; line-height: 25px;
word-spacing: 1.2px; word-spacing: 1.2px;
margin: 5vh 0px; margin: 5vh 0px;
} }
#blog p span { #blog p span {
padding: 2px 4px; padding: 2px 4px;
background: var(--text-color); background: var(--text-color);
color: var(--bg-color) !important; color: var(--bg-color) !important;
} }
#blog img { #blog img {
width: 100%; width: 100%;
margin: 2vh 0px; margin: 2vh 0px;
border-radius: 5px; border-radius: 5px;
border: 1px solid rgb(0, 0, 0, 0.08); border: 1px solid rgb(0, 0, 0, 0.08);
} }
#header { #header {
width: 63vw; width: 63vw;
text-align: right; text-align: right;
padding: 3vh 0px; padding: 3vh 0px;
position: absolute; position: absolute;
} }
#header a { #header a {
color: var(--text-color); color: var(--text-color);
text-decoration: none; text-decoration: none;
margin-left: 4vw; margin-left: 4vw;
font-weight: bold; font-weight: bold;
} }
#footer_blog { #footer_blog {
width: 90vw; width: 90vw;
padding: 8vh 5vw; padding: 8vh 5vw;
text-align: center; text-align: center;
} }
#footer_blog a { #footer_blog a {
color: var(--text-color) !important; color: var(--text-color) !important;
text-decoration: none; text-decoration: none;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
font-weight: bold; font-weight: bold;
} }
#footer { #footer {
width: 100%; width: 100%;
padding: 8vh 0px; padding: 8vh 0px;
text-align: center; text-align: center;
} }
#footer a { #footer a {
color: var(--text-color) !important; color: var(--text-color) !important;
text-decoration: none; text-decoration: none;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
font-weight: bold; font-weight: bold;
} }
#profile_img { #profile_img {
width: 180px; width: 180px;
height: 180px; height: 180px;
min-width: 180px; min-width: 180px;
min-height: 180px; min-height: 180px;
max-width: 180px; max-width: 180px;
max-height: 180px; max-height: 180px;
border-radius: 5px; border-radius: 5px;
background-size: cover !important; background-size: cover !important;
background-repeat: no-repeat !important; background-repeat: no-repeat !important;
} }
#profile div { #profile div {
font-weight: bold; font-weight: bold;
margin: 1.5vh 0px; margin: 1.5vh 0px;
} }
#username { #username {
font-size: 18px; font-size: 18px;
font-weight: bold; font-weight: bold;
} }
#username span { #username span {
font-size: 24px; font-size: 24px;
} }
#userbio { #userbio {
font-size: 26px; font-size: 26px;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
width: 100%; width: 100%;
} }
#about { #about {
font-size: 18px; font-size: 18px;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
} }
#about a, #about a,
#username a { #username a {
color: #fff !important; color: #fff !important;
text-decoration: none; text-decoration: none;
font-weight: bold; font-weight: bold;
} }
#about a:hover, #about a:hover,
#username a:hover { #username a:hover {
text-decoration: underline; text-decoration: underline;
} }
#about span { #about span {
margin: 1vh 0px; margin: 1vh 0px;
display: block; display: block;
} }
#about span i { #about span i {
font-size: 16px; font-size: 16px;
} }
#work { #work {
margin: 2vh 0px; margin: 2vh 0px;
padding: 4vh 0px !important; padding: 4vh 0px !important;
} }
#forks { #forks {
margin: 2vh 0px; margin: 2vh 0px;
padding: 4vh 0px !important; padding: 4vh 0px !important;
} }
.projects { .projects {
margin-left: -15px; margin-left: -15px;
/* align section w/ heading above */ /* align section w/ heading above */
} }
.projects a { .projects a {
/* 30px is the gutter size in magic grid */ /* 30px is the gutter size in magic grid */
width: calc(49% - 30px); width: calc(49% - 30px);
/* 49% avoids a weird single column on some wide screens */ /* 49% avoids a weird single column on some wide screens */
display: flex; display: flex;
text-decoration: none; text-decoration: none;
} }
.projects section { .projects section {
width: 100%; width: 100%;
padding: 2.5vh 5%; padding: 2.5vh 5%;
margin: 1vh 0px; margin: 1vh 0px;
display: inline-block; display: inline-block;
border-radius: 5px; border-radius: 5px;
color: var(--text-color); color: var(--text-color);
border: 1px solid rgb(0, 0, 0, 0.08); border: 1px solid rgb(0, 0, 0, 0.08);
box-shadow: 0px 0px 0px rgb(0, 0, 0, 0); box-shadow: 0px 0px 0px rgb(0, 0, 0, 0);
transition: 0.4s ease-in-out; transition: 0.4s ease-in-out;
transform: scale(1); transform: scale(1);
} }
.projects section:hover { .projects section:hover {
cursor: pointer; cursor: pointer;
border: 1px solid rgb(0, 0, 0, 0); border: 1px solid rgb(0, 0, 0, 0);
box-shadow: 0px 15px 35px rgb(0, 0, 0, 0.06); box-shadow: 0px 15px 35px rgb(0, 0, 0, 0.06);
transform: scale(1.03); transform: scale(1.03);
} }
.section_title { .section_title {
font-size: 24px; font-size: 24px;
font-weight: bold; font-weight: bold;
margin: 1vh 0px; margin: 1vh 0px;
padding: 0px 1px; padding: 0px 1px;
word-wrap: break-word; word-wrap: break-word;
} }
.about_section { .about_section {
font-size: 18px; font-size: 18px;
font-family: 'Questrial', sans-serif; font-family: "Questrial", sans-serif;
margin: 2vh 0px; margin: 2vh 0px;
font-weight: bold; font-weight: bold;
word-wrap: break-word; word-wrap: break-word;
} }
.bottom_section { .bottom_section {
margin: 1vh 0px; margin: 1vh 0px;
font-size: 14px; font-size: 14px;
word-wrap: break-word; word-wrap: break-word;
} }
.bottom_section span { .bottom_section span {
margin-right: 20px; margin-right: 20px;
font-weight: bold; font-weight: bold;
} }
.bottom_section span i { .bottom_section span i {
font-size: 15px; font-size: 15px;
} }
.socials { .socials {
color: #fff; color: #fff;
text-decoration: none; text-decoration: none;
margin: 3vh 0px !important; margin: 3vh 0px !important;
} }
.socials span { .socials span {
display: inline-block !important; display: inline-block !important;
margin-right: 2vw !important; margin-right: 2vw !important;
font-weight: normal !important; font-weight: normal !important;
} }
.socials span a { .socials span a {
font-weight: normal !important; font-weight: normal !important;
} }
#blog_section { #blog_section {
margin: 2vh 0px; margin: 2vh 0px;
padding: 2vh 0px !important; padding: 2vh 0px !important;
} }
#blogs { #blogs {
columns: 2; columns: 2;
} }
#blog_title { #blog_title {
font-size: 50px; font-size: 50px;
} }
#blog_sub_title { #blog_sub_title {
font-size: 36px; font-size: 36px;
margin-top: -2vh; margin-top: -2vh;
} }
#blogs section { #blogs section {
width: 100%; width: 100%;
display: inline-block; display: inline-block;
border-radius: 5px; border-radius: 5px;
color: var(--text-color); color: var(--text-color);
border: 1px solid rgb(0, 0, 0, 0.04); border: 1px solid rgb(0, 0, 0, 0.04);
box-shadow: 0px 0px 0px rgb(0, 0, 0, 0); box-shadow: 0px 0px 0px rgb(0, 0, 0, 0);
transition: 0.4s ease-in-out; transition: 0.4s ease-in-out;
transform: scale(1); transform: scale(1);
padding: 0px; padding: 0px;
margin: 2vh 0px; margin: 2vh 0px;
} }
#blogs section img { #blogs section img {
width: 100%; width: 100%;
border-radius: 5px 5px 0px 0px; border-radius: 5px 5px 0px 0px;
} }
.blog_container { .blog_container {
padding: 2.5vh 5%; padding: 2.5vh 5%;
} }
#blogs section:hover { #blogs section:hover {
cursor: pointer; cursor: pointer;
border: 1px solid rgb(0, 0, 0, 0); border: 1px solid rgb(0, 0, 0, 0);
box-shadow: 0px 15px 35px rgb(0, 0, 0, 0.06); box-shadow: 0px 15px 35px rgb(0, 0, 0, 0.06);
transform: scale(1.03); transform: scale(1.03);
} }
.go_back { .go_back {
position: absolute; position: absolute;
color: var(--text-color); color: var(--text-color);
font-size: 26px; font-size: 26px;
margin-left: 5vw; margin-left: 5vw;
margin-top: 4vh; margin-top: 4vh;
} }
::selection { ::selection {
color: var(--bg-color); color: var(--bg-color);
background: var(--text-color); background: var(--text-color);
} }
@media (max-width: 800px) { @media (max-width: 800px) {
#profile { #profile {
width: 90vw; width: 90vw;
padding: 4vh 5vw; padding: 4vh 5vw;
height: 60vh; height: 60vh;
text-align: center; text-align: center;
position: relative; position: relative;
} }
#display { #display {
width: 90vw; width: 90vw;
padding: 4vh 5vw; padding: 4vh 5vw;
height: auto; height: auto;
display: inline-block; display: inline-block;
padding-left: 5vw; padding-left: 5vw;
} }
#profile_img { #profile_img {
width: 120px; width: 120px;
height: 120px; height: 120px;
min-width: 120px; min-width: 120px;
min-height: 120px; min-height: 120px;
max-width: 120px; max-width: 120px;
max-height: 120px; max-height: 120px;
margin: 0px auto !important; margin: 0px auto !important;
} }
#work { #work {
margin: 0px; margin: 0px;
} }
.projects { .projects {
margin-left: 0; margin-left: 0;
/* remove neg margin to align w/ header */ /* remove neg margin to align w/ header */
} }
.projects a { .projects a {
width: 100%; width: 100%;
} }
.projects section { .projects section {
width: 88%; width: 88%;
} }
#blogs { #blogs {
columns: 1; columns: 1;
} }
#blogs section { #blogs section {
width: 98%; width: 98%;
} }
#blog_section { #blog_section {
margin: 0px; margin: 0px;
} }
#blog-display { #blog-display {
width: 90vw; width: 90vw;
margin: 0px 5vw; margin: 0px 5vw;
text-align: left; text-align: left;
margin-top: 0vh; margin-top: 0vh;
z-index: 1; z-index: 1;
} }
#blog_title { #blog_title {
font-size: 32px !important; font-size: 32px !important;
} }
#blog_sub_title { #blog_sub_title {
font-size: 24px; font-size: 24px;
margin-top: -1vh; margin-top: -1vh;
} }
#profile_blog { #profile_blog {
width: 90vw; width: 90vw;
margin: 0px 5vw; margin: 0px 5vw;
margin-top: 36vh; margin-top: 36vh;
text-align: left; text-align: left;
z-index: 1; z-index: 1;
} }
#profile_img_blog { #profile_img_blog {
width: 65px; width: 65px;
height: 65px; height: 65px;
} }
.go_back { .go_back {
position: relative; position: relative;
color: var(--text-color); color: var(--text-color);
font-size: 26px; font-size: 26px;
margin-left: 5vw; margin-left: 5vw;
top: 5vh; top: 5vh;
} }
#blog img { #blog img {
margin: 1vh 0px !important; margin: 1vh 0px !important;
} }
#blog p { #blog p {
margin: 2vh 0px; margin: 2vh 0px;
} }
} }
::-webkit-scrollbar { ::-webkit-scrollbar {
width: 5px; width: 5px;
height: 5px; height: 5px;
} }
::-webkit-scrollbar-track { ::-webkit-scrollbar-track {
background: var(--bg-color); background: var(--bg-color);
} }
::-webkit-scrollbar-thumb { ::-webkit-scrollbar-thumb {
background: var(--text-color); background: var(--text-color);
} }

View file

@ -2,10 +2,18 @@
--bg-color: rgb(10, 10, 10); --bg-color: rgb(10, 10, 10);
--text-color: #fff; --text-color: #fff;
--blog-gray-color: rgb(180, 180, 180); --blog-gray-color: rgb(180, 180, 180);
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.3), rgb(10, 10, 10, 1)), --background-image: linear-gradient(
url("{{{background}}}"); 90deg,
--background-background: linear-gradient(0deg, rgba(10, 10, 10, 1), rgba(10, 10, 10, 0.6)), rgba(10, 10, 10, 0.3),
url("{{{background}}}") center center fixed; rgb(10, 10, 10, 1)
),
url("{{{background}}}");
--background-background: linear-gradient(
0deg,
rgba(10, 10, 10, 1),
rgba(10, 10, 10, 0.6)
),
url("{{{background}}}") center center fixed;
--height: 50vh; --height: 50vh;
} }
@ -31,7 +39,11 @@
@media (max-width: 800px) { @media (max-width: 800px) {
:root { :root {
--background-image: linear-gradient(0deg, rgba(10, 10, 10, 1), rgba(10, 10, 10, 0)), --background-image: linear-gradient(
url("{{{background}}}") !important; 0deg,
rgba(10, 10, 10, 1),
rgba(10, 10, 10, 0)
),
url("{{{background}}}") !important;
} }
} }

View file

@ -2,6 +2,11 @@
--bg-color: #fff; --bg-color: #fff;
--text-color: rgb(10, 10, 10); --text-color: rgb(10, 10, 10);
--blog-gray-color: rgb(80, 80, 80); --blog-gray-color: rgb(80, 80, 80);
--background-image: linear-gradient(90deg, rgba(10, 10, 10, 0.4), rgb(10, 10, 10, 0.4)), url("{{{background}}}"); --background-image: linear-gradient(
90deg,
rgba(10, 10, 10, 0.4),
rgb(10, 10, 10, 0.4)
),
url("{{{background}}}");
--background-background: #fff; --background-background: #fff;
} }

View file

@ -1,4 +1,4 @@
#! /usr/bin/env node #! /usr/bin/env node
/* Argument parser */ /* Argument parser */
const program = require("commander"); const program = require("commander");
@ -10,6 +10,11 @@ const { uiCommand } = require("../ui");
const { runCommand } = require("../run"); const { runCommand } = require("../run");
const { version } = require("../package.json"); const { version } = require("../package.json");
function collect(val, memo) {
memo.push(val);
return memo;
}
program program
.command("build <username>") .command("build <username>")
.description( .description(

View file

@ -58,54 +58,33 @@ async function populateCSS({
await fs.writeFileAsync(config, JSON.stringify(data, null, " ")); await fs.writeFileAsync(config, JSON.stringify(data, null, " "));
} }
async function populateConfig( async function populateConfig(opts) {
sort,
order,
includeFork,
twitter,
linkedin,
medium,
dribbble
) {
const data = await getConfig(); const data = await getConfig();
data[0].sort = sort; Object.assign(data[0], opts);
data[0].order = order;
data[0].includeFork = includeFork;
data[0].twitter = twitter; // added twitter
data[0].linkedin = linkedin; // added linkedin
data[0].medium = medium; // added medium
data[0].dribbble = dribbble; // added dribbble
await fs.writeFileAsync(config, JSON.stringify(data, null, " ")); await fs.writeFileAsync(config, JSON.stringify(data, null, " "));
} }
async function buildCommand(username, program) { async function buildCommand(username, program) {
await populateCSS(program); await populateCSS(program);
let sort = program.sort ? program.sort : "created"; let types;
let order = program.order ? program.order : "asc"; if (!program.include || !program.include.length) {
let includeFork = program.fork ? true : false; types = ["all"];
let twitter = program.twitter ? program.twitter : null; } else {
let linkedin = program.linkedin ? program.linkedin : null; types = program.include;
let medium = program.medium ? program.medium : null; }
let dribbble = program.dribbble ? program.dribbble : null; const opts = {
await populateConfig( sort: program.sort,
sort, order: program.order,
order, includeFork: program.fork ? true : false,
includeFork, types,
twitter, twitter: program.twitter,
linkedin, linkedin: program.linkedin,
medium, medium: program.medium,
dribbble dribbble: program.dribbble
); };
updateHTML(
("%s", username), await populateConfig(opts);
sort, updateHTML(("%s", username), opts);
order,
includeFork,
twitter,
linkedin,
medium,
dribbble
);
} }
module.exports = { module.exports = {

View file

@ -1 +1 @@
[] []

View file

@ -1,11 +1,11 @@
[ [
{ {
"username": null, "username": null,
"name": null, "name": null,
"userimg": null, "userimg": null,
"sort": null, "sort": null,
"order": null, "order": null,
"includeFork": null, "includeFork": null,
"theme": "light.css" "theme": "light.css"
} }
] ]

38
package-lock.json generated
View file

@ -152,17 +152,32 @@
"integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg==" "integrity": "sha512-zauLjrfCG+xvoyaqLoV8bLVXXNGC4JqlxFCutSDWA6fJrTo2ZuvLYTqZ7aHBLZSMOopbzwv8f+wZcVzfVTI2Dg=="
}, },
"cacheable-request": { "cacheable-request": {
"version": "6.0.0", "version": "6.1.0",
"resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.0.0.tgz", "resolved": "https://registry.npmjs.org/cacheable-request/-/cacheable-request-6.1.0.tgz",
"integrity": "sha512-2N7AmszH/WPPpl5Z3XMw1HAP+8d+xugnKQAeKvxFZ/04dbT/CAznqwbl+7eSr3HkwdepNwtb2yx3CAMQWvG01Q==", "integrity": "sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==",
"requires": { "requires": {
"clone-response": "^1.0.2", "clone-response": "^1.0.2",
"get-stream": "^4.0.0", "get-stream": "^5.1.0",
"http-cache-semantics": "^4.0.0", "http-cache-semantics": "^4.0.0",
"keyv": "^3.0.0", "keyv": "^3.0.0",
"lowercase-keys": "^1.0.1", "lowercase-keys": "^2.0.0",
"normalize-url": "^3.1.0", "normalize-url": "^4.1.0",
"responselike": "^1.0.2" "responselike": "^1.0.2"
},
"dependencies": {
"get-stream": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz",
"integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==",
"requires": {
"pump": "^3.0.0"
}
},
"lowercase-keys": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/lowercase-keys/-/lowercase-keys-2.0.0.tgz",
"integrity": "sha512-tqNXrS78oMOE73NMxK4EMLQsQowWf8jKooH9g7xPavRT706R6bkQJ6DY2Te7QukaZsulxa30wQ7bk0pm4XiHmA=="
}
} }
}, },
"caseless": { "caseless": {
@ -773,9 +788,9 @@
"integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==" "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw=="
}, },
"normalize-url": { "normalize-url": {
"version": "3.3.0", "version": "4.3.0",
"resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-3.3.0.tgz", "resolved": "https://registry.npmjs.org/normalize-url/-/normalize-url-4.3.0.tgz",
"integrity": "sha512-U+JJi7duF1o+u2pynbp2zXDW2/PADgC30f0GsHZtRh+HOcXHnw137TrNlyxxRvWW5fjKd3bcLHPxofWuCjaeZg==" "integrity": "sha512-0NLtR71o4k6GLP+mr6Ty34c5GA6CMoEsncKJxvQd8NzPxaHRJNnb5gZE8R1XF4CPIS7QPHLJ74IFszwtNVAHVQ=="
}, },
"nwsapi": { "nwsapi": {
"version": "2.1.4", "version": "2.1.4",
@ -872,6 +887,11 @@
"resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz", "resolved": "https://registry.npmjs.org/prepend-http/-/prepend-http-2.0.0.tgz",
"integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc=" "integrity": "sha1-6SQ0v6XqjBn0HN/UAddBo8gZ2Jc="
}, },
"prettier": {
"version": "1.18.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-1.18.2.tgz",
"integrity": "sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw=="
},
"proxy-addr": { "proxy-addr": {
"version": "2.0.5", "version": "2.0.5",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz", "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.5.tgz",

View file

@ -7,10 +7,11 @@
"scripts": { "scripts": {
"cli": "OUT_DIR='./dist' node bin/gitfolio.js", "cli": "OUT_DIR='./dist' node bin/gitfolio.js",
"clean": "rm -rf ./dist/*", "clean": "rm -rf ./dist/*",
"prettier": "prettier --write \"./**/*.{js,jsx,json,html,css,md}\"",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"author": { "author": {
"name": "imfunny and community", "name": "@imfunniee and community",
"email": "imfunny@wybemf.com", "email": "imfunny@wybemf.com",
"url": "https://imfunniee.github.io" "url": "https://imfunniee.github.io"
}, },
@ -41,6 +42,7 @@
"got": "^9.6.0", "got": "^9.6.0",
"handlebars": "^4.1.2", "handlebars": "^4.1.2",
"jsdom": "^15.1.0", "jsdom": "^15.1.0",
"ncp": "^2.0.0" "ncp": "^2.0.0",
"prettier": "^1.18.2"
} }
} }

View file

@ -1,11 +1,11 @@
const fs = require("fs"); const fs = require("fs");
const got = require("got");
const emoji = require("github-emoji"); const emoji = require("github-emoji");
const jsdom = require("jsdom").JSDOM, const jsdom = require("jsdom").JSDOM,
options = { options = {
resources: "usable" resources: "usable"
}; };
const { getConfig, outDir } = require("./utils"); const { getConfig, outDir } = require("./utils");
const { getRepos, getUser } = require("./api");
function convertToEmoji(text) { function convertToEmoji(text) {
if (text == null) return; if (text == null) return;
@ -35,16 +35,8 @@ function convertToEmoji(text) {
} }
} }
module.exports.updateHTML = ( module.exports.updateHTML = (username, opts) => {
username, const { includeFork, twitter, linkedin, medium, dribbble } = opts;
sort,
order,
includeFork,
twitter,
linkedin,
medium,
dribbble
) => {
//add data to assets/index.html //add data to assets/index.html
jsdom jsdom
.fromFile(`${__dirname}/assets/index.html`, options) .fromFile(`${__dirname}/assets/index.html`, options)
@ -54,38 +46,19 @@ module.exports.updateHTML = (
(async () => { (async () => {
try { try {
console.log("Building HTML/CSS..."); console.log("Building HTML/CSS...");
var repos = []; const repos = await getRepos(username, opts);
var tempRepos;
var page = 1;
if (sort == "star") {
do {
tempRepos = await got(
`https://api.github.com/users/${username}/repos?per_page=100&page=${page++}`
);
tempRepos = JSON.parse(tempRepos.body);
repos = repos.concat(tempRepos);
} while (tempRepos.length == 100);
if (order == "desc") {
repos = repos.sort(function(a, b) {
return b.stargazers_count - a.stargazers_count;
});
} else {
repos = repos.sort(function(a, b) {
return a.stargazers_count - b.stargazers_count;
});
}
} else {
do {
tempRepos = await got(
`https://api.github.com/users/${username}/repos?sort=${sort}&order=${order}&per_page=100&page=${page++}`
);
tempRepos = JSON.parse(tempRepos.body);
repos = repos.concat(tempRepos);
} while (tempRepos.length == 100);
}
for (var i = 0; i < repos.length; i++) { for (var i = 0; i < repos.length; i++) {
let element;
if (repos[i].fork == false) { if (repos[i].fork == false) {
document.getElementById("work_section").innerHTML += ` element = document.getElementById("work_section");
} else if (includeFork == true) {
document.getElementById("forks").style.display = "block";
element = document.getElementById("forks_section");
} else {
continue;
}
element.innerHTML += `
<a href="${repos[i].html_url}" target="_blank"> <a href="${repos[i].html_url}" target="_blank">
<section> <section>
<div class="section_title">${repos[i].name}</div> <div class="section_title">${repos[i].name}</div>
@ -102,8 +75,8 @@ module.exports.updateHTML = (
? "none" ? "none"
: "inline-block" : "inline-block"
};"><i class="fas fa-code"></i>&nbsp; ${ };"><i class="fas fa-code"></i>&nbsp; ${
repos[i].language repos[i].language
}</span> }</span>
<span><i class="fas fa-star"></i>&nbsp; ${ <span><i class="fas fa-star"></i>&nbsp; ${
repos[i].stargazers_count repos[i].stargazers_count
}</span> }</span>
@ -113,55 +86,18 @@ module.exports.updateHTML = (
</div> </div>
</section> </section>
</a>`; </a>`;
} else {
if (includeFork == true) {
document.getElementById("forks").style.display = "block";
document.getElementById("forks_section").innerHTML += `
<a href="${repos[i].html_url}" target="_blank">
<section>
<div class="section_title">${
repos[i].name
}</div>
<div class="about_section">
<span style="display:${
repos[i].description == undefined
? "none"
: "block"
};">${convertToEmoji(
repos[i].description
)}</span>
</div>
<div class="bottom_section">
<span style="display:${
repos[i].language == null
? "none"
: "inline-block"
};"><i class="fas fa-code"></i>&nbsp; ${
repos[i].language
}</span>
<span><i class="fas fa-star"></i>&nbsp; ${
repos[i].stargazers_count
}</span>
<span><i class="fas fa-code-branch"></i>&nbsp; ${
repos[i].forks_count
}</span>
</div>
</section>
</a>`;
}
}
} }
var user = await got(`https://api.github.com/users/${username}`); const user = await getUser(username);
user = JSON.parse(user.body);
document.title = user.login; document.title = user.login;
var icon = document.createElement("link"); var icon = document.createElement("link");
icon.setAttribute("rel", "icon"); icon.setAttribute("rel", "icon");
icon.setAttribute("href", user.avatar_url); icon.setAttribute("href", user.avatar_url);
icon.setAttribute("type", "image/png"); icon.setAttribute("type", "image/png");
document.getElementsByTagName("head")[0].appendChild(icon); document.getElementsByTagName("head")[0].appendChild(icon);
document.getElementById("profile_img").style.background = `url('${ document.getElementById(
user.avatar_url "profile_img"
}') center center`; ).style.background = `url('${user.avatar_url}') center center`;
document.getElementById( document.getElementById(
"username" "username"
).innerHTML = `<span style="display:${ ).innerHTML = `<span style="display:${
@ -206,19 +142,20 @@ module.exports.updateHTML = (
<span style="display:${ <span style="display:${
medium == null ? "none !important" : "block" medium == null ? "none !important" : "block"
};"><a href="https://www.medium.com/@${medium}/" target="_blank" class="socials"><i class="fab fa-medium-m"></i></a></span> };"><a href="https://www.medium.com/@${medium}/" target="_blank" class="socials"><i class="fab fa-medium-m"></i></a></span>
</div>`; </div>
`;
//add data to config.json //add data to config.json
const data = await getConfig(); const data = await getConfig();
data[0].username = user.login; data[0].username = user.login;
data[0].name = user.name; data[0].name = user.name;
data[0].userimg = user.avatar_url; data[0].userimg = user.avatar_url;
await fs.writeFile( await fs.writeFile(
`${outDir}/config.json`, `${outDir}/config.json`,
JSON.stringify(data, null, " "), JSON.stringify(data, null, " "),
function(err) { function(err) {
if (err) throw err; if (err) throw err;
console.log("Config file updated.\n"); console.log("Config file updated.");
} }
); );
await fs.writeFile( await fs.writeFile(

75
ui.js
View file

@ -1,6 +1,5 @@
const fs = require("fs"); const fs = require("fs");
const express = require("express"); const express = require("express");
let bodyParser = require("body-parser");
const { updateHTML } = require("./populate"); const { updateHTML } = require("./populate");
const { populateCSS, populateConfig } = require("./build"); const { populateCSS, populateConfig } = require("./build");
const { updateCommand } = require("./update"); const { updateCommand } = require("./update");
@ -8,8 +7,17 @@ const app = express();
app.set("view engine", "ejs"); app.set("view engine", "ejs");
app.use(express.static(__dirname + "/views")); app.use(express.static(__dirname + "/views"));
app.set("views", __dirname + "/views"); app.set("views", __dirname + "/views");
app.use(express.json({ limit: "50mb" })); app.use(
app.use(express.urlencoded({ limit: "50mb", extended: true })); express.json({
limit: "50mb"
})
);
app.use(
express.urlencoded({
limit: "50mb",
extended: true
})
);
const port = 3000; const port = 3000;
@ -24,11 +32,19 @@ function createBlog(title, subtitle, folder, topImage, images, content) {
// Checks to make sure this directory actually exists // Checks to make sure this directory actually exists
// and creates it if it doesn't // and creates it if it doesn't
if (!fs.existsSync(`${outDir}/blog/`)) { if (!fs.existsSync(`${outDir}/blog/`)) {
fs.mkdirSync(`${outDir}/blog/`, { recursive: true }, err => {}); fs.mkdirSync(
`${outDir}/blog/`,
{
recursive: true
},
err => {}
);
} }
if (!fs.existsSync(`${outDir}/blog/${folder}`)) { if (!fs.existsSync(`${outDir}/blog/${folder}`)) {
fs.mkdirSync(`${outDir}/blog/${folder}`, { recursive: true }); fs.mkdirSync(`${outDir}/blog/${folder}`, {
recursive: true
});
} }
fs.copyFile( fs.copyFile(
@ -70,7 +86,9 @@ function createBlog(title, subtitle, folder, topImage, images, content) {
item.split("/")[1].split(";")[0] item.split("/")[1].split(";")[0]
}`, }`,
base64Image, base64Image,
{ encoding: "base64" }, {
encoding: "base64"
},
function(err) { function(err) {
if (err) throw err; if (err) throw err;
} }
@ -89,7 +107,9 @@ function createBlog(title, subtitle, folder, topImage, images, content) {
topImage.split("/")[1].split(";")[0] topImage.split("/")[1].split(";")[0]
}`, }`,
base64ImageTop, base64ImageTop,
{ encoding: "base64" }, {
encoding: "base64"
},
function(err) { function(err) {
if (err) throw err; if (err) throw err;
} }
@ -147,6 +167,7 @@ function uiCommand() {
let sort = req.body.sort ? req.body.sort : "created"; let sort = req.body.sort ? req.body.sort : "created";
let order = req.body.order ? req.body.order : "asc"; let order = req.body.order ? req.body.order : "asc";
let includeFork = req.body.fork == "true" ? true : false; let includeFork = req.body.fork == "true" ? true : false;
let types = ["owner"];
let twitter = req.body.twitter ? req.body.twitter : null; let twitter = req.body.twitter ? req.body.twitter : null;
let linkedin = req.body.linkedin ? req.body.linkedin : null; let linkedin = req.body.linkedin ? req.body.linkedin : null;
let medium = req.body.medium ? req.body.medium : null; let medium = req.body.medium ? req.body.medium : null;
@ -155,27 +176,23 @@ function uiCommand() {
? req.body.background ? req.body.background
: "https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=1500&q=80"; : "https://images.unsplash.com/photo-1553748024-d1b27fb3f960?w=1500&q=80";
let theme = req.body.theme == "on" ? "dark" : "light"; let theme = req.body.theme == "on" ? "dark" : "light";
const opts = {
sort: sort,
order: order,
includeFork: includeFork,
types,
twitter: twitter,
linkedin: linkedin,
medium: medium,
dribbble: dribbble
};
updateHTML( updateHTML(username, opts);
username, populateCSS({
sort, background: background,
order, theme: theme
includeFork, });
twitter, populateConfig(opts);
linkedin,
medium,
dribbble
);
populateCSS({ background: background, theme: theme });
populateConfig(
sort,
order,
includeFork,
twitter,
linkedin,
medium,
dribbble
);
res.redirect("/"); res.redirect("/");
}); });
@ -186,7 +203,9 @@ function uiCommand() {
); );
} }
fs.readFile(`${outDir}/config.json`, function(err, data) { fs.readFile(`${outDir}/config.json`, function(err, data) {
res.render("blog.ejs", { profile: JSON.parse(data) }); res.render("blog.ejs", {
profile: JSON.parse(data)
});
}); });
}); });

View file

@ -4,34 +4,23 @@ const { updateHTML } = require("./populate");
async function updateCommand() { async function updateCommand() {
const data = await getConfig(); const data = await getConfig();
var username = data[0].username; var username = data[0].username;
var sort = data[0].sort; if (username == null) {
var order = data[0].order;
var includeFork = data[0].includeFork;
var twitter = data[0].twitter;
var linkedin = data[0].linkedin;
var medium = data[0].medium;
var dribbble = data[0].dribbble;
if (
username == null ||
sort == null ||
order == null ||
includeFork == null
) {
console.log( console.log(
"username not found in config.json, please run build command before using update" "username not found in config.json, please run build command before using update"
); );
return; return;
} }
updateHTML( const opts = {
username, sort: data[0].sort,
sort, order: data[0].order,
order, includeFork: data[0].includeFork,
includeFork, types: data[0].types,
twitter, twitter: data[0].twitter,
linkedin, linkedin: data[0].linkedin,
medium, medium: data[0].medium,
dribbble dribbble: data[0].dribbble
); };
updateHTML(username, opts);
} }
module.exports = { module.exports = {

View file

@ -1,10 +1,10 @@
const path = require('path'); const path = require("path");
const bluebird = require('bluebird'); const bluebird = require("bluebird");
const fs = bluebird.promisifyAll(require('fs')); const fs = bluebird.promisifyAll(require("fs"));
const outDir = path.resolve('./dist/' || process.env.OUT_DIR); const outDir = path.resolve("./dist/" || process.env.OUT_DIR);
const configPath = path.join(outDir, 'config.json'); const configPath = path.join(outDir, "config.json");
const blogPath = path.join(outDir, 'blog.json'); const blogPath = path.join(outDir, "blog.json");
const defaultConfigPath = path.resolve(`${__dirname}/default/config.json`); const defaultConfigPath = path.resolve(`${__dirname}/default/config.json`);
const defaultBlogPath = path.resolve(`${__dirname}/default/blog.json`); const defaultBlogPath = path.resolve(`${__dirname}/default/blog.json`);
@ -14,26 +14,26 @@ const defaultBlogPath = path.resolve(`${__dirname}/default/blog.json`);
* if not present returns default file contents * if not present returns default file contents
*/ */
async function getFileWithDefaults(file, defaultFile) { async function getFileWithDefaults(file, defaultFile) {
try { try {
await fs.accessAsync(file, fs.constants.F_OK); await fs.accessAsync(file, fs.constants.F_OK);
} catch (err) { } catch (err) {
const defaultData = await fs.readFileAsync(defaultFile); const defaultData = await fs.readFileAsync(defaultFile);
return JSON.parse(defaultData); return JSON.parse(defaultData);
} }
const data = await fs.readFileAsync(file); const data = await fs.readFileAsync(file);
return JSON.parse(data); return JSON.parse(data);
} }
async function getConfig() { async function getConfig() {
return getFileWithDefaults(configPath, defaultConfigPath); return getFileWithDefaults(configPath, defaultConfigPath);
} }
async function getBlog() { async function getBlog() {
return getFileWithDefaults(blogPath, defaultBlogPath); return getFileWithDefaults(blogPath, defaultBlogPath);
} }
module.exports = { module.exports = {
outDir, outDir,
getConfig, getConfig,
getBlog getBlog
}; };

View file

@ -296,4 +296,4 @@ textarea:focus {
::placeholder { ::placeholder {
color: #000; color: #000;
} }