mirror of
https://github.com/strapi/strapi.git
synced 2025-09-08 16:16:21 +00:00
Merge branch 'master' into patch-1
This commit is contained in:
commit
4189ce83e9
@ -21,11 +21,11 @@ Every user can send a feature request using the [issues](https://github.com/stra
|
||||
## Repository Organization
|
||||
We made the choice to use a monorepo design such as [React](https://github.com/facebook/react/tree/master/packages), [Babel](https://github.com/babel/babel/tree/master/packages), [Meteor](https://github.com/meteor/meteor/tree/devel/packages) or [Ember](https://github.com/emberjs/ember.js/tree/master/packages) do. It allows the community to easily maintain the whole ecosystem up-to-date and consistent.
|
||||
|
||||
The Babel team wrotes an excellent short post about [the pros and cons of the monorepo design](https://github.com/babel/babel/blob/master/doc/design/monorepo.md).
|
||||
The Babel team wrote an excellent short post about [the pros and cons of the monorepo design](https://github.com/babel/babel/blob/master/doc/design/monorepo.md).
|
||||
|
||||
We will do our best to keep the master branch clean as possible, with tests passing all the times. However, it can happen that the master branch moves faster than the release cycle. To ensure to use the latest stable version, please refers to the [release on npm](https://www.npmjs.com/package/strapi).
|
||||
We will do our best to keep the master branch as clean as possible, with tests passing all the times. However, it can happen that the master branch moves faster than the release cycle. To ensure you have the latest stable version, please refer to the [release on npm](https://www.npmjs.com/package/strapi).
|
||||
|
||||
If you send a pull request, please do it again the `master` branch. We are developing upcoming versions separately to ensure non-breaking changes from master to the latest stable major version.
|
||||
If you send a pull request, please do it against the `master` branch. We are developing upcoming versions separately to ensure non-breaking changes from master to the latest stable major version.
|
||||
|
||||
***
|
||||
|
||||
@ -53,7 +53,7 @@ cd strapi
|
||||
|
||||
**Two setup are available... with or without the front-end builds.**
|
||||
|
||||
Without the front-end builds, you won't be able to access to the administration panel via http://localhost:1337/admin, you'll have to run the administration separately and access it through http://localhost:4000/admin.
|
||||
Without the front-end builds, you won't be able to access the administration panel via http://localhost:1337/admin. You'll have to run the administration separately and access it through http://localhost:4000/admin.
|
||||
|
||||
<br>
|
||||
|
||||
|
@ -15,10 +15,10 @@ The most advanced open-source Content Management Framework to build powerful API
|
||||
|
||||
{% endcenter %}
|
||||
|
||||
## v3@alpha.13 is available!
|
||||
## v3@alpha.14 is available!
|
||||
We've been working on a major update for Strapi during the past months, rewriting the core framework and the dashboard.
|
||||
|
||||
This documentation is only related to Strapi v3@alpha.13 ([v1 documentation is still available](http://strapi.io/documentation/1.x.x)).
|
||||
This documentation is only related to Strapi v3@alpha.14 ([v1 documentation is still available](http://strapi.io/documentation/1.x.x)).
|
||||
|
||||
**[Get Started](getting-started/installation.md)**<br />
|
||||
Learn how to install Strapi and start developing your API.
|
||||
|
@ -335,7 +335,8 @@ Most of the application's configurations are defined by environment. It means th
|
||||
|
||||
- `host` (string): Host name. Default value: `localhost`.
|
||||
- `port` (integer): Port on which the server should be running. Default value: `1337`.
|
||||
- `autoReload` (boolean): Enable or disabled server reload on files update. Default value: depends on the environment.
|
||||
- `autoReload`
|
||||
- `enabled` (boolean): Enable or disabled server reload on files update. Default value: depends on the environment.
|
||||
- [`cron`](https://en.wikipedia.org/wiki/Cron)
|
||||
- `enabled` (boolean): Enable or disable CRON tasks to schedule jobs at specific dates. Default value: `false`.
|
||||
- `admin`
|
||||
|
@ -190,6 +190,140 @@ The User object is available to successfully authenticated requests.
|
||||
```
|
||||
|
||||
|
||||
## Add a new provider
|
||||
|
||||
To add a new provider on strapi, you will need to perform changes onto the following files:
|
||||
|
||||
```
|
||||
packages/strapi-plugin-users-permissions/services/Providers.js
|
||||
packages/strapi-plugin-users-permissions/config/functions/bootstrap.js
|
||||
packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js
|
||||
packages/strapi-plugin-users-permissions/admin/src/translations/en.json
|
||||
```
|
||||
|
||||
We will go step by step.
|
||||
|
||||
### Configure your Provider request
|
||||
First, we need to configure our new provider onto `Provider.js` file.
|
||||
|
||||
Jump onto the `getProfile` function, you will see the list of currently available providers in the form of a `switch...case`.
|
||||
|
||||
As you can see, `getProfile` take three params:
|
||||
|
||||
1. provider :: The name of the used provider as a string.
|
||||
2. query :: The query is the result of the provider callback.
|
||||
3. callback :: The callback function who will continue the internal strapi login logic.
|
||||
|
||||
Let's take the `discord` one as an example since it's not the easier, it should cover most of the case you may encounter trying to implement your own provider.
|
||||
|
||||
#### Configure your oauth generic information
|
||||
|
||||
```js
|
||||
case 'discord': {
|
||||
const discord = new Purest({
|
||||
provider: 'discord',
|
||||
config: {
|
||||
'discord': {
|
||||
'https://discordapp.com/api/': {
|
||||
'__domain': {
|
||||
'auth': {
|
||||
'auth': {'bearer': '[0]'}
|
||||
}
|
||||
},
|
||||
'{endpoint}': {
|
||||
'__path': {
|
||||
'alias': '__default'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
So here, you can see that we use a module called `Purest`. This module gives us with a generic way to interact with the REST API.
|
||||
|
||||
To understand each value usage, and the templating syntax, I invite you to read the [Official Purest Documentation](https://github.com/simov/purest/tree/2.x)
|
||||
|
||||
You may also want to take a look onto the numerous already made configurations [here](https://github.com/simov/purest-providers/blob/master/config/providers.json).
|
||||
|
||||
#### Retrieve your user informations:
|
||||
```js
|
||||
discord.query().get('users/@me').auth(access_token).request((err, res, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
// Combine username and discriminator because discord username is not unique
|
||||
var username = `${body.username}#${body.discriminator}`;
|
||||
callback(null, {
|
||||
username: username,
|
||||
email: body.email
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
```
|
||||
|
||||
Here is the next part of our switch. Now that we have properly configured our provider, we want to use it to retrieve user information.
|
||||
|
||||
Here you see the real power of `purest`, you can simply make a get request on the desired URL, using the `access_token` from the `query` parameter to authenticate.
|
||||
|
||||
That way, you should be able to retrieve the user info you need.
|
||||
|
||||
Now, you can simply call the `callback` function with the username and email of your user. That way, strapi will be able to retrieve your user from the database and log you in.
|
||||
|
||||
#### Configure the new provider model onto database
|
||||
|
||||
Now, we need to configure our 'model' for our new provider. That way, our settings can be stored in the database, and managed from the admin panel.
|
||||
|
||||
Into: `packages/strapi-plugin-users-permissions/config/functions/bootstrap.js`
|
||||
|
||||
Simply add the fields your provider need into the `grantConfig` object.
|
||||
For our discord provider it will look like:
|
||||
|
||||
```js
|
||||
discord: {
|
||||
enabled: false, // make this provider disabled by default
|
||||
icon: 'comments', // The icon to use on the UI
|
||||
key: '', // our provider app id (leave it blank, you will fill it with the content manager)
|
||||
secret: '', // our provider secret key (leave it blank, you will fill it with the content manager)
|
||||
callback: '/auth/discord/callback', // the callback endpoint of our provider
|
||||
scope: [ // the scope that we need from our user to retrieve infos
|
||||
'identify',
|
||||
'email'
|
||||
]
|
||||
},
|
||||
```
|
||||
|
||||
|
||||
You have already done the hard part, now, we simply need to make our new provider available from the front side of our application. So let's do it!
|
||||
|
||||
|
||||
<!-- #### Tests -->
|
||||
<!-- TODO Add documentation about how to configure unit test for the new provider -->
|
||||
|
||||
### Configure frontend for your new provider
|
||||
|
||||
First, let's edit: `packages/strapi-plugin-users-permissions/admin/src/components/PopUpForm/index.js`
|
||||
As for backend, we have a `switch...case` where we need to put our new provider info.
|
||||
|
||||
```js
|
||||
case 'discord':
|
||||
return `${strapi.backendURL}/connect/discord/callback`;
|
||||
```
|
||||
|
||||
Add the corresponding translation into: `packages/strapi-plugin-users-permissions/admin/src/translations/en.json`
|
||||
|
||||
```js
|
||||
"PopUpForm.Providers.discord.providerConfig.redirectURL": "The redirect URL to add in your Discord application configurations",
|
||||
````
|
||||
|
||||
These two change will set up the popup message who appear on the UI when we will configure our new provider.
|
||||
|
||||
That's it, now you should be able to use your new provider.
|
||||
|
||||
|
||||
## Email templates
|
||||
|
||||
[See the documentation on GitHub](https://github.com/strapi/strapi/blob/master/packages/strapi-plugin-users-permissions/docs/email-templates.md)
|
||||
|
@ -13,6 +13,7 @@ The plugin exposes a single route `POST /upload` to upload one or multiple files
|
||||
**Parameters**
|
||||
|
||||
- `files`: The file(s) to upload. The value(s) can be a Buffer or Stream.
|
||||
- `path`: (optional): The folder where the file(s) will be uploaded to (only supported on strapi-upload-aws-s3 now).
|
||||
- `refId`: (optional): The ID of the entry which the file(s) will be linked to.
|
||||
- `ref`: (optional): The name of the model which the file(s) will be linked to (see more below).
|
||||
- `source`: (optional): The name of the plugin where the model is located.
|
||||
@ -111,6 +112,7 @@ Let's say that you want to have a `User` model provided by the plugin `Users & P
|
||||
```js
|
||||
{
|
||||
"files": "...", // Buffer or stream of file(s)
|
||||
"path": "user/avatar", // Uploading folder of file(s).
|
||||
"refId": "5a993616b8e66660e8baf45c", // User's Id.
|
||||
"ref": "user", // Model name.
|
||||
"source": "users-permissions", // Plugin name.
|
||||
|
@ -346,7 +346,7 @@ const send = require('koa-send');
|
||||
|
||||
module.exports = {
|
||||
autoReload: async ctx => {
|
||||
ctx.send({ autoReload: _.get(strapi.config.environments, 'development.server.autoReload', false) });
|
||||
ctx.send({ autoReload: _.get(strapi.config.currentEnvironment, 'server.autoReload', { enabled: false }) });
|
||||
}
|
||||
}
|
||||
```
|
||||
@ -374,8 +374,8 @@ import request from 'utils/request';
|
||||
const shouldRenderCompo = (plugin) => new Promise((resolve, request) => {
|
||||
request('/my-plugin/autoReload')
|
||||
.then(response => {
|
||||
// If autoReload is enabled the response is `{ autoReload: true }`
|
||||
plugin.preventComponentRendering = !response.autoReload;
|
||||
// If autoReload is enabled the response is `{ autoReload: { enabled: true } }`
|
||||
plugin.preventComponentRendering = !response.autoReload.enabled;
|
||||
// Set the BlockerComponent props
|
||||
plugin.blockerComponentProps = {
|
||||
blockerComponentTitle: 'my-plugin.blocker.title',
|
||||
@ -407,8 +407,8 @@ import MyCustomBlockerComponent from 'components/MyCustomBlockerComponent';
|
||||
const shouldRenderCompo = (plugin) => new Promise((resolve, request) => {
|
||||
request('/my-plugin/autoReload')
|
||||
.then(response => {
|
||||
// If autoReload is enabled the response is `{ autoReload: true }`
|
||||
plugin.preventComponentRendering = !response.autoReload;
|
||||
// If autoReload is enabled the response is `{ autoReload: { enabled: true } }`
|
||||
plugin.preventComponentRendering = !response.autoReload.enabled;
|
||||
|
||||
// Tell which component to be rendered instead
|
||||
plugin.blockerComponent = MyCustomBlockerComponent;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"assert": "~1.3.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-admin",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Strapi Admin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -31,8 +31,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"sanitize.css": "^4.1.0",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14",
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-email-amazon-ses",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Amazon SES provider for strapi email",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-email-mailgun",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Mailgun provider for strapi email plugin",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-email-sendgrid",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Sendgrid provider for strapi email",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-email-sendmail",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Sendmail provider for strapi email",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-admin",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate the default admin panel for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -15,8 +15,8 @@
|
||||
"dependencies": {
|
||||
"fs-extra": "^4.0.1",
|
||||
"lodash": "^4.17.5",
|
||||
"strapi-admin": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-admin": "3.0.0-alpha.14",
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-api",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate an API for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-controller",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate a controller for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-model",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate a model for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -145,14 +145,14 @@ module.exports = (scope, cb) => {
|
||||
when: !hasDatabaseConfig && scope.client.database === 'mongo',
|
||||
type: 'boolean',
|
||||
name: 'srv',
|
||||
message: '+srv connection::',
|
||||
message: '+srv connection:',
|
||||
default: _.get(scope.database, 'srv', false)
|
||||
},
|
||||
{
|
||||
when: !hasDatabaseConfig,
|
||||
type: 'input',
|
||||
name: 'port',
|
||||
message: 'Port(It will be ignored if you enable +srv):',
|
||||
message: 'Port (It will be ignored if you enable +srv):',
|
||||
default: (answers) => { // eslint-disable-line no-unused-vars
|
||||
if (_.get(scope.database, 'port')) {
|
||||
return scope.database.port;
|
||||
@ -259,7 +259,7 @@ module.exports = (scope, cb) => {
|
||||
require(path.join(`${scope.tmpPath}`, '/node_modules/', `${scope.client.connector}/lib/utils/connectivity.js`))(scope, cb.success, connectionValidation);
|
||||
} catch(err) {
|
||||
shell.rm('-r', scope.tmpPath);
|
||||
console.log(err)
|
||||
console.log(err);
|
||||
cb.success();
|
||||
}
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-new",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -19,7 +19,7 @@
|
||||
"listr": "^0.14.1",
|
||||
"lodash": "^4.17.5",
|
||||
"ora": "^2.1.0",
|
||||
"strapi-utils": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.14",
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
@ -49,4 +49,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -0,0 +1 @@
|
||||
{}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-plugin",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate an plugin for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -44,4 +44,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-policy",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate a policy for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-service",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Generate a service for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Master of ceremonies for the Strapi generators.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -17,7 +17,7 @@
|
||||
"fs-extra": "^4.0.0",
|
||||
"lodash": "^4.17.5",
|
||||
"reportback": "^2.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -59,7 +59,7 @@ const renderIde = () => (
|
||||
"port": 1337,
|
||||
<br />
|
||||
<span style={{ color: '#006EE7'}}>
|
||||
"autoReload": true,
|
||||
"autoReload": { enabled: true }
|
||||
</span>
|
||||
<br />
|
||||
"proxi": {
|
||||
|
@ -38,6 +38,10 @@ class InputFile extends React.Component {
|
||||
handleChange = ({ target }) => this.addFilesToProps(target.files);
|
||||
|
||||
addFilesToProps = (files) => {
|
||||
if (files.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const initAcc = this.props.multiple ? cloneDeep(this.props.value) : {};
|
||||
const value = Object.keys(files).reduce((acc, current) => {
|
||||
|
||||
|
@ -15,7 +15,7 @@ class InputToggle extends React.Component {
|
||||
const target = {
|
||||
name: this.props.name,
|
||||
type: 'toggle',
|
||||
value: e.target.id.includes('on'),
|
||||
value: e.target.id.includes('__ON__'),
|
||||
};
|
||||
|
||||
this.props.onChange({ target });
|
||||
@ -48,7 +48,7 @@ class InputToggle extends React.Component {
|
||||
autoFocus={autoFocus}
|
||||
disabled={disabled}
|
||||
className={cn('btn', !value && styles.gradientOff)}
|
||||
id={`off_${name}`}
|
||||
id={`__OFF__${name}`}
|
||||
onClick={this.handleClick}
|
||||
tabIndex={tabIndex}
|
||||
type="button"
|
||||
@ -58,7 +58,7 @@ class InputToggle extends React.Component {
|
||||
<button
|
||||
disabled={disabled}
|
||||
className={cn('btn', value && styles.gradientOn)}
|
||||
id={`on_${name}`}
|
||||
id={`__ON__${name}`}
|
||||
onClick={this.handleClick}
|
||||
type="button"
|
||||
>
|
||||
|
@ -23,7 +23,7 @@ const validateInput = (value, inputValidations = {}, type = 'text') => {
|
||||
}
|
||||
break;
|
||||
case 'maxLength':
|
||||
if (value.length > validationValue) {
|
||||
if (value && value.length > validationValue) {
|
||||
errors.push({ id: 'components.Input.error.validation.maxLength' });
|
||||
}
|
||||
break;
|
||||
@ -33,12 +33,12 @@ const validateInput = (value, inputValidations = {}, type = 'text') => {
|
||||
}
|
||||
break;
|
||||
case 'minLength':
|
||||
if (value.length < validationValue) {
|
||||
if (!value || value.length < validationValue) {
|
||||
errors.push({ id: 'components.Input.error.validation.minLength' });
|
||||
}
|
||||
break;
|
||||
case 'required':
|
||||
if (value.length === 0) {
|
||||
if (value == null || value.length === 0) {
|
||||
errors.push({ id: 'components.Input.error.validation.required' });
|
||||
}
|
||||
break;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-helper-plugin",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Helper for Strapi plugins development",
|
||||
"engines": {
|
||||
"node": ">= 9.0.0",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-bookshelf",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Bookshelf hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -20,8 +20,8 @@
|
||||
"inquirer": "^5.2.0",
|
||||
"lodash": "^4.17.5",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-hook-knex": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-hook-knex": "3.0.0-alpha.14",
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"strapi": {
|
||||
"dependencies": [
|
||||
@ -55,4 +55,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-ejs",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "EJS hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-knex",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Knex hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -28,7 +28,7 @@ module.exports = (scope, success, error) => {
|
||||
connectOptions.useNewUrlParser = true;
|
||||
connectOptions.dbName = scope.database.settings.database;
|
||||
|
||||
Mongoose.connect(`mongodb${srv ? "+srv" : ""}://${scope.database.settings.host}:${!srv ? ":" + scope.database.settings.port : ""}/`, connectOptions, function (err) {
|
||||
Mongoose.connect(`mongodb${srv ? '+srv' : ''}://${scope.database.settings.host}${!srv ? `:${scope.database.settings.port}` : ''}/`, connectOptions, function (err) {
|
||||
if (err) {
|
||||
console.log('⚠️ Database connection has failed! Make sure your database is running.');
|
||||
return error();
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-mongoose",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Mongoose hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -19,7 +19,7 @@
|
||||
"mongoose": "^5.0.16",
|
||||
"mongoose-float": "^1.0.2",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-redis",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Redis hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -18,7 +18,7 @@
|
||||
"ioredis": "^3.1.2",
|
||||
"lodash": "^4.17.5",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-lint",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Strapi eslint and prettier configurations",
|
||||
"directories": {
|
||||
"lib": "lib"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-middleware-views",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Views middleware to enable server-side rendering for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-manager",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "A powerful UI to easily manage your data.",
|
||||
"strapi": {
|
||||
"name": "Content Manager",
|
||||
@ -26,7 +26,10 @@
|
||||
"draft-js": "^0.10.5",
|
||||
"react-select": "^1.2.1",
|
||||
"showdown": "^1.8.6",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14"
|
||||
},
|
||||
"dependencies": {
|
||||
"pluralize": "^7.0.0"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -190,7 +190,7 @@ module.exports = {
|
||||
|
||||
autoReload: async ctx => {
|
||||
ctx.send({
|
||||
autoReload: _.get(strapi.config.environments, 'development.server.autoReload', false),
|
||||
autoReload: _.get(strapi.config.currentEnvironment, 'server.autoReload', { enabled: false })
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-type-builder",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Strapi plugin to create content type (API).",
|
||||
"strapi": {
|
||||
"name": "Content Type Builder",
|
||||
@ -24,11 +24,11 @@
|
||||
"dependencies": {
|
||||
"immutable": "^3.8.2",
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-generate": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-api": "3.0.0-alpha.13.1"
|
||||
"strapi-generate": "3.0.0-alpha.14",
|
||||
"strapi-generate-api": "3.0.0-alpha.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-email",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "This is the description of the plugin.",
|
||||
"strapi": {
|
||||
"name": "Email",
|
||||
@ -22,11 +22,11 @@
|
||||
"prepublishOnly": "IS_MONOREPO=true npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"strapi-email-sendmail": "3.0.0-alpha.13.1"
|
||||
"strapi-email-sendmail": "3.0.0-alpha.14"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-copy-to-clipboard": "5.0.1",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-graphql",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "This is the description of the plugin.",
|
||||
"strapi": {
|
||||
"name": "graphql",
|
||||
@ -30,7 +30,7 @@
|
||||
"graphql-type-json": "^0.2.1",
|
||||
"graphql-type-datetime": "^0.2.2",
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
|
@ -3,7 +3,7 @@ import request from 'utils/request';
|
||||
const shouldRenderCompo = (plugin) => new Promise((resolve, reject) => {
|
||||
request('/settings-manager/autoReload')
|
||||
.then(response => {
|
||||
plugin.preventComponentRendering = !response.autoReload;
|
||||
plugin.preventComponentRendering = !response.autoReload.enabled;
|
||||
plugin.blockerComponentProps = {
|
||||
blockerComponentTitle: 'components.AutoReloadBlocker.header',
|
||||
blockerComponentDescription: 'components.AutoReloadBlocker.description',
|
||||
|
@ -334,8 +334,8 @@ module.exports = {
|
||||
|
||||
autoReload: async ctx => {
|
||||
ctx.send({
|
||||
autoReload: _.get(strapi.config.environments, 'development.server.autoReload', false),
|
||||
environment: strapi.config.environment,
|
||||
autoReload: _.get(strapi.config.currentEnvironment, 'server.autoReload', { enabled: false }),
|
||||
environment: strapi.config.environment
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-settings-manager",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Strapi plugin to manage settings.",
|
||||
"strapi": {
|
||||
"name": "Settings Manager",
|
||||
@ -25,7 +25,7 @@
|
||||
"devDependencies": {
|
||||
"flag-icon-css": "^2.8.0",
|
||||
"react-select": "^1.0.0-rc.5",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -24,7 +24,7 @@ module.exports = {
|
||||
}
|
||||
|
||||
// Extract optional relational data.
|
||||
const { refId, ref, source, field } = ctx.request.body.fields;
|
||||
const { refId, ref, source, field, path } = ctx.request.body.fields;
|
||||
const { files = {} } = ctx.request.body.files;
|
||||
|
||||
if (_.isEmpty(files)) {
|
||||
@ -50,6 +50,13 @@ module.exports = {
|
||||
});
|
||||
}
|
||||
|
||||
// Update uploading folder path for the file.
|
||||
if (path) {
|
||||
Object.assign(file, {
|
||||
path
|
||||
});
|
||||
}
|
||||
|
||||
return file;
|
||||
});
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-upload",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "This is the description of the plugin.",
|
||||
"strapi": {
|
||||
"name": "Files Upload",
|
||||
@ -23,12 +23,12 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react-copy-to-clipboard": "^5.0.1",
|
||||
"strapi-upload-local": "3.0.0-alpha.13.1",
|
||||
"strapi-upload-local": "3.0.0-alpha.14",
|
||||
"stream-to-array": "^2.3.0",
|
||||
"uuid": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
|
@ -138,7 +138,7 @@ module.exports = async cb => {
|
||||
},
|
||||
response_email: '',
|
||||
object: 'Account confirmation',
|
||||
message: `<p>Thank you to register!</p>
|
||||
message: `<p>Thank you for registering!</p>
|
||||
|
||||
<p>You have to confirm your email address. Please click on the link below.</p>
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-users-permissions",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Protect your API with a full-authentication process based on JWT",
|
||||
"strapi": {
|
||||
"name": "Roles & Permissions",
|
||||
@ -32,7 +32,7 @@
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -70,10 +70,12 @@ module.exports = {
|
||||
upload: (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// upload file on S3 bucket
|
||||
const path = file.path ? `${file.path}/` : '';
|
||||
S3.upload({
|
||||
Key: `${file.hash}${file.ext}`,
|
||||
Key: `${path}${file.hash}${file.ext}`,
|
||||
Body: new Buffer(file.buffer, 'binary'),
|
||||
ACL: 'public-read'
|
||||
ACL: 'public-read',
|
||||
ContentType: file.mime,
|
||||
}, (err, data) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
@ -89,12 +91,9 @@ module.exports = {
|
||||
delete: (file) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// delete file on S3 bucket
|
||||
const path = file.path ? `${file.path}/` : '';
|
||||
S3.deleteObjects({
|
||||
Delete: {
|
||||
Objects: [{
|
||||
Key: `${file.hash}${file.ext}`
|
||||
}]
|
||||
}
|
||||
Key: `${path}${file.hash}${file.ext}`
|
||||
}, (err, data) => {
|
||||
if (err) {
|
||||
return reject(err);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-upload-aws-s3",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "AWS S3 provider for strapi upload",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-upload-cloudinary",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Cloudinary provider for strapi upload",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-upload-local",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Local provider for strapi upload",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-upload-rackspace",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Rackspace provider for strapi upload",
|
||||
"main": "./lib",
|
||||
"scripts": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-utils",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "Shared utilities for the Strapi packages",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"version": "3.0.0-alpha.14",
|
||||
"description": "An open source solution to create and manage your own API. It provides a powerful dashboard and features to make your life easier.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -55,16 +55,16 @@
|
||||
"rimraf": "^2.6.2",
|
||||
"semver": "^5.4.1",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-generate": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-admin": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-api": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-controller": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-model": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-new": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-policy": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-service": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
"strapi-generate": "3.0.0-alpha.14",
|
||||
"strapi-generate-admin": "3.0.0-alpha.14",
|
||||
"strapi-generate-api": "3.0.0-alpha.14",
|
||||
"strapi-generate-controller": "3.0.0-alpha.14",
|
||||
"strapi-generate-model": "3.0.0-alpha.14",
|
||||
"strapi-generate-new": "3.0.0-alpha.14",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.14",
|
||||
"strapi-generate-policy": "3.0.0-alpha.14",
|
||||
"strapi-generate-service": "3.0.0-alpha.14",
|
||||
"strapi-utils": "3.0.0-alpha.14"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -74,7 +74,8 @@ const main = async () => {
|
||||
return new Promise(async (resolve) => {
|
||||
// Run setup tests to generate the app.
|
||||
await jest({
|
||||
passWithNoTests: true
|
||||
passWithNoTests: true,
|
||||
testURL: 'http://localhost/'
|
||||
}, [process.cwd()]);
|
||||
|
||||
const packages = fs.readdirSync(path.resolve(process.cwd(), 'packages'))
|
||||
@ -84,6 +85,7 @@ const main = async () => {
|
||||
for (let i in packages) {
|
||||
await jest({
|
||||
passWithNoTests: true,
|
||||
testURL: 'http://localhost/'
|
||||
}, [`${process.cwd()}/packages/${packages[i]}`]);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user