Thursday, May 28, 2026

Ibyo police yagezweho byagizwemo uruhare n'abanyarwanda


 

0 Comments:

Post a Comment

Comment here

Subscribe to Post Comments [Atom]

<< Home

.

Nzayisenga Adrien

Rwanda • Africa • History • Business • Technology • Knowledge

Page Views
0
Visitors
0
AdSense Revenue
Check AdSense

Support Nzayisenga Adrien

Ushobora gushyigikira ibikorwa byacu by'ubushakashatsi, ubumenyi, amateka n'itangazamakuru.

Support / Pay

Uko system ikora

Abasomyi basura blog → Google igatanga ads → abantu bareba cyangwa bagakanda ads mu buryo busanzwe → AdSense ikabara amafaranga → Google ikishyura konti yawe hakurikijwe payment settings za AdSense.

Ntukande ku matangazo yawe kandi ntusabe abandi kuyakandaho. Clicks zigomba kuba genuine.

. Rwanda Nziza Ngobyi Iduhetse | ADFID TV | Nzayisenga Adrien ADFID Africa | Digital Library & AI Content Creator

ADFID Africa

African knowledge, digital publishing and AI-powered content creation in one platform.

🤖 AI Content Creator

Create articles, YouTube scripts, Shorts, Facebook posts and SEO content.

📚 Digital Library

Store and manage your African books, research and educational resources.

📺 ADFID TV

Transform written articles into video-ready scripts.

💰 Monetization

Prepare your platform for advertising, subscriptions and reader support.

🤖 ADFID TV AI Content Creator

Create multiple content formats from one article.

📚 ADFID Africa Digital Library

📤 Upload E-Book

📊 ADFID Dashboard

Books

0

Articles Created

0

AI Generations

0

Platform Status

ONLINE

System Information

This running version stores demo data in your browser using localStorage.

For a production platform, connect this interface to a real backend, database, authentication system and AI API.

❤️ Support ADFID Africa

Support Knowledge & African Digital Content

Your support can help develop educational materials, African history resources, digital books and media content.


Email: nayisengadrianos@gmail.com

Mobile: +250 784 296 338

require("dotenv").config(); const express = require("express"); const multer = require("multer"); const path = require("path"); const crypto = require("crypto"); const { createClient } = require("@supabase/supabase-js"); const app = express(); const PORT = process.env.PORT || 3000; const SUPABASE_URL = process.env.SUPABASE_URL; const SUPABASE_SERVICE_KEY = process.env.SUPABASE_SERVICE_KEY; const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD; if (!SUPABASE_URL || !SUPABASE_SERVICE_KEY || !ADMIN_PASSWORD) { console.error("Missing required environment variables."); process.exit(1); } const supabase = createClient( SUPABASE_URL, SUPABASE_SERVICE_KEY, { auth: { autoRefreshToken: false, persistSession: false } } ); app.use(express.json()); app.use(express.urlencoded({ extended: true })); app.use(express.static(path.join(__dirname, "public"))); const upload = multer({ storage: multer.memoryStorage(), limits: { fileSize: 100 * 1024 * 1024 }, fileFilter: (req, file, cb) => { const extension = path.extname(file.originalname).toLowerCase(); if ( extension !== ".pdf" && file.mimetype !== "application/pdf" ) { return cb(new Error("Only PDF files are allowed.")); } cb(null, true); } }); function checkAdmin(req, res, next) { const password = req.headers["x-admin-password"]; if (!password || password !== ADMIN_PASSWORD) { return res.status(401).json({ error: "Unauthorized" }); } next(); } function cleanFileName(name) { return name .replace(/[^a-zA-Z0-9._-]/g, "-") .replace(/-+/g, "-") .toLowerCase(); } /* GET BOOKS */ app.get("/api/books", async (req, res) => { try { const search = (req.query.search || "").trim(); let query = supabase .from("books") .select("*") .order("created_at", { ascending: false }); if (search) { query = query.or( `title.ilike.%${search}%,author.ilike.%${search}%,category.ilike.%${search}%` ); } const { data, error } = await query; if (error) { throw error; } res.json(data || []); } catch (error) { console.error(error); res.status(500).json({ error: "Unable to load books." }); } }); /* UPLOAD BOOK */ app.post( "/api/books", checkAdmin, upload.single("pdf"), async (req, res) => { try { if (!req.file) { return res.status(400).json({ error: "Please select a PDF file." }); } const title = (req.body.title || "").trim(); const author = (req.body.author || "").trim(); const description = (req.body.description || "").trim(); const category = (req.body.category || "General").trim(); if (!title || !author) { return res.status(400).json({ error: "Title and author are required." }); } const unique = crypto.randomBytes(8).toString("hex"); const filename = `${Date.now()}-${unique}-${cleanFileName(req.file.originalname)}`; const storagePath = `pdfs/${filename}`; /* Upload PDF to Supabase Storage */ const { error: uploadError } = await supabase.storage .from("books") .upload( storagePath, req.file.buffer, { contentType: "application/pdf", upsert: false } ); if (uploadError) { throw uploadError; } /* Get public PDF URL */ const { data: publicData } = supabase.storage .from("books") .getPublicUrl(storagePath); const pdfUrl = publicData.publicUrl; /* Save book information */ const { data, error } = await supabase .from("books") .insert({ title, author, description, category, pdf_path: storagePath, pdf_url: pdfUrl, downloads: 0 }) .select() .single(); if (error) { throw error; } res.json({ success: true, message: "Book uploaded successfully.", book: data }); } catch (error) { console.error(error); res.status(500).json({ error: error.message || "Book upload failed." }); } } ); /* DELETE BOOK */ app.delete( "/api/books/:id", checkAdmin, async (req, res) => { try { const id = req.params.id; const { data: book, error: findError } = await supabase .from("books") .select("*") .eq("id", id) .single(); if (findError) { throw findError; } /* Delete PDF from storage */ if (book.pdf_path) { await supabase.storage .from("books") .remove([ book.pdf_path ]); } /* Delete database record */ const { error: deleteError } = await supabase .from("books") .delete() .eq("id", id); if (deleteError) { throw deleteError; } res.json({ success: true }); } catch (error) { console.error(error); res.status(500).json({ error: "Unable to delete book." }); } } ); /* DOWNLOAD BOOK Increments download counter. */ app.get( "/api/books/:id/download", async (req, res) => { try { const id = req.params.id; const { data: book, error } = await supabase .from("books") .select("*") .eq("id", id) .single(); if (error || !book) { return res.status(404).send( "Book not found." ); } /* Increase download count */ await supabase .from("books") .update({ downloads: Number(book.downloads || 0) + 1 }) .eq("id", id); /* Redirect to PDF */ res.redirect(book.pdf_url); } catch (error) { console.error(error); res.status(500).send( "Download failed." ); } } ); /* HEALTH CHECK */ app.get("/api/health", (req, res) => { res.json({ status: "running", application: "ADFID Africa Digital Library" }); }); /* ERROR HANDLER */ app.use((error, req, res, next) => { console.error(error); res.status(400).json({ error: error.message || "Something went wrong." }); }); app.listen(PORT, () => { console.log(""); console.log( "==========================================" ); console.log( " ADFID Africa Digital Library" ); console.log( " PDF Library Server" ); console.log( ` Running: http://localhost:${PORT}` ); console.log( ` Admin: http://localhost:${PORT}/admin.html` ); console.log( "==========================================" ); }); ADFID Library Administration

ADFID AFRICA DIGITAL LIBRARY

Administrator Panel

Administrator Login