Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
"global-shortcut:allow-unregister-all",
"macos-permissions:default",
"fs:read-files",
"fs:allow-resource-read-recursive"
"fs:allow-resource-read-recursive",
{
"identifier": "fs:scope",
"allow": [{ "path": "$APPDATA" }, { "path": "$APPDATA/**/*" }]
}
]
}
35 changes: 32 additions & 3 deletions src/components/settings/history/HistorySettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ import { Button } from "../../ui/Button";
import { Copy, Star, Check, Trash2, FolderOpen } from "lucide-react";
import { convertFileSrc } from "@tauri-apps/api/core";
import { listen } from "@tauri-apps/api/event";
import { platform } from "@tauri-apps/plugin-os";
import { readFile } from "@tauri-apps/plugin-fs";
import { commands, type HistoryEntry } from "@/bindings";
import { formatDateTime } from "@/utils/dateFormat";

const IS_LINUX = platform() === "linux";

interface OpenRecordingsButtonProps {
onClick: () => void;
label: string;
Expand Down Expand Up @@ -93,7 +97,14 @@ export const HistorySettings: React.FC = () => {
try {
const result = await commands.getAudioFilePath(fileName);
if (result.status === "ok") {
return convertFileSrc(`${result.data}`, "asset");
if (IS_LINUX) {
const fileData = await readFile(result.data);
const blob = new Blob([fileData], { type: "audio/wav" });

return URL.createObjectURL(blob);
}

return convertFileSrc(result.data, "asset");
}
return null;
} catch (error) {
Expand Down Expand Up @@ -222,12 +233,30 @@ const HistoryEntryComponent: React.FC<HistoryEntryProps> = ({
const [showCopied, setShowCopied] = useState(false);

useEffect(() => {
let cancelled = false;
let urlToRevoke: string | null = null;

const loadAudio = async () => {
const url = await getAudioUrl(entry.file_name);
setAudioUrl(url);

if (!cancelled) {
urlToRevoke = url;
setAudioUrl(url);
} else if (url?.startsWith("blob:")) {
URL.revokeObjectURL(url);
}
};

loadAudio();
}, [entry.file_name, getAudioUrl]);

return () => {
cancelled = true;

if (urlToRevoke?.startsWith("blob:")) {
URL.revokeObjectURL(urlToRevoke);
}
};
}, [entry.file_name]);

const handleCopyText = () => {
onCopyText();
Expand Down
6 changes: 5 additions & 1 deletion src/i18n/locales/pt/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@
"grant": "Conceder Permissão",
"granted": "Concedido",
"waiting": "Aguardando...",
"allGranted": "Tudo pronto!"
"allGranted": "Tudo pronto!",
"errors": {
"checkFailed": "Erro ao verificar permissões. Por favor, tente novamente.",
"requestFailed": "Erro ao solicitar permissão. Por favor, tente novamente."
}
}
},
"modelSelector": {
Expand Down