Skip to content

Commit a455fe2

Browse files
committed
now the links in the hrefs for the buttons use the routify function in their link that should fix issues, PACKAGE
1 parent 054535a commit a455fe2

File tree

7 files changed

+36
-27
lines changed

7 files changed

+36
-27
lines changed

renderer/src/routes/face-explore/index.svelte

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { midpointEmbedding, sampleClusterMedoids } from './explore-utils';
1010
1111
import { facesSetUp, getFaceThumbnail } from '$lib/utils/faces';
1212
import StreamResultCard from '$lib/components/StreamResultCard.svelte';
13-
13+
import { url } from '@roxi/routify';
1414
1515
const VIDEO_ICON = '/assets/icons/videoplay512.png';
1616
let mediaDir: string = $state(getContext('mediaDir'));
@@ -444,7 +444,7 @@ function buildOptions(): Options {
444444
<div class="d-block d-lg-none h-100">
445445
<Row class="h-100 align-items-center ">
446446
<Col xs="auto" class="d-flex justify-content-start">
447-
<Button color="primary" size="sm" href="/">
447+
<Button color="primary" size="sm" href={$url("/")}>
448448
<Icon name="house-fill" class="fs-6"/>
449449
</Button>
450450
</Col>
@@ -467,7 +467,7 @@ function buildOptions(): Options {
467467
<div class="d-none d-lg-block h-100">
468468
<Row class="h-100 align-items-center gx-3">
469469
<Col xs="auto" class="d-flex justify-content-start">
470-
<Button color="primary" size="md" href="/">
470+
<Button color="primary" size="md" href={$url("/")}>
471471
<Icon name="house-fill" class="fs-3"/>
472472
</Button>
473473
</Col>

renderer/src/routes/import-export/index.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import SpinnerSimple from "$lib/components/SpinnerSimple.svelte";
44
import { clearSessionMediaCache } from "$lib/utils/temp-mediafiles";
55
import { Button, Col, Container, Icon, Input, Row, TabContent, TabPane, Toast } from "@sveltestrap/sveltestrap";
66
7+
import { url } from '@roxi/routify';
8+
79
let status: string|number = 'alpha';
810
let isOpen = $state(false);
911
let toastMessage = "";
@@ -59,7 +61,7 @@ async function importTaga() {
5961
<SpinnerSimple busy={processingSpinner} message="Processing..." color="rgba(0,255,128,.9)" block={true}/>
6062

6163

62-
<Button color="primary" size="lg" href="/" class="ms-3 mt-3 mb-4">
64+
<Button color="primary" size="lg" href={$url("/")} class="ms-3 mt-3 mb-4">
6365
<Icon name="house-fill" class="fs-3"/>
6466
</Button>
6567

renderer/src/routes/index.svelte

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
import { Container, Row, Col, Button, Card, CardBody, CardTitle, CardText, Navbar, NavbarBrand, Icon } from '@sveltestrap/sveltestrap';
55
import { onMount } from 'svelte';
66
7+
import { url } from '@roxi/routify';
78
89
onMount(() => {
910
console.log('main index')
1011
})
11-
</script>
12+
</script>
1213

1314

1415

@@ -24,7 +25,7 @@
2425
<CardBody>
2526
<CardTitle>Gallery</CardTitle>
2627
<CardText>See your files, tag them, describe, and search as well.</CardText>
27-
<Button color="primary" outline size="lg" href="/tagging"><Icon name="hand-index-thumb-fill" /></Button>
28+
<Button color="primary" outline size="lg" href={$url('/tagging')}><Icon name="hand-index-thumb-fill" /></Button>
2829
</CardBody>
2930
</Card>
3031
</Col>
@@ -33,7 +34,7 @@
3334
<CardBody>
3435
<CardTitle>Stream</CardTitle>
3536
<CardText>Use your webcam, or screen to search for people you know in real time.</CardText>
36-
<Button color="primary" outline size="lg" href="/streaming"><Icon name="hand-index-thumb-fill" /></Button>
37+
<Button color="primary" outline size="lg" href={$url("/streaming")}><Icon name="hand-index-thumb-fill" /></Button>
3738
</CardBody>
3839
</Card>
3940
</Col>
@@ -45,7 +46,7 @@
4546
<CardBody>
4647
<CardTitle >Face Explore</CardTitle>
4748
<CardText>Explore and search through faces in the media stored.</CardText>
48-
<Button color="primary" outline size="lg" href="/face-explore"><Icon name="hand-index-thumb-fill" /></Button>
49+
<Button color="primary" outline size="lg" href={$url("/face-explore")}><Icon name="hand-index-thumb-fill" /></Button>
4950
</CardBody>
5051
</Card>
5152
</Col>
@@ -54,7 +55,7 @@
5455
<CardBody>
5556
<CardTitle >Upload / Export / Import</CardTitle>
5657
<CardText>Upload your files / Export your data to be used elsewhere / Import.</CardText>
57-
<Button color="primary" outline size="lg" href="/import-export"><Icon name="hand-index-thumb-fill" /></Button>
58+
<Button color="primary" outline size="lg" href={$url("/import-export")}><Icon name="hand-index-thumb-fill" /></Button>
5859
</CardBody>
5960
</Card>
6061
</Col>

renderer/src/routes/streaming/index.svelte

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import StreamResultCard from '$lib/components/StreamResultCard.svelte';
66
import { facesSetUp, detectFacesInImage, embedFace } from '$lib/utils/faces';
77
import { boxDistance } from '$lib/utils/ml-utils';
88
import type { DisplayServer} from '$lib/utils/localStorageManager';
9+
import { url } from '@roxi/routify';
910
1011
const optionLabels = ["none", "camera", "screen"];
1112
@@ -45,7 +46,7 @@ let videoEl: HTMLVideoElement | null = null;
4546
let canvasEl: HTMLCanvasElement | null = null;
4647
let isPaused = $state(false);
4748
let hasStream = $state(false);
48-
const placeholderUrl = new URL('/assets/images/Taga.png', import.meta.url).href;
49+
4950
let searchRows = $state<SearchRow[]>([]);
5051
5152
type SourceOption = "none"|"screen"|"camera";
@@ -65,6 +66,8 @@ let lastResetTime = $state<number>(0); //timestamp of last reset
6566
let isFixed = $state(false);
6667
let lastDrawnBox = $state<number[] | null>(null);
6768
69+
let assetPath;
70+
const placeholderUrl = new URL('/assets/images/Taga.png', import.meta.url).href; //TODO: check windows
6871
6972
$effect(() => {
7073
handleSourceSelect(sourceSelected);
@@ -73,6 +76,8 @@ $effect(() => {
7376
7477
onMount(async () => {
7578
try {
79+
assetPath = await window.bridge.getAssetPath();
80+
7681
const setupSuccess = await facesSetUp();
7782
console.log(`isWayland = ${isWayland}`);
7883
@@ -522,7 +527,7 @@ async function maybeEmbed(faceId: number) {
522527
<div class="d-block d-lg-none h-100">
523528
<Row class="h-100 align-items-center ">
524529
<Col xs="auto" class="d-flex justify-content-start">
525-
<Button color="primary" size="sm" href="/">
530+
<Button color="primary" size="sm" href={$url("/")}>
526531
<Icon name="house-fill" class="fs-6"/>
527532
</Button>
528533
</Col>
@@ -551,7 +556,7 @@ async function maybeEmbed(faceId: number) {
551556
<div class="d-none d-lg-block h-100">
552557
<Row class="h-100 align-items-center gx-3">
553558
<Col xs="auto" class="d-flex justify-content-start">
554-
<Button color="primary" size="md" href="/">
559+
<Button color="primary" size="md" href={$url("/")}>
555560
<Icon name="house-fill" class="fs-3"/>
556561
</Button>
557562
</Col>

renderer/src/routes/tagging/[slug].svelte

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {facesSetUp, detectFacesInImage, embedFace, scaleFaceBox, make112Face} fr
1414
import SearchResultCard from '$lib/components/SearchResultCard.svelte';
1515
import TaggingSlugContextMenu from '$lib/components/TaggingSlugContextMenu.svelte';
1616
import { l2NormalizeReturn } from '$lib/utils/ml-utils';
17-
17+
import { url } from '@roxi/routify';
1818
1919
const device = getContext<DeviceGPU>('gpuDevice') ?? 'wasm';
2020
@@ -59,14 +59,14 @@ onMount(async () => {
5959
}
6060
6161
if(!mediaFile) {
62-
window.location.href = "/tagging"
62+
window.location.href = $url("/tagging")
6363
} else {
6464
seenMediaFiles.push(mediaFile);
6565
await removeMediaFileSequential(mediaFile.fileHash);
6666
}
6767
} catch (error) {
6868
console.error("Error during media retrieval:", error);
69-
window.location.href = "/tagging"; //$goto('/tagging');
69+
window.location.href = $url("/tagging"); //$goto('/tagging');
7070
}
7171
7272
await facesSetUp(); //~0.6seconds
@@ -94,11 +94,11 @@ async function nextMediaFile() {
9494
9595
await removeMediaFileSequential(mediaFile.fileHash);
9696
} else {
97-
window.location.href = "/tagging"; //$goto('/tagging');
97+
window.location.href = $url("/tagging"); //$goto('/tagging');
9898
}
9999
} catch (error) {
100100
console.error("Error in nextMediaFile:", error);
101-
window.location.href = "/tagging" //$goto('/tagging');
101+
window.location.href = $url("/tagging") //$goto('/tagging');
102102
}
103103
}
104104
@@ -110,7 +110,7 @@ async function prevMediaFile() {
110110
try {
111111
if (!mediaFile) {
112112
console.warn("No current media file is set.");
113-
window.location.href = "/tagging"; //$goto('/tagging');
113+
window.location.href = $url("/tagging"); //$goto('/tagging');
114114
return;
115115
}
116116
@@ -125,7 +125,7 @@ async function prevMediaFile() {
125125
}
126126
} catch (error) {
127127
console.error("Error in prevMediaFile:", error);
128-
window.location.href = "/tagging"; //$goto('/tagging');
128+
window.location.href = $url("/tagging"); //$goto('/tagging');
129129
}
130130
}
131131
@@ -149,7 +149,7 @@ async function confirmDelete() {
149149
150150
const freshCount = await getTotalMediaFileCount();
151151
if( freshCount <= 0 ) {
152-
window.location.href = "/tagging";
152+
window.location.href = $url("/tagging");
153153
}
154154
155155
isProcessing = false;
@@ -383,7 +383,7 @@ async function saveFile() {
383383
<!-- Top row: Back and Delete -->
384384
<Row class="mb-1 align-items-center">
385385
<Col xs="6" class="d-flex justify-content-start">
386-
<Button color="primary" size="sm" href="/"><Icon name="house-fill" class="fs-6"/></Button>
386+
<Button color="primary" size="sm" href={$url("/")}><Icon name="house-fill" class="fs-6"/></Button>
387387

388388
<Input disabled={isProcessing} type="select" class="w-auto ms-1 me-2" bind:value={mode}>
389389
{#each ["edit", "gallery"] as option}
@@ -410,7 +410,7 @@ async function saveFile() {
410410
<div class="d-none d-sm-block">
411411
<Row class="mb-2 align-items-center">
412412
<Col xs="4" class="d-flex justify-content-start">
413-
<Button color="primary" size="md" href="/"><Icon name="house-fill" class="fs-3"/></Button>
413+
<Button color="primary" size="md" href={$url("/")}><Icon name="house-fill" class="fs-3"/></Button>
414414

415415
<Input disabled={isProcessing} type="select" class="w-auto ms-2 me-2" bind:value={mode}>
416416
{#each ["edit", "gallery"] as option}

renderer/src/routes/tagging/index.svelte

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { getContext, onMount } from 'svelte';
99
import { type MediaFile } from '$lib/types/general-types';
1010
import { fillSampleMediaFiles, getNewMediaFiles } from '$lib/utils/temp-mediafiles';
1111
import { assignFreshImport, freshImport } from '$lib/state/states.svelte';
12-
12+
import { url } from '@roxi/routify';
1313
1414
1515
let mediaDir: string = $state(getContext('mediaDir'));
@@ -65,7 +65,7 @@ function truncateDescription(description: string): string {
6565
<div class="pt-3">
6666
<div class="d-block d-md-none mb-4">
6767
<div class="d-flex flex-row justify-content-evenly">
68-
<Button color="primary" class="w-25" href="/"><Icon name="house-fill" class="fs-4"/></Button>
68+
<Button color="primary" class="w-25" href={$url("/")}><Icon name="house-fill" class="fs-4"/></Button>
6969
<Button disabled={isProcessing} id="btn-dice-sm" color="primary" class="w-25" on:click={setCards}><Icon name="dice-5-fill"/></Button>
7070
<Tooltip target="btn-dice-sm" placement="bottom">See New</Tooltip>
7171
</div>
@@ -75,7 +75,7 @@ function truncateDescription(description: string): string {
7575
<div class="d-none d-md-block mb-4">
7676
<Row class="align-items-center">
7777
<Col md="2" class="text-start">
78-
<Button color="primary" size="lg" href="/"><Icon name="house-fill" class="fs-4"/></Button>
78+
<Button color="primary" size="lg" href={$url("/")}><Icon name="house-fill" class="fs-4"/></Button>
7979
</Col>
8080
<Col md="2" class="text-center">
8181
<Button disabled={isProcessing} id="btn-dice-md" color="primary" size="lg" style="white-space: nowrap;" on:click={setCards}><Icon name="dice-5-fill" /></Button>
@@ -105,7 +105,7 @@ function truncateDescription(description: string): string {
105105
outline
106106
color="primary"
107107
size="md"
108-
href={`/tagging/${card.fileHash}?fileType=${encodeURIComponent(card.fileType)}`}>
108+
href={$url(`/tagging/[slug]`, {slug: card.fileHash, fileType: encodeURIComponent(card.fileType)})}>
109109
<Icon name="hand-index-thumb-fill" />
110110
</Button>
111111
</CardTitle>

renderer/src/routes/user-settings/index.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<script lang="ts">
22
import {Container, Row, Col, Button, Modal, ModalHeader, ModalBody, ModalFooter, Icon, Input} from '@sveltestrap/sveltestrap';
33
import { onMount } from 'svelte';
4+
import { url } from '@roxi/routify';
45
56
let showConfirm = $state(false);
67
let baseDataPath = $state('');
@@ -28,7 +29,7 @@
2829

2930
<Container class="my-4">
3031

31-
<Button color="primary" size="lg" href="/" class="mt-1 mb-4">
32+
<Button color="primary" size="lg" href={$url("/")} class="mt-1 mb-4">
3233
<Icon name="house-fill" class="fs-3"/>
3334
</Button>
3435

0 commit comments

Comments
 (0)