From 5ce521c8a78345f98add8d9c8e2fe2c2b1dbaff2 Mon Sep 17 00:00:00 2001 From: Spacelord Date: Mon, 21 Apr 2025 17:35:13 +0200 Subject: [PATCH] Remove invalid unsplash api key - Never commit such keys! / Remove unsplash branding from credits --- static/js/lockscreenBgHandler.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/static/js/lockscreenBgHandler.js b/static/js/lockscreenBgHandler.js index 64b6b49..7cc6e2d 100644 --- a/static/js/lockscreenBgHandler.js +++ b/static/js/lockscreenBgHandler.js @@ -1,8 +1,4 @@ // 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'; let credits = document.getElementById('credits'); @@ -23,7 +19,19 @@ if (cookieScreen) { function handleImage() { 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((data) => { // data = { @@ -71,7 +79,7 @@ function handleImage() { }, 1000); // Set the credits - credits.innerHTML = `Photo by ${data.user.name} on Unsplash`; + credits.innerHTML = `Photo by ${data.user.name}`; credits.style.zIndex = 300000; } })