mirror of
https://github.com/EndPwnArchive/bspwn-lambda.git
synced 2024-08-14 23:57:04 +00:00
init
This commit is contained in:
commit
4fbee777b0
9 changed files with 977 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
config.json
|
21
LICENSE
Normal file
21
LICENSE
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 EndPwn Project
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
2
README.md
Normal file
2
README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# bspwn-scraper
|
||||||
|
The daemon that runs on the bspwn server to automatically patch client updates
|
444
bspwn/glslsandbox.js
Normal file
444
bspwn/glslsandbox.js
Normal file
|
@ -0,0 +1,444 @@
|
||||||
|
/* https://github.com/mrdoob/glsl-sandbox */
|
||||||
|
|
||||||
|
if (!window.requestAnimationFrame) {
|
||||||
|
|
||||||
|
window.requestAnimationFrame = (function () {
|
||||||
|
|
||||||
|
return window.webkitRequestAnimationFrame ||
|
||||||
|
window.mozRequestAnimationFrame ||
|
||||||
|
window.oRequestAnimationFrame ||
|
||||||
|
window.msRequestAnimationFrame ||
|
||||||
|
function (callback, element) {
|
||||||
|
|
||||||
|
window.setTimeout(callback, 1000 / 60);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
})();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get older browsers safely through init code, so users can read the
|
||||||
|
// message about how to download newer browsers.
|
||||||
|
if (!Date.now) {
|
||||||
|
Date.now = function () {
|
||||||
|
return +new Date();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
var quality = 1, quality_levels = [0.5, 1, 2, 4, 8];
|
||||||
|
var toolbar, compileButton, fullscreenButton, compileTimer, errorLines = [];
|
||||||
|
var canvas, gl, buffer, currentProgram, vertexPosition, screenVertexPosition,
|
||||||
|
parameters = { startTime: Date.now(), time: 0, mouseX: 0.5, mouseY: 0.5, screenWidth: 0, screenHeight: 0 },
|
||||||
|
surface = { centerX: 0, centerY: 0, width: 1, height: 1, isPanning: false, isZooming: false, lastX: 0, lastY: 0 },
|
||||||
|
frontTarget, backTarget, screenProgram, getWebGL, resizer = {}, compileOnChangeCode = true;
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
|
||||||
|
console.log('initializing...');
|
||||||
|
|
||||||
|
if (!document.addEventListener) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas = document.createElement('canvas');
|
||||||
|
document.body.appendChild(canvas);
|
||||||
|
|
||||||
|
// Initialise WebGL
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
gl = canvas.getContext('experimental-webgl', { preserveDrawingBuffer: true });
|
||||||
|
|
||||||
|
} catch (error) { }
|
||||||
|
|
||||||
|
if (gl) {
|
||||||
|
|
||||||
|
// enable dFdx, dFdy, fwidth
|
||||||
|
gl.getExtension('OES_standard_derivatives');
|
||||||
|
|
||||||
|
// Create vertex buffer (2 triangles)
|
||||||
|
|
||||||
|
buffer = gl.createBuffer();
|
||||||
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
||||||
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([- 1.0, - 1.0, 1.0, - 1.0, - 1.0, 1.0, 1.0, - 1.0, 1.0, 1.0, - 1.0, 1.0]), gl.STATIC_DRAW);
|
||||||
|
|
||||||
|
// Create surface buffer (coordinates at screen corners)
|
||||||
|
|
||||||
|
surface.buffer = gl.createBuffer();
|
||||||
|
}
|
||||||
|
|
||||||
|
var clientXLast, clientYLast;
|
||||||
|
|
||||||
|
document.addEventListener('mousemove', function (event) {
|
||||||
|
|
||||||
|
var clientX = event.clientX;
|
||||||
|
var clientY = event.clientY;
|
||||||
|
|
||||||
|
if (clientXLast == clientX && clientYLast == clientY)
|
||||||
|
return;
|
||||||
|
|
||||||
|
clientXLast = clientX;
|
||||||
|
clientYLast = clientY;
|
||||||
|
|
||||||
|
parameters.mouseX = clientX / window.innerWidth;
|
||||||
|
parameters.mouseY = 1 - clientY / window.innerHeight;
|
||||||
|
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
onWindowResize();
|
||||||
|
window.addEventListener('resize', onWindowResize, false);
|
||||||
|
|
||||||
|
compile();
|
||||||
|
compileScreenProgram();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function computeSurfaceCorners() {
|
||||||
|
|
||||||
|
if (gl) {
|
||||||
|
|
||||||
|
surface.width = surface.height * parameters.screenWidth / parameters.screenHeight;
|
||||||
|
|
||||||
|
var halfWidth = surface.width * 0.5, halfHeight = surface.height * 0.5;
|
||||||
|
|
||||||
|
gl.bindBuffer(gl.ARRAY_BUFFER, surface.buffer);
|
||||||
|
gl.bufferData(gl.ARRAY_BUFFER, new Float32Array([
|
||||||
|
surface.centerX - halfWidth, surface.centerY - halfHeight,
|
||||||
|
surface.centerX + halfWidth, surface.centerY - halfHeight,
|
||||||
|
surface.centerX - halfWidth, surface.centerY + halfHeight,
|
||||||
|
surface.centerX + halfWidth, surface.centerY - halfHeight,
|
||||||
|
surface.centerX + halfWidth, surface.centerY + halfHeight,
|
||||||
|
surface.centerX - halfWidth, surface.centerY + halfHeight]), gl.STATIC_DRAW);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetSurface() {
|
||||||
|
|
||||||
|
surface.centerX = surface.centerY = 0;
|
||||||
|
surface.height = 1;
|
||||||
|
computeSurfaceCorners();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function compile() {
|
||||||
|
|
||||||
|
console.log('compiling shader...');
|
||||||
|
|
||||||
|
if (!gl) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
var program = gl.createProgram();
|
||||||
|
var fragment = document.getElementById('shaderCode').textContent;
|
||||||
|
var vertex = document.getElementById('surfaceVertexShader').textContent;
|
||||||
|
|
||||||
|
var vs = createShader(vertex, gl.VERTEX_SHADER);
|
||||||
|
var fs = createShader(fragment, gl.FRAGMENT_SHADER);
|
||||||
|
|
||||||
|
if (vs == null || fs == null) return null;
|
||||||
|
|
||||||
|
gl.attachShader(program, vs);
|
||||||
|
gl.attachShader(program, fs);
|
||||||
|
|
||||||
|
gl.deleteShader(vs);
|
||||||
|
gl.deleteShader(fs);
|
||||||
|
|
||||||
|
gl.linkProgram(program);
|
||||||
|
|
||||||
|
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
||||||
|
|
||||||
|
var error = gl.getProgramInfoLog(program);
|
||||||
|
|
||||||
|
compileButton.title = error;
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
|
console.error('VALIDATE_STATUS: ' + gl.getProgramParameter(program, gl.VALIDATE_STATUS), 'ERROR: ' + gl.getError());
|
||||||
|
compileButton.style.color = '#ff0000';
|
||||||
|
compileButton.textContent = 'compiled with errors';
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentProgram) {
|
||||||
|
|
||||||
|
gl.deleteProgram(currentProgram);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
currentProgram = program;
|
||||||
|
|
||||||
|
// Cache uniforms
|
||||||
|
|
||||||
|
cacheUniformLocation(program, 'time');
|
||||||
|
cacheUniformLocation(program, 'mouse');
|
||||||
|
cacheUniformLocation(program, 'resolution');
|
||||||
|
cacheUniformLocation(program, 'backbuffer');
|
||||||
|
cacheUniformLocation(program, 'surfaceSize');
|
||||||
|
|
||||||
|
// Load program into GPU
|
||||||
|
|
||||||
|
gl.useProgram(currentProgram);
|
||||||
|
|
||||||
|
// Set up buffers
|
||||||
|
|
||||||
|
surface.positionAttribute = gl.getAttribLocation(currentProgram, "surfacePosAttrib");
|
||||||
|
gl.enableVertexAttribArray(surface.positionAttribute);
|
||||||
|
|
||||||
|
vertexPosition = gl.getAttribLocation(currentProgram, "position");
|
||||||
|
gl.enableVertexAttribArray(vertexPosition);
|
||||||
|
|
||||||
|
console.log('compilation finished');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function compileScreenProgram() {
|
||||||
|
|
||||||
|
console.log('compiling screen program...');
|
||||||
|
|
||||||
|
if (!gl) { return; }
|
||||||
|
|
||||||
|
var program = gl.createProgram();
|
||||||
|
var fragment = document.getElementById('fragmentShader').textContent;
|
||||||
|
var vertex = document.getElementById('vertexShader').textContent;
|
||||||
|
|
||||||
|
var vs = createShader(vertex, gl.VERTEX_SHADER);
|
||||||
|
var fs = createShader(fragment, gl.FRAGMENT_SHADER);
|
||||||
|
|
||||||
|
gl.attachShader(program, vs);
|
||||||
|
gl.attachShader(program, fs);
|
||||||
|
|
||||||
|
gl.deleteShader(vs);
|
||||||
|
gl.deleteShader(fs);
|
||||||
|
|
||||||
|
gl.linkProgram(program);
|
||||||
|
|
||||||
|
if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {
|
||||||
|
|
||||||
|
console.error('VALIDATE_STATUS: ' + gl.getProgramParameter(program, gl.VALIDATE_STATUS), 'ERROR: ' + gl.getError());
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
screenProgram = program;
|
||||||
|
|
||||||
|
gl.useProgram(screenProgram);
|
||||||
|
|
||||||
|
cacheUniformLocation(program, 'resolution');
|
||||||
|
cacheUniformLocation(program, 'texture');
|
||||||
|
|
||||||
|
screenVertexPosition = gl.getAttribLocation(screenProgram, "position");
|
||||||
|
gl.enableVertexAttribArray(screenVertexPosition);
|
||||||
|
|
||||||
|
console.log('compilation finished');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function cacheUniformLocation(program, label) {
|
||||||
|
|
||||||
|
if (program.uniformsCache === undefined) {
|
||||||
|
|
||||||
|
program.uniformsCache = {};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
program.uniformsCache[label] = gl.getUniformLocation(program, label);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function createTarget(width, height) {
|
||||||
|
|
||||||
|
var target = {};
|
||||||
|
|
||||||
|
target.framebuffer = gl.createFramebuffer();
|
||||||
|
target.renderbuffer = gl.createRenderbuffer();
|
||||||
|
target.texture = gl.createTexture();
|
||||||
|
|
||||||
|
// set up framebuffer
|
||||||
|
|
||||||
|
gl.bindTexture(gl.TEXTURE_2D, target.texture);
|
||||||
|
gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, width, height, 0, gl.RGBA, gl.UNSIGNED_BYTE, null);
|
||||||
|
|
||||||
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);
|
||||||
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);
|
||||||
|
|
||||||
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);
|
||||||
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);
|
||||||
|
|
||||||
|
gl.bindFramebuffer(gl.FRAMEBUFFER, target.framebuffer);
|
||||||
|
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, target.texture, 0);
|
||||||
|
|
||||||
|
// set up renderbuffer
|
||||||
|
|
||||||
|
gl.bindRenderbuffer(gl.RENDERBUFFER, target.renderbuffer);
|
||||||
|
|
||||||
|
gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);
|
||||||
|
gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, target.renderbuffer);
|
||||||
|
|
||||||
|
// clean up
|
||||||
|
|
||||||
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
||||||
|
gl.bindRenderbuffer(gl.RENDERBUFFER, null);
|
||||||
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||||
|
|
||||||
|
return target;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function createRenderTargets() {
|
||||||
|
|
||||||
|
frontTarget = createTarget(parameters.screenWidth, parameters.screenHeight);
|
||||||
|
backTarget = createTarget(parameters.screenWidth, parameters.screenHeight);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
var dummyFunction = function () { };
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function htmlEncode(str) {
|
||||||
|
|
||||||
|
return String(str)
|
||||||
|
.replace(/&/g, '&')
|
||||||
|
.replace(/"/g, '"')
|
||||||
|
.replace(/'/g, ''')
|
||||||
|
.replace(/</g, '<')
|
||||||
|
.replace(/>/g, '>');
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function createShader(src, type) {
|
||||||
|
|
||||||
|
var shader = gl.createShader(type);
|
||||||
|
var line, lineNum, lineError, index = 0, indexEnd;
|
||||||
|
|
||||||
|
gl.shaderSource(shader, src);
|
||||||
|
gl.compileShader(shader);
|
||||||
|
|
||||||
|
if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {
|
||||||
|
|
||||||
|
var error = gl.getShaderInfoLog(shader);
|
||||||
|
|
||||||
|
// Remove trailing linefeed, for FireFox's benefit.
|
||||||
|
while ((error.length > 1) && (error.charCodeAt(error.length - 1) < 32)) {
|
||||||
|
error = error.substring(0, error.length - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.error(error);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return shader;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function onWindowResize(event) {
|
||||||
|
|
||||||
|
var isMaxWidth = ((resizer.currentWidth === resizer.maxWidth) || (resizer.currentWidth === resizer.minWidth)),
|
||||||
|
isMaxHeight = ((resizer.currentHeight === resizer.maxHeight) || (resizer.currentHeight === resizer.minHeight));
|
||||||
|
|
||||||
|
canvas.width = window.innerWidth / quality;
|
||||||
|
canvas.height = window.innerHeight / quality;
|
||||||
|
|
||||||
|
canvas.style.width = window.innerWidth + 'px';
|
||||||
|
canvas.style.height = window.innerHeight + 'px';
|
||||||
|
|
||||||
|
parameters.screenWidth = canvas.width;
|
||||||
|
parameters.screenHeight = canvas.height;
|
||||||
|
|
||||||
|
computeSurfaceCorners();
|
||||||
|
|
||||||
|
if (gl) {
|
||||||
|
|
||||||
|
gl.viewport(0, 0, canvas.width, canvas.height);
|
||||||
|
|
||||||
|
createRenderTargets();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
|
||||||
|
function animate() {
|
||||||
|
|
||||||
|
requestAnimationFrame(animate);
|
||||||
|
render();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function render() {
|
||||||
|
|
||||||
|
if (!currentProgram) return;
|
||||||
|
|
||||||
|
parameters.time = Date.now() - parameters.startTime;
|
||||||
|
|
||||||
|
// Set uniforms for custom shader
|
||||||
|
|
||||||
|
gl.useProgram(currentProgram);
|
||||||
|
|
||||||
|
gl.uniform1f(currentProgram.uniformsCache['time'], parameters.time / 1000);
|
||||||
|
gl.uniform2f(currentProgram.uniformsCache['mouse'], parameters.mouseX, parameters.mouseY);
|
||||||
|
gl.uniform2f(currentProgram.uniformsCache['resolution'], parameters.screenWidth, parameters.screenHeight);
|
||||||
|
gl.uniform1i(currentProgram.uniformsCache['backbuffer'], 0);
|
||||||
|
gl.uniform2f(currentProgram.uniformsCache['surfaceSize'], surface.width, surface.height);
|
||||||
|
|
||||||
|
gl.bindBuffer(gl.ARRAY_BUFFER, surface.buffer);
|
||||||
|
gl.vertexAttribPointer(surface.positionAttribute, 2, gl.FLOAT, false, 0, 0);
|
||||||
|
|
||||||
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
||||||
|
gl.vertexAttribPointer(vertexPosition, 2, gl.FLOAT, false, 0, 0);
|
||||||
|
|
||||||
|
gl.activeTexture(gl.TEXTURE0);
|
||||||
|
gl.bindTexture(gl.TEXTURE_2D, backTarget.texture);
|
||||||
|
|
||||||
|
// Render custom shader to front buffer
|
||||||
|
|
||||||
|
gl.bindFramebuffer(gl.FRAMEBUFFER, frontTarget.framebuffer);
|
||||||
|
|
||||||
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
||||||
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
||||||
|
|
||||||
|
// Set uniforms for screen shader
|
||||||
|
|
||||||
|
gl.useProgram(screenProgram);
|
||||||
|
|
||||||
|
gl.uniform2f(screenProgram.uniformsCache['resolution'], parameters.screenWidth, parameters.screenHeight);
|
||||||
|
gl.uniform1i(screenProgram.uniformsCache['texture'], 1);
|
||||||
|
|
||||||
|
gl.bindBuffer(gl.ARRAY_BUFFER, buffer);
|
||||||
|
gl.vertexAttribPointer(screenVertexPosition, 2, gl.FLOAT, false, 0, 0);
|
||||||
|
|
||||||
|
gl.activeTexture(gl.TEXTURE1);
|
||||||
|
gl.bindTexture(gl.TEXTURE_2D, frontTarget.texture);
|
||||||
|
|
||||||
|
// Render front buffer to screen
|
||||||
|
|
||||||
|
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
|
||||||
|
|
||||||
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
||||||
|
gl.drawArrays(gl.TRIANGLES, 0, 6);
|
||||||
|
|
||||||
|
// Swap buffers
|
||||||
|
|
||||||
|
var tmp = frontTarget;
|
||||||
|
frontTarget = backTarget;
|
||||||
|
backTarget = tmp;
|
||||||
|
|
||||||
|
}
|
93
bspwn/index.js
Normal file
93
bspwn/index.js
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
EndPwn3.2 Stage 2 Payload
|
||||||
|
|
||||||
|
Copyright 2018 EndPwn Project
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
https://github.com/endpwn/
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
// we just get remote because nothing in the root of the module is useful to us
|
||||||
|
const electron = require('electron').remote;
|
||||||
|
const fs = require('original-fs');
|
||||||
|
|
||||||
|
const data = electron.app.getPath('userData') + '/';
|
||||||
|
|
||||||
|
function bsprint(str) {
|
||||||
|
console.log(`%c[bspwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
function bswarn(str) {
|
||||||
|
console.warn(`%c[bspwn]%c ` + str, 'font-weight:bold;color:#0cc', '');
|
||||||
|
}
|
||||||
|
|
||||||
|
// basically took this one verbatim from epapi bc i couldnt be fucked to reimplement it
|
||||||
|
function bserror(t, e) {
|
||||||
|
console.error(`%c[bspwn]%c ${t}:\n\n`, 'font-weight:bold;color:#0cc', '', e);
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.go = function () {
|
||||||
|
|
||||||
|
// crashing the preload script is very bad and definitely not something we want to do, so we catch our errors
|
||||||
|
try {
|
||||||
|
|
||||||
|
bsprint('initializing...');
|
||||||
|
|
||||||
|
if (location.hostname.indexOf('discordapp') == -1) {
|
||||||
|
bswarn('hm, not running under discordapp, let\'s abort...');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// apparently tripping hasSuspiciousCode() makes discord not report errors, so lets do that on purpose
|
||||||
|
window.BetterDiscord = 'this is a dummy value to trip hasSuspiciousCode()';
|
||||||
|
|
||||||
|
// make sure crispr and epapi are actually there before trying to load them
|
||||||
|
var crisprFound = fs.existsSync(data + 'crispr.js');
|
||||||
|
var epapiFound = fs.existsSync(data + 'epapi.js');
|
||||||
|
|
||||||
|
if (!epapiFound) {
|
||||||
|
bswarn('EPAPI not detected, aborting...');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!crisprFound) bswarn('CRISPR not detected');
|
||||||
|
|
||||||
|
// load our friends :)
|
||||||
|
var crispr = require(data + 'crispr.js');
|
||||||
|
var epapi = require(data + 'epapi.js');
|
||||||
|
|
||||||
|
// these are the bootstrap properties we pass to crispr and epapi
|
||||||
|
var properties = {
|
||||||
|
name: 'EndPwn3',
|
||||||
|
version: {
|
||||||
|
major: 3,
|
||||||
|
minor: 2,
|
||||||
|
|
||||||
|
toString: function () {
|
||||||
|
return `v${this.major}.${this.minor}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
method: 'bspwn',
|
||||||
|
brand: true,
|
||||||
|
native: true
|
||||||
|
};
|
||||||
|
|
||||||
|
// start crispr
|
||||||
|
if (crisprFound) crispr.go(properties);
|
||||||
|
|
||||||
|
// delay epapi until dom-ready to prevent errors
|
||||||
|
electron.getCurrentWindow().webContents.on('dom-ready', () => epapi.go(properties));
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
bserror('exception during init', ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
277
bspwn/updater.html
Normal file
277
bspwn/updater.html
Normal file
|
@ -0,0 +1,277 @@
|
||||||
|
<!--
|
||||||
|
|
||||||
|
EndPwn3.2 Updater
|
||||||
|
|
||||||
|
Copyright 2018 EndPwn Project
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
https://github.com/endpwn/
|
||||||
|
|
||||||
|
-->
|
||||||
|
|
||||||
|
<html>
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<script src="glslsandbox.js"></script>
|
||||||
|
|
||||||
|
<script id="shaderCode" type="x-shader/x-fragment">
|
||||||
|
//pastel psx/dreamcast thingy
|
||||||
|
// @samloeschen
|
||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define M_PI 3.1415926535897932384626433832795
|
||||||
|
|
||||||
|
uniform float time;
|
||||||
|
uniform vec2 mouse;
|
||||||
|
uniform vec2 resolution;
|
||||||
|
|
||||||
|
|
||||||
|
// 2D Random
|
||||||
|
float random (in vec2 st) {
|
||||||
|
return fract(sin(dot(st.xy, vec2(12.9898,78.233)))* 43758.5453123);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2D Noise based on Morgan McGuire @morgan3d
|
||||||
|
// https://www.shadertoy.com/view/4dS3Wd
|
||||||
|
float noise (in vec2 st) {
|
||||||
|
vec2 i = floor(st);
|
||||||
|
vec2 f = fract(st);
|
||||||
|
|
||||||
|
// Four corners in 2D of a tile
|
||||||
|
float a = random(i);
|
||||||
|
float b = random(i + vec2(1.0, 0.0));
|
||||||
|
float c = random(i + vec2(0.0, 1.0));
|
||||||
|
float d = random(i + vec2(1.0, 1.0));
|
||||||
|
|
||||||
|
// Smooth Interpolation
|
||||||
|
|
||||||
|
// Cubic Hermine Curve. Same as SmoothStep()
|
||||||
|
vec2 u = f*f*(3.0-2.0*f);
|
||||||
|
// u = smoothstep(0.,1.,f);
|
||||||
|
|
||||||
|
// Mix 4 coorners porcentages
|
||||||
|
return mix(a, b, u.x) +
|
||||||
|
(c - a)* u.y * (1.0 - u.x) +
|
||||||
|
(d - b) * u.x * u.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool boxtest (in vec2 p, in vec2 square, in float w) {
|
||||||
|
return p.x - w < square.x && p.x + w > square.x && p.y - w < square.y && p.y + w > square.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 palette (in float t) {
|
||||||
|
vec3 a = vec3(0.25,0.5,0.75);
|
||||||
|
vec3 b = vec3(0.75,0.5,0.25);
|
||||||
|
vec3 c = vec3(0.5,0.75,0.25);
|
||||||
|
vec3 d = vec3(0.75,0.25,0.5);
|
||||||
|
return a + b*cos( 2.0*M_PI*(c*t+d) );
|
||||||
|
}
|
||||||
|
|
||||||
|
vec3 drawSquare (in vec2 p, in vec2 square, in vec3 setting) {
|
||||||
|
if(boxtest(p, square, setting.x) && !(boxtest(p, square, setting.x - setting.y)))
|
||||||
|
return palette(setting.z / 70.0 + time * 0.1);
|
||||||
|
|
||||||
|
return vec3(0.0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main (void) {
|
||||||
|
vec2 uv = (gl_FragCoord.xy / resolution.xy);
|
||||||
|
vec2 aspect = resolution.xy / min(resolution.x, resolution.y);
|
||||||
|
vec2 center = vec2(0.5);
|
||||||
|
vec2 pos = uv - center;
|
||||||
|
float horizon = 0.03*cos(time); //lil motion here
|
||||||
|
float fov = -0.5; //if we negate fov the box has a better palette relationship with the planes
|
||||||
|
|
||||||
|
vec3 p = vec3(pos.x, fov, pos.y - horizon);
|
||||||
|
float scroll = (time * -sign(p.z));
|
||||||
|
float bump = noise((vec2(p.x + 100., p.y) * 1.)) * 1.;
|
||||||
|
vec2 s = vec2(p.x/p.z, p.y/p.z + bump + scroll) * 0.1; //actual plane position
|
||||||
|
|
||||||
|
bool grid = (fract(s.y / 0.02) > 0.95) || (fract(s.x / 0.02) > 0.95);
|
||||||
|
vec3 gridColor = (mix(palette(s.y + bump * 0.5), vec3(0.0), float(grid)));
|
||||||
|
gridColor = mix(gridColor, vec3(0.0), 0.3); //slight desaturate and boost
|
||||||
|
float fog = pow(sin(uv.y * M_PI), 5.);
|
||||||
|
vec3 color = mix(gridColor, vec3(0.0), fog);
|
||||||
|
|
||||||
|
float a = sin(time) * 0.6; //box angle
|
||||||
|
mat2 rot = mat2(cos(a), -sin(a), sin(a), cos(a));
|
||||||
|
pos = uv * aspect * rot;
|
||||||
|
center *= aspect * rot;
|
||||||
|
|
||||||
|
/*for(int i = 0; i < 50; i++) {
|
||||||
|
vec3 d = drawSquare(pos, center + vec2(sin(float(i) / 10.0 + time) / 4.0, 0.0), vec3(0.0 + sin(float(i) / 200.0), 0.01 , float(i)));
|
||||||
|
if(d.x > 0.) color = mix(d, vec3(0.0), 0.3); //slight desaturate and boost
|
||||||
|
}*/
|
||||||
|
gl_FragColor = vec4(color, 0.5);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="fragmentShader" type="x-shader/x-fragment">
|
||||||
|
|
||||||
|
#ifdef GL_ES
|
||||||
|
precision mediump float;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
uniform vec2 resolution;
|
||||||
|
uniform sampler2D texture;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
vec2 uv = gl_FragCoord.xy / resolution.xy;
|
||||||
|
gl_FragColor = texture2D( texture, uv );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="vertexShader" type="x-shader/x-vertex">
|
||||||
|
|
||||||
|
attribute vec3 position;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
gl_Position = vec4( position, 1.0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<script id="surfaceVertexShader" type="x-shader/x-vertex">
|
||||||
|
|
||||||
|
attribute vec3 position;
|
||||||
|
attribute vec2 surfacePosAttrib;
|
||||||
|
varying vec2 surfacePosition;
|
||||||
|
|
||||||
|
void main() {
|
||||||
|
|
||||||
|
surfacePosition = surfacePosAttrib;
|
||||||
|
gl_Position = vec4( position, 1.0 );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
@font-face {
|
||||||
|
font-family: 'IBMVGA8';
|
||||||
|
src: url('https://xn--lmbda-2be.cf/fonts/ibm_vga8.eot');
|
||||||
|
src: url('https://xn--lmbda-2be.cf/fonts/ibm_vga8.eot?#iefix') format('embedded-opentype'),
|
||||||
|
url('https://xn--lmbda-2be.cf/fonts/ibm_vga8.woff2') format('woff2'),
|
||||||
|
url('https://xn--lmbda-2be.cf/fonts/ibm_vga8.woff') format('woff'),
|
||||||
|
url('https://xn--lmbda-2be.cf/fonts/ibm_vga8.ttf') format('truetype');
|
||||||
|
font-weight: normal;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
* {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'IBMVGA8' !important;
|
||||||
|
text-align: center;
|
||||||
|
background-color: #1a1d23;
|
||||||
|
color: #ffffff
|
||||||
|
}
|
||||||
|
|
||||||
|
div {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
background: linear-gradient(to bottom right, #c0ff80, #c080ff);
|
||||||
|
-webkit-background-clip: text;
|
||||||
|
-webkit-text-fill-color: transparent;
|
||||||
|
font-size: 96px;
|
||||||
|
}
|
||||||
|
|
||||||
|
span {
|
||||||
|
position: absolute;
|
||||||
|
top: 0%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0%);
|
||||||
|
color: #f00;
|
||||||
|
font-size: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
canvas {
|
||||||
|
display: block;
|
||||||
|
position: absolute;
|
||||||
|
z-index: -1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
|
||||||
|
// wait until DOM is ready so that error messages can display properly
|
||||||
|
window.onload = () => {
|
||||||
|
|
||||||
|
init();
|
||||||
|
if (gl) animate();
|
||||||
|
|
||||||
|
setTimeout(async () => {
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
window.electron = require('electron').remote;
|
||||||
|
window.fs = require('original-fs');
|
||||||
|
|
||||||
|
const data = electron.app.getPath('userData');
|
||||||
|
|
||||||
|
// TODO: make this...not constant
|
||||||
|
const approot = 'https://xn--lmbda-2be.cf/';
|
||||||
|
|
||||||
|
// continue to discord
|
||||||
|
function load() {
|
||||||
|
var branch = DiscordNative.globals.releaseChannel;
|
||||||
|
electron.getCurrentWindow().loadURL('https://' + (branch != 'stable' && branch != 'development' ? branch + '.' : '') + 'discordapp.com/channels/@me');
|
||||||
|
}
|
||||||
|
|
||||||
|
// make the plugins and styles dirs if they dont exist
|
||||||
|
if (!fs.existsSync(data + '/plugins')) fs.mkdirSync(data + '/plugins');
|
||||||
|
if (!fs.existsSync(data + '/styles')) fs.mkdirSync(data + '/styles');
|
||||||
|
|
||||||
|
// dont update stuff if DONTUPDATE exists
|
||||||
|
if (!fs.existsSync(data + '/DONTUPDATE')) {
|
||||||
|
|
||||||
|
// get files
|
||||||
|
fs.writeFileSync(data + '/epapi.js', await (await fetch(approot + '/epapi/epapi.js?_=' + Date.now())).text());
|
||||||
|
fs.writeFileSync(data + '/crispr.js', await (await fetch(approot + '/crispr/crispr.js?_=' + Date.now())).text());
|
||||||
|
fs.writeFileSync(data + '/rapiddom.js', await (await fetch(approot + '/rapiddom/rapiddom.js?_=' + Date.now())).text());
|
||||||
|
fs.writeFileSync(data + '/plugins/system.js', await (await fetch(approot + '/plugin/system.js?_=' + Date.now())).text());
|
||||||
|
fs.writeFileSync(data + '/plugins/customizer.js', await (await fetch(approot + '/plugin/customizer.js?_=' + Date.now())).text());
|
||||||
|
fs.writeFileSync(data + '/plugins/settings.js', await (await fetch(approot + '/plugin/settings.js?_=' + Date.now())).text());
|
||||||
|
fs.writeFileSync(data + '/styles/system.css', await (await fetch(approot + '/plugin/system.css?_=' + Date.now())).text());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setTimeout(load, 1000);
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
console.error(ex);
|
||||||
|
alert('Updater failed. Check the console for details.', 'EndPwn3.2');
|
||||||
|
}
|
||||||
|
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<div>Lλmbda</div>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
1
files/index.js
Normal file
1
files/index.js
Normal file
|
@ -0,0 +1 @@
|
||||||
|
module.exports = require('./core');
|
1
files/package.json
Normal file
1
files/package.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
{"name":"discord_desktop_core","version":"0.0.0","private":"true","main":"index.js"}
|
137
scrape.js
Normal file
137
scrape.js
Normal file
|
@ -0,0 +1,137 @@
|
||||||
|
#!/usr/bin/node --expose-gc
|
||||||
|
|
||||||
|
const fetch = require('node-fetch');
|
||||||
|
const request = require('request');
|
||||||
|
const fs = require('fs');
|
||||||
|
const ncp = require('ncp');
|
||||||
|
const asar = require('asar');
|
||||||
|
const archiver = require('archiver');
|
||||||
|
const exec = require('child_process').exec;
|
||||||
|
|
||||||
|
const branches = ['canary', 'ptb', 'stable'];
|
||||||
|
const platforms = ['win', 'linux', 'osx'];
|
||||||
|
|
||||||
|
console.log('loading config...');
|
||||||
|
var config = fs.existsSync('config.json') ?
|
||||||
|
JSON.parse(fs.readFileSync('config.json').toString()) :
|
||||||
|
{};
|
||||||
|
|
||||||
|
var lastver = {};
|
||||||
|
|
||||||
|
function patch(target, resolve) {
|
||||||
|
|
||||||
|
console.log('extracting zip...');
|
||||||
|
if (!fs.existsSync(target)) fs.mkdirSync(target);
|
||||||
|
console.log(`unzip -o ${target}.orig.zip -d ${target}`);
|
||||||
|
var child = exec(`unzip -o ${target}.orig.zip -d ${target}`);
|
||||||
|
child.stdout.pipe(process.stdout);
|
||||||
|
child.on('exit', () => {
|
||||||
|
|
||||||
|
path = target + '/core';
|
||||||
|
|
||||||
|
console.log('extracting asar...');
|
||||||
|
asar.extractAll(path + '.asar', path);
|
||||||
|
|
||||||
|
console.log('patching mainScreen.js...');
|
||||||
|
var mainScreen = fs.readFileSync(path + '/app/mainScreen.js').toString();
|
||||||
|
mainScreen = mainScreen
|
||||||
|
.replace(/nodeIntegration: false,/, 'nodeIntegration: true,')
|
||||||
|
.replace(/mainWindow\.loadURL\(URL_TO_LOAD\);/, "mainWindow.loadURL(_url.format({ pathname: _path2.default.join(__dirname, 'bspwn/updater.html'), protocol: 'file:', slashes: true }));");
|
||||||
|
fs.writeFileSync(path + '/app/mainScreen.js', mainScreen);
|
||||||
|
|
||||||
|
console.log('patching mainScreenPreload.js...');
|
||||||
|
var mainScreenPreload = fs.readFileSync(path + '/app/mainScreenPreload.js').toString();
|
||||||
|
mainScreenPreload = mainScreenPreload
|
||||||
|
.replace(/var electron = require\('electron'\);/, "var bspwn = require('./bspwn');\nbspwn.go();\nvar electron = require('electron');");
|
||||||
|
fs.writeFileSync(path + '/app/mainScreenPreload.js', mainScreenPreload);
|
||||||
|
|
||||||
|
console.log('copying bspwn files...')
|
||||||
|
ncp.ncp(__dirname + '/bspwn', path + '/app/bspwn', () => {
|
||||||
|
|
||||||
|
console.log('zipping it all up...');
|
||||||
|
var archive = archiver('zip');
|
||||||
|
|
||||||
|
var output = fs.createWriteStream((config.target || './') + target + '.zip');
|
||||||
|
|
||||||
|
archive.pipe(output);
|
||||||
|
archive.directory(path, 'core');
|
||||||
|
archive.file(__dirname + '/files/index.js', { name: 'index.js' });
|
||||||
|
archive.file(target + '/package.json', { name: 'package.json' });
|
||||||
|
archive.finalize();
|
||||||
|
|
||||||
|
//output.close(resolve);
|
||||||
|
resolve();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
async function scrape() {
|
||||||
|
|
||||||
|
console.log('scraping...');
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
for (b in branches) {
|
||||||
|
|
||||||
|
var branch = branches[b];
|
||||||
|
|
||||||
|
for (p in platforms) {
|
||||||
|
|
||||||
|
await new Promise(async (resolve, reject) => {
|
||||||
|
|
||||||
|
var platform = platforms[p];
|
||||||
|
|
||||||
|
var ident = `${branch}-${platform}`;
|
||||||
|
|
||||||
|
var currentver = await fetch(`https://discordapp.com/api/updates/${branch}?platform=${platform}`);
|
||||||
|
currentver = await currentver.json();
|
||||||
|
currentver = currentver.name;
|
||||||
|
|
||||||
|
var modules = await fetch(`https://discordapp.com/api/modules/${branch}/versions.json?platform=${platform}&host_version=${currentver}`);
|
||||||
|
modules = await modules.json();
|
||||||
|
|
||||||
|
var verstring = `${currentver}-${modules.discord_desktop_core}`;
|
||||||
|
|
||||||
|
console.log(`${ident} ${verstring}`);
|
||||||
|
|
||||||
|
if (!lastver[ident] || verstring > lastver[ident]) {
|
||||||
|
console.log('update available, fetching...');
|
||||||
|
lastver[ident] = verstring;
|
||||||
|
var target = `https://discordapp.com/api/modules/${branch}/discord_desktop_core/${modules.discord_desktop_core}?platform=${platform}&host_version=${currentver}`;
|
||||||
|
console.log(target);
|
||||||
|
|
||||||
|
request({
|
||||||
|
followAllRedirects: true,
|
||||||
|
url: target,
|
||||||
|
encoding: null
|
||||||
|
}, (err, response, body) => {
|
||||||
|
fs.writeFile(ident + '.orig.zip', body, () => {
|
||||||
|
console.log('done downloading');
|
||||||
|
patch(ident, resolve);
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else resolve();
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (ex) {
|
||||||
|
console.log(ex);
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log('scraping again in 15 minutes');
|
||||||
|
global.gc();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
setInterval(scrape, 15 * 60 * 1000);
|
||||||
|
//setInterval(scrape, 60*1000);
|
||||||
|
scrape();
|
Loading…
Reference in a new issue