dxfl 0.3.0 → 0.3.1
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.
- package/CHANGELOG.md +4 -0
- package/dist/index.js +1 -1
- package/dist/website_config.js +11 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import { deploy } from "./deploy.js";
|
|
|
6
6
|
import { empty } from "./empty.js";
|
|
7
7
|
import { vhostsList } from "./vhosts.js";
|
|
8
8
|
import { inspect } from "./inspect.js";
|
|
9
|
-
program.name("dxfl").description("Deuxfleurs CLI tool").version("0.3.
|
|
9
|
+
program.name("dxfl").description("Deuxfleurs CLI tool").version("0.3.1");
|
|
10
10
|
program
|
|
11
11
|
.command("login")
|
|
12
12
|
.description("Link your Deuxfleurs account with this tool.")
|
package/dist/website_config.js
CHANGED
|
@@ -143,8 +143,8 @@ function unescape(s) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
function interpConfig(rawcfg) {
|
|
146
|
-
var _a, _b, _c, _d, _e;
|
|
147
|
-
function interpRedirect(
|
|
146
|
+
var _a, _b, _c, _d, _e, _f;
|
|
147
|
+
function interpRedirect(r) {
|
|
148
148
|
var _a, _b;
|
|
149
149
|
const rfrom = withErrorMsg(() => unescape(r.from), msg => `from: ${msg}`);
|
|
150
150
|
const rto = withErrorMsg(() => unescape(r.to), msg => `to: ${msg}`);
|
|
@@ -264,7 +264,7 @@ function interpConfig(rawcfg) {
|
|
|
264
264
|
return s !== null && s !== void 0 ? s : def;
|
|
265
265
|
};
|
|
266
266
|
// use index.html as default index page
|
|
267
|
-
const index_page =
|
|
267
|
+
const index_page = (_a = rawcfg.index_page) !== null && _a !== void 0 ? _a : "index.html";
|
|
268
268
|
// use error.html as default error page
|
|
269
269
|
const error_page = withDefault(rawcfg.error_page, "error.html");
|
|
270
270
|
let cfg = {
|
|
@@ -274,9 +274,9 @@ function interpConfig(rawcfg) {
|
|
|
274
274
|
object_redirects: new Map(),
|
|
275
275
|
cors_rules: [],
|
|
276
276
|
};
|
|
277
|
-
for (const [i, raw] of ((
|
|
277
|
+
for (const [i, raw] of ((_b = rawcfg.redirects) !== null && _b !== void 0 ? _b : []).entries()) {
|
|
278
278
|
// `i+1` is only used for display: start counting redirects from 1 instead of 0
|
|
279
|
-
const r = withErrorMsg(() => interpRedirect(
|
|
279
|
+
const r = withErrorMsg(() => interpRedirect(raw), msg => `Redirect ${i + 1}: ${msg}`);
|
|
280
280
|
if (r.kind == "bucket") {
|
|
281
281
|
cfg.bucket_redirects.push(r.r);
|
|
282
282
|
}
|
|
@@ -287,15 +287,15 @@ function interpConfig(rawcfg) {
|
|
|
287
287
|
cfg.object_redirects.set(r.from, r.to);
|
|
288
288
|
}
|
|
289
289
|
}
|
|
290
|
-
for (const [_, raw] of ((
|
|
290
|
+
for (const [_, raw] of ((_c = rawcfg.cors) !== null && _c !== void 0 ? _c : []).entries()) {
|
|
291
291
|
const interpRawArray = (x) => {
|
|
292
292
|
return typeof x === "string" ? [x] : x;
|
|
293
293
|
};
|
|
294
294
|
cfg.cors_rules.push({
|
|
295
295
|
allowed_origins: interpRawArray(raw.allowed_origins),
|
|
296
|
-
allowed_methods: interpRawArray((
|
|
297
|
-
allowed_headers: interpRawArray((
|
|
298
|
-
expose_headers: interpRawArray((
|
|
296
|
+
allowed_methods: interpRawArray((_d = raw.allowed_methods) !== null && _d !== void 0 ? _d : ["GET", "HEAD"]),
|
|
297
|
+
allowed_headers: interpRawArray((_e = raw.allowed_methods) !== null && _e !== void 0 ? _e : []),
|
|
298
|
+
expose_headers: interpRawArray((_f = raw.expose_headers) !== null && _f !== void 0 ? _f : []),
|
|
299
299
|
});
|
|
300
300
|
}
|
|
301
301
|
return cfg;
|
|
@@ -431,10 +431,10 @@ export function putBucketWebsiteConfig(bucket, index_page, error_page, bucket_re
|
|
|
431
431
|
return __awaiter(this, void 0, void 0, function* () {
|
|
432
432
|
// TODO: printing to show what changes are being applied?
|
|
433
433
|
const WebsiteConfiguration = {};
|
|
434
|
-
if (error_page) {
|
|
434
|
+
if (error_page != undefined) {
|
|
435
435
|
WebsiteConfiguration.ErrorDocument = { Key: error_page };
|
|
436
436
|
}
|
|
437
|
-
if (index_page) {
|
|
437
|
+
if (index_page != undefined) {
|
|
438
438
|
WebsiteConfiguration.IndexDocument = { Suffix: index_page };
|
|
439
439
|
}
|
|
440
440
|
if (bucket_redirects.length > 0) {
|