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
45 changes: 33 additions & 12 deletions cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -907,12 +907,19 @@ Encryption:
}
// Make the API request
try {
// Extract filename if uploading a file
const filename = options.file ? path.basename(options.file) : '';
const headers = {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
};
// Include filename header if we have a file
if (filename) {
headers['X-Filename'] = filename;
}
const response = await fetch(`${API_URL}${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
},
headers,
body: content
});
if (!response.ok) {
Expand Down Expand Up @@ -1451,13 +1458,20 @@ program
// Determine the endpoint for encrypted pastes
const endpoint = options.temp ? '/e/temp' : '/e/upload';
try {
// Extract filename if uploading a file
const filename = options.file ? path.basename(options.file) : '';
const headers = {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
};
// Include filename header if we have a file
if (filename) {
headers['X-Filename'] = filename;
}
// Make the API request
const response = await fetch(`${API_URL}${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
},
headers,
body: content
});
if (!response.ok) {
Expand Down Expand Up @@ -1505,13 +1519,20 @@ ${options.copy ? '📋 URL copied to clipboard: ' : '📋 '} ${url.trim()}
// Determine the endpoint based on whether it's a temporary paste
const endpoint = options.temp ? '/temp' : '/upload';
try {
// Extract filename if uploading a file
const filename = options.file ? path.basename(options.file) : '';
const headers = {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
};
// Include filename header if we have a file
if (filename) {
headers['X-Filename'] = filename;
}
// Make the API request
const response = await fetch(`${API_URL}${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
},
headers,
body: content
});
if (!response.ok) {
Expand Down
54 changes: 42 additions & 12 deletions cli/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,12 +1154,22 @@ Encryption:

// Make the API request
try {
// Extract filename if uploading a file
const filename = options.file ? path.basename(options.file) : '';

const headers: Record<string, string> = {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
};

// Include filename header if we have a file
if (filename) {
headers['X-Filename'] = filename;
}

const response = await fetch(`${API_URL}${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
},
headers,
body: content
});

Expand Down Expand Up @@ -1739,13 +1749,23 @@ program
const endpoint = options.temp ? '/e/temp' : '/e/upload';

try {
// Extract filename if uploading a file
const filename = options.file ? path.basename(options.file) : '';

const headers: Record<string, string> = {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
};

// Include filename header if we have a file
if (filename) {
headers['X-Filename'] = filename;
}

// Make the API request
const response = await fetch(`${API_URL}${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
},
headers,
body: content
});

Expand Down Expand Up @@ -1795,13 +1815,23 @@ ${options.copy ? '📋 URL copied to clipboard: ' : '📋 '} ${url.trim()}
const endpoint = options.temp ? '/temp' : '/upload';

try {
// Extract filename if uploading a file
const filename = options.file ? path.basename(options.file) : '';

const headers: Record<string, string> = {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
};

// Include filename header if we have a file
if (filename) {
headers['X-Filename'] = filename;
}

// Make the API request
const response = await fetch(`${API_URL}${endpoint}`, {
method: 'POST',
headers: {
'Content-Type': contentType,
'User-Agent': `dedpaste-cli/${packageJson.version}`
},
headers,
body: content
});

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dedpaste",
"version": "1.17.0",
"version": "1.18.0",
"description": "CLI pastebin application using Cloudflare Workers and R2",
"main": "dist/index.js",
"type": "module",
Expand Down