Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump actions/checkout from 2 to 3 #2

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .env.example

This file was deleted.

2 changes: 2 additions & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_HOST_URL=http://localhost:3000
NEXT_PUBLIC_USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

# Maintain dependencies for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"
2 changes: 1 addition & 1 deletion .github/workflows/codeberg-mirror.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
codeberg:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: pixta-dev/repository-mirroring-action@v1
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:lts-bullseye
WORKDIR /app
RUN apt update -y && apt upgrade -y \
&& apt install -y --no-install-recommends git \
&& apt autoclean -y \
&& apt autoremove -y \
&& rm -rf /var/lib/apt/lists/* \
&& npm install -g pnpm \
&& git clone --depth=1 https://github.com/nesaku/SpotifyInfo.git . \
&& pnpm install \
&& pnpm build
EXPOSE 3000
CMD ["pnpm", "start"]
2 changes: 1 addition & 1 deletion LICENSE.txt → LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -658,4 +658,4 @@ specific requirements.
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.
<https://www.gnu.org/licenses/>.
97 changes: 15 additions & 82 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,96 +27,29 @@ SpotifyInfo - Get Info On A Spotify Track

---

## Instances
## Security Audits:

| Instance URL | Country | Provider | Notes |
| --------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------: | ---------- | ----------------------------------------------- |
| [spotifyinfo.netlify.app](https://spotifyinfo.netlify.app) | :us: | Netlify | Run by [me](https://github.com/nesaku) |
| [spotifyinfo.vercel.app](https://spotifyinfo.vercel.app) | :us: | Vercel | Run by [me](https://github.com/nesaku) |

---

## FAQ

### How Do I Use This?

There are two ways you can use SpotifyInfo:

1. Visit [spotifyinfo.netlify.app](spotifyinfo.netlify.app) and paste the Spotify track url into the input box.
2. Replace `https://open.spotify.com` of any url with `spotifyinfo.netlify.app`. Then click the "Fetch Data" button.
3. Append `https://open.spotify.com` of any url with `spotifyinfo.netlify.app`. Then click the "Fetch Data" button.

### How Does This Work? - Scraping

While the [Spotify developer Web API](https://developer.spotify.com/documentation/web-api/) could have been used for this project. I weighed the pros and cons and chose to go with scraping the required content off the track page instead.

Some of the pros of the Spotify Web API are that it is more stable than scraping, it is more quicker than scraping, good documentation, officially suported, the API has many features and etc. Some of the cons of the Web API are that all requests made are tied to a single developer token, their [Developer Terms of Service](https://developer.spotify.com/terms/) must be followed and that a developer account is required to use the Web API.

### Why Is This Slower Than Spotify?

When you make a request for a song on SpotifyInfo, your request needs to be first scraped by the scraper from Spotify before the result can be shown to you. This causes a delay from when you make the request to when the result is shown.

### What Do You Do With My Data?
- [Internet.ml](https://internet.nl/site/listen-spotify.whateveritworks.org/2060148/)
- [Mozilla.org](https://observatory.mozilla.org/)
- [ImmuniWeb](https://www.immuniweb.com/ssl/listen-spotify.whateveritworks.org/a8FxuGr6/)
- [HSTS Preload](https://hstspreload.org/)
- [SSL Labs](https://www.ssllabs.com/ssltest/analyze.html?d=listen-spotify.whateveritworks.org)
- [Security Headers](https://securityheaders.com/?q=listen-spotify.whateveritworks.org&hide=on&followRedirects=on)

Nothing. Since we don't collect any user data we can't use it

### Why Is This Missing Functionality?
## Usage:

SpotifyInfo, is still a work in progress and new functionality is continually being developed. If you have a certain feature that you would like to see, feel free to open an issue on GitHub

## Installation:

### Manual Installation

**Prerequisites:**

- [Node.js](https://nodejs.org/en/)
- [Git](https://github.com/git-guides/install-git)

1. Clone the Git Repository

```bash
git clone https://github.com/nesaku/SpotifyInfo.git
cd SpotifyInfo
cp .env.example .env.local
```

2. Edit the .env file if required

3. Install & Start The Project

```bash
npm install
npm run start
# or
yarn install
yarn start
```

---
1. Buy [Hetzner.com](https://hetzner.com) it's 100% renewal hardware and you get affordable dedicated servers, and you also help save the world.

## Development:
2. Get [Cloudflare](https://cloudflare.com) it's carbon renewal and you help save the world.

### Built Using
3. ```apt install git```

- Next.js
- Cheerio
- TailwindCSS
4. ```git clone https://github.com/WhateverItWorks/my-SpotifyInfo-docker-compose.git spotify```

### Getting Started
5. ```nano docker-compose.yml```

To run the development server:
6. ```docker-compose up -d --build```

```bash
git clone https://github.com/nesaku/SpotifyInfo.git
cd SpotifyInfo
cp .env.example .env.local
# then
npm install
npm run dev
# or
yarn install
yarn dev
```

**ⓘ If you want use the API directly or run any kind of automation. Please host the API on your own server.**
```http://localhost:3014```
25 changes: 25 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
version: '3.7'

services:
spotifyinfo:
container_name: spotifyinfo
hostname: spotifyinfo
build: .
user: 65534:65534
read_only: true
restart: always
ports:
- '127.0.0.1:3014:3000'
environment:
- "NEXT_PUBLIC_HOST_URL=http://localhost:3014"
- "NEXT_PUBLIC_USER_AGENT=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36"
security_opt:
- no-new-privileges:true
cap_drop:
- ALL
# use if you get the error: ERROR: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network
#sudo docker network create "spotifyinfo" --subnet="172.16.0.0/16"
#networks:
#default:
#external:
#name: spotifyinfo
41 changes: 41 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;

server_name changethis;

add_header strict_sni on;
add_header strict_sni_header on;
add_header Strict-Transport-Security "max-age=31536000" always;
add_header Content-Security-Policy upgrade-insecure-requests;
add_header X-XSS-Protection "1; mode=block";
add_header X-Frame-Options "DENY";
add_header Clear-Site-Data "cookies";
add_header X-Content-Type-Options nosniff;
add_header Referrer-Policy "strict-origin";
add_header Permissions-Policy "geolocation=(),midi=(),sync-xhr=(),microphone=(),camera=(),magnetometer=(),gyroscope=(),fullscreen=(self),payment=()";
resolver 1.1.1.1;

ssl_certificate /etc/letsencrypt/live/changethis/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/changethis/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/changethis/chain.pem;
include /etc/letsencrypt/options-ssl-nginx.conf;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
ssl_stapling on;
ssl_stapling_verify on;

access_log /dev/null;
error_log /dev/null;

location / {
proxy_set_header X-Forwarded-For $remote_addr;
proxy_pass http://localhost:3014;
}
}

server {
listen 80;
listen [::]:80;
server_name changethis;
return 301 https://changethis$request_uri;
}