2024-07-18 10:42:44 -07:00
|
|
|
function doCORSRequest(options, printResult) {
|
|
|
|
var x = new XMLHttpRequest();
|
|
|
|
var proxy_url = 'https://api.allorigins.win/get?url=';
|
|
|
|
var target_url = encodeURIComponent(options.url);
|
|
|
|
x.open(options.method, proxy_url + target_url);
|
|
|
|
x.onload = x.onerror = function() {
|
|
|
|
var response = JSON.parse(x.responseText);
|
|
|
|
printResult(
|
|
|
|
options.method + ' ' + options.url + '\n' +
|
|
|
|
x.status + ' ' + x.statusText + '\n\n' +
|
|
|
|
(response.contents || '')
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
x.send(options.data);
|
|
|
|
}
|
|
|
|
|
|
|
|
doCORSRequest({
|
|
|
|
method: "GET",
|
|
|
|
url: "https://packages.boostyconnect.com/oreonproject/oreon-security/",
|
|
|
|
}, function printResult(res) {
|
|
|
|
console.log('Response:', res);
|
|
|
|
|
|
|
|
try {
|
|
|
|
const parser = new DOMParser();
|
|
|
|
const doc = parser.parseFromString(res, "text/html");
|
|
|
|
const links = doc.querySelectorAll("a");
|
|
|
|
links.forEach((link) => {
|
|
|
|
const forbidden_links = ["Name", "Last modified", "Size", "Destination", "Description", "Parent Directory"];
|
|
|
|
if (!forbidden_links.includes(link.innerHTML)) {
|
|
|
|
const link_e = document.createElement("a");
|
2024-07-21 13:59:15 -07:00
|
|
|
const new_href = link.href;
|
2024-07-18 10:42:44 -07:00
|
|
|
|
|
|
|
link_e.href = new_href;
|
|
|
|
link_e.innerHTML = link.innerHTML;
|
|
|
|
link_e.className = "package";
|
|
|
|
link_e.target = "_blank";
|
|
|
|
document.getElementById("packages").appendChild(link_e);
|
|
|
|
console.log(link.href);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
} catch (e) {
|
|
|
|
console.error('Parsing error:', e);
|
|
|
|
}
|
|
|
|
});
|