+1
-6
src/Components/PhotoList.tsx
+1
-6
src/Components/PhotoList.tsx
···
64
64
let filterType: FilterType = FilterType.USER;
65
65
let filter = '';
66
66
67
-
let os = "unknown";
68
-
(async () => {
69
-
os = await invoke('get_os');
70
-
})();
71
-
72
67
let filteredPhotos: Photo[] = [];
73
68
74
69
let closeWithKey = ( e: KeyboardEvent ) => {
···
173
168
this.imageEl = document.createElement('img');
174
169
this.imageEl.crossOrigin = 'anonymous';
175
170
176
-
this.imageEl.src = os === "windows" ? "http://photo.localhost/" : "photo://localhost" + photoPath + this.path + "?downscale";
171
+
this.imageEl.src = (window.OS === "windows" ? "http://photo.localhost/" : "photo://localhost") + photoPath + this.path + "?downscale";
177
172
178
173
this.imageEl.onload = () => {
179
174
this.image!.width = this.scaledWidth!;
+1
-1
src/Components/PhotoViewer.tsx
+1
-1
src/Components/PhotoViewer.tsx
···
262
262
if(!photoPath)
263
263
photoPath = await invoke('get_user_photos_path') + '/';
264
264
265
-
imageViewer.src = await invoke('get_os') === "windows" ? "http://photo.localhost/" : 'photo://localhost' + (photoPath + props.currentPhotoView().path).split('\\').join('/') + "?full";
265
+
imageViewer.src = (window.OS === "windows" ? "http://photo.localhost/" : 'photo://localhost') + (photoPath + props.currentPhotoView().path).split('\\').join('/') + "?full";
266
266
imageViewer.crossOrigin = 'anonymous';
267
267
})();
268
268
+12
-6
src/index.tsx
+12
-6
src/index.tsx
···
4
4
declare global{
5
5
interface Window {
6
6
CloseAllPopups: (() => void)[]
7
+
OS: string;
7
8
}
8
9
}
9
10
···
13
14
14
15
import "./styles.css";
15
16
import App from "./Components/App";
16
-
17
-
render(() => <App />, document.getElementById("root") as HTMLElement);
17
+
import { invoke } from "@tauri-apps/api/core";
18
18
19
-
let f = new FontFace('Rubik', 'url(https://cdn.phaz.uk/fonts/rubik/Rubik-VariableFont_wght.ttf)');
19
+
(async () => {
20
+
window.OS = await invoke('get_os');
20
21
21
-
f.load().then((font) => {
22
-
document.fonts.add(font);
23
-
});
22
+
render(() => <App />, document.getElementById("root") as HTMLElement);
23
+
24
+
let f = new FontFace('Rubik', 'url(https://cdn.phaz.uk/fonts/rubik/Rubik-VariableFont_wght.ttf)');
25
+
26
+
f.load().then((font) => {
27
+
document.fonts.add(font);
28
+
});
29
+
})();