Telegram Web K with changes to work inside I2P https://web.telegram.i2p/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
948 B

5 years ago
const compression = require('compression');
const express = require('express');
const https = require('https');
const http = require('http');
5 years ago
const fs = require('fs');
const app = express();
const thirdTour = process.argv[2] == 3;
const forcePort = process.argv[3];
const useHttp = process.argv[4] === 'http';
const publicFolderName = thirdTour ? 'public3' : 'public';
const port = forcePort ? +forcePort : (thirdTour ? 8443 : 8443);
5 years ago
app.use(compression());
app.use(express.static(publicFolderName));
5 years ago
app.get('/', (req, res) => {
res.sendFile(__dirname + `/${publicFolderName}/index.html`);
5 years ago
});
const server = useHttp ? http : https;
let options = {};
if(!useHttp) {
options.key = fs.readFileSync(__dirname + '/certs/server-key.pem');
options.cert = s.readFileSync(__dirname + '/certs/server-cert.pem');
}
server.createServer(options, app).listen(port, () => {
console.log('Listening port:', port, 'folder:', publicFolderName);
});