easy-vps 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,14 +13,25 @@ const client_s3_1 = require("@aws-sdk/client-s3");
13
13
  const node_fs_1 = require("node:fs");
14
14
  const BACKUP_PREFIX = 'easy-vps/backups/database';
15
15
  function createS3Client(config) {
16
+ let endpoint = config.endpoint || undefined;
17
+ // Cloudflare R2's dashboard shows the S3 API URL with the bucket appended
18
+ // (https://<account>.r2.cloudflarestorage.com/<bucket>). With forcePathStyle
19
+ // the SDK appends the bucket itself, so strip a trailing bucket segment to
20
+ // avoid a doubled path like /<bucket>/<bucket>/<key>.
21
+ if (endpoint && config.bucket) {
22
+ const trimmed = endpoint.replace(/\/+$/, '');
23
+ if (trimmed.endsWith(`/${config.bucket}`)) {
24
+ endpoint = trimmed.slice(0, -(config.bucket.length + 1));
25
+ }
26
+ }
16
27
  return new client_s3_1.S3Client({
17
28
  region: config.region,
18
- endpoint: config.region.includes('.') ? undefined : `https://s3.${config.region}.amazonaws.com`,
29
+ endpoint,
19
30
  credentials: {
20
31
  accessKeyId: config.accessKey,
21
32
  secretAccessKey: config.secretKey,
22
33
  },
23
- forcePathStyle: false,
34
+ forcePathStyle: !!config.endpoint,
24
35
  });
25
36
  }
26
37
  function backupS3Key(engine, dbName, timestamp) {
@@ -88,6 +99,6 @@ async function enforceRetention(s3Config, engine, dbName, retention) {
88
99
  return;
89
100
  const toDelete = backups.slice(retention);
90
101
  for (const backup of toDelete) {
91
- await deleteFromS3(s3Config, backup.key);
102
+ await deleteFromS3(s3Config, backup.key).catch(() => { });
92
103
  }
93
104
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "easy-vps",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "Install dependencies, point domains, deploy apps and run Postgres on a VPS from one UI",
5
5
  "keywords": [
6
6
  "easy-vps",
@@ -42,7 +42,9 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@aws-sdk/client-s3": "^3.1118.0",
45
+ "@types/multer": "^2.2.0",
45
46
  "express": "^4.21.2",
47
+ "multer": "^2.3.0",
46
48
  "node-cron": "^4.6.0",
47
49
  "ssh2": "^1.17.0"
48
50
  },