mirror of
https://github.com/R0m1k3/Socialflow.git
synced 2026-10-11 17:26:45 +02:00
4 files changed
+45
-2
No files matched your search
@@ -18,6 +18,10 @@ externalPort = 80
|
|||||||
localPort = 35357
|
localPort = 35357
|
||||||
externalPort = 3002
|
externalPort = 3002
|
||||||
|
|
||||||
|
[[ports]]
|
||||||
|
localPort = 37659
|
||||||
|
externalPort = 4200
|
||||||
|
|
||||||
[[ports]]
|
[[ports]]
|
||||||
localPort = 40537
|
localPort = 40537
|
||||||
externalPort = 3000
|
externalPort = 3000
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useQuery, useMutation } from "@tanstack/react-query";
|
import { useQuery, useMutation } from "@tanstack/react-query";
|
||||||
import { Plus, Facebook, Instagram, Trash2, RefreshCw, Edit } from "lucide-react";
|
import { Plus, Facebook, Instagram, Trash2, RefreshCw, Edit, Bug, Code } from "lucide-react";
|
||||||
import Sidebar from "@/components/sidebar";
|
import Sidebar from "@/components/sidebar";
|
||||||
import TopBar from "@/components/topbar";
|
import TopBar from "@/components/topbar";
|
||||||
import { Button } from "@/components/ui/button";
|
import { Button } from "@/components/ui/button";
|
||||||
@@ -73,6 +73,25 @@ export default function PagesManagement() {
|
|||||||
<EditPageDialog page={editingPage} onOpenChange={(open) => !open && setEditingPage(null)} />
|
<EditPageDialog page={editingPage} onOpenChange={(open) => !open && setEditingPage(null)} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="flex gap-3 mb-6">
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
onClick={() => window.open('https://developers.facebook.com/tools/debug/accesstoken/', '_blank')}
|
||||||
|
data-testid="button-debug-token"
|
||||||
|
>
|
||||||
|
<Bug className="w-4 h-4 mr-2" />
|
||||||
|
Débogueur de jeton
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
variant="outline"
|
||||||
|
onClick={() => window.open('https://developers.facebook.com/tools/explorer', '_blank')}
|
||||||
|
data-testid="button-graph-explorer"
|
||||||
|
>
|
||||||
|
<Code className="w-4 h-4 mr-2" />
|
||||||
|
Graph Explorer
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
{isLoading ? (
|
{isLoading ? (
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
{[1, 2, 3].map((i) => (
|
{[1, 2, 3].map((i) => (
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ Preferred communication style: Simple, everyday language.
|
|||||||
- sameSite: 'lax' pour prévention CSRF
|
- sameSite: 'lax' pour prévention CSRF
|
||||||
- Durée de session: 7 jours
|
- Durée de session: 7 jours
|
||||||
- Secret de session via variable d'environnement `SESSION_SECRET`
|
- Secret de session via variable d'environnement `SESSION_SECRET`
|
||||||
|
- Store de session:
|
||||||
|
- **Production**: PostgreSQL via connect-pg-simple (table `session` auto-créée)
|
||||||
|
- **Développement**: MemoryStore (par défaut)
|
||||||
|
|
||||||
**Protection des routes**:
|
**Protection des routes**:
|
||||||
- Backend: Middleware `requireAuth` pour routes utilisateur, `requireAdmin` pour routes admin
|
- Backend: Middleware `requireAuth` pour routes utilisateur, `requireAdmin` pour routes admin
|
||||||
@@ -94,7 +97,9 @@ Preferred communication style: Simple, everyday language.
|
|||||||
- Scheduler service running every minute to check for pending posts
|
- Scheduler service running every minute to check for pending posts
|
||||||
- Automated post publication to social media platforms
|
- Automated post publication to social media platforms
|
||||||
|
|
||||||
**Session Management**: Stateless authentication with session cookies (connect-pg-simple for PostgreSQL session store)
|
**Session Management**:
|
||||||
|
- Développement: MemoryStore (sessions en mémoire)
|
||||||
|
- Production: connect-pg-simple (sessions persistées dans PostgreSQL, table `session`)
|
||||||
|
|
||||||
**Key Architectural Patterns**:
|
**Key Architectural Patterns**:
|
||||||
- Service layer pattern (OpenRouterService, CloudinaryService, SchedulerService)
|
- Service layer pattern (OpenRouterService, CloudinaryService, SchedulerService)
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import express, { type Request, Response, NextFunction } from "express";
|
import express, { type Request, Response, NextFunction } from "express";
|
||||||
import session from "express-session";
|
import session from "express-session";
|
||||||
|
import connectPgSimple from "connect-pg-simple";
|
||||||
|
import pg from "pg";
|
||||||
import passport from "./auth";
|
import passport from "./auth";
|
||||||
import { registerRoutes } from "./routes";
|
import { registerRoutes } from "./routes";
|
||||||
import { setupVite, serveStatic, log } from "./vite";
|
import { setupVite, serveStatic, log } from "./vite";
|
||||||
@@ -7,6 +9,7 @@ import { schedulerService } from "./services/scheduler";
|
|||||||
import { ensureAdminUserExists } from "./init-admin";
|
import { ensureAdminUserExists } from "./init-admin";
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
const PgSession = connectPgSimple(session);
|
||||||
|
|
||||||
declare module 'http' {
|
declare module 'http' {
|
||||||
interface IncomingMessage {
|
interface IncomingMessage {
|
||||||
@@ -28,7 +31,19 @@ if (!process.env.SESSION_SECRET) {
|
|||||||
// Déterminer si on utilise HTTPS basé sur APP_URL
|
// Déterminer si on utilise HTTPS basé sur APP_URL
|
||||||
const isHttps = process.env.APP_URL?.startsWith('https://') || false;
|
const isHttps = process.env.APP_URL?.startsWith('https://') || false;
|
||||||
|
|
||||||
|
// Configuration du store de session pour production
|
||||||
|
const sessionStore = process.env.NODE_ENV === 'production' && process.env.DATABASE_URL
|
||||||
|
? new PgSession({
|
||||||
|
pool: new pg.Pool({
|
||||||
|
connectionString: process.env.DATABASE_URL,
|
||||||
|
}),
|
||||||
|
tableName: 'session',
|
||||||
|
createTableIfMissing: true,
|
||||||
|
})
|
||||||
|
: undefined; // MemoryStore par défaut en dev
|
||||||
|
|
||||||
app.use(session({
|
app.use(session({
|
||||||
|
store: sessionStore,
|
||||||
secret: process.env.SESSION_SECRET || 'your-secret-key-change-me',
|
secret: process.env.SESSION_SECRET || 'your-secret-key-change-me',
|
||||||
resave: false,
|
resave: false,
|
||||||
saveUninitialized: false,
|
saveUninitialized: false,
|
||||||
|
|||||||
Reference in new issue
Block a user