Remove invalid unsplash api key - Never commit such keys! / Remove unsplash branding from credits

This commit is contained in:
Leon Meier 2025-04-21 17:35:13 +02:00
parent ef16f045f7
commit 5ce521c8a7

View File

@ -1,8 +1,4 @@
// Image Handler // Image Handler
const baseUrl = 'https://api.unsplash.com/photos/random?client_id=[KEY]&orientation=landscape&topics=nature';
const apiKey = 'tYOt7Jo94U7dunVcP5gt-kDKDMjWFOGQNsHuhLDLV8k'; // Take from config
const fullUrl = baseUrl.replace('[KEY]', apiKey);
const showModeImage = '/static/media/showModeLockscreen.jpg'; const showModeImage = '/static/media/showModeLockscreen.jpg';
let credits = document.getElementById('credits'); let credits = document.getElementById('credits');
@ -23,7 +19,19 @@ if (cookieScreen) {
function handleImage() { function handleImage() {
if (screenState === 'lock') { if (screenState === 'lock') {
fetch('https://staging.thegreydiamond.de/projects/photoPortfolio/api/getRand.php?uuid=01919dec-b2cd-7adc-8ca2-a071d1169cbc&unsplash=true&orientation=landscape') const apiParams = {
// default galery; spring awakens
uuid: '01919dec-b2cd-7adc-8ca2-a071d1169cbc;01953de0-3aa7-71f1-bfff-cbf9488efa64',
unsplash: true,
// orientation: 'landscape',
height: window.screen.availHeight,
width: window.screen.availWidth,
cropCenteringMode: 'sm'
};
const apiUrl = `https://staging.thegreydiamond.de/projects/photoPortfolio/api/getRand.php?${new URLSearchParams(apiParams).toString()}`;
fetch(apiUrl)
.then((response) => response.json()) .then((response) => response.json())
.then((data) => { .then((data) => {
// data = { // data = {
@ -71,7 +79,7 @@ function handleImage() {
}, 1000); }, 1000);
// Set the credits // Set the credits
credits.innerHTML = `Photo by <a href="${data.user.links.html}" target="_blank">${data.user.name}</a> on <a href="https://unsplash.com" target="_blank">Unsplash</a>`; credits.innerHTML = `Photo by <a href="${data.user.links.html}" target="_blank">${data.user.name}</a>`;
credits.style.zIndex = 300000; credits.style.zIndex = 300000;
} }
}) })