Skip to content

Commit

Permalink
Heroku/Repl.it fix?
Browse files Browse the repository at this point in the history
  • Loading branch information
QuiteAFancyEmerald committed Feb 10, 2022
1 parent 73cdcb3 commit 2cbcaeb
Show file tree
Hide file tree
Showing 44 changed files with 1,082 additions and 35,733 deletions.
1 change: 1 addition & 0 deletions backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const proxy = new corrosion({
prefix: config.prefix || '/search/',
codec: config.codec || 'xor',
ws: config.ws,
forceHttps: true,
requestMiddleware: [
corrosion.middleware.blacklist(blacklist, 'Service not allowed due to bot protection! Make sure you are not trying to verify on a proxy.'),
],
Expand Down
69 changes: 0 additions & 69 deletions lib/browser/attributes.js

This file was deleted.

318 changes: 254 additions & 64 deletions lib/browser/document.js

Large diffs are not rendered by default.

113 changes: 0 additions & 113 deletions lib/browser/dom.js

This file was deleted.

70 changes: 0 additions & 70 deletions lib/browser/function.js

This file was deleted.

46 changes: 21 additions & 25 deletions lib/browser/history.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,26 @@
const { overrideFunction } = require("./utils");

function createHistoryRewriter(ctx) {
if (ctx.serviceWorker) return () => null;
if (ctx.window.History && ctx.window.History.prototype) {
ctx.originalFn.historyPushstate = ctx.window.History.prototype.pushState;
ctx.originalFn.historyReplacestate = ctx.window.History.prototype.replaceState;
};
function rewritePushReplaceState() {
const handler = (target, that, args) => {
if (args[2]) {
/*if (new URL(args[2], ctx.meta.base).origin != ctx.location.origin) {
args[2] = '';
} else {*/
args[2] = ctx.url.wrap(args[2], ctx.meta);
//};
};
return target.apply(that, args);
}
if (ctx.originalFn.historyPushstate) overrideFunction(ctx.window.History.prototype, 'pushState', handler);
if (ctx.originalFn.historyReplacestate) overrideFunction(ctx.window.History.prototype, 'replaceState', handler);
return true;
};
return function rewriteHistory() {
rewritePushReplaceState();
return true;
if (ctx.serviceWorker) return;
if (ctx.window.History.prototype.pushState) {
ctx.window.History.prototype.pushState = new Proxy(ctx.window.History.prototype.pushState, {
apply: (target, that, args) => {
if (args[2]) args[2] = ctx.url.wrap(args[2], ctx.meta);
const ret = Reflect.apply(target, that, args);
ctx.updateLocation();
return ret;
},
});
};
if (ctx.window.History.prototype.replaceState) {
ctx.window.History.prototype.replaceState = new Proxy(ctx.window.History.prototype.replaceState, {
apply: (target, that, args) => {
if (args[2]) args[2] = ctx.url.wrap(args[2], ctx.meta);
const ret = Reflect.apply(target, that, args);
ctx.updateLocation();
return ret;
},
});
};
};
};

module.exports = createHistoryRewriter;
Loading

0 comments on commit 2cbcaeb

Please sign in to comment.