We are launching a docker version (server version) today so we want to just organize the repo so its easier to navigate.
82 lines
3.8 KiB
TypeScript
82 lines
3.8 KiB
TypeScript
import { FastifyInstance, FastifyRequest, FastifyReply } from 'fastify';
|
|
import * as fs from 'fs';
|
|
import * as path from 'path';
|
|
|
|
async function viewsRoutes(fastify: FastifyInstance) {
|
|
fastify.get('/', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'users.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/anime', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'anime', 'animes.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/my-list', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'list.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/books', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'books', 'books.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/schedule', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'schedule.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/gallery', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'gallery', 'gallery.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/marketplace', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'marketplace.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/gallery/:extension/*', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'gallery', 'image.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/gallery/favorites/*', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'gallery', 'image.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/anime/:id', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'anime', 'anime.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/anime/:extension/*', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'anime', 'anime.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/watch/:id/:episode', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'anime', 'watch.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/book/:id', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'books', 'book.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/book/:extension/*', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'books', 'book.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
|
|
fastify.get('/read/:provider/:chapter/*', (req: FastifyRequest, reply: FastifyReply) => {
|
|
const stream = fs.createReadStream(path.join(__dirname, '..', '..', 'views', 'books', 'read.html'));
|
|
reply.type('text/html').send(stream);
|
|
});
|
|
}
|
|
|
|
export default viewsRoutes; |