mirror of
https://github.com/strapi/strapi.git
synced 2025-11-16 01:57:56 +00:00
Merge branch 'master' into fix/add-img-compo-rel
This commit is contained in:
commit
bc7473c9f7
@ -10,12 +10,13 @@ const createSchemaHandler = require('./schema-handler');
|
|||||||
|
|
||||||
module.exports = function createComponentBuilder() {
|
module.exports = function createComponentBuilder() {
|
||||||
return {
|
return {
|
||||||
setRelation({ key, modelName, attribute }) {
|
setRelation({ key, modelName, plugin, attribute }) {
|
||||||
this.contentTypes.get(attribute.target).setAttribute(
|
this.contentTypes.get(attribute.target).setAttribute(
|
||||||
attribute.targetAttribute,
|
attribute.targetAttribute,
|
||||||
generateRelation({
|
generateRelation({
|
||||||
key,
|
key,
|
||||||
attribute,
|
attribute,
|
||||||
|
plugin,
|
||||||
modelName,
|
modelName,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
@ -93,6 +94,7 @@ module.exports = function createComponentBuilder() {
|
|||||||
this.setRelation({
|
this.setRelation({
|
||||||
key,
|
key,
|
||||||
modelName: contentType.modelName,
|
modelName: contentType.modelName,
|
||||||
|
plugin: contentType.plugin,
|
||||||
attribute,
|
attribute,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -153,6 +155,7 @@ module.exports = function createComponentBuilder() {
|
|||||||
return this.setRelation({
|
return this.setRelation({
|
||||||
key,
|
key,
|
||||||
modelName: contentType.modelName,
|
modelName: contentType.modelName,
|
||||||
|
plugin: contentType.plugin,
|
||||||
attribute: newAttributes[key],
|
attribute: newAttributes[key],
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -172,6 +175,7 @@ module.exports = function createComponentBuilder() {
|
|||||||
return this.setRelation({
|
return this.setRelation({
|
||||||
key,
|
key,
|
||||||
modelName: contentType.modelName,
|
modelName: contentType.modelName,
|
||||||
|
plugin: contentType.plugin,
|
||||||
attribute: newAttribute,
|
attribute: newAttribute,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -185,6 +189,7 @@ module.exports = function createComponentBuilder() {
|
|||||||
this.setRelation({
|
this.setRelation({
|
||||||
key,
|
key,
|
||||||
modelName: contentType.modelName,
|
modelName: contentType.modelName,
|
||||||
|
plugin: contentType.plugin,
|
||||||
attribute,
|
attribute,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -227,9 +232,10 @@ module.exports = function createComponentBuilder() {
|
|||||||
const createContentTypeUID = ({ name }) =>
|
const createContentTypeUID = ({ name }) =>
|
||||||
`application::${nameToSlug(name)}.${nameToSlug(name)}`;
|
`application::${nameToSlug(name)}.${nameToSlug(name)}`;
|
||||||
|
|
||||||
const generateRelation = ({ key, attribute, modelName }) => {
|
const generateRelation = ({ key, attribute, plugin, modelName }) => {
|
||||||
const opts = {
|
const opts = {
|
||||||
via: key,
|
via: key,
|
||||||
|
plugin,
|
||||||
columnName: attribute.targetColumnName || undefined,
|
columnName: attribute.targetColumnName || undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -70,6 +70,8 @@ class PopUpForm extends React.Component {
|
|||||||
return `${strapi.backendURL}/connect/twitter/callback`;
|
return `${strapi.backendURL}/connect/twitter/callback`;
|
||||||
case 'instagram':
|
case 'instagram':
|
||||||
return `${strapi.backendURL}/connect/instagram/callback`;
|
return `${strapi.backendURL}/connect/instagram/callback`;
|
||||||
|
case 'vk':
|
||||||
|
return `${strapi.backendURL}/connect/vk/callback`;
|
||||||
default: {
|
default: {
|
||||||
const value = get(this.props.values, 'callback', '');
|
const value = get(this.props.values, 'callback', '');
|
||||||
|
|
||||||
|
|||||||
@ -85,6 +85,7 @@
|
|||||||
"PopUpForm.Providers.github.providerConfig.redirectURL": "The redirect URL to add in your GitHub application configurations",
|
"PopUpForm.Providers.github.providerConfig.redirectURL": "The redirect URL to add in your GitHub application configurations",
|
||||||
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
|
"PopUpForm.Providers.google.providerConfig.redirectURL": "The redirect URL to add in your Google application configurations",
|
||||||
"PopUpForm.Providers.instagram.providerConfig.redirectURL": "The redirect URL to add in your Instagram application configurations",
|
"PopUpForm.Providers.instagram.providerConfig.redirectURL": "The redirect URL to add in your Instagram application configurations",
|
||||||
|
"PopUpForm.Providers.vk.providerConfig.redirectURL": "The redirect URL to add in your VK application configurations",
|
||||||
"PopUpForm.Providers.key.label": "Client ID",
|
"PopUpForm.Providers.key.label": "Client ID",
|
||||||
"PopUpForm.Providers.key.placeholder": "TEXT",
|
"PopUpForm.Providers.key.placeholder": "TEXT",
|
||||||
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
|
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "The redirect URL to add in your Linkedin application configurations",
|
||||||
|
|||||||
@ -84,6 +84,7 @@
|
|||||||
"PopUpForm.Providers.github.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки GitHub приложения",
|
"PopUpForm.Providers.github.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки GitHub приложения",
|
||||||
"PopUpForm.Providers.google.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки Google приложения",
|
"PopUpForm.Providers.google.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки Google приложения",
|
||||||
"PopUpForm.Providers.instagram.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки Instagram приложения",
|
"PopUpForm.Providers.instagram.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки Instagram приложения",
|
||||||
|
"PopUpForm.Providers.vk.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки VK приложения",
|
||||||
"PopUpForm.Providers.key.label": "Client ID",
|
"PopUpForm.Providers.key.label": "Client ID",
|
||||||
"PopUpForm.Providers.key.placeholder": "TEXT",
|
"PopUpForm.Providers.key.placeholder": "TEXT",
|
||||||
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки Linkedin приложения",
|
"PopUpForm.Providers.linkedin2.providerConfig.redirectURL": "URL-адрес перенаправления, который необходимо добавить в настройки Linkedin приложения",
|
||||||
|
|||||||
@ -89,6 +89,14 @@ module.exports = async () => {
|
|||||||
secret: '',
|
secret: '',
|
||||||
callback: '/auth/instagram/callback',
|
callback: '/auth/instagram/callback',
|
||||||
},
|
},
|
||||||
|
vk: {
|
||||||
|
enabled: false,
|
||||||
|
icon: 'vk',
|
||||||
|
key: '',
|
||||||
|
secret: '',
|
||||||
|
callback: '/auth/vk/callback',
|
||||||
|
scope: ['email'],
|
||||||
|
},
|
||||||
};
|
};
|
||||||
const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {};
|
const prevGrantConfig = (await pluginStore.get({ key: 'grant' })) || {};
|
||||||
// store grant auth config to db
|
// store grant auth config to db
|
||||||
|
|||||||
@ -370,6 +370,25 @@ const getProfile = async (provider, query, callback) => {
|
|||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 'vk': {
|
||||||
|
const vk = new Purest({ provider: 'vk' });
|
||||||
|
|
||||||
|
vk.query()
|
||||||
|
.get('users.get')
|
||||||
|
.auth(access_token)
|
||||||
|
.qs({ id: query.raw.user_id, v: '5.013' })
|
||||||
|
.request((err, res, body) => {
|
||||||
|
if (err) {
|
||||||
|
callback(err);
|
||||||
|
} else {
|
||||||
|
callback(null, {
|
||||||
|
username: `${body.response[0].last_name} ${body.response[0].first_name}`,
|
||||||
|
email: query.raw.email,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
callback({
|
callback({
|
||||||
message: 'Unknown provider.',
|
message: 'Unknown provider.',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user