Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
content_security_policy: Joi.string(),
// This key must be present if the extension contains the _locales directory, and must be absent otherwise. It identifies a subdirectory of _locales, and this subdirectory will be used to find the default strings for your extension.
default_locale: Joi.string(),
// A short description of the extension, intended for display in the browser's user interface.
description: Joi.string(),
// The name of the extension's developer and their homepage URL, intended for display in the browser's user interface.
developer: Joi.object({
name: Joi.string(),
url: Joi.string()
}),
// Use this key to enable your extension to extend the browser's built-in devtools.
devtools_page: Joi.string(),
// URL for the extension's home page.
homepage_url: Joi.string(),
// The icons key specifies icons for your extension. Those icons will be used to represent the extension in components such as the Add-ons Manager.
icons: Joi.object(),
// Use the incognito key to control how the extension works with private browsing windows.
incognito: Joi.string().valid('spanning', 'split', 'not_allowed'),
// This key specifies the version of manifest.json used by this extension.
// Currently, this must always be 2.
manifest_version: Joi.number().default(2),
// Name of the extension. This is used to identify the extension in the browser's user interface and on sites like addons.mozilla.org.
name: Joi.string().max(45).required(),
export const register = async (req: Request): Promise => {
try {
// validate POST data
await Joi.object({
bridge: Joi.string().uri().required(),
topic: Joi.string().uuid().required(),
type: Joi.string().valid('fcm').required(),
token: Joi.string().token().required(),
peerName: Joi.string(),
language: Joi.string()
}).validateAsync(req.body);
// save data in firestore
await setRegistration(req.body);
// register webhook on the bridge
const webhook = `${req.protocol}://${req.headers.host}${req.baseUrl}`;
const bridgeSubscribeResponse = await axios.post(
`${req.body.bridge.replace(/\/$/, '')}/subscribe`,
{
topic: req.body.topic,
webhook
options: Joi.object()
})
]);
// Manager schemas
exports.viewOverride = Joi.object({
path: [Joi.array().items(Joi.string()), Joi.string()],
relativeTo: Joi.string(),
compileOptions: Joi.object(),
runtimeOptions: Joi.object(),
layout: Joi.string().allow(false, true),
layoutKeyword: Joi.string(),
layoutPath: [Joi.array().items(Joi.string()), Joi.string()],
encoding: Joi.string(),
allowAbsolutePaths: Joi.boolean(),
allowInsecureAccess: Joi.boolean(),
contentType: Joi.string()
});
exports.viewBase = exports.viewOverride.keys({
partialsPath: [Joi.array().items(Joi.string()), Joi.string()],
helpersPath: [Joi.array().items(Joi.string()), Joi.string()],
isCached: Joi.boolean(),
compileMode: Joi.string().valid('sync', 'async'),
defaultExtension: Joi.string()
});
exports.manager = exports.viewBase.keys({
const Joi = require('@hapi/joi')
const BN = require('bn.js')
const web3Utils = require('web3-utils')
const validateAddress = Joi.string().custom(value => {
return web3Utils.isAddress(value)
})
const validateTxOption = Joi.object({
gas: Joi.number(),
gasPrice: Joi.string(),
privateKey: Joi.string(),
from: validateAddress
})
const validateBn = Joi.any().custom((value, helpers) => {
if (!BN.isBN(value)) {
return helpers.message(`${value} is not an instance of BN.js`)
}
return value
})
module.exports = {
validateAddress,
validateTxOption,
validateBn
}
tags: [ 'api' ],
plugins: {
'hapi-swagger': {
payloadType: 'form',
validate: {
payload: {
file: Joi.any()
.meta({ swaggerType: 'file' })
.description('json file')
}
}
}
},
validate: { headers: Joi.object({ authorization: Joi.string().optional() }).unknown() },
payload: { output: 'data', maxBytes: 1024 * 1024 * 20 },
response:
{ schema: Joi.object().length(0) }
}
const cohortsAssignmentSchema = Joi.array().min(0).items(Joi.object().keys({
paymentId: Joi.string().guid().required().description('identity of the wallet'),
cohort: Joi.string().required().description('cohort to assign')
}).unknown(true).description('grant cohorts'))
/*
PUT /v2/grants/cohorts
*/
v2.cohorts = { handler: (runtime) => {
import * as Joi from "@hapi/joi";
import { blockId } from "../shared/schemas/block-id";
import { pagination } from "../shared/schemas/pagination";
export const index: object = {
query: {
...pagination,
...{
orderBy: Joi.string(),
id: blockId,
version: Joi.number()
.integer()
.min(0),
timestamp: Joi.number()
.integer()
.min(0),
previousBlock: blockId,
height: Joi.number()
.integer()
.positive(),
numberOfTransactions: Joi.number()
.integer()
.min(0),
totalAmount: Joi.number()
.integer()
/**
* Schema for UserDependencyConfigT
*/
export const dependencyConfig = t
.object({
dependency: t
.object({
platforms: map(t.string(), t.any())
.keys({
ios: t
.object({
project: t.string(),
podspecPath: t.string(),
sharedLibraries: t.array().items(t.string()),
libraryFolder: t.string(),
scriptPhases: t.array().items(t.object()),
})
.default({}),
android: t
.object({
sourceDir: t.string(),
manifestPath: t.string(),
packageImportPath: t.string(),
packageInstance: t.string(),
})
.default({}),
})
.default(),
assets: t
.array()
.items(t.string())
'use strict'
const Joi = require('@hapi/joi')
const { BaseJsonService } = require('..')
const resourceSchema = Joi.object({
downloads: Joi.number().required(),
file: Joi.object({
size: Joi.number().required(),
sizeUnit: Joi.string().required(),
}).required(),
testedVersions: Joi.array(),
rating: Joi.object({
count: Joi.number().required(),
average: Joi.number().required(),
}).required(),
}).required()
const documentation = `
<p>You can find your resource ID in the url for your resource page.</p>
<p>Example: <code>https://www.spigotmc.org/resources/essentialsx.9089/</code> - Here the Resource ID is 9089.</p>`
const keywords = ['spigot', 'spigotmc']
class BaseSpigetService extends BaseJsonService {
async fetch({
'use strict'
const Joi = require('@hapi/joi')
const { BaseJsonService } = require('..')
const validatorSchema = Joi.object()
.keys({
schemaValidationMessages: Joi.array().items(
Joi.object({
level: Joi.string().required(),
message: Joi.string().required(),
}).required()
),
})
.required()
module.exports = class SwaggerValidatorService extends BaseJsonService {
static get category() {
return 'other'
}
static get route() {
return {
base: 'swagger/valid/2.0',
pattern: ':scheme(http|https)?/:url*',
}
}
auth: false,
apiVersion: null,
basePath: Path.join(__dirname, '..', 'templates'),
cssPath: Path.join(__dirname, '..', 'public', 'css'),
helpersPath: Path.join(__dirname, '..', 'templates', 'helpers'),
partialsPath: Path.join(__dirname, '..', 'templates'),
indexTemplate: 'index',
routeTemplate: 'route',
methodsOrder: ['get', 'head', 'post', 'put', 'patch', 'delete', 'trace', 'options'],
filterRoutes: null
},
options: Joi.object({
engines: Joi.object(),
endpoint: Joi.string(),
apiVersion: Joi.string().allow(null),
basePath: Joi.string(),
cssPath: Joi.string().allow(null),
helpersPath: Joi.string(),
partialsPath: Joi.string(),
auth: Joi.object(),
indexTemplate: Joi.string(),
routeTemplate: Joi.string(),
filterRoutes: Joi.func()
})
};
exports.plugin = {
name: 'lout',
pkg: require('../package.json'),
multiple: true,
requirements: {