mirror of
https://github.com/mue/mue.git
synced 2026-07-16 21:44:22 +02:00
feat: pexels background api
This commit is contained in:
10
package.json
10
package.json
@@ -27,12 +27,12 @@
|
||||
"weather-icons-react": "1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.13.16",
|
||||
"@babel/core": "^7.14.0",
|
||||
"@babel/eslint-parser": "^7.13.14",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-transform-react-constant-elements": "^7.13.13",
|
||||
"@babel/plugin-transform-runtime": "^7.13.15",
|
||||
"@babel/preset-env": "^7.13.15",
|
||||
"@babel/preset-env": "^7.14.0",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"babel-loader": "^8.2.2",
|
||||
"babel-plugin-transform-react-class-to-function": "^1.2.2",
|
||||
@@ -42,11 +42,11 @@
|
||||
"eslint-config-react-app": "^6.0.0",
|
||||
"eslint-webpack-plugin": "^2.5.4",
|
||||
"html-webpack-plugin": "^5.3.1",
|
||||
"mini-css-extract-plugin": "^1.5.1",
|
||||
"sass": "^1.32.11",
|
||||
"mini-css-extract-plugin": "^1.6.0",
|
||||
"sass": "^1.32.12",
|
||||
"sass-loader": "^11.0.1",
|
||||
"source-map-loader": "^2.0.1",
|
||||
"webpack": "^5.36.0",
|
||||
"webpack": "^5.36.2",
|
||||
"webpack-cli": "^4.6.0",
|
||||
"webpack-dev-server": "^3.11.2"
|
||||
},
|
||||
|
||||
@@ -104,6 +104,10 @@ export default class BackgroundSettings extends React.PureComponent {
|
||||
{
|
||||
'name': 'Unsplash',
|
||||
'value': 'unsplash'
|
||||
},
|
||||
{
|
||||
'name': 'Pexels',
|
||||
'value': 'pexels'
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
@@ -139,6 +139,9 @@ export default class Background extends React.PureComponent {
|
||||
//requestURL = `${window.constants.UNSPLASH_URL}/getImage?category=${apiCategory}`;
|
||||
requestURL = `${window.constants.UNSPLASH_URL}/getImage`;
|
||||
break;
|
||||
case 'pexels':
|
||||
requestURL = `${window.constants.PEXELS_URL}/getImage`;
|
||||
break;
|
||||
// Defaults to Mue
|
||||
default:
|
||||
requestURL = `${window.constants.API_URL}/images/random?category=${apiCategory}`;
|
||||
@@ -152,13 +155,17 @@ export default class Background extends React.PureComponent {
|
||||
return this.offlineBackground();
|
||||
}
|
||||
|
||||
let credit = data.photographer;
|
||||
if (backgroundAPI === 'unsplash') credit = data.photographer + ` ${this.language.unsplash}`;
|
||||
else if (backgroundAPI === 'pexels') credit = data.photographer + ` ${this.language.pexels}`;
|
||||
|
||||
this.setState({
|
||||
url: data.file,
|
||||
type: 'api',
|
||||
currentAPI: backgroundAPI,
|
||||
photoInfo: {
|
||||
hidden: false,
|
||||
credit: (backgroundAPI !== 'unsplash') ? data.photographer : data.photographer + ` ${this.language.unsplash}`,
|
||||
credit: credit,
|
||||
location: (data.location.replace(/[null]+/g, '') !== ' ') ? data.location : 'N/A',
|
||||
camera: data.camera,
|
||||
resolution: data.resolution,
|
||||
|
||||
@@ -30,7 +30,7 @@ export default function PhotoInformation(props) {
|
||||
}
|
||||
|
||||
// remove unsplash text
|
||||
const photographer = props.info.credit.split(` ${language.unsplash}`)[0];
|
||||
const photographer = props.info.credit.split(` ${language.unsplash}`)[0].split(` ${language.pexels}`);
|
||||
|
||||
let credit = props.info.credit;
|
||||
let photo = language.credit;
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
export const API_URL = 'https://api.muetab.com';
|
||||
export const UNSPLASH_URL = 'https://unsplash.muetab.com';
|
||||
export const PEXELS_URL = 'https://pexels.muetab.com';
|
||||
export const MARKETPLACE_URL = 'https://marketplace.muetab.com';
|
||||
export const WEATHER_URL = 'https://weather.muetab.com';
|
||||
export const WEBSITE_URL = 'https://muetab.com';
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Foto von",
|
||||
"unsplash": "unsplash.com",
|
||||
"pexels": "pexels.com",
|
||||
"information": "Informationen",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Photo by",
|
||||
"unsplash": "on Unsplash",
|
||||
"pexels": "on Pexels",
|
||||
"information": "Information",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Photo by",
|
||||
"unsplash": "on Unsplash",
|
||||
"pexels": "on Pexels",
|
||||
"information": "Information",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Foto por",
|
||||
"unsplash": "en Unsplash",
|
||||
"pexels": "en Pexels",
|
||||
"information": "Información",
|
||||
"download": "Descargar"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Photo par",
|
||||
"unsplash": "sur Unsplash",
|
||||
"pexels": "sur Pexels",
|
||||
"information": "Information",
|
||||
"download": "Téléchargement"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Foto van",
|
||||
"unsplash": "on Unsplash",
|
||||
"pexels": "on Pexels",
|
||||
"information": "Information",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Bilde av",
|
||||
"unsplash": "on Unsplash",
|
||||
"pexels": "on Pexels",
|
||||
"information": "Information",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "Фото",
|
||||
"unsplash": "on Unsplash",
|
||||
"pexels": "on Pexels",
|
||||
"information": "Information",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
"background": {
|
||||
"credit": "图像作者:",
|
||||
"unsplash": "on Unsplash",
|
||||
"pexels": "on Pexels",
|
||||
"information": "Information",
|
||||
"download": "Download"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user