Skip to content

Commit

Permalink
Upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
JMPerez committed May 25, 2024
1 parent d0493aa commit 548c068
Show file tree
Hide file tree
Showing 21 changed files with 670 additions and 5,960 deletions.
3 changes: 0 additions & 3 deletions .eslintrc.json

This file was deleted.

7 changes: 2 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# sitemap & robots
public/robots.txt
public/sitemap*.*
# robots
public/robots.txt
6 changes: 0 additions & 6 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ You can check it out on [https://spotify-dedup.com](https://spotify-dedup.com) o

Install the dependencies:

yarn install
pnpm install

Run it:

yarn dev
pnpm dev

Then open http://localhost:3000 in a browser

Expand Down
19 changes: 10 additions & 9 deletions pages/api/buymecoffee.ts → app/api/bmc/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import * as cheerio from 'cheerio';

import { NextApiRequest, NextApiResponse } from 'next';
import { NextRequest, NextResponse } from 'next/server';

import axios from 'axios';

const BuyMeACoffee = async (_req: NextApiRequest, res: NextApiResponse) => {
export async function GET(_req: NextRequest) {
const url = 'https://www.buymeacoffee.com/jmp';
const selector = '.text-grey71.!font-cr-regular.text-sm';
const response = await axios.get(url);
Expand All @@ -13,11 +13,12 @@ const BuyMeACoffee = async (_req: NextApiRequest, res: NextApiResponse) => {
const supportersText = $(selector).text().trim();
const supportersNumber = supportersText.replace(/[^0-9]/g, '');

res.setHeader(
'Cache-Control',
'public, max-age=0, s-maxage=86400'
return NextResponse.json(
{ total: supportersNumber },
{
headers: {
'Cache-Control': 'public, max-age=0, s-maxage=86400',
},
}
);
return res.status(200).json({ total: supportersNumber });
};

export default BuyMeACoffee;
}
18 changes: 18 additions & 0 deletions app/robots.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type { MetadataRoute } from 'next'

export default function robots(): MetadataRoute.Robots {
return {
rules: [
{
userAgent: ['mj12', 'Dotbot'],
disallow: '/',
},
{
userAgent: '*',
allow: '/',
},

],
sitemap: 'https://spotify-dedup.com/sitemap.xml',
}
}
16 changes: 16 additions & 0 deletions app/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xhtml="http://www.w3.org/1999/xhtml">
<url>
<loc>https://spotify-dedup.com</loc>
<xhtml:link rel="alternate" hreflang="de" href="https://spotify-dedup.com/de" />
<xhtml:link rel="alternate" hreflang="es" href="https://spotify-dedup.com/es" />
<xhtml:link rel="alternate" hreflang="fr" href="https://spotify-dedup.com/fr" />
<xhtml:link rel="alternate" hreflang="id" href="https://spotify-dedup.com/id" />
<xhtml:link rel="alternate" hreflang="it" href="https://spotify-dedup.com/it" />
<xhtml:link rel="alternate" hreflang="nl" href="https://spotify-dedup.com/nl" />
<xhtml:link rel="alternate" hreflang="pl" href="https://spotify-dedup.com/pl" />
<xhtml:link rel="alternate" hreflang="pt" href="https://spotify-dedup.com/pt" />
<xhtml:link rel="alternate" hreflang="sv" href="https://spotify-dedup.com/sv" />
<xhtml:link rel="alternate" hreflang="tr" href="https://spotify-dedup.com/tr" />
</url>
</urlset>
2 changes: 1 addition & 1 deletion components/pages/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { AvailableLanguages } from '@/languages';
import Head from 'next/head';
import React from 'react';
import { useTranslation } from 'react-i18next';
import OAuthManager from '../../dedup/oauthManager';
import SpotifyWebApi from '../../dedup/spotifyApi';
import { AvailableLanguages } from '../../i18n';
import Faq from '../faq';
import Features from '../features';
import Footer from '../footer';
Expand Down
4 changes: 2 additions & 2 deletions components/reviews.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import fetcher from '@/lib/fetcher';
import { useTranslation } from 'react-i18next';
import useSWR from 'swr';
const Reviews = () => {
const { data } = useSWR('/api/buymecoffee', fetcher<{ total: number }>);
const { data } = useSWR('/api/bmc', fetcher<{ total: number }>);

const { t, i18n } = useTranslation();
return (
Expand Down Expand Up @@ -75,7 +75,7 @@ const Reviews = () => {
</p>
<p className="mt-4 text-lg tracking-tight text-center text-slate-700" dangerouslySetInnerHTML={{
__html: t('home.review', {
supportersCount: '<span class="font-semibold">' + (data && new Number(data.total).toLocaleString(i18n.language)) + '</span>',
supportersCount: '<span class="font-semibold">' + (new Number(data?.total || 1400).toLocaleString(i18n.language)) + '</span>',
linkOpen: '<a href="https://www.buymeacoffee.com/jmp" class="font-semibold">',
linkClose: '</a>',
}),
Expand Down
18 changes: 2 additions & 16 deletions i18n.js → i18n.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';

export const AvailableLanguages = [
'de',
'en',
'es',
'fr',
'id',
'it',
'nl',
'pl',
'pt',
'sv',
'tr',
];

// the translations
// (tip move them in a JSON file and import them)
const resources = {
Expand Down Expand Up @@ -109,15 +95,15 @@ const resources = {
'faq.question-10': 'Does this tool work with other music streaming services?',
'faq.answer-10': 'No, this tool only works with Spotify through Spotify\'s Web API.',
},
},
fallbackLng: 'en',
}
};

i18n
.use(initReactI18next) // passes i18n down to react-i18next
.init({
resources,
lng: 'en',
fallbackLng: 'en',
keySeparator: false, // we do not use keys in form messages.welcome
debug: false,
react: {
Expand Down
14 changes: 14 additions & 0 deletions languages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@

export const AvailableLanguages = [
'de',
'en',
'es',
'fr',
'id',
'it',
'nl',
'pl',
'pt',
'sv',
'tr',
];
6 changes: 0 additions & 6 deletions next-sitemap.config.js

This file was deleted.

7 changes: 7 additions & 0 deletions next.config.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const nextConfig = {
experimental: {
reactCompiler: true,
},
};

module.exports = nextConfig;
Loading

0 comments on commit 548c068

Please sign in to comment.