studio: version text in the status bar, favicon
Deploy web Studio / deploy (push) Successful in 3m15s
Deploy web Studio / deploy (push) Successful in 3m15s
The status bar ends with "isokit <engine version>"; the web build adds the commit (linked on Gitea), its date as a tooltip and a "+" when built from a tree with uncommitted changes (build_web.py writes a <meta name="isokit-build"> from GITHUB_SHA or git). /api/meta now carries "engine". studio/favicon.svg (isometric cube in the accent green) is served by `isokit studio` (also on /view) and copied into the web build. check_web.py and check_studio.py check both.
This commit is contained in:
1 parent
c1d01331ac
commit
c647f39059
11 files changed
+66
-4
No files matched your search
@@ -13,7 +13,7 @@ use tiny_http::{Header, Method, Request, Response, Server};
|
||||
const VIEW_PAGE: &str = r#"<!doctype html><html lang="en"><head><meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"><title>isokit preview</title>
|
||||
<script>(function(){var t=null;try{t=localStorage.getItem("isokit-theme")}catch(e){}if(t!=="light"&&t!=="dark")t=matchMedia("(prefers-color-scheme: light)").matches?"light":"dark";document.documentElement.setAttribute("data-theme",t);})();</script>
|
||||
<link rel="stylesheet" href="/assets/viewer/isokit-view.css"><link rel="stylesheet" href="/assets/theme.css">
|
||||
<link rel="icon" type="image/svg+xml" href="/assets/studio/favicon.svg"><link rel="stylesheet" href="/assets/viewer/isokit-view.css"><link rel="stylesheet" href="/assets/theme.css">
|
||||
<style>:root{color-scheme:dark}html[data-theme=light]{color-scheme:light}body{margin:0;background:#0a0f1a;font:14px system-ui,sans-serif;color:#d6deeb}
|
||||
html[data-theme=light] body{background:#f4f6fa;color:#1b2533}main{max-width:1320px;margin:0 auto;padding:16px}</style></head>
|
||||
<body><main><div id="view"></div></main><script src="/assets/viewer/isokit-view.js"></script><script>
|
||||
@@ -164,6 +164,8 @@ pub fn studio(dir: &Path, port: u16, open: bool) -> Result<()> {
|
||||
"text/javascript; charset=utf-8"
|
||||
} else if name.ends_with(".css") {
|
||||
"text/css; charset=utf-8"
|
||||
} else if name.ends_with(".svg") {
|
||||
"image/svg+xml"
|
||||
} else {
|
||||
"text/html; charset=utf-8"
|
||||
};
|
||||
|
||||
@@ -18,6 +18,7 @@ pub fn meta<S: Store>(ws: &Workspace<S>) -> Value {
|
||||
v["dir"] = json!(ws.dir.display().to_string());
|
||||
v["load_error"] = json!(ws.load_error);
|
||||
v["script_error"] = json!(ws.project.runtime.as_ref().err());
|
||||
v["engine"] = json!(env!("CARGO_PKG_VERSION"));
|
||||
v
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ pub const PAGE: &str = include_str!("../../../viewer/page.html");
|
||||
pub const STUDIO_HTML: &str = include_str!("../../../studio/index.html");
|
||||
pub const STUDIO_JS: &str = include_str!("../../../studio/studio.js");
|
||||
pub const STUDIO_CSS: &str = include_str!("../../../studio/studio.css");
|
||||
pub const STUDIO_FAVICON: &str = include_str!("../../../studio/favicon.svg");
|
||||
|
||||
/// Asset by its path in the repository ("viewer/isokit-view.js",
|
||||
/// "studio/studio.js"), from disk when `ISOKIT_ASSETS` is set.
|
||||
@@ -26,6 +27,7 @@ pub fn get(path: &str) -> Option<Cow<'static, str>> {
|
||||
"studio/index.html" => STUDIO_HTML,
|
||||
"studio/studio.js" => STUDIO_JS,
|
||||
"studio/studio.css" => STUDIO_CSS,
|
||||
"studio/favicon.svg" => STUDIO_FAVICON,
|
||||
_ => return None,
|
||||
};
|
||||
Some(Cow::Borrowed(s))
|
||||
|
||||
@@ -216,6 +216,7 @@ mod tests {
|
||||
assert_eq!(m["title"], "isokit demo works");
|
||||
assert!(m["catalog"].as_array().unwrap().len() > 20);
|
||||
assert!(m["script_error"].is_null());
|
||||
assert_eq!(m["engine"], env!("CARGO_PKG_VERSION"));
|
||||
let n = j(&s.state())["doc"]["objects"].as_array().unwrap().len();
|
||||
let v = j(&s.render("site", 1, "", true));
|
||||
assert!(
|
||||
|
||||
Reference in new issue
Block a user