first commit
This commit is contained in:
commit
7135ea4ce2
|
@ -0,0 +1,2 @@
|
|||
node_modules/*
|
||||
package-lock.json
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
// 使用 IntelliSense 了解相关属性。
|
||||
// 悬停以查看现有属性的描述。
|
||||
// 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "调试当前文件",
|
||||
"program": "${file}"
|
||||
}
|
||||
]
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
FROM registry.cn-shanghai.aliyuncs.com/devcon/node:18
|
||||
ADD . /app
|
||||
WORKDIR /app
|
||||
RUN mkdir /app/log
|
||||
RUN cd /app && \
|
||||
chmod +x start.sh && \
|
||||
npm config set registry https://registry.npmmirror.com/ && \
|
||||
npm install
|
||||
EXPOSE 9000
|
||||
CMD [ "/app/start.sh" ]
|
||||
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
const express = require("express");
|
||||
const request = require("request");
|
||||
const fs = require("fs");
|
||||
const app = express();
|
||||
const port = 9000;
|
||||
const { getDecryptionArray } = require("./decode");
|
||||
const { Transform } = require("stream");
|
||||
function xorTransform(decryptionArray) {
|
||||
let processedBytes = 0;
|
||||
return new Transform({
|
||||
transform(chunk, encoding, callback) {
|
||||
if (processedBytes < decryptionArray.length) {
|
||||
let remaining = Math.min(
|
||||
decryptionArray.length - processedBytes,
|
||||
chunk.length
|
||||
);
|
||||
for (let i = 0; i < remaining; i++) {
|
||||
chunk[i] = chunk[i] ^ decryptionArray[processedBytes + i];
|
||||
}
|
||||
processedBytes += remaining;
|
||||
}
|
||||
this.push(chunk);
|
||||
callback();
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
app.get("/download", (req, res) => {
|
||||
const { url, decodeKey } = req.query;
|
||||
let xorStream = xorTransform(
|
||||
getDecryptionArray(decodeURIComponent(decodeKey))
|
||||
);
|
||||
request(decodeURIComponent(url)).pipe(xorStream).pipe(res);
|
||||
});
|
||||
|
||||
app.listen(port, () => {
|
||||
console.log(`Example app listening at http://localhost:${port}`);
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "origin",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www"
|
||||
},
|
||||
"dependencies": {
|
||||
"cookie-parser": "~1.4.4",
|
||||
"debug": "~2.6.9",
|
||||
"express": "~4.16.1",
|
||||
"stream": "^0.0.3",
|
||||
"request": "^2.88.2"
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue