Update site appearance and user authentication functionality

Implement a new login system, update UI elements, and enable static asset serving for images.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 069d4324-6c40-4355-955e-c714a50de1ea
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/3df548ff-50ae-432f-9be4-25d34eccc983/069d4324-6c40-4355-955e-c714a50de1ea/InMLMqG
This commit is contained in:
kimjaehyeon0101
2025-09-29 16:29:07 +00:00
parent 9633469631
commit d8491366cf
16 changed files with 331 additions and 167 deletions

View File

@ -1,7 +1,7 @@
import type { Express } from "express";
import { createServer, type Server } from "http";
import { storage } from "./storage";
import { setupAuth, isAuthenticated } from "./replitAuth";
import { setupAuth, isAuthenticated } from "./simpleAuth";
import { insertArticleSchema, insertMediaOutletRequestSchema, insertBidSchema, insertCommentSchema } from "@shared/schema";
export async function registerRoutes(app: Express): Promise<Server> {
@ -11,8 +11,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
// Auth routes
app.get('/api/auth/user', isAuthenticated, async (req: any, res) => {
try {
const userId = req.user.claims.sub;
const user = await storage.getUser(userId);
const user = req.user;
res.json(user);
} catch (error) {
console.error("Error fetching user:", error);
@ -82,8 +81,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
app.post('/api/articles', isAuthenticated, async (req: any, res) => {
try {
const userId = req.user.claims.sub;
const user = await storage.getUser(userId);
const user = req.user;
if (!user || (user.role !== 'admin' && user.role !== 'superadmin')) {
return res.status(403).json({ message: "Insufficient permissions" });
@ -91,7 +89,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
const articleData = insertArticleSchema.parse({
...req.body,
authorId: userId
authorId: user.id
});
const article = await storage.createArticle(articleData);