mirror of
https://github.com/skidoodle/albert.lol.git
synced 2026-04-29 11:47:41 +02:00
.
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import { AppProps } from 'next/app';
|
||||
import { Analytics } from '@vercel/analytics/react';
|
||||
import { ThemeProvider } from 'next-themes';
|
||||
import Head from 'next/head';
|
||||
import '@/styles/globals.scss';
|
||||
|
||||
export default function App({ Component, pageProps }: AppProps) {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>albert</title>
|
||||
</Head>
|
||||
<ThemeProvider>
|
||||
<Component {...pageProps} />
|
||||
</ThemeProvider>
|
||||
<Analytics />
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { Html, Head, Main, NextScript } from 'next/document';
|
||||
|
||||
export default function Document() {
|
||||
return (
|
||||
<Html lang='en'>
|
||||
<Head>
|
||||
<link rel='preconnect' href='https://vitals.vercel-insights.com' />
|
||||
<meta name='title' content='albert' />
|
||||
<meta name='og:title' content='albert' />
|
||||
<meta name='description' content='system administrator' />
|
||||
<meta name='og:description' content='system administrator' />
|
||||
<meta name='theme-color' content='#000000' />
|
||||
<meta property='og:image' content='/favicon.ico' />
|
||||
</Head>
|
||||
<body>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</body>
|
||||
</Html>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import type { NextApiRequest, NextApiResponse } from 'next';
|
||||
import { SpotifyService } from '@/service/spotify';
|
||||
|
||||
const { CLIENT_ID, CLIENT_SECRET, REFRESH_TOKEN } = process.env;
|
||||
const spotify = new SpotifyService(CLIENT_ID!, CLIENT_SECRET!, REFRESH_TOKEN!);
|
||||
|
||||
export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const song = await spotify.getCurrentSong();
|
||||
if (!song || !song.isPlaying) {
|
||||
return res.status(200).json({
|
||||
nowplaying: false,
|
||||
});
|
||||
}
|
||||
res.status(200).json({
|
||||
nowplaying: true,
|
||||
song: {
|
||||
artist: song.artists.name,
|
||||
title: song.title,
|
||||
url: song.url,
|
||||
image: song.album.image,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import { MainLayout } from '@/components/MainLayout';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<MainLayout />
|
||||
</>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user