Skip to content

Commit

Permalink
add crowdNavigate helper function
Browse files Browse the repository at this point in the history
  • Loading branch information
NotAProton committed Dec 1, 2023
1 parent 5788d6e commit 8d99f12
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/bypasses/tii.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ export default class TiiLa extends BypassDefinition {
execute() {
const urlObj = new URL(window.location.href)
this.helpers.crowdQuery('tii.la', urlObj.pathname.slice(1)).then((dest) => {
this.helpers.crowdNavigate(dest);
this.helpers.crowdNavigate(dest)
});
/*keep checking for the button*/
setInterval(() => {
setInterval(() => {
const button = document.querySelector("a.btn.btn-success.btn-lg.get-link");
if (button.href) {
if (button && button.href) {
this.helpers.crowdContribute('tii.la', urlObj.pathname.slice(1), button.href)
this.helpers.safelyNavigate(button.href)
}
Expand Down
10 changes: 9 additions & 1 deletion src/helpers/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export function crowdQuery(domain, path) {
return new Promise((resolve, reject) => {
const timeout = setTimeout(() => {
reject(new Error('Timeout: crowd response not received'));
}, 5000); //5 sec timeout
}, 10000); //10 sec timeout

document.addEventListener('ff53054c0e13_crowdResponse', function (event) {
clearTimeout(timeout);
Expand Down Expand Up @@ -443,6 +443,13 @@ export async function bypassRequests(execution_method) {
return Promise.resolve(result);
};
}
/**
* Navigates to the specified URL. To be used for crowd sourced bypasses.
* @param {string} target - The target URL to navigate to.
*/
export function crowdNavigate(target) {
unsafelyNavigate(target, null, true);
}

export default {
insertInfoBox,
Expand All @@ -451,6 +458,7 @@ export default {
ffclipboard,
crowdQuery,
crowdContribute,
crowdNavigate,
followAndContribute,
unsafelyNavigate,
parseTarget,
Expand Down

0 comments on commit 8d99f12

Please sign in to comment.