Skip to content

Commit

Permalink
feat: custom apk uploading
Browse files Browse the repository at this point in the history
  • Loading branch information
reis committed Dec 15, 2022
1 parent c9882cf commit be4941f
Show file tree
Hide file tree
Showing 8 changed files with 522 additions and 4 deletions.
10 changes: 10 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ const { createServer } = require('node:http');
const { join } = require('node:path');

const exec = require('./utils/promisifiedExec.js');
const uploadAPKFile = require('./utils/uploadAPKFile.js');

const Express = require('express');
const fileUpload = require('express-fileupload');
const { WebSocketServer } = require('ws');
const open_ = require('open');
const pf = require('portfinder');
Expand All @@ -30,14 +32,22 @@ const app = Express();
const server = createServer(app);
const wsServer = new WebSocketServer({ server });
const wsClients = [];
let currentWSClient;

app.use(fileUpload());
app.use(Express.static(join(__dirname, 'public')));
app.get('/revanced.apk', (_, res) => {
const file = join(process.cwd(), 'revanced', global.outputName);

res.download(file);
});

app.post('/uploadApk', (req, res) => {
req.socket.setTimeout(10 * 60 * 1000);
req.setTimeout(10 * 60 * 1000);
uploadAPKFile(req, res, wsClients);
});

/**
* @param {number} port
*/
Expand Down
Loading

0 comments on commit be4941f

Please sign in to comment.