Skip to content

Commit 804ba70

Browse files
bugfixes for certificate upload retrieval
1 parent 7f91a64 commit 804ba70

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

public/script.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ async function uploadFiles(files) {
11771177
// Update progress
11781178
updateProgress(25, 'Uploading files...');
11791179

1180-
const response = await fetch('/api/certificates/upload', {
1180+
const response = await fetch('/api/upload', {
11811181
method: 'POST',
11821182
body: formData,
11831183
credentials: 'same-origin'
@@ -1415,22 +1415,22 @@ async function downloadFile(url, filename) {
14151415
}
14161416

14171417
function downloadCert(folderParam, filename) {
1418-
const url = API_BASE + '/download/cert/' + folderParam + '/' + filename;
1418+
const url = API_BASE + '/api/download/cert/' + folderParam + '/' + filename;
14191419
downloadFile(url, filename);
14201420
}
14211421

14221422
function downloadKey(folderParam, filename) {
1423-
const url = API_BASE + '/download/key/' + folderParam + '/' + filename;
1423+
const url = API_BASE + '/api/download/key/' + folderParam + '/' + filename;
14241424
downloadFile(url, filename);
14251425
}
14261426

14271427
function downloadBundle(folderParam, certname) {
1428-
const url = API_BASE + '/download/bundle/' + folderParam + '/' + certname;
1428+
const url = API_BASE + '/api/download/bundle/' + folderParam + '/' + certname;
14291429
downloadFile(url, certname + '.zip');
14301430
}
14311431

14321432
function downloadRootCA() {
1433-
const url = API_BASE + '/download/rootca';
1433+
const url = API_BASE + '/api/download/rootca';
14341434
downloadFile(url, 'mkcert-rootCA.pem');
14351435
}
14361436

server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,11 @@ const { createSCEPRoutes } = require('./src/routes/scep');
2121
// Import notification routes and services
2222
const createNotificationRoutes = require('./src/routes/notifications');
2323

24-
// Import certificate, system, and settings routes
24+
// Import certificate, system, settings, and file routes
2525
const { createCertificateRoutes } = require('./src/routes/certificates');
2626
const { createSystemRoutes } = require('./src/routes/system');
2727
const createSettingsRoutes = require('./src/routes/settings');
28+
const { createFileRoutes } = require('./src/routes/files');
2829

2930
const config = require('./src/config');
3031
const { EmailService } = require('./src/services/emailService');
@@ -282,6 +283,9 @@ app.use(createNotificationRoutes(config, rateLimiters, requireAuth, emailService
282283
// Mount certificate routes
283284
app.use(createCertificateRoutes(config, rateLimiters, requireAuth));
284285

286+
// Mount file routes (upload/download)
287+
app.use(createFileRoutes(config, rateLimiters, requireAuth));
288+
285289
// Mount SCEP routes (must be before system routes to avoid catch-all)
286290
app.use(createSCEPRoutes(config, rateLimiters, requireAuth));
287291

0 commit comments

Comments
 (0)