mirror of
https://github.com/strapi/strapi.git
synced 2025-07-23 17:10:08 +00:00
Merge branch 'master' into improvement/remember-me
This commit is contained in:
commit
ef97f72ff7
119
CONTRIBUTING.md
119
CONTRIBUTING.md
@ -1,6 +1,6 @@
|
||||
# Contribute to Strapi
|
||||
|
||||
👍🎉 First off, thanks for taking the time to contribute! 🎉👍
|
||||
First off, thanks for taking the time to contribute! 🎉👍
|
||||
|
||||
The following is a set of guidelines for contributing to Strapi and its packages.
|
||||
|
||||
@ -32,40 +32,115 @@ If you send a pull request, please do it again the `master` branch. We are devel
|
||||
## Setup Development Environment
|
||||
To facilitate the contribution, we drastically reduce the amount of commands necessary to install the entire development environment. First of all, you need to check if you're using the recommended versions of Node.js (v8) and npm (v5).
|
||||
|
||||
**Then, please follow the instructions below:**
|
||||
Then, please follow the instructions below:
|
||||
|
||||
1. [Fork the repository](https://github.com/strapi/strapi) to your own GitHub account.
|
||||
2. Clone it to your computer `git clone git@github.com:strapi/strapi.git`.
|
||||
3. Run `npm run setup` at the root of the directory.
|
||||
#### 1. ▪️ Fork the repository
|
||||
|
||||
> Note: If the installation failed, please remove the global packages related to Strapi. The command `npm ls strapi` will help you to find where your packages are installed globally.
|
||||
[Go to the repository](https://github.com/strapi/strapi) and fork it to your own GitHub account.
|
||||
|
||||
> Note: You can run `npm run setup:build` to build the plugins' admin (the setup time will be longer).
|
||||
#### 2. 💿 Clone the repository
|
||||
|
||||
```bash
|
||||
git clone git@github.com:strapi/strapi.git
|
||||
```
|
||||
|
||||
The development environment has been installed. Now, you have to create a development project to live-test your updates.
|
||||
#### 3. ⏳ Installation
|
||||
|
||||
Go to the root of the repository.
|
||||
```bash
|
||||
cd strapi
|
||||
```
|
||||
|
||||
1. Go to a folder on your computer `cd /path/to/my/folder`.
|
||||
2. Create a new project `strapi new myDevelopmentProject --dev`.
|
||||
3. Start your app with `strapi start`.
|
||||
**Two setup are available... with or without the front-end builds.**
|
||||
|
||||
Awesome! You are now able to make bug fixes or enhancements in the framework layer of Strapi. **To make updates in the administration panel, you need to go a little bit further.**
|
||||
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.
|
||||
|
||||
4. Open a new tab or new terminal window.
|
||||
5. Go to the `my-app/admin` folder of your currently running app.
|
||||
6. Run `npm start` and go to the following url [http://localhost:4000/admin](http://localhost:4000/admin)
|
||||
<br>
|
||||
|
||||
Without the front-end builds (recommended)
|
||||
```bash
|
||||
npm run setup
|
||||
```
|
||||
or with the front-end builds
|
||||
```bash
|
||||
npm run setup:build
|
||||
```
|
||||
|
||||
> ⚠️ If the installation failed, please remove the global packages related to Strapi. The command `npm ls strapi` will help you to find where your packages are installed globally.
|
||||
|
||||
#### 4. 🏗 Create a new project
|
||||
|
||||
You can open a new terminal window and go into any folder you want for the next steps.
|
||||
```bash
|
||||
cd /.../workspace/
|
||||
```
|
||||
|
||||
The command to generate a project is the same, except you have to add the `--dev` argument at the end of line.
|
||||
```bash
|
||||
strapi new my-project --dev
|
||||
```
|
||||
|
||||
#### 5. 🚀 Start the project
|
||||
|
||||
First, you have to start the server.
|
||||
```bash
|
||||
cd ./my-project
|
||||
strapi start
|
||||
```
|
||||
|
||||
The server (API) is available at http://localhost:1337
|
||||
|
||||
> ⚠️ If you've followed the recommended setup, you should not be able to reach the administration panel at http://localhost:1337/admin.
|
||||
|
||||
Then, you have to start the Webpack server to build and run the administration.
|
||||
```bash
|
||||
cd ./my-project/admin
|
||||
npm run start
|
||||
```
|
||||
|
||||
The administration panel is available at http://localhost:4000/admin
|
||||
|
||||
**Awesome! You are now able to contribute to Strapi.**
|
||||
|
||||
---
|
||||
|
||||
## Plugin Development Setup
|
||||
|
||||
To create a new plugin, you'll have to run the following commands
|
||||
To create a new plugin, you'll have to run the following commands:
|
||||
|
||||
1. In your project folder `cd myDevelopmentProject && strapi generate:plugin my-plugin`.
|
||||
2. Make sure that the `strapi-helper-plugin` is linked to your plugin
|
||||
- In the folder where strapi is cloned `cd pathToStrapiRepo/strapi/packages/strapi-helper-plugin && npm link`.
|
||||
- In your project folder `cd pathToMyProject/myDevelopmentProject/plugins/my-plugin && npm link strapi-helper-plugin`.
|
||||
3. Start the server in the admin folder `cd pathToMyProject/myDevelopmentProject/admin && npm start` and go to the following url [http://localhost:4000/admin](http://localhost:4000/admin).
|
||||
#### 1. 🏗 Generate a new plugin
|
||||
|
||||
***
|
||||
```bash
|
||||
cd ./my-project
|
||||
strapi generate:plugin my-plugin
|
||||
```
|
||||
|
||||
#### 2. ✅ Verify the symlink
|
||||
|
||||
Make you that the `strapi-helper-plugin` is linked to your project.
|
||||
|
||||
Please run this command in the repository folder where Strapi is cloned:
|
||||
```bash
|
||||
cd /repository/strapi/packages/strapi-helper-plugin
|
||||
npm link
|
||||
```
|
||||
|
||||
Link the `strapi-helper-plugin` node_modules in the plugin folder:
|
||||
```bash
|
||||
cd ./my-project/plugins/my-plugin
|
||||
npm link strapi-helper-plugin
|
||||
```
|
||||
|
||||
#### 3. 🚀 Start the project
|
||||
|
||||
```bash
|
||||
cd ./my-project/admin
|
||||
npm run start
|
||||
```
|
||||
|
||||
The administration panel is available at http://localhost:4000/admin
|
||||
|
||||
---
|
||||
|
||||
## Reporting an issue
|
||||
|
||||
|
73
README.md
73
README.md
@ -11,7 +11,7 @@
|
||||
</a>
|
||||
</p>
|
||||
<h3 align="center">API creation made simple, secure and fast.</h3>
|
||||
<p align="center">The most advanced open-source Content Management Framework to build powerful API with no effort.</p>
|
||||
<p align="center">The most advanced open-source Content Management Framework (headless-CMS) to build powerful API with no effort.</p>
|
||||
<br />
|
||||
<p align="center">
|
||||
<a href="https://www.npmjs.org/package/strapi">
|
||||
@ -32,35 +32,52 @@
|
||||
|
||||
<p align="center">
|
||||
<a href="https://strapi.io">
|
||||
<img src="https://blog.strapi.io/content/images/2017/10/Github-Preview.png" />
|
||||
<img src="https://blog.strapi.io/content/images/2018/08/github_preview-2.png" />
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
||||
## Quick start
|
||||
## Getting Started
|
||||
|
||||
We've been working on a major update to Strapi for several months now, rewriting the core framework and the administration panel. Performances has been increased, Developer eXperience has been improved and a brand new plugins
|
||||
ecosystem has been introduced. **Both versions are available, we still recommend you to use v1 for production usage.**.
|
||||
<a href="https://strapi.io/getting-started)" target="_blank">Read the Getting Started tutorial</a> or follow the steps below:
|
||||
|
||||
#### ⏳ Installation
|
||||
|
||||
```bash
|
||||
npm install strapi@alpha -g
|
||||
````
|
||||
|
||||
**We recommend to use the latest version of Strapi to start your new project**.
|
||||
Some breaking changes might happen, new releases are shipped every two weeks to fix/enhance the product.
|
||||
|
||||
#### 🏗 Create a new project
|
||||
|
||||
```bash
|
||||
strapi new my-project
|
||||
```
|
||||
|
||||
It will generate a brand new project with the default features (authentication, permissions, content management, content type builder & file upload).
|
||||
|
||||
#### 🚀 Start your project
|
||||
|
||||
```bash
|
||||
cd my-project
|
||||
strapi start
|
||||
```
|
||||
|
||||
Congratulations, you made it! Enjoy 🎉
|
||||
|
||||
<br>
|
||||
|
||||
You can also give it a try using Heroku! Be aware that one of the content type builder won't work due to the writing files restriction on the Heroku servers.
|
||||
|
||||
<a href="https://heroku.com/deploy?template=https://github.com/strapi/strapi-heroku-app">
|
||||
<img src="https://www.herokucdn.com/deploy/button.svg" alt="Deploy">
|
||||
</a>
|
||||
|
||||
#### Alpha
|
||||
<br>
|
||||
|
||||
The alpha has support for the latest version of Node.js (v9) and npm (v5).
|
||||
```bash
|
||||
npm install strapi@alpha -g
|
||||
```
|
||||
|
||||
#### Stable
|
||||
This is the production-ready version of Strapi (v1). You should also consider that the migration to v3 will not be easy due to many breaking changes.
|
||||
```bash
|
||||
npm install strapi -g
|
||||
```
|
||||
|
||||
Read the [Getting started](https://strapi.io/getting-started) page to create your first project using Strapi.
|
||||
|
||||
## Features
|
||||
|
||||
@ -73,19 +90,17 @@ Read the [Getting started](https://strapi.io/getting-started) page to create you
|
||||
- **Powerful CLI:** Scaffold projects and APIs on the fly.
|
||||
- **SQL & NoSQL databases:** Work with Mongo as a main database, also supports Postgres, MySQL, etc.
|
||||
|
||||
## Philosophy ?
|
||||
**[See more on our website](https://strapi.io/overview)**
|
||||
|
||||
> At [Strapi](https://strapi.io), everything we do we believe in changing the status quo of web development. Our products are simple to use, user friendly and production-ready.
|
||||
## Contributing
|
||||
|
||||
Web and mobile applications needed a powerful, simple to use and production-ready API-driven solution. That's why we created Strapi, an open-source Content Management Framework (CMF) for exposing your content (data, media) accross multi-devices.
|
||||
|
||||
Halfway between a CMS and a framework, Strapi takes advantages of both worlds. A powerful dashboard to easily manage your content with a flexible framework layer to develop and integrate specific features.
|
||||
Please read our [Contributing Guide](./CONTRIBUTING.md) before submitting a Pull Request to the project.
|
||||
|
||||
## Support
|
||||
|
||||
For more information on the upcoming version, please take a look to our [ROADMAP](https://github.com/strapi/strapi/projects).
|
||||
|
||||
### Community support
|
||||
#### Community support
|
||||
|
||||
For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io/documentation/). For additional help, you can use one of this channel to ask question:
|
||||
|
||||
@ -95,13 +110,15 @@ For general help using Strapi, please refer to [the official Strapi documentatio
|
||||
- [Twitter](https://twitter.com/strapijs)
|
||||
- [Facebook](https://www.facebook.com/Strapi-616063331867161).
|
||||
|
||||
### Professional support
|
||||
#### Professional support
|
||||
|
||||
[Strapi Solutions](https://strapi.io), the company behind Strapi, provides a full range of solutions to get better results, faster. We're always looking for the next challenge: coaching, consulting, training, customization, etc. [Drop us an email](mailto:support@strapi.io) to see how we can help you.
|
||||
[Strapi Solutions](https://strapi.io), the company behind Strapi, provides a full range of solutions to get better results, faster. We're always looking for the next challenge: coaching, consulting, training, customization, etc.
|
||||
|
||||
### Migration
|
||||
[Drop us an email](mailto:support@strapi.io) to see how we can help you.
|
||||
|
||||
Follow our [migration guides](https://github.com/strapi/strapi/wiki) on the wiki to keep your Strapi projects updated.
|
||||
## Migration
|
||||
|
||||
Follow our [migration guides](https://github.com/strapi/strapi/wiki) on the wiki to keep your projects up-to-date.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -19,6 +19,11 @@ The info key on the model-json states information about the model. This informat
|
||||
- `description`: The description of the model.
|
||||
- `mainField`: Determines which model-attribute is shown when displaying the model.
|
||||
|
||||
## Model options
|
||||
The options key on the model-json states.
|
||||
- `idAttribute`: This tells the model which attribute to expect as the unique identifier for each database row (typically an auto-incrementing primary key named 'id').
|
||||
- `idAttributeType`: Data type of `idAttribute`, accepted list of value bellow:
|
||||
|
||||
## Define the attributes
|
||||
|
||||
The following types are currently available:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"private": true,
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"assert": "~1.3.0",
|
||||
|
@ -129,7 +129,7 @@ if (window.location.port !== '4000') {
|
||||
});
|
||||
})
|
||||
.catch(err => {
|
||||
console.log(err);
|
||||
console.log(err); // eslint-disable-line no-console
|
||||
});
|
||||
} else if (findIndex(plugins, ['id', 'users-permissions']) === -1) {
|
||||
store.dispatch(unsetHasUserPlugin());
|
||||
|
@ -5,7 +5,7 @@
|
||||
width: 100%;
|
||||
height: $header-height;
|
||||
position: fixed;
|
||||
z-index: 100;
|
||||
z-index: 1050;
|
||||
left: $left-menu-width;
|
||||
|
||||
box-shadow: 0 1px 2px 0 rgba(40, 42, 49, 0.16);
|
||||
|
@ -20,9 +20,10 @@ class LeftMenuLink extends React.Component {
|
||||
// We need to create our own active url checker,
|
||||
// because of the two levels router.
|
||||
const isLinkActive = startsWith(
|
||||
window.location.pathname.replace('/admin', ''),
|
||||
this.props.destination,
|
||||
window.location.pathname.replace('/admin', '').concat('/'),
|
||||
this.props.destination.concat('/'),
|
||||
);
|
||||
|
||||
const plugin =
|
||||
this.props.source !== 'content-manager' && this.props.source !== '' ? (
|
||||
<div className={styles.plugin}>
|
||||
|
@ -137,7 +137,7 @@ export class HomePage extends React.PureComponent {
|
||||
const data = this.showFirstBlock()
|
||||
? {
|
||||
className: styles.homePageTutorialButton,
|
||||
href: 'https://strapi.io/documentation/getting-started/quick-start.html',
|
||||
href: 'https://strapi.io/documentation/getting-started/quick-start.html#create-your-first-api',
|
||||
id: 'app.components.HomePage.button.quickStart',
|
||||
primary: true,
|
||||
}
|
||||
|
@ -8,8 +8,10 @@ import {
|
||||
DOWNLOAD_PLUGIN,
|
||||
DOWNLOAD_PLUGIN_ERROR,
|
||||
DOWNLOAD_PLUGIN_SUCCEEDED,
|
||||
GET_PLUGINS,
|
||||
GET_PLUGINS_SUCCEEDED,
|
||||
GET_AVAILABLE_PLUGINS,
|
||||
GET_AVAILABLE_PLUGINS_SUCCEEDED,
|
||||
GET_INSTALLED_PLUGINS,
|
||||
GET_INSTALLED_PLUGINS_SUCCEEDED,
|
||||
ON_CHANGE,
|
||||
} from './constants';
|
||||
|
||||
@ -32,19 +34,32 @@ export function downloadPluginSucceeded() {
|
||||
};
|
||||
}
|
||||
|
||||
export function getPlugins() {
|
||||
export function getAvailablePlugins() {
|
||||
return {
|
||||
type: GET_PLUGINS,
|
||||
type: GET_AVAILABLE_PLUGINS,
|
||||
};
|
||||
}
|
||||
|
||||
export function getPluginsSucceeded(availablePlugins) {
|
||||
export function getAvailablePluginsSucceeded(availablePlugins) {
|
||||
return {
|
||||
type: GET_PLUGINS_SUCCEEDED,
|
||||
type: GET_AVAILABLE_PLUGINS_SUCCEEDED,
|
||||
availablePlugins,
|
||||
};
|
||||
}
|
||||
|
||||
export function getInstalledPlugins() {
|
||||
return {
|
||||
type: GET_INSTALLED_PLUGINS,
|
||||
};
|
||||
}
|
||||
|
||||
export function getInstalledPluginsSucceeded(installedPlugins) {
|
||||
return {
|
||||
type: GET_INSTALLED_PLUGINS_SUCCEEDED,
|
||||
installedPlugins,
|
||||
};
|
||||
}
|
||||
|
||||
export function onChange({ target }) {
|
||||
return {
|
||||
type: ON_CHANGE,
|
||||
|
@ -7,6 +7,8 @@
|
||||
export const DOWNLOAD_PLUGIN = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN';
|
||||
export const DOWNLOAD_PLUGIN_ERROR = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN_ERROR';
|
||||
export const DOWNLOAD_PLUGIN_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/DOWNLOAD_PLUGIN_SUCCEEDED';
|
||||
export const GET_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_PLUGINS';
|
||||
export const GET_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_PLUGINS_SUCCEEDED';
|
||||
export const GET_AVAILABLE_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_AVAILABLE_PLUGINS';
|
||||
export const GET_AVAILABLE_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_AVAILABLE_PLUGINS_SUCCEEDED';
|
||||
export const GET_INSTALLED_PLUGINS = 'StrapiAdmin/InstallPluginPage/GET_INSTALLED_PLUGINS';
|
||||
export const GET_INSTALLED_PLUGINS_SUCCEEDED = 'StrapiAdmin/InstallPluginPage/GET_INSTALLED_PLUGINS_SUCCEEDED';
|
||||
export const ON_CHANGE = 'StrapiAdmin/InstallPluginPage/ON_CHANGE';
|
||||
|
@ -11,7 +11,7 @@ import { Helmet } from 'react-helmet';
|
||||
import { FormattedMessage } from 'react-intl';
|
||||
import { bindActionCreators, compose } from 'redux';
|
||||
import cn from 'classnames';
|
||||
import { get, isUndefined, map } from 'lodash';
|
||||
import { map } from 'lodash';
|
||||
|
||||
import {
|
||||
disableGlobalOverlayBlocker,
|
||||
@ -32,7 +32,8 @@ import injectReducer from 'utils/injectReducer';
|
||||
|
||||
import {
|
||||
downloadPlugin,
|
||||
getPlugins,
|
||||
getAvailablePlugins,
|
||||
getInstalledPlugins,
|
||||
onChange,
|
||||
} from './actions';
|
||||
|
||||
@ -55,8 +56,11 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
|
||||
|
||||
// Don't fetch the available plugins if it has already been done
|
||||
if (!this.props.didFetchPlugins) {
|
||||
this.props.getPlugins();
|
||||
this.props.getAvailablePlugins();
|
||||
}
|
||||
|
||||
// Get installed plugins
|
||||
this.props.getInstalledPlugins();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -65,10 +69,10 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.props.didFetchPlugins) {
|
||||
if (!this.props.didFetchPlugins || !this.props.didFetchInstalledPlugins) {
|
||||
return <LoadingIndicatorPage />;
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div>
|
||||
<OverlayBlocker isOpen={this.props.blockApp}>
|
||||
@ -112,7 +116,7 @@ export class InstallPluginPage extends React.Component { // eslint-disable-line
|
||||
key={plugin.id}
|
||||
plugin={plugin}
|
||||
showSupportUsButton={plugin.id === 'support-us'}
|
||||
isAlreadyInstalled={!isUndefined(get(this.context.plugins.toJS(), plugin.id))}
|
||||
isAlreadyInstalled={this.props.installedPlugins.includes(plugin.id)}
|
||||
downloadPlugin={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
@ -134,19 +138,18 @@ InstallPluginPage.childContextTypes = {
|
||||
downloadPlugin: PropTypes.func.isRequired,
|
||||
};
|
||||
|
||||
InstallPluginPage.contextTypes = {
|
||||
plugins: PropTypes.object.isRequired,
|
||||
};
|
||||
|
||||
InstallPluginPage.propTypes = {
|
||||
availablePlugins: PropTypes.array.isRequired,
|
||||
blockApp: PropTypes.bool.isRequired,
|
||||
didFetchInstalledPlugins: PropTypes.bool.isRequired,
|
||||
didFetchPlugins: PropTypes.bool.isRequired,
|
||||
disableGlobalOverlayBlocker: PropTypes.func.isRequired,
|
||||
downloadPlugin: PropTypes.func.isRequired,
|
||||
enableGlobalOverlayBlocker: PropTypes.func.isRequired,
|
||||
getPlugins: PropTypes.func.isRequired,
|
||||
getAvailablePlugins: PropTypes.func.isRequired,
|
||||
getInstalledPlugins: PropTypes.func.isRequired,
|
||||
history: PropTypes.object.isRequired,
|
||||
installedPlugins: PropTypes.array.isRequired,
|
||||
// onChange: PropTypes.func.isRequired,
|
||||
// search: PropTypes.string.isRequired,
|
||||
};
|
||||
@ -159,7 +162,8 @@ function mapDispatchToProps(dispatch) {
|
||||
disableGlobalOverlayBlocker,
|
||||
downloadPlugin,
|
||||
enableGlobalOverlayBlocker,
|
||||
getPlugins,
|
||||
getAvailablePlugins,
|
||||
getInstalledPlugins,
|
||||
onChange,
|
||||
},
|
||||
dispatch,
|
||||
|
@ -9,14 +9,17 @@ import {
|
||||
DOWNLOAD_PLUGIN,
|
||||
DOWNLOAD_PLUGIN_ERROR,
|
||||
DOWNLOAD_PLUGIN_SUCCEEDED,
|
||||
GET_PLUGINS_SUCCEEDED,
|
||||
GET_AVAILABLE_PLUGINS_SUCCEEDED,
|
||||
GET_INSTALLED_PLUGINS_SUCCEEDED,
|
||||
ON_CHANGE,
|
||||
} from './constants';
|
||||
|
||||
const initialState = fromJS({
|
||||
availablePlugins: List([]),
|
||||
installedPlugins: List([]),
|
||||
blockApp: false,
|
||||
didFetchPlugins: false,
|
||||
didFetchInstalledPlugins: false,
|
||||
pluginToDownload: '',
|
||||
search: '',
|
||||
});
|
||||
@ -35,10 +38,14 @@ function installPluginPageReducer(state = initialState, action) {
|
||||
return state
|
||||
.set('blockApp', false)
|
||||
.set('pluginToDownload', '');
|
||||
case GET_PLUGINS_SUCCEEDED:
|
||||
case GET_AVAILABLE_PLUGINS_SUCCEEDED:
|
||||
return state
|
||||
.set('didFetchPlugins', true)
|
||||
.set('availablePlugins', List(action.availablePlugins));
|
||||
case GET_INSTALLED_PLUGINS_SUCCEEDED:
|
||||
return state
|
||||
.set('didFetchInstalledPlugins', true)
|
||||
.set('installedPlugins', List(action.installedPlugins));
|
||||
case ON_CHANGE:
|
||||
return state.updateIn(action.keys, () => action.value);
|
||||
default:
|
||||
|
@ -15,9 +15,10 @@ import { selectLocale } from '../LanguageProvider/selectors';
|
||||
import {
|
||||
downloadPluginError,
|
||||
downloadPluginSucceeded,
|
||||
getPluginsSucceeded,
|
||||
getAvailablePluginsSucceeded,
|
||||
getInstalledPluginsSucceeded,
|
||||
} from './actions';
|
||||
import { DOWNLOAD_PLUGIN, GET_PLUGINS } from './constants';
|
||||
import { DOWNLOAD_PLUGIN, GET_AVAILABLE_PLUGINS, GET_INSTALLED_PLUGINS } from './constants';
|
||||
import { makeSelectPluginToDownload } from './selectors';
|
||||
|
||||
|
||||
@ -49,7 +50,7 @@ export function* pluginDownload() {
|
||||
}
|
||||
}
|
||||
|
||||
export function* pluginsGet() {
|
||||
export function* getAvailablePlugins() {
|
||||
try {
|
||||
// Get current locale.
|
||||
const locale = yield select(selectLocale());
|
||||
@ -73,20 +74,44 @@ export function* pluginsGet() {
|
||||
availablePlugins = [];
|
||||
}
|
||||
|
||||
yield put(getPluginsSucceeded(availablePlugins));
|
||||
yield put(getAvailablePluginsSucceeded(availablePlugins));
|
||||
} catch(err) {
|
||||
strapi.notification.error('notification.error');
|
||||
}
|
||||
}
|
||||
|
||||
export function* getInstalledPlugins() {
|
||||
try {
|
||||
const opts = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
};
|
||||
|
||||
let installedPlugins;
|
||||
|
||||
try {
|
||||
// Retrieve plugins list.
|
||||
installedPlugins = yield call(request, '/admin/plugins', opts);
|
||||
} catch (e) {
|
||||
installedPlugins = [];
|
||||
}
|
||||
|
||||
yield put(getInstalledPluginsSucceeded(Object.keys(installedPlugins.plugins)));
|
||||
} catch(err) {
|
||||
strapi.notification.error('notification.error');
|
||||
}
|
||||
}
|
||||
|
||||
// Individual exports for testing
|
||||
export default function* defaultSaga() {
|
||||
const loadPluginsWatcher = yield fork(takeLatest, GET_PLUGINS, pluginsGet);
|
||||
const loadAvailablePluginsWatcher = yield fork(takeLatest, GET_AVAILABLE_PLUGINS, getAvailablePlugins);
|
||||
const loadInstalledPluginsWatcher = yield fork(takeLatest, GET_INSTALLED_PLUGINS, getInstalledPlugins);
|
||||
yield fork(takeLatest, DOWNLOAD_PLUGIN, pluginDownload);
|
||||
|
||||
yield take(LOCATION_CHANGE);
|
||||
|
||||
yield cancel(loadPluginsWatcher);
|
||||
yield cancel(loadAvailablePluginsWatcher);
|
||||
yield cancel(loadInstalledPluginsWatcher);
|
||||
}
|
||||
|
@ -16,12 +16,12 @@
|
||||
"app.components.HomePage.welcome": "Willkommen an Bord!",
|
||||
"app.components.HomePage.welcome.again": "Willkommen",
|
||||
"app.components.HomePage.create": "Erstelle deinen ersten Inhaltstyp",
|
||||
"app.components.HomePage.welcomeBlock.content": "Wir freuen uns, dich als Mitglied der Community zu haben. Wir sind offen für Feedback, senden uns einfach eine direkt Nachricht an\u0020",
|
||||
"app.components.HomePage.welcomeBlock.content.issues": "Fehler",
|
||||
"app.components.HomePage.welcomeBlock.content.raise": "\u0020oder erhöhen\u0020",
|
||||
"app.components.HomePage.welcomeBlock.content": "Wir freuen uns, dich als Mitglied der Community zu haben. Wir sind offen für Feedback, senden uns einfach eine direkt Nachricht in\u0020",
|
||||
"app.components.HomePage.welcomeBlock.content.issues": "Ticket.",
|
||||
"app.components.HomePage.welcomeBlock.content.raise": "\u0020oder eröffne\u0020",
|
||||
"app.components.HomePage.createBlock.content.first": "Das\u0020",
|
||||
"app.components.HomePage.createBlock.content.second": "\u0020Plugin wird dir helfen, die Datenstruktur deiner Modelle zu definieren. Wenn du neu hier bist, empfehlen wir dir unsere\u0020",
|
||||
"app.components.HomePage.createBlock.content.tutorial": "\u0020Anleitung.",
|
||||
"app.components.HomePage.createBlock.content.second": "\u0020Plugin wird dir helfen, die Datenstruktur deiner Modelle zu definieren. Wenn du neu hier bist, empfehlen wir dir unser\u0020",
|
||||
"app.components.HomePage.createBlock.content.tutorial": "\u0020Tutorial.",
|
||||
"app.components.HomePage.welcomeBlock.content.again": "Wir hoffen, dass du Fortschritte bei deinem Projekt machst.... Lese das Neueste über Strapi. Wir geben unser Bestes, um das Produkt auf der Grundlage deines Feedbacks zu verbessern.",
|
||||
"app.components.HomePage.cta": "BESTÄTIGEN",
|
||||
"app.components.HomePage.community": "Finde die Community im Web",
|
||||
@ -44,7 +44,7 @@
|
||||
|
||||
"app.components.InstallPluginPage.helmet": "Marktplatz - Plugins",
|
||||
"app.components.InstallPluginPage.title": "Marktplatz - Plugins",
|
||||
"app.components.InstallPluginPage.description": "Erweitere problemlos deine App",
|
||||
"app.components.InstallPluginPage.description": "Erweitere problemlos deine App.",
|
||||
"app.components.InstallPluginPage.plugin.support-us.description": "Unterstütze uns durch den Kauf eines Strapi T-Shirts. Das erlaubt uns, weiter an dem Projekt arbeiten zu können und es so gut wie nur möglich zu gestalten!",
|
||||
"app.components.InstallPluginPage.InputSearch.label": " ",
|
||||
"app.components.InstallPluginPage.InputSearch.placeholder": "Suche nach einem Plugin... (z.B.: Authentifizierung)",
|
||||
@ -126,20 +126,20 @@
|
||||
|
||||
"components.ListRow.empty": "Es gibt keine Daten.",
|
||||
|
||||
"components.Wysiwyg.collapse": "Collapse",
|
||||
"components.Wysiwyg.selectOptions.title": "Add a title",
|
||||
"components.Wysiwyg.selectOptions.H1": "Title H1",
|
||||
"components.Wysiwyg.selectOptions.H2": "Title H2",
|
||||
"components.Wysiwyg.selectOptions.H3": "Title H3",
|
||||
"components.Wysiwyg.selectOptions.H4": "Title H4",
|
||||
"components.Wysiwyg.selectOptions.H5": "Title H5",
|
||||
"components.Wysiwyg.selectOptions.H6": "Title H6",
|
||||
"components.Wysiwyg.ToggleMode.markdown": "Switch to markdown",
|
||||
"components.Wysiwyg.ToggleMode.preview": "Switch to preview",
|
||||
"components.WysiwygBottomControls.charactersIndicators": "characters",
|
||||
"components.WysiwygBottomControls.uploadFiles": "Attach files by dragging & dropping, {browse}, or pasting from the clipboard.",
|
||||
"components.WysiwygBottomControls.uploadFiles.browse": "selecting them",
|
||||
"components.WysiwygBottomControls.fullscreen": "Expand",
|
||||
"components.Wysiwyg.collapse": "Verkleinern",
|
||||
"components.Wysiwyg.selectOptions.title": "Füge einen Überschrift hinzu",
|
||||
"components.Wysiwyg.selectOptions.H1": "Überschrift H1",
|
||||
"components.Wysiwyg.selectOptions.H2": "Überschrift H2",
|
||||
"components.Wysiwyg.selectOptions.H3": "Überschrift H3",
|
||||
"components.Wysiwyg.selectOptions.H4": "Überschrift H4",
|
||||
"components.Wysiwyg.selectOptions.H5": "Überschrift H5",
|
||||
"components.Wysiwyg.selectOptions.H6": "Überschrift H6",
|
||||
"components.Wysiwyg.ToggleMode.markdown": "Wechsel zu Markdown",
|
||||
"components.Wysiwyg.ToggleMode.preview": "Wechsel zur Vorschau",
|
||||
"components.WysiwygBottomControls.charactersIndicators": "Zeichen",
|
||||
"components.WysiwygBottomControls.uploadFiles": "Ziehe eine Datei hierher, {browse} eine Datei zum hochladen aus oder füge sie aus der Zwischenablage ein.",
|
||||
"components.WysiwygBottomControls.uploadFiles.browse": "wähle",
|
||||
"components.WysiwygBottomControls.fullscreen": "Vergrößern",
|
||||
|
||||
"HomePage.notification.newsLetter.success": "Newsletter erfolgreich abonniert",
|
||||
|
||||
@ -148,7 +148,7 @@
|
||||
|
||||
"Analytics": "Analytics",
|
||||
"Auth & Permissions": "Authentifizierung & Berechtigungen",
|
||||
"Content Manager": "Content-Manager",
|
||||
"Content Manager": "Inhalts-Manager",
|
||||
"Content Type Builder": "Inhaltstyp-Manager",
|
||||
"Files Upload": "Dateien hochladen",
|
||||
"Settings Manager": "Einstellungs-Manager",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-admin",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Strapi Admin",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@ -31,8 +31,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"sanitize.css": "^4.1.0",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi",
|
||||
@ -51,4 +51,4 @@
|
||||
"npm": ">= 5.0.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-email-amazon-ses",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate the default admin panel for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -14,9 +14,9 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-extra": "^4.0.1",
|
||||
"lodash": "^4.17.4",
|
||||
"strapi-admin": "3.0.0-alpha.13.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"lodash": "^4.17.5",
|
||||
"strapi-admin": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-api",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate an API for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -13,7 +13,7 @@
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"pluralize": "^6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-controller",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate a controller for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -14,7 +14,7 @@
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "npm prune"
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-model",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate a model for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -14,7 +14,7 @@
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublish": "npm prune"
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -187,10 +187,10 @@ module.exports = (scope, cb) => {
|
||||
console.log();
|
||||
console.log(`👌 Your new application ${green(scope.name)} is ready at ${cyan(scope.rootPath)}.`);
|
||||
console.log();
|
||||
console.log('⚡️ change directory:');
|
||||
console.log('⚡️ Change directory:');
|
||||
console.log(`$ ${green(`cd ${scope.name}`)}`);
|
||||
console.log();
|
||||
console.log('⚡️ start application:');
|
||||
console.log('⚡️ Start application:');
|
||||
console.log(`$ ${green('strapi start')}`);
|
||||
|
||||
cb();
|
||||
|
@ -132,7 +132,7 @@ module.exports = (scope, cb) => {
|
||||
type: 'input',
|
||||
name: 'database',
|
||||
message: 'Database name:',
|
||||
default: _.get(scope.database, 'database', 'strapi')
|
||||
default: _.get(scope.database, 'database', scope.name)
|
||||
},
|
||||
{
|
||||
when: !hasDatabaseConfig,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-new",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate a new Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -17,9 +17,9 @@
|
||||
"fs-extra": "^4.0.0",
|
||||
"inquirer": "^4.0.2",
|
||||
"listr": "^0.14.1",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"ora": "^2.1.0",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1",
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"scripts": {
|
||||
@ -49,4 +49,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-plugin",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate an plugin for a Strapi application.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -14,7 +14,7 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"fs-extra": "^4.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"pluralize": "^6.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
@ -44,4 +44,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-policy",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate a policy for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -14,7 +14,7 @@
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm prune"
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate-service",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Generate a service for a Strapi API.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -14,7 +14,7 @@
|
||||
"lib": "./lib"
|
||||
},
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"scripts": {
|
||||
"prepublishOnly": "npm prune"
|
||||
@ -43,4 +43,4 @@
|
||||
"npm": ">= 5.3.0"
|
||||
},
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-generate",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Master of ceremonies for the Strapi generators.",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -15,9 +15,9 @@
|
||||
"dependencies": {
|
||||
"async": "^2.5.0",
|
||||
"fs-extra": "^4.0.0",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"reportback": "^2.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -51,7 +51,10 @@ if (isAdmin && !isSetup) {
|
||||
);
|
||||
|
||||
try {
|
||||
const server = require(serverConfig);
|
||||
const { templateConfiguration } = require(path.join(adminPath, 'node_modules', 'strapi-utils'));
|
||||
|
||||
let server = require(serverConfig);
|
||||
server = templateConfiguration(server);
|
||||
|
||||
if (process.env.PWD.indexOf('/admin') !== -1) {
|
||||
if (_.get(server, 'admin.build.host')) {
|
||||
@ -61,7 +64,7 @@ if (isAdmin && !isSetup) {
|
||||
}
|
||||
|
||||
URLs.publicPath = URLs.host;
|
||||
URLs.backend = _.get(server, 'admin.build.backend', `/`);
|
||||
URLs.backend = _.get(server, 'admin.build.backend', '/');
|
||||
|
||||
if (_.get(server, 'admin.build.plugins.source') === 'backend') {
|
||||
URLs.mode = 'backend';
|
||||
|
@ -4,7 +4,7 @@
|
||||
height: 6rem;
|
||||
width: 6.5rem;
|
||||
line-height: 6rem;
|
||||
z-index: 999;
|
||||
z-index: 1040;
|
||||
text-align: center;
|
||||
background-color: #FFFFFF;
|
||||
color: #81848A;
|
||||
|
@ -20,7 +20,7 @@
|
||||
background-repeat: no-repeat !important;
|
||||
white-space: nowrap;
|
||||
|
||||
z-index: 1;
|
||||
z-index: 1 !important;
|
||||
> img {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
@ -49,7 +49,7 @@
|
||||
display: block;
|
||||
position: absolute;
|
||||
top: 37px;
|
||||
z-index: 9999;
|
||||
z-index: 999;
|
||||
padding: 12px 40px 0 40px;
|
||||
line-height: 18px;
|
||||
color: #fff !important;
|
||||
|
@ -6,6 +6,6 @@
|
||||
height: 20px;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
z-index: 9999;
|
||||
z-index: 999;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-helper-plugin",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Helper for Strapi plugins development",
|
||||
"engines": {
|
||||
"node": ">= 9.0.0",
|
||||
@ -73,7 +73,7 @@
|
||||
"intl": "^1.2.5",
|
||||
"invariant": "2.2.1",
|
||||
"json-loader": "^0.5.7",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"lodash-webpack-plugin": "^0.11.4",
|
||||
"mocha": "3.1.2",
|
||||
"moment": "^2.16.0",
|
||||
|
@ -26,9 +26,6 @@ const GLOBALS = {};
|
||||
* Bookshelf hook
|
||||
*/
|
||||
|
||||
/* eslint-disable no-unused-vars */
|
||||
/* eslint-disable prefer-template */
|
||||
/* eslint-disable no-case-declarations */
|
||||
module.exports = function(strapi) {
|
||||
const hook = _.merge({
|
||||
/**
|
||||
@ -79,17 +76,16 @@ module.exports = function(strapi) {
|
||||
_.forEach(models, (definition, model) => {
|
||||
definition.globalName = _.upperFirst(_.camelCase(definition.globalId));
|
||||
|
||||
_.defaults(definition, {
|
||||
primaryKey: 'id'
|
||||
});
|
||||
|
||||
// Define local GLOBALS to expose every models in this file.
|
||||
GLOBALS[definition.globalId] = {};
|
||||
|
||||
// Add some informations about ORM & client connection & tableName
|
||||
definition.orm = 'bookshelf';
|
||||
definition.client = _.get(connection.settings, 'client');
|
||||
|
||||
_.defaults(definition, {
|
||||
primaryKey: 'id',
|
||||
primaryKeyType: _.get(definition, 'options.idAttributeType', 'integer')
|
||||
});
|
||||
// Register the final model for Bookshelf.
|
||||
const loadedModel = _.assign({
|
||||
tableName: definition.collectionName,
|
||||
@ -287,7 +283,7 @@ module.exports = function(strapi) {
|
||||
: Promise.resolve();
|
||||
});
|
||||
|
||||
this.on('saving', (instance, attrs) => {
|
||||
this.on('saving', (instance, attrs, options) => { //eslint-disable-line
|
||||
instance.attributes = mapper(instance.attributes);
|
||||
attrs = mapper(attrs);
|
||||
|
||||
@ -394,13 +390,16 @@ module.exports = function(strapi) {
|
||||
case 'oneToOne':
|
||||
case 'manyToOne':
|
||||
case 'oneWay':
|
||||
type = definition.client === 'pg' ? 'integer' : 'int';
|
||||
type = definition.primaryKeyType;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
switch (attribute.type) {
|
||||
case 'uuid':
|
||||
type = definition.client === 'pg' ? 'uuid' : 'varchar(36)';
|
||||
break;
|
||||
case 'text':
|
||||
type = definition.client === 'pg' ? type = 'text' : 'longtext';
|
||||
break;
|
||||
@ -521,7 +520,13 @@ module.exports = function(strapi) {
|
||||
|
||||
|
||||
if (!tableExist) {
|
||||
const columns = generateColumns(attributes, [`id ${definition.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY`]).join(',\n\r');
|
||||
let idAttributeBuilder = [`id ${definition.client === 'pg' ? 'SERIAL' : 'INT AUTO_INCREMENT'} NOT NULL PRIMARY KEY`];
|
||||
if (definition.primaryKeyType === 'uuid' && definition.client === 'pg') {
|
||||
idAttributeBuilder = ['id uuid NOT NULL DEFAULT uuid_generate_v4() NOT NULL PRIMARY KEY'];
|
||||
} else if (definition.primaryKeyType !== 'integer') {
|
||||
idAttributeBuilder = [`id ${getType({type: definition.primaryKeyType})} NOT NULL PRIMARY KEY`];
|
||||
}
|
||||
const columns = generateColumns(attributes, idAttributeBuilder).join(',\n\r');
|
||||
|
||||
// Create table
|
||||
await ORM.knex.raw(`
|
||||
@ -593,7 +598,6 @@ module.exports = function(strapi) {
|
||||
const changeRequired = definition.client === 'pg'
|
||||
? `ALTER COLUMN ${quote}${attribute}${quote} ${attributes[attribute].required ? 'SET' : 'DROP'} NOT NULL`
|
||||
: `CHANGE ${quote}${attribute}${quote} ${quote}${attribute}${quote} ${type} ${attributes[attribute].required ? 'NOT' : ''} NULL`;
|
||||
|
||||
await ORM.knex.raw(`ALTER TABLE ${quote}${table}${quote} ${changeType}`);
|
||||
await ORM.knex.raw(`ALTER TABLE ${quote}${table}${quote} ${changeRequired}`);
|
||||
}
|
||||
@ -631,10 +635,10 @@ module.exports = function(strapi) {
|
||||
if (morphRelations) {
|
||||
const attributes = {
|
||||
[`${loadedModel.tableName}_id`]: {
|
||||
type: 'integer'
|
||||
type: definition.primaryKeyType
|
||||
},
|
||||
[`${morphRelations.alias}_id`]: {
|
||||
type: 'integer'
|
||||
type: definition.primaryKeyType
|
||||
},
|
||||
[`${morphRelations.alias}_type`]: {
|
||||
type: 'text'
|
||||
@ -661,10 +665,10 @@ module.exports = function(strapi) {
|
||||
|
||||
const attributes = {
|
||||
[`${pluralize.singular(manyRelations.collection)}_id`]: {
|
||||
type: 'integer'
|
||||
type: definition.primaryKeyType
|
||||
},
|
||||
[`${pluralize.singular(definition.globalId.toLowerCase())}_id`]: {
|
||||
type: 'integer'
|
||||
type: definition.primaryKeyType
|
||||
}
|
||||
};
|
||||
|
||||
@ -999,7 +1003,7 @@ module.exports = function(strapi) {
|
||||
cb();
|
||||
},
|
||||
|
||||
getQueryParams: (value, type, key) => {
|
||||
getQueryParams: (value, type, key) =>{
|
||||
const result = {};
|
||||
|
||||
switch (type) {
|
||||
@ -1046,18 +1050,18 @@ module.exports = function(strapi) {
|
||||
};
|
||||
break;
|
||||
case '_sort':
|
||||
result.key = `sort`;
|
||||
result.key = 'sort';
|
||||
result.value = {
|
||||
key,
|
||||
order: value.toUpperCase()
|
||||
};
|
||||
break;
|
||||
case '_start':
|
||||
result.key = `start`;
|
||||
result.key = 'start';
|
||||
result.value = parseFloat(value);
|
||||
break;
|
||||
case '_limit':
|
||||
result.key = `limit`;
|
||||
result.key = 'limit';
|
||||
result.value = parseFloat(value);
|
||||
break;
|
||||
case '_contains':
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-bookshelf",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Bookshelf hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -18,10 +18,10 @@
|
||||
"dependencies": {
|
||||
"bookshelf": "^0.12.1",
|
||||
"inquirer": "^5.2.0",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-hook-knex": "3.0.0-alpha.13.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"strapi-hook-knex": "3.0.0-alpha.13.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Knex hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -17,7 +17,7 @@
|
||||
"main": "./lib",
|
||||
"dependencies": {
|
||||
"knex": "^0.13.0",
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-mongoose",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Mongoose hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -15,11 +15,11 @@
|
||||
},
|
||||
"main": "./lib",
|
||||
"dependencies": {
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"mongoose": "^5.0.16",
|
||||
"mongoose-float": "^1.0.2",
|
||||
"pluralize": "^6.0.0",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-hook-redis",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Redis hook for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -16,9 +16,9 @@
|
||||
"main": "./lib",
|
||||
"dependencies": {
|
||||
"ioredis": "^3.1.2",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-lint",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Strapi eslint and prettier configurations",
|
||||
"directories": {
|
||||
"lib": "lib"
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-middleware-views",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Views middleware to enable server-side rendering for the Strapi framework",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -17,7 +17,7 @@
|
||||
"dependencies": {
|
||||
"consolidate": "^0.14.5",
|
||||
"koa-views": "^6.1.1",
|
||||
"lodash": "^4.17.4"
|
||||
"lodash": "^4.17.5"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"plugin.description.short": "Greife blitzschnell auf alle Daten in der Datenbank zu und manipuliere sie.",
|
||||
"plugin.description.long": "Greife blitzschnell auf alle Daten in der Datenbank zu und manipuliere sie.",
|
||||
"plugin.description.short": "Greife blitzschnell auf alle Daten in der Datenbank zu und änder sie.",
|
||||
"plugin.description.long": "Greife blitzschnell auf alle Daten in der Datenbank zu und änder sie.",
|
||||
|
||||
"containers.Home.pluginHeaderTitle": "Inhalts-Manager",
|
||||
"containers.Home.introduction": "Um deine Einträge zu verwalten, klicke auf den entsprechenden Link im Menü links. Dieses Plugin ist noch in aktiver Entwicklung und seine Einstellungen können nicht optimal angepasst werden.",
|
||||
@ -24,7 +24,7 @@
|
||||
"containers.SettingsPage.Block.generalSettings.description": "Konfiguriere die Standardoptionen für deine Inhaltstypen.",
|
||||
"containers.SettingsPage.Block.generalSettings.title" : "Allgemeines",
|
||||
"containers.SettingsPage.Block.contentType.title": "Inhaltstypen",
|
||||
"containers.SettingsPage.Block.contentType.description": "Konfiguriere die spezifischen Einstellungen",
|
||||
"containers.SettingsPage.Block.contentType.description": "Konfiguriere die spezifischen Einstellungen.",
|
||||
"containers.SettingsPage.pluginHeaderDescription": "Konfigurieren Sie die Standardeinstellungen für alle Ihre Inhaltstypen.",
|
||||
|
||||
"components.AddFilterCTA.add": "Filter",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-manager",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "A powerful UI to easily manage your data.",
|
||||
"strapi": {
|
||||
"name": "Content Manager",
|
||||
@ -29,7 +29,7 @@
|
||||
"react-select": "^1.2.1",
|
||||
"react-sortable-hoc": "^0.8.3",
|
||||
"showdown": "^1.8.6",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -514,12 +514,9 @@ export class Form extends React.Component { // eslint-disable-line react/prefer-
|
||||
}
|
||||
|
||||
renderModalBodyChooseAttributes = () => {
|
||||
const attributesDisplay = forms.attributesDisplay.items;
|
||||
|
||||
// Don't display the media field if the upload plugin isn't installed
|
||||
if (!has(this.context.plugins.toJS(), 'upload')) {
|
||||
attributesDisplay.splice(8, 1);
|
||||
}
|
||||
const attributesDisplay = has(this.context.plugins.toJS(), 'upload')
|
||||
? forms.attributesDisplay.items
|
||||
: forms.attributesDisplay.items.filter(obj => obj.type !== 'media'); // Don't display the media field if the upload plugin isn't installed
|
||||
|
||||
return (
|
||||
map(attributesDisplay, (attribute, key) => (
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-content-type-builder",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Strapi plugin to create content type (API).",
|
||||
"strapi": {
|
||||
"name": "Content Type Builder",
|
||||
@ -23,11 +23,11 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"pluralize": "^7.0.0",
|
||||
"strapi-generate": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-api": "3.0.0-alpha.13.0.1"
|
||||
"strapi-generate": "3.0.0-alpha.13.1",
|
||||
"strapi-generate-api": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-email",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1"
|
||||
"strapi-email-sendmail": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"react-copy-to-clipboard": "5.0.1",
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-graphql",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1"
|
||||
"strapi-utils": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
|
@ -630,7 +630,8 @@ module.exports = {
|
||||
};
|
||||
|
||||
if (association.type === 'model') {
|
||||
params.id = obj[association.alias];
|
||||
const rel = obj[association.alias];
|
||||
params.id = typeof rel === 'object' && 'id' in rel ? rel.id : rel;
|
||||
} else {
|
||||
// Get refering model.
|
||||
const ref = association.plugin ?
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-settings-manager",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -13,8 +13,8 @@
|
||||
"EntriesNumber.number": "{number} Datei gefunden",
|
||||
"EntriesNumber.number.plural": "{number} Dateien gefunden",
|
||||
|
||||
"HomePage.title": "Hochladen",
|
||||
"HomePage.description": "Übersicht über alle hochgeladenen Dateien",
|
||||
"HomePage.title": "Dateien hochladen",
|
||||
"HomePage.description": "Übersicht über alle hochgeladenen Dateien.",
|
||||
"HomePage.InputSearch.placeholder": "Suche nach einer Datei...",
|
||||
|
||||
"Li.linkCopied": "Link in die Zwischenablage kopiert",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-upload",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"strapi-upload-local": "3.0.0-alpha.13.1",
|
||||
"stream-to-array": "^2.3.0",
|
||||
"uuid": "^3.2.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "A Strapi developer",
|
||||
|
@ -51,6 +51,8 @@ class PopUpForm extends React.Component { // eslint-disable-line react/prefer-st
|
||||
return `${strapi.backendURL}/connect/google/callback`;
|
||||
case 'github':
|
||||
return get(this.props.values, 'redirect_uri', '');
|
||||
case 'microsoft':
|
||||
return `${strapi.backendURL}/connect/microsoft/callback`;
|
||||
default: {
|
||||
const value = get(this.props.values, 'callback', '');
|
||||
|
||||
|
@ -60,7 +60,7 @@ export function setForm(formType, email) {
|
||||
password: '',
|
||||
confirmPassword: '',
|
||||
email: '',
|
||||
news: true,
|
||||
news: false,
|
||||
};
|
||||
break;
|
||||
case 'register-success':
|
||||
|
@ -80,7 +80,7 @@
|
||||
},
|
||||
"name": "news",
|
||||
"type": "checkbox",
|
||||
"value": true
|
||||
"value": false
|
||||
}
|
||||
],
|
||||
"register-success": [
|
||||
|
@ -89,8 +89,8 @@
|
||||
"HeaderNav.link.providers": "Methoden",
|
||||
"HeaderNav.link.roles": "Rollen",
|
||||
|
||||
"HomePage.header.title": "Benutzer & Befugnisse",
|
||||
"HomePage.header.description": "Lege Rollen und deren Befugnisse fest",
|
||||
"HomePage.header.title": "Benutzer & Berechtigungen",
|
||||
"HomePage.header.description": "Lege Rollen und deren Berechtigungen fest.",
|
||||
|
||||
"InputSearch.placeholder": "Suche nach einem Benutzer",
|
||||
|
||||
|
@ -43,8 +43,10 @@
|
||||
"Auth.form.error.code.provide": "Incorrect code provided.",
|
||||
"Auth.form.error.password.matching": "Passwords do not match.",
|
||||
"Auth.form.error.params.provide": "Incorrect params provided.",
|
||||
"Auth.form.error.username.taken": "Username is already taken",
|
||||
"Auth.form.error.email.taken": "Email is already taken",
|
||||
"Auth.form.error.username.taken": "Username is already taken.",
|
||||
"Auth.form.error.email.taken": "Email is already taken.",
|
||||
"Auth.form.error.blocked": "Your account has been blocked by the administrator.",
|
||||
"Auth.form.error.ratelimit": "Too many attempts, please try again in a minute.",
|
||||
|
||||
"Auth.link.forgot-password": "Forgot your password?",
|
||||
"Auth.link.ready": "Ready to sign in?",
|
||||
@ -167,6 +169,7 @@
|
||||
"PopUpForm.Providers.facebook.providerConfig.redirectURL": "The redirect URL to add in your Facebook application configurations",
|
||||
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
|
||||
"PopUpForm.Providers.github.providerConfig.redirectURL": "The redirect URL to add in your GitHub application configurations",
|
||||
"PopUpForm.Providers.microsoft.providerConfig.redirectURL": "The redirect URL to add in your Microsoft application configurations",
|
||||
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
|
||||
"PopUpForm.Providers.twitter.providerConfig.redirectURL": "The redirect URL to add in your Twitter application configurations",
|
||||
|
||||
|
@ -77,6 +77,14 @@ module.exports = async cb => {
|
||||
'user:email'
|
||||
]
|
||||
},
|
||||
microsoft: {
|
||||
enabled: false,
|
||||
icon: 'windows',
|
||||
key: '',
|
||||
secret: '',
|
||||
callback: '/auth/microsoft/callback',
|
||||
scope: ['user.read']
|
||||
},
|
||||
twitter: {
|
||||
enabled: false,
|
||||
icon: 'twitter',
|
||||
|
@ -23,6 +23,10 @@ module.exports = async (ctx, next) => {
|
||||
if (role.type === 'root') {
|
||||
return await next();
|
||||
}
|
||||
|
||||
if (ctx.state.user.blocked === true) {
|
||||
return ctx.unauthorized(`Your account has been blocked by the administrator.`);
|
||||
}
|
||||
}
|
||||
// Retrieve `public` role.
|
||||
if (!role) {
|
||||
@ -43,7 +47,7 @@ module.exports = async (ctx, next) => {
|
||||
return ctx.request.graphql = strapi.errors.forbidden();
|
||||
}
|
||||
|
||||
ctx.forbidden();
|
||||
return ctx.forbidden();
|
||||
}
|
||||
|
||||
// Execute the policies.
|
||||
|
@ -0,0 +1,12 @@
|
||||
const RateLimit = require('koa2-ratelimit').RateLimit;
|
||||
|
||||
module.exports = async (ctx, next) => {
|
||||
const message = ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.ratelimit' }] }] : 'Too many attempts, please try again in a minute.';
|
||||
|
||||
return RateLimit.middleware(Object.assign({}, {
|
||||
interval: 1*60*1000,
|
||||
max: 5,
|
||||
prefixKey: `${ctx.request.url}:${ctx.request.ip}`,
|
||||
message
|
||||
}, strapi.plugins['users-permissions'].config.ratelimit))(ctx, next);
|
||||
};
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"ratelimit": {
|
||||
"interval": 60000,
|
||||
"max": 10
|
||||
}
|
||||
}
|
@ -153,7 +153,7 @@
|
||||
"path": "/connect/*",
|
||||
"handler": "Auth.connect",
|
||||
"config": {
|
||||
"policies": [],
|
||||
"policies": ["plugins.users-permissions.ratelimit"],
|
||||
"prefix": ""
|
||||
}
|
||||
},
|
||||
@ -162,7 +162,7 @@
|
||||
"path": "/auth/local",
|
||||
"handler": "Auth.callback",
|
||||
"config": {
|
||||
"policies": [],
|
||||
"policies": ["plugins.users-permissions.ratelimit"],
|
||||
"prefix": ""
|
||||
}
|
||||
},
|
||||
@ -171,7 +171,7 @@
|
||||
"path": "/auth/local/register",
|
||||
"handler": "Auth.register",
|
||||
"config": {
|
||||
"policies": [],
|
||||
"policies": ["plugins.users-permissions.ratelimit"],
|
||||
"prefix": ""
|
||||
}
|
||||
},
|
||||
@ -189,7 +189,7 @@
|
||||
"path": "/auth/forgot-password",
|
||||
"handler": "Auth.forgotPassword",
|
||||
"config": {
|
||||
"policies": [],
|
||||
"policies": ["plugins.users-permissions.ratelimit"],
|
||||
"prefix": ""
|
||||
}
|
||||
},
|
||||
@ -198,7 +198,7 @@
|
||||
"path": "/auth/reset-password",
|
||||
"handler": "Auth.changePassword",
|
||||
"config": {
|
||||
"policies": [],
|
||||
"policies": ["plugins.users-permissions.ratelimit"],
|
||||
"prefix": ""
|
||||
}
|
||||
},
|
||||
|
@ -52,6 +52,10 @@ module.exports = {
|
||||
// Check if the user exists.
|
||||
const user = await strapi.query('user', 'users-permissions').findOne(query, ['role']);
|
||||
|
||||
if (user.blocked === true) {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.blocked' }] }] : 'Your account has been blocked by the administrator.');
|
||||
}
|
||||
|
||||
if (!user) {
|
||||
return ctx.badRequest(null, ctx.request.admin ? [{ messages: [{ id: 'Auth.form.error.invalid' }] }] : 'Identifier or password invalid.');
|
||||
}
|
||||
|
@ -33,6 +33,11 @@
|
||||
"configurable": false,
|
||||
"private": true
|
||||
},
|
||||
"blocked": {
|
||||
"type": "boolean",
|
||||
"default": false,
|
||||
"configurable": false
|
||||
},
|
||||
"role": {
|
||||
"model": "role",
|
||||
"via": "users",
|
||||
@ -40,4 +45,4 @@
|
||||
"configurable": false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-plugin-users-permissions",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Protect your API with a full-authentication process based on JWT",
|
||||
"strapi": {
|
||||
"name": "Roles & Permissions",
|
||||
@ -26,12 +26,13 @@
|
||||
"grant-koa": "^3.8.1",
|
||||
"jsonwebtoken": "^8.1.0",
|
||||
"koa": "^2.1.0",
|
||||
"koa2-ratelimit": "^0.6.1",
|
||||
"purest": "^2.0.1",
|
||||
"request": "^2.83.0",
|
||||
"uuid": "^3.1.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.0.1"
|
||||
"strapi-helper-plugin": "3.0.0-alpha.13.1"
|
||||
},
|
||||
"author": {
|
||||
"name": "Strapi team",
|
||||
|
@ -208,6 +208,40 @@ const getProfile = async (provider, query, callback) => {
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'microsoft': {
|
||||
const microsoft = new Purest({
|
||||
provider: 'microsoft',
|
||||
config:{
|
||||
'microsoft': {
|
||||
'https://graph.microsoft.com': {
|
||||
'__domain': {
|
||||
'auth': {
|
||||
'auth': {'bearer': '[0]'}
|
||||
}
|
||||
},
|
||||
'[version]/{endpoint}': {
|
||||
'__path': {
|
||||
'alias': '__default',
|
||||
'version': 'v1.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
microsoft.query().get('me').auth(access_token).request((err, res, body) => {
|
||||
if (err) {
|
||||
callback(err);
|
||||
} else {
|
||||
callback(null, {
|
||||
username: body.userPrincipalName,
|
||||
email: body.userPrincipalName
|
||||
});
|
||||
}
|
||||
});
|
||||
break;
|
||||
}
|
||||
case 'twitter': {
|
||||
const twitter = new Purest({
|
||||
provider: 'twitter',
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-upload-aws-s3",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Rackspace provider for strapi upload",
|
||||
"main": "./lib",
|
||||
"scripts": {
|
||||
|
@ -15,5 +15,6 @@ module.exports = {
|
||||
models: require('./models'),
|
||||
packageManager: require('./packageManager'),
|
||||
policy: require('./policy'),
|
||||
regex: require('./regex')
|
||||
regex: require('./regex'),
|
||||
templateConfiguration: require('./templateConfiguration')
|
||||
};
|
||||
|
26
packages/strapi-utils/lib/templateConfiguration.js
Normal file
26
packages/strapi-utils/lib/templateConfiguration.js
Normal file
@ -0,0 +1,26 @@
|
||||
const { isString, isPlainObject } = require('lodash');
|
||||
|
||||
const regex = /\$\{[^()]*\}/g;
|
||||
|
||||
/**
|
||||
* Allow dynamic config values through the native ES6 template string function.
|
||||
*/
|
||||
const templateConfiguration = (obj) => {
|
||||
// Allow values which looks like such as an ES6 literal string without parenthesis inside (aka function call).
|
||||
return Object.keys(obj).reduce((acc, key) => {
|
||||
if (isPlainObject(obj[key]) && !isString(obj[key])) {
|
||||
acc[key] = templateConfiguration(obj[key]);
|
||||
|
||||
} else if (isString(obj[key]) && obj[key].match(regex) !== null) {
|
||||
// eslint-disable-next-line prefer-template
|
||||
acc[key] = eval('`' + obj[key] + '`');
|
||||
|
||||
} else {
|
||||
acc[key] = obj[key];
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
||||
module.exports = templateConfiguration;
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi-utils",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"description": "Shared utilities for the Strapi packages",
|
||||
"homepage": "http://strapi.io",
|
||||
"keywords": [
|
||||
@ -21,7 +21,7 @@
|
||||
"commander": "^2.11.0",
|
||||
"joi-json": "^2.0.1",
|
||||
"knex": "^0.13.0",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash": "^4.17.5",
|
||||
"pino": "^4.7.1",
|
||||
"shelljs": "^0.7.7"
|
||||
},
|
||||
|
@ -3,7 +3,8 @@
|
||||
// Dependencies.
|
||||
const path = require('path');
|
||||
const glob = require('glob');
|
||||
const { merge, setWith, get, upperFirst, isString, isEmpty, isObject, pullAll, defaults, isPlainObject, assign, clone, cloneDeep, camelCase } = require('lodash');
|
||||
const { merge, setWith, get, upperFirst, isEmpty, isObject, pullAll, defaults, assign, clone, cloneDeep, camelCase } = require('lodash');
|
||||
const { templateConfiguration } = require('strapi-utils');
|
||||
const utils = require('../utils');
|
||||
|
||||
module.exports.nested = function() {
|
||||
@ -84,14 +85,14 @@ module.exports.app = async function() {
|
||||
this.config.currentEnvironment = this.config.environments[this.config.environment] || {};
|
||||
|
||||
// Set current connections.
|
||||
this.config.connections = get(this.config.currentEnvironment, `database.connections`, {});
|
||||
this.config.connections = get(this.config.currentEnvironment, 'database.connections', {});
|
||||
|
||||
if (get(this.config, 'language.enabled')) {
|
||||
this.config.language.locales = Object.keys(get(strapi.config, 'locales', {}));
|
||||
}
|
||||
|
||||
// Template literal string.
|
||||
this.config = templateConfigurations(this.config);
|
||||
this.config = templateConfiguration(this.config);
|
||||
|
||||
// Initialize main router to use it in middlewares.
|
||||
this.router = this.koaMiddlewares.routerJoi();
|
||||
@ -304,7 +305,7 @@ module.exports.app = async function() {
|
||||
|
||||
this.config.hook.settings = Object.keys(this.hook).reduce((acc, current) => {
|
||||
// Try to find the settings in the current environment, then in the main configurations.
|
||||
const currentSettings = merge(get(cloneDeep(this.hook[current]), ['defaults', current], {}), flattenHooksConfig[current] || this.config.currentEnvironment[current] || this.config[current]);
|
||||
const currentSettings = merge(get(cloneDeep(this.hook[current]), ['defaults', current], {}), flattenHooksConfig[current] || get(this.config.currentEnvironment, ['hook', current]) || get(this.config, ['hook', current]));
|
||||
acc[current] = !isObject(currentSettings) ? {} : currentSettings;
|
||||
|
||||
if (!acc[current].hasOwnProperty('enabled')) {
|
||||
@ -359,24 +360,3 @@ const enableHookNestedDependencies = function (name, flattenHooksConfig, force =
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Allow dynamic config values through
|
||||
* the native ES6 template string function.
|
||||
*/
|
||||
const regex = /\$\{[^()]*\}/g;
|
||||
const templateConfigurations = function (obj) {
|
||||
// Allow values which looks like such as
|
||||
// an ES6 literal string without parenthesis inside (aka function call).
|
||||
return Object.keys(obj).reduce((acc, key) => {
|
||||
if (isPlainObject(obj[key]) && !isString(obj[key])) {
|
||||
acc[key] = templateConfigurations(obj[key]);
|
||||
} else if (isString(obj[key]) && obj[key].match(regex) !== null) {
|
||||
acc[key] = eval('`' + obj[key] + '`'); // eslint-disable-line prefer-template
|
||||
} else {
|
||||
acc[key] = obj[key];
|
||||
}
|
||||
|
||||
return acc;
|
||||
}, {});
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "strapi",
|
||||
"version": "3.0.0-alpha.13.0.1",
|
||||
"version": "3.0.0-alpha.13.1",
|
||||
"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": [
|
||||
@ -49,22 +49,22 @@
|
||||
"koa-router-joi": "^1.0.1",
|
||||
"koa-session": "^5.5.1",
|
||||
"koa-static": "^4.0.1",
|
||||
"lodash": "^4.16.5",
|
||||
"lodash": "^4.17.5",
|
||||
"node-fetch": "^1.7.3",
|
||||
"node-schedule": "^1.2.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"semver": "^5.4.1",
|
||||
"stack-trace": "0.0.10",
|
||||
"strapi-generate": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-admin": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-api": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-controller": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-model": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-new": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-plugin": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-policy": "3.0.0-alpha.13.0.1",
|
||||
"strapi-generate-service": "3.0.0-alpha.13.0.1",
|
||||
"strapi-utils": "3.0.0-alpha.13.0.1"
|
||||
"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"
|
||||
},
|
||||
"author": {
|
||||
"email": "hi@strapi.io",
|
||||
|
Loading…
x
Reference in New Issue
Block a user