Skip to content
This repository was archived by the owner on May 28, 2023. It is now read-only.

Commit e860d68

Browse files
Rammerhead fixed, compression fixed, hcaptcha fixed, terminal colors added
1 parent 97b214e commit e860d68

File tree

6 files changed

+78
-36
lines changed

6 files changed

+78
-36
lines changed

index.ts

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,20 @@ const rammerheadScopes = [
3636
];
3737
const rammerheadSession = /^\/[a-z0-9]{32}/;
3838
//END rammerhead specific stuff
39+
//Chalk colors for codes
40+
const error = chalk.bold.red;
41+
const success = chalk.green;
42+
const warning = chalk.yellow;
43+
const info = chalk.blue;
44+
const debug = chalk.magenta;
45+
const boldInfo = chalk.bold.blue;
46+
const debug2 = chalk.cyan;
47+
//END CHALK
3948
dotenv.config();
4049
//getting environment vars
4150
const numCPUs = process.env.CPUS || os.cpus().length;
4251
let key = process.env.KEY || 'unlock';
4352
let uri = process.env.URL || 'rubynetwork.tech';
44-
let start = false;
4553
if (uri.includes('http')) {
4654
uri = uri.replace('http://', '');
4755
}
@@ -64,18 +72,17 @@ fs.readFile(join(__dirname, 'blocklists/ADS.txt'), (err, data) => {
6472
for (let i in lines) blacklisted.push(lines[i]);
6573
});
6674
if (numCPUs > 0 && cluster.isPrimary) {
67-
console.log(chalk.cyan(chalk.bold('Starting Server...')))
68-
console.log(chalk.yellow(`Primary ${process.pid} is running`));
75+
console.log(debug(`Primary ${process.pid} is running`));
6976
for (let i = 0; i < numCPUs; i++) {
7077
cluster.fork().on('online', () => {
71-
console.log(chalk.magenta(`Worker ${i + 1} is online`));
78+
console.log(debug2(`Worker ${i + 1} is online`));
7279
});
7380
}
7481
cluster.on('exit', (worker, code, signal) => {
75-
console.log(chalk.red(chalk.bold(
82+
console.log(error(
7683
`Worker ${worker.process.pid} died with code: ${code} and signal: ${signal}`
77-
)));
78-
console.log(chalk.yellow(`Starting new worker in it's place`));
84+
));
85+
console.log(warning(`Starting new worker in it's place`));
7986
cluster.fork();
8087
});
8188
} else {
@@ -113,7 +120,7 @@ if (numCPUs > 0 && cluster.isPrimary) {
113120
return;
114121
}
115122
} else if (shouldRouteRh(req)) {
116-
routeRhRequest(req, res);
123+
routeRhRequest(req, res);
117124
//@ts-ignore
118125
} else if (req.headers.host === uri) {
119126
app(req, res);
@@ -156,7 +163,10 @@ if (numCPUs > 0 && cluster.isPrimary) {
156163
bare.routeUpgrade(req, socket, head);
157164
}
158165
else if (shouldRouteRh(req)) {
159-
routeRhUpgrade(req, socket, head);
166+
try {
167+
routeRhUpgrade(req, socket, head);
168+
}
169+
catch (error) {}
160170
}
161171
else {
162172
socket.end();
@@ -250,7 +260,6 @@ if (numCPUs > 0 && cluster.isPrimary) {
250260
res.end();
251261
return;
252262
});
253-
254263
//!CUSTOM ENDPOINTS END
255264
//RAMMERHEAD FUNCTIONS
256265
//@ts-ignore
@@ -267,7 +276,10 @@ if (numCPUs > 0 && cluster.isPrimary) {
267276
}
268277
//@ts-ignore
269278
function routeRhUpgrade(req, socket, head) {
270-
rh.emit('upgrade', req, socket, head);
279+
try {
280+
rh.emit('upgrade', req, socket, head);
281+
}
282+
catch (error) {}
271283
}
272284
//END RAMMERHEAD SPECIFIC FUNCTIONS
273285
let port = parseInt(process.env.PORT || '');
@@ -280,13 +292,13 @@ if (numCPUs > 0 && cluster.isPrimary) {
280292
// by default we are listening on 0.0.0.0 (every interface)
281293
// we just need to list a few
282294
// LIST PID
283-
console.log(chalk.green(`Process id: ${process.pid}`));
284-
console.log(chalk.blue('Listening on:'));
295+
console.log(success(`Process id: ${process.pid}`));
296+
console.log(debug('Listening on:'));
285297
//@ts-ignore
286-
console.log(chalk.blue(`\thttp://localhost:${address.port}`));
298+
console.log(debug2(`\thttp://localhost:${address.port}`));
287299
//@ts-ignore
288-
console.log(chalk.blue(`\thttp://${hostname()}:${address.port}`));
289-
console.log(chalk.blue(
300+
console.log(debug2(`\thttp://${hostname()}:${address.port}`));
301+
console.log(debug2(
290302
`\thttp://${
291303
//@ts-ignore
292304
address.family === 'IPv6'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"path-to-regexp": "^6.2.1",
4444
"postcss": "^8.4.21",
4545
"prettier": "^2.8.7",
46-
"rammerhead": "https://github.com/holy-unblocker/rammerhead/releases/download/v1.2.41-holy.5/rammerhead-1.2.41-holy.5.tgz",
46+
"rammerhead": "https://github.com/Ruby-Network/rammerhead/releases/download/version/rammerhead.tgz",
4747
"react": "^18.0.0",
4848
"react-dom": "^18.0.0",
4949
"tailwindcss": "^3.0.24",

public/chrome-tabs/tabbedLogic.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ var el = document.querySelector('.chrome-tabs')
2828
}
2929
}
3030
async function updateURL(id) {
31-
let iframeURL = document.getElementById(id).contentWindow.document.getElementById('uv-iframe').contentWindow.location.href
31+
let iframeURL = document.getElementById(id).contentWindow.location.href
3232
if (iframeURL.includes('/loading')) {
3333
document.getElementById('url-bar').value = ''
3434
}
@@ -62,6 +62,7 @@ var el = document.querySelector('.chrome-tabs')
6262
}
6363
let tabContents = []
6464
function init() {
65+
localStorage.setItem('gamesBypass', 'false')
6566
if (localStorage.getItem('savedTabs') === 'true') {
6667
chromeTabs.removeTab(chromeTabs.activeTabEl);
6768
if (localStorage.getItem('savedTabsLength') === '0') {
@@ -106,9 +107,7 @@ var el = document.querySelector('.chrome-tabs')
106107
document.getElementById('tabContents').appendChild(iframe)
107108
browserInit(detail.tabEl, iframeid);
108109
iframe.addEventListener('load', function () {
109-
document.getElementById(iframeid).contentWindow.document.getElementById('uv-iframe').addEventListener('load', function () {
110-
window.parent.updateURL(iframeid)
111-
})
110+
updateURL(iframeid)
112111
})
113112
})
114113
function saveTabs() {
@@ -145,7 +144,7 @@ var el = document.querySelector('.chrome-tabs')
145144
let URLBAR = document.getElementById('url-bar')
146145
let iframeSRC;
147146
try {
148-
iframeSRC = document.getElementById(id).contentWindow.document.getElementById('uv-iframe').contentWindow.location.href
147+
iframeSRC = document.getElementById(id).contentWindow.location.href
149148
}
150149
catch (err) {
151150
console.log('No content to load ignoring')
@@ -179,8 +178,11 @@ var el = document.querySelector('.chrome-tabs')
179178
}
180179
}
181180
function browserSearch(value) {
182-
document.getElementById(currentTab).contentWindow.document.getElementById('uv-address').value = value
183-
document.getElementById(currentTab).contentWindow.document.getElementById('uv-form').dispatchEvent(new Event('submit'))
181+
document.getElementById(currentTab).contentWindow.location.href = '/tabbedSearch'
182+
document.getElementById(currentTab).addEventListener('load', function () {
183+
document.getElementById(currentTab).contentWindow.document.getElementById('uv-address').value = value
184+
document.getElementById(currentTab).contentWindow.document.getElementById('uv-form').dispatchEvent(new Event('submit'))
185+
})
184186
}
185187
function decode(str) {
186188
if (str.charAt(str.length - 1) == "/") str = str.slice(0, -1);
@@ -262,7 +264,7 @@ var el = document.querySelector('.chrome-tabs')
262264

263265
function popOut() {
264266
try {
265-
let SRC = document.getElementById(currentTab).contentWindow.document.getElementById('uv-iframe').contentWindow.location.href
267+
let SRC = document.getElementById(currentTab).contentWindow.location.href
266268
if (SRC.includes('/loading')) {
267269
throw ('LOL')
268270
}
@@ -278,13 +280,13 @@ var el = document.querySelector('.chrome-tabs')
278280
console.log('To be implemented')
279281
}
280282
function Refresh() {
281-
document.getElementById(currentTab).contentWindow.refreshIframe()
283+
document.getElementById(currentTab).contentWindow.location.reload()
282284
}
283285
function Forward() {
284-
document.getElementById(currentTab).contentWindow.forwardIframe()
286+
document.getElementById(currentTab).contentWindow.history.forward()
285287
}
286288
function Backward() {
287-
document.getElementById(currentTab).contentWindow.backIframe()
289+
document.getElementById(currentTab).contentWindow.history.back()
288290
}
289291

290292
init();

public/chrome-tabs/tabsEnabled.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
if (localStorage.getItem('tabs') === 'true') {
22
if (window.location.hash.includes('#link') || window.location.hash.includes('#g')) {
33
console.log('App or custom link found! Not Redirecting to /tabs...')
4+
localStorage.setItem('gamesBypass', 'true')
45
}
56
else if (window.location.hash.includes('#')) {
67
console.log('Custom App most likely not redirecting...')
8+
localStorage.setItem('gamesBypass', 'false')
79
}
810
else if (window === window.top) {
911
window.location.replace('/tabs')
12+
localStorage.setItem('gamesBypass', 'false')
1013
}
1114
else {
1215
window.location.replace('/tabbedSearch')

public/js/index.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,13 @@ if (proxytype === 'Ultraviolet') {
4747
//loadingIframe.classList.remove('dnone');
4848
//loadingIframe.src = `/loading#${textcolor}`;
4949
// blob = __uv$config.prefix + __uv$config.encodeUrl(url);
50-
iframe.src = __uv$config.prefix + __uv$config.encodeUrl(url);
50+
if(localStorage.getItem('tabs') === 'true' && localStorage.getItem('gamesBypass') === 'false') {
51+
location.href = __uv$config.prefix + __uv$config.encodeUrl(url)
52+
localStorage.setItem('gamesBypass', 'false')
53+
}
54+
else {
55+
iframe.src = __uv$config.prefix + __uv$config.encodeUrl(url);
56+
}
5157
//iframe.addEventListener('load', function () {
5258
//loadingIframe.classList.add('dnone');
5359
document.getElementById('control').classList.remove('dnone');
@@ -73,7 +79,12 @@ if (proxytype === 'DIP') {
7379
document.body
7480
).getPropertyValue('--text-color');
7581
//loadingIframe.src = `/loading#${textcolor}`;
76-
iframe.src = __DIP.config.prefix + __DIP.encodeURL(url);
82+
if(localStorage.getItem('tabs') === 'true' && localStorage.getItem('gamesBypass') === 'false') {
83+
location.href = __DIP.config.prefix + __DIP.encodeURL(url);
84+
}
85+
else {
86+
iframe.src = __DIP.config.prefix + __DIP.encodeURL(url);
87+
}
7788
//iframe.addEventListener('load', function () {
7889
//loadingIframe.classList.add('dnone');
7990
document.getElementById('control').classList.remove('dnone');
@@ -105,8 +116,12 @@ if (proxytype === 'Osana') {
105116
document.body
106117
).getPropertyValue('--text-color');
107118
//loadingIframe.src = `/loading#${textcolor}`;
108-
iframe.src =
109-
__osana$config.prefix + __osana$config.codec.encode(url);
119+
if(localStorage.getItem('tabs') === 'true' && localStorage.getItem('gamesBypass') === 'false') {
120+
location.href = __osana$config.prefix + __osana$config.codec.encode(url);
121+
}
122+
else {
123+
iframe.src = __osana$config.prefix + __osana$config.codec.encode(url);
124+
}
110125
//iframe.addEventListener('load', function () {
111126
//loadingIframe.classList.add('dnone');
112127
document.getElementById('control').classList.remove('dnone');
@@ -138,7 +153,12 @@ if (proxytype === 'Aero') {
138153
document.body
139154
).getPropertyValue('--text-color');
140155
//loadingIframe.src = `/loading#${textcolor}`;
141-
iframe.src = '/go/' + url;
156+
if(localStorage.getItem('tabs') === 'true' && localStorage.getItem('gamesBypass') === 'false') {
157+
location.href = '/go/' + url;
158+
}
159+
else {
160+
iframe.src = '/go/' + url;
161+
}
142162
//iframe.addEventListener('load', function () {
143163
//loadingIframe.classList.add('dnone');
144164
document.getElementById('control').classList.remove('dnone');
@@ -164,7 +184,12 @@ if (proxytype === 'Rammerhead') {
164184
let url = search(address.value, searchEngine.value)
165185
iframe.classList.remove('dnone')
166186
let endURL = await window.rh.rhInteract(`${topURL}`, `${url}`)
167-
iframe.src = endURL.href
187+
if(localStorage.getItem('tabs') === 'true' && localStorage.getItem('gamesBypass') === 'false') {
188+
location.href = endURL.href
189+
}
190+
else {
191+
iframe.src = endURL.href
192+
}
168193
document.getElementById('control').classList.remove('dnone')
169194
})
170195
}

yarn.lock

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4109,9 +4109,9 @@ quick-lru@^5.1.1:
41094109
resolved "https://registry.yarnpkg.com/quick-lru/-/quick-lru-5.1.1.tgz#366493e6b3e42a3a6885e2e99d18f80fb7a8c932"
41104110
integrity sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==
41114111

4112-
"rammerhead@https://github.com/holy-unblocker/rammerhead/releases/download/v1.2.41-holy.5/rammerhead-1.2.41-holy.5.tgz":
4112+
"rammerhead@https://github.com/Ruby-Network/rammerhead/releases/download/version/rammerhead.tgz":
41134113
version "1.2.41-holy.5"
4114-
resolved "https://github.com/holy-unblocker/rammerhead/releases/download/v1.2.41-holy.5/rammerhead-1.2.41-holy.5.tgz#b75e518a9a24ad752f09e4c359b028051336df9d"
4114+
resolved "https://github.com/Ruby-Network/rammerhead/releases/download/version/rammerhead.tgz#a339c12d84270a3635140a1f4579c545814877e4"
41154115
dependencies:
41164116
async-exit-hook "^2.0.1"
41174117
cookie "^0.5.0"

0 commit comments

Comments
 (0)