Skip to content

Commit

Permalink
Increase allowed delay for asynchronous requests
Browse files Browse the repository at this point in the history
  • Loading branch information
krasun committed Jul 21, 2024
1 parent 63e7f48 commit 6726811
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "screenshotone-validations",
"homepage": "https://screenshotone.com",
"version": "1.0.35",
"version": "1.0.36",
"description": "Validation schemes for the ScreenshotOne API requests.",
"repository": {
"type": "git",
Expand Down
24 changes: 15 additions & 9 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const validUri = (value: string, helper: any) => {
if (!value) {
return helper.message('"url" must be specified');
}

const u = new URL(value);

if (u.protocol !== "http:" && u.protocol !== "https:") {
Expand All @@ -25,7 +25,10 @@ const validUri = (value: string, helper: any) => {
}

const withoutProtocol = value.substring((u.protocol + "//").length);
if (withoutProtocol.startsWith("http://") || withoutProtocol.startsWith("https://")) {
if (
withoutProtocol.startsWith("http://") ||
withoutProtocol.startsWith("https://")
) {
return helper.message(
'"url" must be a valid URI with a scheme matching the http|https pattern'
);
Expand Down Expand Up @@ -325,8 +328,8 @@ const commonOptionsScheme = Joi.object({
.integer()
.min(0)
.when("timeout", {
is: Joi.number().greater(60),
then: Joi.number().max(60),
is: Joi.number().greater(300),
then: Joi.number().max(300),
otherwise: Joi.number().max(30),
})
.optional(),
Expand Down Expand Up @@ -461,28 +464,31 @@ const animateScheme = withHtmlOrUrlOrMarkdownRequired
scroll_try_navigate: Joi.boolean().default(false).optional(),
scroll_navigate_after: Joi.number().integer().optional(),
scroll_navigate_to_url: Joi.string().trim().custom(validUri).optional(),
scroll_navigate_link_hints: Joi.array().items(Joi.string().trim()).default(['pricing', 'about', 'customers']).optional(),
scroll_navigate_link_hints: Joi.array()
.items(Joi.string().trim())
.default(["pricing", "about", "customers"])
.optional(),

clip_x: Joi.when("format", {
is: Joi.valid("gif"),
then: Joi.number().integer().optional(),
otherwise: Joi.forbidden(),
}),
}),
clip_y: Joi.when("format", {
is: Joi.valid("gif"),
then: Joi.number().integer().optional(),
otherwise: Joi.forbidden(),
}),
}),
clip_height: Joi.when("format", {
is: Joi.valid("gif"),
then: Joi.number().integer().optional(),
otherwise: Joi.forbidden(),
}),
}),
clip_width: Joi.when("format", {
is: Joi.valid("gif"),
then: Joi.number().integer().optional(),
otherwise: Joi.forbidden(),
}),
}),

scroll_easing: Joi.string()
.trim()
Expand Down

0 comments on commit 6726811

Please sign in to comment.