Skip to content

Commit 174ebdd

Browse files
committed
Merge branch 'main' into new-kb-impl
2 parents c2206f7 + 246fb4e commit 174ebdd

File tree

3 files changed

+42
-5
lines changed

3 files changed

+42
-5
lines changed

src-tauri/capabilities/default.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@
1515
"global-shortcut:allow-unregister-all",
1616
"macos-permissions:default",
1717
"fs:read-files",
18-
"fs:allow-resource-read-recursive"
18+
"fs:allow-resource-read-recursive",
19+
{
20+
"identifier": "fs:scope",
21+
"allow": [{ "path": "$APPDATA" }, { "path": "$APPDATA/**/*" }]
22+
}
1923
]
2024
}

src/components/settings/history/HistorySettings.tsx

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,13 @@ import { Button } from "../../ui/Button";
55
import { Copy, Star, Check, Trash2, FolderOpen } from "lucide-react";
66
import { convertFileSrc } from "@tauri-apps/api/core";
77
import { listen } from "@tauri-apps/api/event";
8+
import { platform } from "@tauri-apps/plugin-os";
9+
import { readFile } from "@tauri-apps/plugin-fs";
810
import { commands, type HistoryEntry } from "@/bindings";
911
import { formatDateTime } from "@/utils/dateFormat";
1012

13+
const IS_LINUX = platform() === "linux";
14+
1115
interface OpenRecordingsButtonProps {
1216
onClick: () => void;
1317
label: string;
@@ -93,7 +97,14 @@ export const HistorySettings: React.FC = () => {
9397
try {
9498
const result = await commands.getAudioFilePath(fileName);
9599
if (result.status === "ok") {
96-
return convertFileSrc(`${result.data}`, "asset");
100+
if (IS_LINUX) {
101+
const fileData = await readFile(result.data);
102+
const blob = new Blob([fileData], { type: "audio/wav" });
103+
104+
return URL.createObjectURL(blob);
105+
}
106+
107+
return convertFileSrc(result.data, "asset");
97108
}
98109
return null;
99110
} catch (error) {
@@ -222,12 +233,30 @@ const HistoryEntryComponent: React.FC<HistoryEntryProps> = ({
222233
const [showCopied, setShowCopied] = useState(false);
223234

224235
useEffect(() => {
236+
let cancelled = false;
237+
let urlToRevoke: string | null = null;
238+
225239
const loadAudio = async () => {
226240
const url = await getAudioUrl(entry.file_name);
227-
setAudioUrl(url);
241+
242+
if (!cancelled) {
243+
urlToRevoke = url;
244+
setAudioUrl(url);
245+
} else if (url?.startsWith("blob:")) {
246+
URL.revokeObjectURL(url);
247+
}
228248
};
249+
229250
loadAudio();
230-
}, [entry.file_name, getAudioUrl]);
251+
252+
return () => {
253+
cancelled = true;
254+
255+
if (urlToRevoke?.startsWith("blob:")) {
256+
URL.revokeObjectURL(urlToRevoke);
257+
}
258+
};
259+
}, [entry.file_name]);
231260

232261
const handleCopyText = () => {
233262
onCopyText();

src/i18n/locales/pt/translation.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@
7171
"grant": "Conceder Permissão",
7272
"granted": "Concedido",
7373
"waiting": "Aguardando...",
74-
"allGranted": "Tudo pronto!"
74+
"allGranted": "Tudo pronto!",
75+
"errors": {
76+
"checkFailed": "Erro ao verificar permissões. Por favor, tente novamente.",
77+
"requestFailed": "Erro ao solicitar permissão. Por favor, tente novamente."
78+
}
7579
}
7680
},
7781
"modelSelector": {

0 commit comments

Comments
 (0)