This commit is contained in:
2025-07-25 23:04:44 +02:00
parent c14d78b2b0
commit f5edf9f81f
3 changed files with 6 additions and 3 deletions

View File

@@ -54,7 +54,7 @@ rule minhtml
build build.ninja: regen | config.py build/badges.txt res pages build build.ninja: regen | config.py build/badges.txt res pages
build build/deploy/coffee.js : python_capture coffee/gen_js.py build build/deploy/coffee.js : python_capture gen_coffee_js.py
rule cargo_release_bin rule cargo_release_bin
command = (cd $in && cargo build --release) && cp $in/target/release/$file $out command = (cd $in && cargo build --release) && cp $in/target/release/$file $out
@@ -64,6 +64,7 @@ build build/coffee_server : cargo_release_bin coffee
file = coffee file = coffee
""" """
web_targets.append("build/deploy/coffee.js")
web_targets.append("build/coffee_server") web_targets.append("build/coffee_server")
pages = [x for x in os.listdir("./pages/")] pages = [x for x in os.listdir("./pages/")]

View File

@@ -17,14 +17,14 @@ const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
if(tz==null) return null; if(tz==null) return null;
const c=\""""+out+"""\".split("|"); const c=\""""+out+"""\".split("|");
for(let i=0;i<c.length;i+=2){ for(let i=0;i<c.length;i+=2){
if(c[i]===timezone){ if(c[i]===tz){
return c[i+1]; return c[i+1];
}} }}
return null; return null;
} }
async function byCountry(country) { async function byCountry(country) {
const url = `http://127.0.0.1:3000/price/${encodeURIComponent(country)}`; const url = `https://coffee-price.vxcc.dev/price/${encodeURIComponent(country)}`;
try { try {
const response = await fetch(url); const response = await fetch(url);

View File

@@ -105,6 +105,8 @@
gotoVariant('.min.pdf'); gotoVariant('.min.pdf');
}); });
") ")
html.elem("script", attrs:("src":"coffee.js","async":""))
} }
] ]
} }