Use relative paths for static resources, and fix some lint errors
parent
fff01410d5
commit
7d0dc6d907
|
@ -30,7 +30,7 @@ export const toRealUrl = <T extends (string | URL)>(url : T) : T => {
|
|||
|
||||
export const toInternalUrl = (url : string) => {
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) {
|
||||
var parsedUrl = new URL(url);
|
||||
const parsedUrl = new URL(url);
|
||||
if (parsedUrl.pathname.startsWith(urlPrefix)) {
|
||||
parsedUrl.pathname = parsedUrl.pathname.substr(urlPrefix.length);
|
||||
return parsedUrl.href;
|
||||
|
|
|
@ -40,7 +40,7 @@ export async function updateMarkdownPreview() {
|
|||
"rhs",
|
||||
2,
|
||||
`
|
||||
<link rel="stylesheet" href="/.client/main.css" />
|
||||
<link rel="stylesheet" href=".client/main.css" />
|
||||
<style>
|
||||
${css}
|
||||
${customStyles ?? ""}
|
||||
|
|
|
@ -287,7 +287,7 @@ export class HttpServer {
|
|||
if (req.method === "GET") {
|
||||
if (assetName === "service_worker.js") {
|
||||
c.header("Cache-Control", "no-cache");
|
||||
const textData = new TextDecoder().decode(data as Uint8Array);
|
||||
const textData = new TextDecoder().decode(data);
|
||||
// console.log(
|
||||
// "Swapping out config hash in service worker",
|
||||
// );
|
||||
|
@ -302,12 +302,6 @@ export class HttpServer {
|
|||
),
|
||||
);
|
||||
}
|
||||
if (assetName.endsWith(".css")) {
|
||||
const textData = new TextDecoder().decode(data as Uint8Array);
|
||||
data = textData.replaceAll(
|
||||
"{{URL_PREFIX}}",
|
||||
urlPrefix);
|
||||
}
|
||||
return Promise.resolve(c.body(data));
|
||||
} // else e.g. HEAD, OPTIONS, don't send body
|
||||
} catch {
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<base href="{{URL_PREFIX}}/" />
|
||||
<link rel="apple-touch-icon" href="{{URL_PREFIX}}/.client/logo.png" />
|
||||
<link rel="apple-touch-icon" href=".client/logo.png" />
|
||||
<meta
|
||||
name="theme-color"
|
||||
content="#e1e1e1"
|
||||
|
@ -21,7 +21,7 @@
|
|||
<meta name="referrer" content="no-referrer" />
|
||||
|
||||
<title>{{TITLE}}</title>
|
||||
<meta property="og:image" content="{{URL_PREFIX}}/.client/logo.png" />
|
||||
<meta property="og:image" content=".client/logo.png" />
|
||||
<meta property="og:description" content="{{DESCRIPTION}}" />
|
||||
|
||||
<script>
|
||||
|
@ -68,11 +68,11 @@
|
|||
};
|
||||
}
|
||||
</script>
|
||||
<link rel="stylesheet" href="{{URL_PREFIX}}/.client/main.css" />
|
||||
<link rel="stylesheet" href=".client/main.css" />
|
||||
<style id="custom-styles"></style>
|
||||
<script type="module" src="{{URL_PREFIX}}/.client/client.js"></script>
|
||||
<link rel="manifest" href="{{URL_PREFIX}}/.client/manifest.json" />
|
||||
<link rel="icon" type="image/x-icon" href="{{URL_PREFIX}}/.client/favicon.png" />
|
||||
<script type="module" src=".client/client.js"></script>
|
||||
<link rel="manifest" href=".client/manifest.json" />
|
||||
<link rel="icon" type="image/x-icon" href=".client/favicon.png" />
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
|
|
@ -5,28 +5,28 @@
|
|||
|
||||
@font-face {
|
||||
font-family: "iA-Mono";
|
||||
src: url("{{URL_PREFIX}}/.client/iAWriterMonoS-Regular.woff2");
|
||||
src: url("iAWriterMonoS-Regular.woff2");
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "iA-Mono";
|
||||
src: url("{{URL_PREFIX}}/.client/iAWriterMonoS-Bold.woff2");
|
||||
src: url("iAWriterMonoS-Bold.woff2");
|
||||
font-weight: bold;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "iA-Mono";
|
||||
src: url("{{URL_PREFIX}}/.client/iAWriterMonoS-Italic.woff2");
|
||||
src: url("iAWriterMonoS-Italic.woff2");
|
||||
font-weight: normal;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "iA-Mono";
|
||||
src: url("{{URL_PREFIX}}/.client/iAWriterMonoS-BoldItalic.woff2");
|
||||
src: url("iAWriterMonoS-BoldItalic.woff2");
|
||||
font-weight: bold;
|
||||
font-style: italic;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue