general: fixes

This commit is contained in:
k
2024-09-19 21:03:50 +02:00
parent d2349741f7
commit 412769ff03
11 changed files with 40 additions and 21 deletions

View File

@@ -4,6 +4,19 @@
![Image of the kibō Web App version 0.X.Y](./assets/v0.X.Y.jpg)
## v. 0.4.1 | WIP
![Image of the kibō Web App version 0.4.1](./assets/v0.4.1.jpg)
## Website
- Fixed service worker not passing 304 (not modified) response and instead serving cached responses
- Fixed history not being properly registered
## Server
- Fixed links in several places missing the `/api` part and thus not working
## v. 0.4.0 | [861950](https://mempool.space/block/00000000000000000000530d0e30ccf7deeace122dcc99f2668a06c6dad83629) - 2024/09/19
![Image of the kibō Web App version 0.4.0](./assets/v0.4.0.jpg)

2
parser/Cargo.lock generated
View File

@@ -1280,7 +1280,7 @@ dependencies = [
[[package]]
name = "parser"
version = "0.4.0"
version = "0.4.1"
dependencies = [
"allocative",
"bincode",

View File

@@ -1,6 +1,6 @@
[package]
name = "parser"
version = "0.4.0"
version = "0.4.1"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

4
server/Cargo.lock generated
View File

@@ -1814,7 +1814,7 @@ dependencies = [
[[package]]
name = "parser"
version = "0.4.0"
version = "0.4.1"
dependencies = [
"allocative",
"bincode",
@@ -2478,7 +2478,7 @@ dependencies = [
[[package]]
name = "server"
version = "0.4.0"
version = "0.4.1"
dependencies = [
"axum",
"bincode",

View File

@@ -1,6 +1,6 @@
[package]
name = "server"
version = "0.4.0"
version = "0.4.1"
edition = "2021"
[dependencies]

View File

@@ -180,7 +180,7 @@ where
datasets.get(&ChunkId::from_usize(offseted)).map(|_| {
let scheme = headers.get_scheme();
let host = headers.get_host();
format!("{scheme}://{host}/{}?chunk={offseted}", route.url_path)
format!("{scheme}://{host}/api/{}?chunk={offseted}", route.url_path)
})
};

View File

@@ -133,7 +133,7 @@ impl Routes {
.map(|(key, route)| {
(
key.to_owned(),
format!("{url}/{}", route.url_path.to_owned()),
format!("{url}/api/{}", route.url_path.to_owned()),
)
})
.collect()

View File

@@ -1,4 +1,4 @@
<!doctype html>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
@@ -1308,7 +1308,7 @@
localStorage.getItem(settingsThemeLocalStorageKey)
);
const preferredColorSchemeMatchMedia = window.matchMedia(
"(prefers-color-scheme: dark)",
"(prefers-color-scheme: dark)"
);
if (
theme === "dark" ||
@@ -1320,7 +1320,7 @@
}
const backgroundColor = getComputedStyle(
window.document.documentElement,
window.document.documentElement
).getPropertyValue("--background-color");
const meta = window.document.createElement("meta");
meta.name = "theme-color";
@@ -1676,7 +1676,7 @@
<a
id="anchor-git"
title="Git"
href="https://github.com/kibo-money"
href="https://github.com/kibo-money/kibo"
target="_blank"
rel="noopener noreferrer"
>
@@ -2015,7 +2015,7 @@
rel="noopener noreferrer"
target="_blank"
>
0.4.0
0.4.1
</a>
</p>
</footer>

View File

@@ -8431,6 +8431,7 @@ lazySignals.then((importedSignals) => {
const head = history.at(0);
if (
head &&
head.preset === preset &&
dateToTestedString(new Date()) === dateToTestedString(head.date)
) {
return;
@@ -8452,10 +8453,11 @@ lazySignals.then((importedSignals) => {
serializedHistory.length = MAX_HISTORY_LENGTH;
}
localStorage.setItem(
LOCAL_STORAGE_HISTORY_KEY,
JSON.stringify(serializedHistory)
);
const jsonHistory = JSON.stringify(serializedHistory);
console.log(jsonHistory);
localStorage.setItem(LOCAL_STORAGE_HISTORY_KEY, jsonHistory);
});
});
}

View File

@@ -50,18 +50,22 @@ self.addEventListener("fetch", (_event) => {
const request = event.request;
const { url, method } = request;
console.log(`service-worker: fetching: ${url}`);
event.respondWith(
caches.match(request).then((cachedResponse) => {
return fetch(request)
.then((response) => {
const { status } = response;
// @ts-ignore
if (url.includes("/api/")) {
return response;
}
return caches.open(version).then((cache) => {
if (response.status === 200) {
if (method === "GET") {
if (status === 200 || status === 304) {
if (status === 200 && method === "GET") {
cache.put(request, response.clone());
}
return response;

File diff suppressed because one or more lines are too long