mirror of
https://github.com/garethgeorge/backrest.git
synced 2026-09-25 09:25:36 +00:00
chore: use JWTs for signed download URLs instead of bespoke signatures
This commit is contained in:
@@ -458,7 +458,7 @@ const RestoreOperationStatus = ({ operation }: { operation: Operation }) => {
|
||||
type="link"
|
||||
onClick={() => {
|
||||
backrestService
|
||||
.getDownloadURL({ value: operation.id })
|
||||
.getDownloadURL({ opId: operation.id!, filePath: "" })
|
||||
.then((resp) => {
|
||||
window.open(resp.value, "_blank");
|
||||
})
|
||||
|
||||
@@ -133,13 +133,19 @@ export const SnapshotBrowser = ({
|
||||
path += "/";
|
||||
}
|
||||
|
||||
const resp = await backrestService.listSnapshotFiles(
|
||||
create(ListSnapshotFilesRequestSchema, {
|
||||
path,
|
||||
repoGuid,
|
||||
snapshotId,
|
||||
})
|
||||
);
|
||||
let resp: ListSnapshotFilesResponse;
|
||||
try {
|
||||
resp = await backrestService.listSnapshotFiles(
|
||||
create(ListSnapshotFilesRequestSchema, {
|
||||
path,
|
||||
repoGuid,
|
||||
snapshotId,
|
||||
})
|
||||
);
|
||||
} catch (e: any) {
|
||||
alertApi?.error("Failed to load snapshot files: " + e.message);
|
||||
return;
|
||||
}
|
||||
|
||||
setTreeData((treeData) => {
|
||||
let toUpdate: DataNode | null = null;
|
||||
@@ -234,15 +240,10 @@ const FileNode = ({
|
||||
label: "Download",
|
||||
onClick: () => {
|
||||
backrestService
|
||||
.getDownloadURL({ value: snapshotOpId })
|
||||
.getDownloadURL({ opId: snapshotOpId!, filePath: entry.path! })
|
||||
.then((resp) => {
|
||||
const encodePathKeepSlashes = (p: string) =>
|
||||
p
|
||||
.split("/")
|
||||
.map((seg) => encodeURIComponent(seg))
|
||||
.join("/");
|
||||
window.open(
|
||||
resp.value + encodePathKeepSlashes(entry.path!),
|
||||
resp.value,
|
||||
"_blank"
|
||||
);
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user