randydev commited on
Commit
70335fc
·
verified ·
1 Parent(s): 324ec25

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +61 -39
index.js CHANGED
@@ -1,5 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  import express from 'express';
2
- const app = express()
3
 
4
  import * as swaggerUi from 'swagger-ui-express';
5
  import * as swaggerDocs from './swagger.js';
@@ -7,63 +27,65 @@ import * as cheerio from 'cheerio';
7
  import * as lifestyle from './lifestyle.js';
8
 
9
  import { OpenaiRes, tebakgambar, AnimeHentai } from './scrapper.js';
 
10
  import { CheckMilWare } from './midware.js';
11
 
12
  const CheckMilWares = new CheckMilWare();
13
 
14
- app.disable('x-powered-by')
15
 
16
  app.get('/', (req, res) => {
17
  res.redirect('https://t.me/RendyProjects');
18
  });
19
 
20
  app.use(async (req, res, next) => {
21
- await CheckMilWares.handle(req, res, next);
22
  });
23
 
24
- app.get('/api/test', async (req, res) => {
25
- try {
26
- res.send("Hello world")
27
- } catch (error) {
28
- res.status(401).json({error: error.message})
29
- }
30
- })
31
-
32
- app.get('/api/hentai-anime', async (req, res) => {
33
- try {
34
- const result = await AnimeHentai();
35
- if (result) {
36
- res.json({ result });
37
- } else {
38
- res.status(404).json({ error: "No result found." });
39
  }
40
- } catch (error) {
41
- res.status(500).json({ error: error.message });
42
- }
43
  });
44
 
45
- app.get('/api/tebakgambar', async (req, res) => {
46
- try {
47
- const result = await tebakgambar();
48
- if (result) {
49
- res.json({ result });
50
- } else {
51
- res.status(404).json({ error: "No result found." });
52
  }
53
- } catch (error) {
54
- res.status(500).json({ error: error.message });
55
- }
56
  });
57
 
 
 
 
 
 
 
 
 
 
 
 
 
58
 
59
- app.get('/api/gpt-old', async (req, res) => {
60
- try {
61
- const query = req.query.query;
62
- const results = await OpenaiRes(query);
63
- res.json({ results });
64
- } catch (error) {
65
- res.status(401).json({ error: error.message });
66
- }
67
  });
68
 
69
  lifestyle.startServer(app);
 
1
+ /*
2
+ Credits @xpushz on telegram
3
+ Copyright 2017-2025 (c) Randy W @xtdevs, @xtsea on telegram
4
+
5
+ from : https://github.com/TeamKillerX
6
+ Channel : @RendyProjects
7
+ This program is free software: you can redistribute it and/or modify
8
+ it under the terms of the GNU Affero General Public License as published by
9
+ the Free Software Foundation, either version 3 of the License, or
10
+ (at your option) any later version.
11
+
12
+ This program is distributed in the hope that it will be useful,
13
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
+ GNU Affero General Public License for more details.
16
+
17
+ You should have received a copy of the GNU Affero General Public License
18
+ along with this program. If not, see <https://www.gnu.org/licenses/>.
19
+ */
20
+
21
  import express from 'express';
22
+ const app = express();
23
 
24
  import * as swaggerUi from 'swagger-ui-express';
25
  import * as swaggerDocs from './swagger.js';
 
27
  import * as lifestyle from './lifestyle.js';
28
 
29
  import { OpenaiRes, tebakgambar, AnimeHentai } from './scrapper.js';
30
+ import { GeminiResponse } from './googleGemini.js';
31
  import { CheckMilWare } from './midware.js';
32
 
33
  const CheckMilWares = new CheckMilWare();
34
 
35
+ app.disable('x-powered-by');
36
 
37
  app.get('/', (req, res) => {
38
  res.redirect('https://t.me/RendyProjects');
39
  });
40
 
41
  app.use(async (req, res, next) => {
42
+ await CheckMilWares.handle(req, res, next);
43
  });
44
 
45
+ app.get('/api/v1/hentai-anime', async (req, res) => {
46
+ try {
47
+ const result = await AnimeHentai();
48
+ if (result) {
49
+ res.json({ result });
50
+ } else {
51
+ res.status(404).json({ error: "No result found." });
52
+ }
53
+ } catch (error) {
54
+ res.status(500).json({ error: error.message });
 
 
 
 
 
55
  }
 
 
 
56
  });
57
 
58
+ app.get("/api/v1/google-gemini", async (req, res) => {
59
+ try {
60
+ const query = req.query.query;
61
+ const results = await GeminiResponse(query);
62
+ res.json({ message: results });
63
+ } catch (e) {
64
+ res.status(500).json({ error: e.message });
65
  }
 
 
 
66
  });
67
 
68
+ app.get('/api/v1/tebakgambar', async (req, res) => {
69
+ try {
70
+ const result = await tebakgambar();
71
+ if (result) {
72
+ res.json({ result });
73
+ } else {
74
+ res.status(404).json({ error: "No result found." });
75
+ }
76
+ } catch (error) {
77
+ res.status(500).json({ error: error.message });
78
+ }
79
+ });
80
 
81
+ app.get('/api/v1/gpt-old', async (req, res) => {
82
+ try {
83
+ const query = req.query.query;
84
+ const results = await OpenaiRes(query);
85
+ res.json({ results });
86
+ } catch (error) {
87
+ res.status(401).json({ error: error.message });
88
+ }
89
  });
90
 
91
  lifestyle.startServer(app);