[F] Fix deploy subpath breadcrumbs
This commit is contained in:
+6
-1
@@ -1,5 +1,9 @@
|
|||||||
root $dir_path;
|
root $dir_path;
|
||||||
|
|
||||||
|
if ($deploy_path = "") {
|
||||||
|
set $deploy_path "/";
|
||||||
|
}
|
||||||
|
|
||||||
# The MeowIndex web app block
|
# The MeowIndex web app block
|
||||||
location /__meowindex__ {
|
location /__meowindex__ {
|
||||||
alias /etc/nginx/MeowIndex/dist;
|
alias /etc/nginx/MeowIndex/dist;
|
||||||
@@ -7,7 +11,8 @@ location /__meowindex__ {
|
|||||||
# Use sub_filter to configure the app
|
# Use sub_filter to configure the app
|
||||||
sub_filter_types application/javascript;
|
sub_filter_types application/javascript;
|
||||||
sub_filter_once off;
|
sub_filter_once off;
|
||||||
sub_filter "{DEPLOY-PATH-PLACEHOLDER}" "/__meowindex__";
|
sub_filter "{ASSETS-PATH-PLACEHOLDER}" "/__meowindex__";
|
||||||
|
sub_filter "{DEPLOY-PATH-PLACEHOLDER}" $deploy_path;
|
||||||
sub_filter "{HOST-PLACEHOLDER}" "/api";
|
sub_filter "{HOST-PLACEHOLDER}" "/api";
|
||||||
sub_filter "\"/assets" "\"/__meowindex__/assets";
|
sub_filter "\"/assets" "\"/__meowindex__/assets";
|
||||||
sub_filter "File Listing" $title;
|
sub_filter "File Listing" $title;
|
||||||
|
|||||||
+8
-6
@@ -26,10 +26,12 @@ interface File {
|
|||||||
const getType = (f: File) => f.type ?? f.file_type
|
const getType = (f: File) => f.type ?? f.file_type
|
||||||
|
|
||||||
// Placeholder for nginx to replace
|
// Placeholder for nginx to replace
|
||||||
|
let assetsPath = "{ASSETS-PATH-PLACEHOLDER}"
|
||||||
let deployPath = "{DEPLOY-PATH-PLACEHOLDER}"
|
let deployPath = "{DEPLOY-PATH-PLACEHOLDER}"
|
||||||
let host = "{HOST-PLACEHOLDER}"
|
let host = "{HOST-PLACEHOLDER}"
|
||||||
|
|
||||||
// Default deploy path and host for testing
|
// Default paths and host for testing
|
||||||
|
if (assetsPath.includes("-PLACEHOLDER")) assetsPath = "/"
|
||||||
if (deployPath.includes("-PLACEHOLDER")) deployPath = "/"
|
if (deployPath.includes("-PLACEHOLDER")) deployPath = "/"
|
||||||
if (host.includes("-PLACEHOLDER")) host = "https://daisy.hydev.org/data/api"
|
if (host.includes("-PLACEHOLDER")) host = "https://daisy.hydev.org/data/api"
|
||||||
|
|
||||||
@@ -47,14 +49,14 @@ const fetchApi = async () =>
|
|||||||
|
|
||||||
function getIcon(f: File)
|
function getIcon(f: File)
|
||||||
{
|
{
|
||||||
if (getType(f) == "directory") return urlJoin(deployPath, "mime/folder.svg")
|
if (getType(f) == "directory") return urlJoin(assetsPath, "mime/folder.svg")
|
||||||
|
|
||||||
if (f.has_thumb) return urlJoin(host, filePath, f.name) + "?thumb=1"
|
if (f.has_thumb) return urlJoin(host, filePath, f.name) + "?thumb=1"
|
||||||
|
|
||||||
const sp = f.name.split(".")
|
const sp = f.name.split(".")
|
||||||
const m = f.mime ?? mime.getType(sp[sp.length - 1])
|
const m = f.mime ?? mime.getType(sp[sp.length - 1])
|
||||||
if (m) return urlJoin(deployPath, `mime/${m.replace("/", "-")}.svg`)
|
if (m) return urlJoin(assetsPath, `mime/${m.replace("/", "-")}.svg`)
|
||||||
else return urlJoin(deployPath, 'mime/application-blank.svg')
|
else return urlJoin(assetsPath, 'mime/application-blank.svg')
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHref(f: File)
|
function getHref(f: File)
|
||||||
@@ -67,7 +69,7 @@ const alpNum = new Set("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRST
|
|||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
const [api] = createResource(fetchApi)
|
const [api] = createResource(fetchApi)
|
||||||
const paths = [window.location.host, ...filePath.split("/").filter(it => it)]
|
const paths = [window.location.host, ...fullPath.split("/").filter(it => it)]
|
||||||
|
|
||||||
// Infinite Scroll
|
// Infinite Scroll
|
||||||
const [scrollIndex, setScrollIndex] = createSignal(50)
|
const [scrollIndex, setScrollIndex] = createSignal(50)
|
||||||
@@ -150,7 +152,7 @@ export default function App() {
|
|||||||
<>
|
<>
|
||||||
<a class="breadcrumb-link ml-2 first:ml-0"
|
<a class="breadcrumb-link ml-2 first:ml-0"
|
||||||
classList={{active: i() + 1 == paths.length}}
|
classList={{active: i() + 1 == paths.length}}
|
||||||
href={urlJoin(filePath, "../".repeat(paths.length - i() - 1))}>{decodeURIComponent(p)}</a>
|
href={urlJoin(fullPath, "../".repeat(paths.length - i() - 1))}>{decodeURIComponent(p)}</a>
|
||||||
<span class="color-subsub ml-2 last:hidden">/</span>
|
<span class="color-subsub ml-2 last:hidden">/</span>
|
||||||
</>
|
</>
|
||||||
}</For>
|
}</For>
|
||||||
|
|||||||
Reference in New Issue
Block a user