Skip to content
Open
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
25 changes: 25 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,12 @@
"category": "B2",
"icon": "$(new-folder)"
},
{
"command": "b2.uploadFiles",
"title": "Upload Files...",
"category": "B2",
"icon": "$(cloud-upload)"
},
{
"command": "b2.deleteBucket",
"title": "Delete Bucket",
Expand Down Expand Up @@ -211,6 +217,10 @@
"command": "b2.createFolder",
"when": "false"
},
{
"command": "b2.uploadFiles",
"when": "false"
},
{
"command": "b2.deleteBucket",
"when": "false"
Expand Down Expand Up @@ -244,6 +254,11 @@
"when": "view == b2Buckets && b2.authenticated",
"group": "navigation@2"
},
{
"command": "b2.uploadFiles",
"when": "view == b2Buckets && b2.authenticated",
"group": "navigation@3"
},
{
"command": "b2.logout",
"when": "view == b2Buckets && b2.authenticated",
Expand Down Expand Up @@ -281,11 +296,21 @@
"when": "view == b2Buckets && viewItem == bucket",
"group": "2_bucket@3"
},
{
"command": "b2.uploadFiles",
"when": "view == b2Buckets && viewItem == bucket",
"group": "2_bucket@4"
},
{
"command": "b2.createFolder",
"when": "view == b2Buckets && viewItem == folder",
"group": "2_bucket@1"
},
{
"command": "b2.uploadFiles",
"when": "view == b2Buckets && viewItem == folder",
"group": "2_bucket@2"
},
{
"command": "b2.createFolder",
"when": "view == b2Buckets && viewItem =~ /^(bucket|folder)$/",
Expand Down
3 changes: 2 additions & 1 deletion scripts/release-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ const manifestContract = {
"b2.createBucket",
"b2.changeBucketVisibility",
"b2.createFolder",
"b2.uploadFiles",
"b2.deleteBucket",
"b2.deleteFolder",
"b2.deleteFile",
Expand All @@ -59,7 +60,7 @@ const manifestContract = {
"b2_deleteFile",
"b2_presignUrl",
],
contributesSha256: "40a5f09a30986dfcb974032113ec6afaa2a694fa9fd12421b222955dac64eda7",
contributesSha256: "1d1b39b1cf126691c0b01d073a264c0ef545f29a817fc89f892f5601d83e32cc",
};

function stableStringify(value) {
Expand Down
14 changes: 14 additions & 0 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ import {
type PublicBucketVisibilityAction,
} from "./publicBucketVisibility";
import { renameFileVersion } from "./renameFile";
import { isUploadTargetTreeItem, type UploadTargetTreeItem } from "../models/uploadTarget";
import { uploadFilesCommand } from "./uploadFiles";

const BUCKET_MUTATION_TIMEOUT_MS = 2 * 60 * 1000;
const BUCKET_MUTATION_POST_TIMEOUT_SETTLE_MS = 1_000;
Expand Down Expand Up @@ -257,6 +259,7 @@ export interface CommandServices extends CreateBucketCommandServices {
context: vscode.ExtensionContext;
getClient: () => B2Client | null;
setClient: (client: B2Client | null) => void;
getSelectedUploadTarget?: () => UploadTargetTreeItem | undefined;
createClient?: ConfiguredB2ClientFactory;
}

Expand Down Expand Up @@ -658,6 +661,17 @@ export function registerCommands(services: CommandServices): void {
),
);

// ── Upload Files ─────────────────────────────────────────────────────
context.subscriptions.push(
vscode.commands.registerCommand("b2.uploadFiles", async (item?: unknown) =>
uploadFilesCommand(isUploadTargetTreeItem(item) ? item : undefined, {
treeProvider,
getClient,
getSelectedUploadTarget: services.getSelectedUploadTarget,
}),
),
);

// ── Delete Bucket ─────────────────────────────────────────────────────
context.subscriptions.push(
vscode.commands.registerCommand("b2.deleteBucket", async (item?: BucketTreeItem) => {
Expand Down
Loading
Loading