File size: 3,732 Bytes
70335fc 6f115e7 70335fc cc43160 1c2f245 83075c1 78a8417 3dd504b 2a1da11 e28d3f7 2a1da11 0a020de 70335fc e805e95 aaeefe8 1122fa5 70335fc e28d3f7 43cc2ca dc7aadc 90e4651 dc7aadc aaeefe8 70335fc 27ace8b 8babfe5 70335fc 0cdf085 70335fc 8db3c5a 70335fc 9280f36 6f9bb64 70335fc 9280f36 70335fc 17f2e27 fa3c558 2a1da11 98b8079 2a1da11 0753d74 8ce8afc 2a1da11 1c2f245 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
/*
Credits @xpushz on telegram
Copyright 2017-2025 (c) Randy W @xtdevs, @xtsea on telegram
from : https://github.com/TeamKillerX
Channel : @RendyProjects
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import express from 'express';
const app = express();
import * as swaggerUi from 'swagger-ui-express';
import * as swaggerDocs from './swagger.js';
import * as cheerio from 'cheerio';
import * as lifestyle from './lifestyle.js';
import sharp from "sharp";
import { Readable } from "stream";
import bodyParser from 'body-parser';
import { schellwithflux } from './fluxai.js';
import { OpenaiRes, tebakgambar, AnimeHentai } from './scrapper.js';
import { GeminiResponse } from './googleGemini.js';
import { CheckMilWare } from './midware.js';
const CheckMilWares = new CheckMilWare();
app.disable('x-powered-by');
app.use(bodyParser.json());
app.get('/', (req, res) => {
res.redirect('https://t.me/RendyProjects');
});
app.use(async (req, res, next) => {
await CheckMilWares.handle(req, res, next);
});
app.get('/api/v1/hentai-anime', async (req, res) => {
try {
const result = await AnimeHentai();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.get("/api/v1/google-gemini", async (req, res) => {
try {
const query = req.query.query;
const results = await GeminiResponse(query);
res.json({ message: results });
} catch (e) {
res.status(500).json({ error: e.message });
}
});
app.get('/api/v1/tebakgambar', async (req, res) => {
try {
const result = await tebakgambar();
if (result) {
res.json({ result });
} else {
res.status(404).json({ error: "No result found." });
}
} catch (error) {
res.status(500).json({ error: error.message });
}
});
app.get('/api/v1/gpt-old', async (req, res) => {
try {
const query = req.query.query;
const results = await OpenaiRes(query);
res.json({ results });
} catch (error) {
res.status(401).json({ error: error.message });
}
});
app.post("/api/v1/fluxai-ai", async (req, res) => {
try {
const query = req.body.query;
const imageBytes = await schellwithflux(query);
if (!query) {
return res.status(400).send('Query parameter is missing');
}
if (!imageBytes) {
return res.status(500).json({ error: "Failed to fetch image bytes" });
}
const buffer = Buffer.isBuffer(imageBytes) ? imageBytes : Buffer.from(imageBytes);
const processedImage = await sharp(buffer)
.jpeg()
.toBuffer();
res.set("Content-Type", "image/jpeg");
const stream = Readable.from(processedImage);
stream.pipe(res);
} catch (error) {
console.error("Error processing image:", error.message);
res.status(500).json({ error: "Internal server error" });
}
});
lifestyle.startServer(app); |