mirror of
https://github.com/strapi/strapi.git
synced 2025-10-27 16:10:08 +00:00
Merge branch 'develop' into features/single-types
This commit is contained in:
commit
ff870e7aa0
@ -4,6 +4,8 @@
|
||||
|
||||
The context object (`ctx`) contains all the requests related information. They are accessible through `ctx.request`, from [controllers](controllers.md) and [policies](policies.md).
|
||||
|
||||
Strapi passes the `body` on `ctx.request.body` and `files` through `ctx.request.files`
|
||||
|
||||
For more information, please refer to the [Koa request documentation](http://koajs.com/#request).
|
||||
|
||||
## Responses
|
||||
|
||||
@ -22,11 +22,11 @@
|
||||
"@babel/preset-env": "^7.4.3",
|
||||
"@babel/preset-react": "^7.0.0",
|
||||
"@babel/runtime": "^7.4.3",
|
||||
"@buffetjs/core": "2.1.1-next.1",
|
||||
"@buffetjs/custom": "2.1.1-next.1",
|
||||
"@buffetjs/hooks": "2.1.1-next.1",
|
||||
"@buffetjs/icons": "2.1.1-next.1",
|
||||
"@buffetjs/styles": "2.1.1-next.1",
|
||||
"@buffetjs/core": "3.0.0-next.1",
|
||||
"@buffetjs/custom": "3.0.0-next.1",
|
||||
"@buffetjs/hooks": "3.0.0-next.1",
|
||||
"@buffetjs/icons": "3.0.0-next.1",
|
||||
"@buffetjs/styles": "3.0.0-next.1",
|
||||
"@buffetjs/utils": "^2.0.0",
|
||||
"@fortawesome/fontawesome-free": "^5.11.2",
|
||||
"@fortawesome/fontawesome-svg-core": "^1.2.25",
|
||||
|
||||
@ -13,13 +13,7 @@ module.exports = {
|
||||
const uploadService = strapi.plugins.upload.services.upload;
|
||||
|
||||
// Retrieve provider configuration.
|
||||
const config = await strapi
|
||||
.store({
|
||||
environment: strapi.config.environment,
|
||||
type: 'plugin',
|
||||
name: 'upload',
|
||||
})
|
||||
.get({ key: 'provider' });
|
||||
const config = await uploadService.getConfig();
|
||||
|
||||
// Verify if the file upload is enable.
|
||||
if (config.enabled === false) {
|
||||
@ -131,13 +125,19 @@ module.exports = {
|
||||
},
|
||||
|
||||
async updateSettings(ctx) {
|
||||
const {
|
||||
request: { body: newSettings },
|
||||
} = ctx;
|
||||
await strapi
|
||||
.store({
|
||||
environment: ctx.params.environment,
|
||||
type: 'plugin',
|
||||
name: 'upload',
|
||||
})
|
||||
.set({ key: 'provider', value: ctx.request.body });
|
||||
.set({
|
||||
key: 'provider',
|
||||
value: { ...newSettings, sizeLimit: parseFloat(newSettings.sizeLimit) },
|
||||
});
|
||||
|
||||
ctx.send({ ok: true });
|
||||
},
|
||||
@ -208,10 +208,9 @@ const searchQueries = {
|
||||
return ({ id }) => {
|
||||
return model
|
||||
.query(qb => {
|
||||
qb.whereRaw('LOWER(hash) LIKE ?', [`%${id}%`]).orWhereRaw(
|
||||
'LOWER(name) LIKE ?',
|
||||
[`%${id}%`]
|
||||
);
|
||||
qb.whereRaw('LOWER(hash) LIKE ?', [
|
||||
`%${id}%`,
|
||||
]).orWhereRaw('LOWER(name) LIKE ?', [`%${id}%`]);
|
||||
})
|
||||
.fetchAll()
|
||||
.then(results => results.toJSON());
|
||||
|
||||
@ -176,4 +176,15 @@ module.exports = {
|
||||
})
|
||||
);
|
||||
},
|
||||
async getConfig() {
|
||||
const config = await strapi
|
||||
.store({
|
||||
environment: strapi.config.environment,
|
||||
type: 'plugin',
|
||||
name: 'upload',
|
||||
})
|
||||
.get({ key: 'provider' });
|
||||
|
||||
return { ...config, sizeLimit: parseFloat(config.sizeLimit) };
|
||||
},
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user