|
1 | 1 | import { readable, writable } from "svelte/store"; |
2 | 2 | import type { Run } from "./types"; |
3 | | -import { get, set } from "tauri-settings"; |
| 3 | +// import { get, set } from "tauri-settings"; |
4 | 4 |
|
5 | | -type directory = { |
| 5 | +/* type directory = { |
6 | 6 | stableDiffusionDirectory: string; |
7 | 7 | }; |
8 | | - |
9 | 8 | const getStableDiffusionDirectory = async () => { |
10 | 9 | let sdDir = ""; |
11 | 10 |
|
@@ -36,11 +35,27 @@ async function stableDiffusionDirectoryStore() { |
36 | 35 | register: (sdDirectory: string) => setStableDiffusionDirectory(sdDirectory), |
37 | 36 | }; |
38 | 37 | } |
39 | | -export const stableDiffusionDirectory = await stableDiffusionDirectoryStore(); |
| 38 | +export const stableDiffusionDirectory = await stableDiffusionDirectoryStore(); */ |
40 | 39 |
|
41 | 40 | // Use this in lieu of an event bus to assign a prompt from a saved run to the prompt input |
42 | 41 | export const reusePrompt = writable(''); |
43 | 42 |
|
| 43 | +// Store runs to localStorage for now |
| 44 | +function createStableDiffusionDirectory() { |
| 45 | + let storedStableDiffusionDirectory = JSON.parse(localStorage.getItem("stableDiffusionDirectory")) || ""; |
| 46 | + const { subscribe, set } = writable(storedStableDiffusionDirectory); |
| 47 | + |
| 48 | + return { |
| 49 | + subscribe, |
| 50 | + set: (sdDir: string) => { |
| 51 | + localStorage.setItem("stableDiffusionDirectory", JSON.stringify(sdDir)); |
| 52 | + set(sdDir); |
| 53 | + } |
| 54 | + }; |
| 55 | +} |
| 56 | + |
| 57 | +export const stableDiffusionDirectory = createStableDiffusionDirectory(); |
| 58 | + |
44 | 59 | // Store runs to localStorage for now |
45 | 60 | function createRunsStore() { |
46 | 61 | let storedRuns = JSON.parse(localStorage.getItem("runs")) || []; |
|
0 commit comments