server: use etag for vecs instead of date modified

This commit is contained in:
nym21
2025-06-24 10:11:03 +02:00
parent 0f3c267a48
commit 016d80e002
45 changed files with 132 additions and 181 deletions

View File

@@ -951,10 +951,7 @@ function createUtils() {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "Years";
}
if (
(!unit || thoroughUnitCheck) &&
(id === "0" || id === "1" || id === "50" || id === "100")
) {
if ((!unit || thoroughUnitCheck) && id.startsWith("constant")) {
if (unit) throw Error(`Unit "${unit}" already assigned "${id}"`);
unit = "constant";
}
@@ -2226,7 +2223,6 @@ function main() {
import("./table.js").then(({ init }) =>
signals.runWithOwner(owner, () =>
init({
colors,
elements,
signals,
utils,

View File

@@ -3484,7 +3484,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
}
} else {
const { input, label } = utils.dom.createLabeledInput({
inputId: `${option.id}_${frame}${id || ""}_selector`,
inputId: `${option.id}-${frame}${id || ""}-selector`,
inputValue: option.id,
inputName: `option_${frame}${id || ""}`,
labelTitle: option.title,
@@ -3667,7 +3667,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
} else if ("url" in anyPartial) {
option = /** @satisfies {UrlOption} */ ({
kind: "url",
id: `${utils.stringToId(anyPartial.name)}_url`,
id: `${utils.stringToId(anyPartial.name)}-url`,
name: anyPartial.name,
path: path || [],
title: anyPartial.name,
@@ -3676,7 +3676,7 @@ export function initOptions({ colors, signals, env, utils, qrcode }) {
});
} else {
const title = anyPartial.title || anyPartial.name;
const id = `chart_${utils.stringToId(title)}`;
const id = `chart-${utils.stringToId(title)}`;
option = /** @satisfies {ChartOption} */ ({
kind: "chart",
id,

View File

@@ -268,7 +268,7 @@ export function init({
/** @type {Record<string, Frequency>} */
const idToFrequency = {};
list.forEach((anyFreq, index) => {
list.forEach((anyFreq) => {
if ("list" in anyFreq) {
anyFreq.list?.forEach((freq) => {
idToFrequency[freq.value] = freq;

View File

@@ -353,7 +353,6 @@ function createTable({
/**
* @param {Object} args
* @param {Colors} args.colors
* @param {Signals} args.signals
* @param {Utilities} args.utils
* @param {Option} args.option
@@ -362,7 +361,6 @@ function createTable({
* @param {VecIdToIndexes} args.vecIdToIndexes
*/
export function init({
colors,
elements,
signals,
option,
@@ -500,7 +498,7 @@ function createIndexToVecIds(vecIdToIndexes) {
});
return arr;
},
/** @type {VecId[][]} */ (new Array(24)),
/** @type {VecId[][]} */ (Array.from({ length: 24 })),
);
indexToVecIds.forEach((arr) => {
arr.sort();