From c520df5b0093360282154021e3fc70e78a435013 Mon Sep 17 00:00:00 2001 From: novatorem Date: Wed, 22 Jul 2020 00:03:44 -0400 Subject: [PATCH] Added setup instructions --- README.md | 2 +- SetUp.md | 44 +++++++++++++++++++++++++++++++++++ api/templates/spotify.html.j2 | 2 +- 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 SetUp.md diff --git a/README.md b/README.md index f6739b3..ac464f4 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ Aphelion | Perihelion :-------------------------:|------- -                                                                                              [![Spotify](https://novatorem.vercel.app/api/spotify-playing)](https://open.spotify.com/user/omnitenebris)
|
Software Developer currently working on cool projects at [Cast](https://blacktrax.cast-soft.com/). Everything here is under the MIT License, [info here](https://choosealicense.com/licenses/mit/)!

[![Website](https://img.shields.io/badge/website-dev-2a8?style=flat-square&logo=safari&logoColor=white)](https://novac.dev) [![E-Mail](https://img.shields.io/badge/email-reveal-369?style=flat-square&logo=gmail&logoColor=white)](https://mailhide.io/e/5ck1H)
[![Spotify](https://img.shields.io/badge/spotify-omni-1DB954?style=flat-square&logo=spotify&logoColor=white)](https://open.spotify.com/user/omnitenebris) [![E-Mail](https://badges.pufler.dev/visits/novatorem/novatorem?logo=GitHub&label=github%20visits&color=blue&logoColor=white&style=flat-square)](https://github.com/novatorem)

+                                                                                              [![Spotify](https://novatorem.vercel.app/api/spotify-playing)](https://open.spotify.com/user/omnitenebris)
|
Software Developer currently working on cool projects at [Cast](https://blacktrax.cast-soft.com/showcase/). Everything here is under the MIT License, [info here](https://choosealicense.com/licenses/mit/)!

[![Website](https://img.shields.io/badge/website-dev-2a8?style=flat-square&logo=safari&logoColor=white)](https://novac.dev) [![E-Mail](https://img.shields.io/badge/email-reveal-369?style=flat-square&logo=gmail&logoColor=white)](https://mailhide.io/e/5ck1H)
[![Spotify](https://img.shields.io/badge/spotify-omni-1DB954?style=flat-square&logo=spotify&logoColor=white)](https://open.spotify.com/user/omnitenebris) [![E-Mail](https://badges.pufler.dev/visits/novatorem/novatorem?logo=GitHub&label=github%20visits&color=blue&logoColor=white&style=flat-square)](https://github.com/novatorem)

[//]: <> (The ` ` is to have Aphelion take up more space) \ No newline at end of file diff --git a/SetUp.md b/SetUp.md new file mode 100644 index 0000000..182a394 --- /dev/null +++ b/SetUp.md @@ -0,0 +1,44 @@ +# Set Up Guide + +## Spotify + +* Create a [Spotify Application](https://developer.spotify.com/dashboard/applications) +* Put aside: + * `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](https://www.base64encode.org/). + +* Then run a [curl command](https://httpie.org/run) in the form of: +```sh +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](https://vercel.com/) + +* Create project linked to your github repo + +* Add System Variables: + * `https://vercel.com///settings/environment-variables` + * `SPOTIFY_REFRESH_TOKEN` + * `SPOTIFY_CLIENT_ID` + * `SPOTIFY_SECRET_ID` + +* Deploy! diff --git a/api/templates/spotify.html.j2 b/api/templates/spotify.html.j2 index e8c477c..c96c466 100644 --- a/api/templates/spotify.html.j2 +++ b/api/templates/spotify.html.j2 @@ -35,7 +35,7 @@ } .text { - width: 73%; + width: 71%; } .song {