mirror of https://github.com/kern/filepizza
mostly working
parent
4e6b8e7c18
commit
96b67dfaac
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,32 +0,0 @@
|
|||||||
/* latin */
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Lobster Two';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Lobster Two'), local('LobsterTwo'), url(./LobsterTwo.woff2) format('woff2');
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
|
||||||
}
|
|
||||||
/* latin */
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Quicksand';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 300;
|
|
||||||
src: local('Quicksand Light'), local('Quicksand-Light'), url(./QuicksandLight.woff2) format('woff2');
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
|
||||||
}
|
|
||||||
/* latin */
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Quicksand';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 400;
|
|
||||||
src: local('Quicksand Regular'), local('Quicksand-Regular'), url(./QuicksandNormal.woff2) format('woff2');
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
|
||||||
}
|
|
||||||
/* latin */
|
|
||||||
@font-face {
|
|
||||||
font-family: 'Quicksand';
|
|
||||||
font-style: normal;
|
|
||||||
font-weight: 700;
|
|
||||||
src: local('Quicksand Bold'), local('Quicksand-Bold'), url(./QuicksandBold.woff2) format('woff2');
|
|
||||||
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2212, U+2215, U+E0FF, U+EFFD, U+F000;
|
|
||||||
}
|
|
||||||
@ -1,16 +1,7 @@
|
|||||||
import { NextRequest, NextResponse } from 'next/server'
|
import { NextResponse } from 'next/server'
|
||||||
import { Channel, channelRepo } from '../../../channel'
|
import { Channel, channelRepo } from '../../../channel'
|
||||||
|
|
||||||
export async function POST(request: NextRequest): Promise<NextResponse> {
|
export async function POST(): Promise<NextResponse> {
|
||||||
const { uploaderPeerID } = await request.json()
|
const channel: Channel = await channelRepo.create()
|
||||||
|
|
||||||
if (!uploaderPeerID) {
|
|
||||||
return NextResponse.json(
|
|
||||||
{ error: 'uploaderPeerID is required' },
|
|
||||||
{ status: 400 },
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
const channel: Channel = await channelRepo.create(uploaderPeerID)
|
|
||||||
return NextResponse.json(channel)
|
return NextResponse.json(channel)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,17 @@
|
|||||||
|
import { NextRequest, NextResponse } from 'next/server'
|
||||||
|
import { channelRepo } from '../../../channel'
|
||||||
|
|
||||||
|
export async function POST(request: NextRequest): Promise<NextResponse> {
|
||||||
|
const { slug, offer } = await request.json()
|
||||||
|
|
||||||
|
if (!slug) {
|
||||||
|
return NextResponse.json({ error: 'Slug is required' }, { status: 400 })
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!offer) {
|
||||||
|
return NextResponse.json({ error: 'Offer is required' }, { status: 400 })
|
||||||
|
}
|
||||||
|
|
||||||
|
await channelRepo.offer(slug, offer)
|
||||||
|
return NextResponse.json({ success: true })
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
'use client'
|
||||||
|
|
||||||
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
||||||
|
|
||||||
|
const queryClient = new QueryClient()
|
||||||
|
|
||||||
|
export default function FilePizzaQueryClientProvider({
|
||||||
|
children,
|
||||||
|
}: {
|
||||||
|
children: React.ReactNode
|
||||||
|
}): React.ReactElement {
|
||||||
|
return (
|
||||||
|
<QueryClientProvider client={queryClient}>{children}</QueryClientProvider>
|
||||||
|
)
|
||||||
|
}
|
||||||
@ -1,40 +0,0 @@
|
|||||||
import { useEffect } from 'react'
|
|
||||||
import { useMutation } from '@tanstack/react-query'
|
|
||||||
|
|
||||||
export function useUploaderChannelRenewal(
|
|
||||||
shortSlug: string | undefined,
|
|
||||||
renewInterval = 5000,
|
|
||||||
): void {
|
|
||||||
const mutation = useMutation({
|
|
||||||
mutationFn: async () => {
|
|
||||||
const response = await fetch('/api/renew', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ slug: shortSlug }),
|
|
||||||
})
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error('Network response was not ok')
|
|
||||||
}
|
|
||||||
return response.json()
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!shortSlug) return
|
|
||||||
|
|
||||||
let timeout: NodeJS.Timeout | null = null
|
|
||||||
|
|
||||||
const run = (): void => {
|
|
||||||
timeout = setTimeout(() => {
|
|
||||||
mutation.mutate()
|
|
||||||
run()
|
|
||||||
}, renewInterval)
|
|
||||||
}
|
|
||||||
|
|
||||||
run()
|
|
||||||
|
|
||||||
return () => {
|
|
||||||
if (timeout) clearTimeout(timeout)
|
|
||||||
}
|
|
||||||
}, [shortSlug, mutation, renewInterval])
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue