Skip to content

Instantly share code, notes, and snippets.

@WINOFFRG

WINOFFRG/app.js Secret

Created Sep 29, 2021
Embed
What would you like to do?
Widevine Reverse Proxy Server
const express = require('express');
const cors = require('cors');
const axios = require('axios');
const bodyParser = require('body-parser');
const app = express();
const port = 5000;
const BASE_URL = '/api';
app.use(bodyParser.raw({type: "application/octet-stream"}));
app.use(cors());
app.post(`${BASE_URL}/license`, async (req, res) => {
getLicense(req,res);
});
async function getLicense(req, res) {
let licenseUrl = 'https://cwip-shaka-proxy.appspot.com/no_auth';
let rurl = `${licenseUrl}`;
let config = {
method: 'POST',
url: rurl,
headers: {
"content-type" : "application/octet-stream"
},
data : new Int8Array((req.body)),
responseType: 'arraybuffer',
};
axios(config)
.then(function (response) {
// console.log("Served Request");
res.status(response.status).send(response.data);
})
.catch(function (error) {
return res.status(400).send(error);
});
}
app.listen(port, () => {
console.log(`Listening on port ${port}`)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment