mirror of
https://github.com/cupcakearmy/blaze.git
synced 2024-12-22 16:26:26 +00:00
Testing some stuff
This commit is contained in:
parent
869585ae29
commit
6507a5667d
9
dist/index.html
vendored
9
dist/index.html
vendored
@ -48,10 +48,17 @@
|
|||||||
timeout errors from occurring.
|
timeout errors from occurring.
|
||||||
</p>
|
</p>
|
||||||
<script>
|
<script>
|
||||||
|
const DEV_MODE = false
|
||||||
|
|
||||||
|
let url = "https://ill-red-skunk-wig.cyclic.app"
|
||||||
|
if (DEV_MODE) {
|
||||||
|
url = "http://localhost:8888"
|
||||||
|
}
|
||||||
|
|
||||||
const b = document.querySelector("button"),
|
const b = document.querySelector("button"),
|
||||||
i = document.querySelector("input");
|
i = document.querySelector("input");
|
||||||
b.addEventListener("click", () => {
|
b.addEventListener("click", () => {
|
||||||
location.href = `https://ill-red-skunk-wig.cyclic.app?q=${encodeURI(i.value)}`;
|
location.href = `${url}?q=${encodeURI(i.value)}`;
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
7
index.ts
7
index.ts
@ -24,6 +24,13 @@ app.get("/", (req, res) => {
|
|||||||
|
|
||||||
got(`${searchEngine}?q=${query}`)
|
got(`${searchEngine}?q=${query}`)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
|
|
||||||
|
if (response.statusCode !== 200) {
|
||||||
|
console.log("Error code:", response.statusCode)
|
||||||
|
res.send(`Error code ${response.statusCode}`)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const dom = new JSDOM(response.body);
|
const dom = new JSDOM(response.body);
|
||||||
const links = dom.window.document.querySelectorAll('link')
|
const links = dom.window.document.querySelectorAll('link')
|
||||||
const results = dom.window.document.querySelectorAll('.result')
|
const results = dom.window.document.querySelectorAll('.result')
|
||||||
|
Loading…
Reference in New Issue
Block a user