mirror of
https://github.com/QuiteAFancyEmerald/Holy-Unblocker.git
synced 2025-05-12 11:30:01 -04:00
Formatting and workflow organization changes
This commit is contained in:
parent
461c89212f
commit
8c9f79d3e7
13 changed files with 1010 additions and 979 deletions
|
@ -1,5 +1,5 @@
|
|||
// This file is solely used for the automatically run GitHub job, which checks to
|
||||
// see if all HU LTS code is working properly (at least on an Ubuntu machine).
|
||||
// This file is solely used for the automatically run GitHub job, which checks to
|
||||
// see if all HU LTS code is working properly (at least on an Ubuntu machine).
|
||||
|
||||
const axios = require('axios');
|
||||
const puppeteer = require('puppeteer');
|
||||
|
@ -122,21 +122,21 @@ const testCommonJSOnPage = async () => {
|
|||
}
|
||||
});
|
||||
|
||||
// Locate the omnibox element on the Rammerhead page.
|
||||
// Locate the omnibox element on the Rammerhead page.
|
||||
let omnibox = document.getElementById('pr-rh');
|
||||
omnibox = omnibox && omnibox.querySelector('input[type=text]');
|
||||
|
||||
if (omnibox) {
|
||||
try {
|
||||
// Send an artificial input to the omnibox. The omnibox will create
|
||||
// a proxy URL and leave it as the input value in response.
|
||||
// Send an artificial input to the omnibox. The omnibox will create
|
||||
// a proxy URL and leave it as the input value in response.
|
||||
const urlPath = 'example.com';
|
||||
omnibox.value = urlPath;
|
||||
await omnibox.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { code: 'Validator Test' })
|
||||
);
|
||||
|
||||
// Wait up to 5 seconds for the omnibox to finish updating.
|
||||
// Wait up to 5 seconds for the omnibox to finish updating.
|
||||
const loadUrl = new Promise((resolve) => {
|
||||
if (omnibox.value !== urlPath) resolve(omnibox.value);
|
||||
else
|
||||
|
@ -147,7 +147,7 @@ const testCommonJSOnPage = async () => {
|
|||
timeout = new Promise((resolve) => {
|
||||
setTimeout(() => resolve(omnibox.value), 40000);
|
||||
}),
|
||||
// Record the proxy URL that the omnibox left here.
|
||||
// Record the proxy URL that the omnibox left here.
|
||||
rammerheadUrl = await Promise.race([loadUrl, timeout]);
|
||||
console.log('Generated Rammerhead URL:', rammerheadUrl);
|
||||
results.rammerhead = rammerheadUrl ? rammerheadUrl : 'failure';
|
||||
|
@ -225,8 +225,8 @@ xx xx
|
|||
? resolve()
|
||||
: window.addEventListener('load', resolve);
|
||||
|
||||
// Wait until a service worker is registered before continuing.
|
||||
// Also make sure the document is loaded.
|
||||
// Wait until a service worker is registered before continuing.
|
||||
// Also make sure the document is loaded.
|
||||
const waitForWorker = async () =>
|
||||
setTimeout(async () => {
|
||||
(await navigator.serviceWorker.getRegistrations()).length >= 1
|
||||
|
@ -237,32 +237,32 @@ xx xx
|
|||
waitForWorker();
|
||||
});
|
||||
|
||||
// Locate the omnibox element on the Ultraviolet page.
|
||||
// Locate the omnibox element on the Ultraviolet page.
|
||||
let omnibox = document.getElementById('pr-uv');
|
||||
omnibox = omnibox && omnibox.querySelector('input[type=text]');
|
||||
|
||||
if (omnibox) {
|
||||
// For the hacky URL test, use the URL page's EXACT title.
|
||||
// For the hacky URL test, use the URL page's EXACT title.
|
||||
const website = {
|
||||
path: 'example.com',
|
||||
title: 'Example Domain',
|
||||
};
|
||||
|
||||
try {
|
||||
// Send an artificial input to the omnibox. The omnibox will create
|
||||
// a proxy URL and leave it as the input value in response.
|
||||
// Send an artificial input to the omnibox. The omnibox will create
|
||||
// a proxy URL and leave it as the input value in response.
|
||||
omnibox.value = website.path;
|
||||
await omnibox.dispatchEvent(
|
||||
new KeyboardEvent('keydown', { code: 'Validator Test' })
|
||||
);
|
||||
|
||||
// Record the proxy URL that the omnibox left here.
|
||||
// Record the proxy URL that the omnibox left here.
|
||||
const generatedUrl = omnibox.value;
|
||||
console.log('Generated Ultraviolet URL:', generatedUrl);
|
||||
results[0].ultraviolet = generatedUrl ? generatedUrl : 'failure';
|
||||
|
||||
// Test to see if the document title for example.com has loaded,
|
||||
// by appending an IFrame to the document and grabbing its content.
|
||||
// Test to see if the document title for example.com has loaded,
|
||||
// by appending an IFrame to the document and grabbing its content.
|
||||
const testGeneratedUrlHacky = async (url) => {
|
||||
let result = false;
|
||||
const exampleIFrame = document.createElement('iframe');
|
||||
|
@ -311,7 +311,7 @@ xx xx
|
|||
}
|
||||
};
|
||||
|
||||
// Run tests for Rammerhead and Ultraviolet
|
||||
// Run tests for Rammerhead and Ultraviolet.
|
||||
const rammerheadPassed = await testRammerhead();
|
||||
const ultravioletPassed = await testUltraviolet();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue