mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
commit
This commit is contained in:
commit
b9dc57578a
26 changed files with 2590 additions and 0 deletions
8
pages/_app.tsx
Normal file
8
pages/_app.tsx
Normal file
|
@ -0,0 +1,8 @@
|
|||
import { AppProps } from 'next/app'
|
||||
import 'styles/globals.scss'
|
||||
|
||||
const MyApp = ({ Component, pageProps }: AppProps) => {
|
||||
return <Component {...pageProps} />
|
||||
}
|
||||
|
||||
export default MyApp
|
26
pages/_document.tsx
Normal file
26
pages/_document.tsx
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { Html, Head, Main, NextScript } from 'next/document'
|
||||
|
||||
const Document = () => {
|
||||
return (
|
||||
<>
|
||||
<Html lang='en'>
|
||||
<Head>
|
||||
<link rel='preconnect' href='https://vitals.vercel-insights.com' />
|
||||
<link rel='preconnect' href='https://ws.audioscrobbler.com' />
|
||||
<meta property='og:url' content='https://albrt.hu' />
|
||||
<meta property='og:site_name' content='albrt.hu' />
|
||||
<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>
|
||||
<Main />
|
||||
<NextScript />
|
||||
</Html>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export default Document
|
26
pages/api/s3.tsx
Normal file
26
pages/api/s3.tsx
Normal file
|
@ -0,0 +1,26 @@
|
|||
import aws from 'aws-sdk';
|
||||
|
||||
export default async function handler(req, res) {
|
||||
aws.config.update({
|
||||
accessKeyId: process.env.ACCESS_KEY,
|
||||
secretAccessKey: process.env.SECRET_KEY,
|
||||
region: process.env.REGION,
|
||||
endpoint: process.env.ENDPOINT,
|
||||
signatureVersion: 'v4'
|
||||
});
|
||||
const s3 = new aws.S3();
|
||||
const params = {
|
||||
Bucket: 'i.albrt.hu'
|
||||
}
|
||||
const data = await s3.listObjectsV2(params).promise()
|
||||
let totalsize = data.Contents!.reduce((acc, curr) => {
|
||||
return acc + curr.Size! / 1024 / 1024 / 1024
|
||||
}, 0)
|
||||
|
||||
res.statusCode = 200
|
||||
res.setHeader('Content-Type', 'application/json')
|
||||
res.end(JSON.stringify({
|
||||
'objectCount': data.KeyCount,
|
||||
'totalSize': (Math.round(totalsize * 100) / 100)
|
||||
}, null, 2))
|
||||
}
|
52
pages/index.tsx
Normal file
52
pages/index.tsx
Normal file
|
@ -0,0 +1,52 @@
|
|||
import { GetServerSideProps } from 'next'
|
||||
import Head from 'next/head'
|
||||
import FadeIn from 'react-fade-in'
|
||||
import Body from 'components/Body'
|
||||
import Icon from 'components/Icon'
|
||||
import IconLayout from 'components/IconLayout'
|
||||
import MainLayout from 'components/MainLayout'
|
||||
import Spotify from 'components/Spotify'
|
||||
import Weather from 'components/Weather'
|
||||
import { FaSteam, FaGithub, FaEnvelope } from 'react-icons/fa'
|
||||
import { RiInstagramFill } from 'react-icons/ri'
|
||||
import { SiDiscord } from 'react-icons/si'
|
||||
import dynamic from 'next/dynamic'
|
||||
const Time = dynamic(() => import('components/Time'), {
|
||||
ssr: false,
|
||||
})
|
||||
|
||||
const Home = ({data}: any) => {
|
||||
return (
|
||||
<>
|
||||
<Head>
|
||||
<title>albert</title>
|
||||
</Head>
|
||||
<Body>
|
||||
<FadeIn>
|
||||
<MainLayout />
|
||||
<IconLayout>
|
||||
<Icon icon={<FaGithub />} reference={'https://github.com/skidoodle'} copy={false} />
|
||||
<Icon icon={<FaSteam />} reference={'https://steamcommunity.com/id/_albert'} copy={false} />
|
||||
<Icon icon={<FaEnvelope />} reference={'hello@albrt.hu'} copy={true} />
|
||||
<Icon icon={<RiInstagramFill />} reference={'https://instagram.com/albertadam_'} copy={false} />
|
||||
<Icon icon={<SiDiscord />} reference={'albert#8838'} copy={true} />
|
||||
</IconLayout>
|
||||
<Time />
|
||||
<Weather data={data} />
|
||||
<Spotify />
|
||||
</FadeIn>
|
||||
</Body>
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async () => {
|
||||
const response = await fetch('https://api.openweathermap.org/data/2.5/weather?lat=47.51&lon=19.04&appid=1b3c10c18e894eaf1fd63eedde53fa54&units=metric')
|
||||
const data = await response.json()
|
||||
|
||||
return {
|
||||
props: { data }
|
||||
}
|
||||
}
|
||||
|
||||
export default Home
|
Loading…
Add table
Add a link
Reference in a new issue