Shows favicon when page is loaded in embed mode now.
This commit is contained in:
parent
815f4d5999
commit
f8b92dc0b9
6 changed files with 42 additions and 4 deletions
3
index.js
3
index.js
|
|
@ -54,6 +54,9 @@ app.use(function (req, res, next) {
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
app.use("/", express.static("dist/client/"));
|
app.use("/", express.static("dist/client/"));
|
||||||
|
app.get("/favicon.ico", (req, res) => {
|
||||||
|
res.sendFile(path.join(process.cwd(), "dist/client/favicon.svg"));
|
||||||
|
})
|
||||||
app.get("/search", async (req, res) => {
|
app.get("/search", async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const { query } = req.query;
|
const { query } = req.query;
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
|
||||||
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
<svg height="800px" width="800px" version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
viewBox="0 0 512 512" xml:space="preserve">
|
viewBox="0 0 512 512" xml:space="preserve">
|
||||||
<path style="fill:#1E0478;" d="M494.176,64.787c15.4,22.42,20.974,52.758,16.123,88.421c-4.751,34.914-19.365,74.181-42.346,113.946
|
<path style="fill:#1E0478;" d="M494.176,64.787c15.4,22.42,20.974,52.758,16.123,88.421c-4.751,34.914-19.365,74.181-42.346,113.946
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.6 KiB |
|
|
@ -1 +1 @@
|
||||||
Subproject commit 8793db1e2fe64cae8936c00bcd4f333f158f6ebd
|
Subproject commit 11287d0a834c672a55d10164dbfefe9ee1922d3d
|
||||||
|
|
@ -110,6 +110,7 @@
|
||||||
topbar.style.opacity = 1;
|
topbar.style.opacity = 1;
|
||||||
topbar.style.pointerEvents = "auto";
|
topbar.style.pointerEvents = "auto";
|
||||||
|
|
||||||
|
updateProxiedFavicon();
|
||||||
closeButton.onclick = () => {
|
closeButton.onclick = () => {
|
||||||
iframe.style.opacity = 0;
|
iframe.style.opacity = 0;
|
||||||
topbar.style.opacity = 0;
|
topbar.style.opacity = 0;
|
||||||
|
|
@ -191,6 +192,24 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function updateProxiedFavicon(iframe) {
|
||||||
|
let proxiedFavicon = document.getElementById("proxied-favicon");
|
||||||
|
if (iframe) {
|
||||||
|
if (iframe.contentDocument) {
|
||||||
|
let favicon = iframe.contentDocument.querySelector("link[rel='icon']") || iframe.contentDocument.querySelector("link[rel*='icon']");
|
||||||
|
if (favicon) {
|
||||||
|
proxiedFavicon.src = favicon.href;
|
||||||
|
} else {
|
||||||
|
proxiedFavicon.src = "/favicon.ico";
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
setTimeout(() => updateProxiedFavicon(iframe), 400);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function iframeURLChange(iframe, callback) {
|
function iframeURLChange(iframe, callback) {
|
||||||
var lastDispatched = null;
|
var lastDispatched = null;
|
||||||
|
|
||||||
|
|
@ -199,6 +218,7 @@
|
||||||
|
|
||||||
if (newHref !== lastDispatched) {
|
if (newHref !== lastDispatched) {
|
||||||
callback(newHref);
|
callback(newHref);
|
||||||
|
|
||||||
lastDispatched = newHref;
|
lastDispatched = newHref;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
@ -218,6 +238,7 @@
|
||||||
|
|
||||||
iframe.addEventListener("load", function () {
|
iframe.addEventListener("load", function () {
|
||||||
attachUnload();
|
attachUnload();
|
||||||
|
updateProxiedFavicon(iframe);
|
||||||
|
|
||||||
// Just in case the change wasn't dispatched during the unload event...
|
// Just in case the change wasn't dispatched during the unload event...
|
||||||
dispatchChange();
|
dispatchChange();
|
||||||
|
|
|
||||||
|
|
@ -193,6 +193,16 @@ const { title, optionalPreloads } = Astro.props;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
.top-bar-right, .top-bar-left {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
gap: 10px;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
#proxied-favicon {
|
||||||
|
height: 80%;
|
||||||
|
}
|
||||||
#close-button {
|
#close-button {
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
padding-inline: 40px;
|
padding-inline: 40px;
|
||||||
|
|
|
||||||
|
|
@ -27,9 +27,14 @@ export function getStaticPaths() {
|
||||||
<div id="loading-content">Loading...</div>
|
<div id="loading-content">Loading...</div>
|
||||||
</form>
|
</form>
|
||||||
<div id="top-bar">
|
<div id="top-bar">
|
||||||
|
<div class="top-bar-left">
|
||||||
<button id="close-button">Close</button>
|
<button id="close-button">Close</button>
|
||||||
|
</div>
|
||||||
|
<div class="top-bar-right">
|
||||||
|
<img id="proxied-favicon" />
|
||||||
<span id="url-text"></span>
|
<span id="url-text"></span>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<iframe title="proxy-iframe" id="proxy-frame"></iframe>
|
<iframe title="proxy-iframe" id="proxy-frame"></iframe>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue