GithubHelp home page GithubHelp logo

darckfast / novatorem Goto Github PK

View Code? Open in Web Editor NEW

This project forked from novatorem/novatorem

0.0 1.0 0.0 287 KB

Dynamic realtime profile ReadMe linked with spotify

Home Page: https://novatorem.vercel.app

License: The Unlicense

HTML 3.91% JavaScript 6.93% TypeScript 89.15%

novatorem's Introduction

Spotify

Set Up Guide

Spotify

  • Create a Spotify Application
  • Take note of:
    • Client ID
    • Client Secret
  • Click on Edit Settings
  • In Redirect URIs:
    • Add http://localhost/callback/

Refresh Token

  • Navigate to the following URL:
https://accounts.spotify.com/authorize?client_id={SPOTIFY_CLIENT_ID}&response_type=code&scope=user-read-currently-playing,user-read-recently-played&redirect_uri=http://localhost/callback/
  • After logging in, save the {CODE} portion of: http://localhost/callback/?code={CODE}

  • Create a string combining {SPOTIFY_CLIENT_ID}:{SPOTIFY_CLIENT_SECRET} (e.g. 5n7o4v5a3t7o5r2e3m1:5a8n7d3r4e2w5n8o2v3a7c5) and encode into Base64.

  • Then run a curl command in the form of:

curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Authorization: Basic {BASE64}" -d "grant_type=authorization_code&redirect_uri=http://localhost/callback/&code={CODE}" https://accounts.spotify.com/api/token
  • Save the Refresh token

Vercel

  • Register on Vercel

  • Fork this repo, then create a vercel project linked to it

  • Add secret environment variables:

    • https://vercel.com/<YourName>/<ProjectName>/settings/environment-variables
      • SPOTIFY_REFRESH_TOKEN
      • SPOTIFY_CLIENT_ID
      • SPOTIFY_SECRET_ID
  • Deploy!

ReadMe

You can now use the following in your readme:

[![Spotify](https://USER_NAME.vercel.app/api/spotify)](https://open.spotify.com/user/USER_NAME)

Customization

This fork uses styled components to create the Html/Css component. All customization available on file src/styles/theme.ts.

const theme = {
  colors: {
    background: '#121214',
    backgroundLight: '#2a2a2f',
    text: '#e1e1e6',
    primary: '#8257e6',
    secondary: '#0ec63c'
  },
  bars: {
    amount: 60,
    margin: '0.5px',
    color: {
      primary: '#8257e6'
    },
    width: '4px',
    height: '3px',
    container: {
      height: '30px',
      width: '40px'
    }
  },
  artist: {
    fontSize: '20px',
    fontColor: '#e1e1e6',
    margin: '5px 0 0 0'
  },
  song: {
    width: '13em',
    fontSize: '24px',
    fontColor: '#808080',
    margin: '0.7em 0 0.7em 0'
  },
  albumCover: {
    margin: '1em',
    width: '128px',
    borderRadius: '4px',
    boxShadow: '4px 4px #8257e6;'
  },
  dimension: {
    width: '480',
    height: '164'
  },
  fontFamily: 'Roboto, sans-serif',
  placeHolder: {
    albumCover: 'https://i.imgur.com/FAMtjqN.png',
    musicName: 'No music playing now',
    artists: 'None'
  }
}

export default theme

Developing

Requirements

  • To run this app locally, you will need the Vercel CLI
  • yarn installed

Install all deps

$ yarn

This will make all files inside of api as a endpoint

$ vercel dev

Export locally all the needed keys

$ export SPOTIFY_CLIENT_ID=c4ca4238a0b... 
$ export SPOTIFY_SECRET_ID=c81e728d9d4... 
$ export SPOTIFY_REFRESH_TOKEN=a0X54-... 

Test the main endpoint, it should return a html

$ curl localhost:3000/api/spotify 

novatorem's People

Contributors

darckfast avatar lizzykerrigan avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.