|
@ -2,7 +2,7 @@ |
|
|
// Copyright (C) 2025 DTP Technologies, LLC
|
|
|
// Copyright (C) 2025 DTP Technologies, LLC
|
|
|
// All Rights Reserved
|
|
|
// All Rights Reserved
|
|
|
|
|
|
|
|
|
import { Request, Response } from "express"; |
|
|
import { NextFunction, Request, Response } from "express"; |
|
|
|
|
|
|
|
|
import { SidebarService } from "../services/sidebar.js"; |
|
|
import { SidebarService } from "../services/sidebar.js"; |
|
|
|
|
|
|
|
@ -10,6 +10,7 @@ import { |
|
|
WebServer, |
|
|
WebServer, |
|
|
WebController, |
|
|
WebController, |
|
|
} from '../../lib/dtplib.js'; |
|
|
} from '../../lib/dtplib.js'; |
|
|
|
|
|
import { FeedService } from "app/services/feed.js"; |
|
|
|
|
|
|
|
|
export class HomeController extends WebController { |
|
|
export class HomeController extends WebController { |
|
|
|
|
|
|
|
@ -27,12 +28,18 @@ export class HomeController extends WebController { |
|
|
this.router.get('/', sidebarService.middleware(), this.getHome.bind(this)); |
|
|
this.router.get('/', sidebarService.middleware(), this.getHome.bind(this)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
async getHome (req: Request, res: Response) : Promise<void> { |
|
|
async getHome (req: Request, res: Response, next: NextFunction) : Promise<void> { |
|
|
this.log.info('session debug', { sessionId: req.session.id }); |
|
|
const feedService = this.getService<FeedService>("feed"); |
|
|
if (req.user) { |
|
|
try { |
|
|
return res.render('home-auth'); |
|
|
res.locals.feedLibrary = await feedService.getUnifiedFeed({ p: 1, skip: 0, cpp: 20 }); |
|
|
|
|
|
if (req.user) { |
|
|
|
|
|
return res.render('home-auth'); |
|
|
|
|
|
} |
|
|
|
|
|
return res.render('home'); |
|
|
|
|
|
} catch (error) { |
|
|
|
|
|
this.log.error("failed to present the Home view", { error }); |
|
|
|
|
|
return next(error); |
|
|
} |
|
|
} |
|
|
return res.render('home'); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|