404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.222.10.145: ~ $
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// https://dev.to/waqasabbasi/building-a-search-engine-api-with-node-express-and-puppeteer-using-google-search-4m21
const express_1 = __importDefault(require("express"));
const HybridTranslate_1 = require("./HybridTranslate");
const app = (0, express_1.default)();
const port = 3100;
class TranslateServer {
    constructor() {
        this.queue = [];
        this.inprogress = false;
    }
    async listen() {
        //Import puppeteer function 
        const googleTranslate = new HybridTranslate_1.HybridTranslate();
        // await googleTranslate.init();
        await googleTranslate.prepare();
        // await googleTranslate.init();
        // let timerInterval: any = null;
        // clearInterval(timerInterval);
        // timerInterval = setInterval(() => {
        // }, 240000)
        //Catches requests made to localhost:3000/search
        app.get('/start', (request, response) => {
            // clearInterval(timerInterval);
            // timerInterval = setInterval(() => {
            // }, 240000)
            // googleTranslate.init();
            // googleTranslate.prepare();
            response.status(200);
            response.json({ "status": "started" });
        });
        app.get('/stop', (request, response) => {
            // clearInterval(timerInterval);
            response.status(200);
            response.json({ "status": "stoped" });
        });
        app.use((req, res, next) => {
            if (this.inprogress) {
                this.queue.push({ req, res, next });
            }
            else {
                next();
            }
        });
        app.get('/translateDeFa/:text', async (request, response, next) => {
            if (!this.inprogress) {
                this.inprogress = true;
                const text = decodeURI(request.params.text);
                const result = await googleTranslate.translate(text, "de", "fa");
                response.status(200);
                response.json({ result: result });
                this.inprogress = false;
            }
            next();
        });
        app.use((req, res, next) => {
            if (this.queue.length > 0) {
                const queued = this.queue.shift();
                queued.next();
            }
            next();
        });
        app.get('/', (req, res) => res.send('Hi Hybrid'));
        //Initialises the express server on the port 30000
        app.listen(port, "0.0.0.0", () => {
            console.log(`app listening to localhost:${port}!`);
            console.log(`example http://localhost:${port}/start`);
            console.log(`example http://localhost:${port}translateFa/`);
        });
    }
}
const server = new TranslateServer();
server.listen();

Filemanager

Name Type Size Permission Actions
Browcore.js File 6.89 KB 0644
HybridTranslate.js File 6.05 KB 0644
HybridTranslateDeDe.js File 2.2 KB 0644
HybridTranslateDeFa.js File 2.03 KB 0644
HybridTranslateFaDe.js File 2.99 KB 0644
TranslateServer.js File 1.91 KB 0644
TranslateServerDeDe.js File 1.37 KB 0644
TranslateServerDeFa.js File 1.37 KB 0644
TranslateServerFaDe.js File 1.37 KB 0644
generate-cookie.js File 635 B 0644
main.js File 1.85 KB 0644
server-de-fa.js File 2.88 KB 0644
server.js File 764 B 0644