mirror of
https://github.com/JonasunderscoreJones/K-Comebacks.git
synced 2025-10-23 09:59:20 +02:00
Compare commits
No commits in common. "610937910ceb98abad82daa5ab696445252f3476" and "441e3d5dec3fbe22f011028f9a114bf53fdaddff" have entirely different histories.
610937910c
...
441e3d5dec
3 changed files with 411 additions and 610 deletions
981
package-lock.json
generated
981
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,5 @@
|
|||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { recordRequest } from "./analytics";
|
||||
|
||||
let releases = [];
|
||||
let searchArtist = "";
|
||||
|
@ -44,8 +43,8 @@
|
|||
: release.types) === selectedRelease ||
|
||||
release.types.includes(selectedRelease);
|
||||
const dateMatch =
|
||||
(!startDate || new Date(release.date) >= new Date(startDate)) &&
|
||||
(!endDate || new Date(release.date) <= new Date(endDate));
|
||||
(!startDate || new Date(release.date) >= startDate) &&
|
||||
(!endDate || new Date(release.date) <= endDate);
|
||||
return artistMatch && titleMatch && releaseTypeMatch && dateMatch;
|
||||
});
|
||||
|
||||
|
@ -72,7 +71,6 @@
|
|||
}
|
||||
|
||||
onMount(async () => {
|
||||
recordRequest();
|
||||
try {
|
||||
const response = await fetch('https://cdn.jonasjones.dev/api/kcomebacks/rkpop_data.json');
|
||||
//const response = await fetch('/rkpop_data.json')
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
// Function to record the request with analytics
|
||||
export async function recordRequest() {
|
||||
|
||||
const analyticsData = {
|
||||
timestamp: Date.now(),
|
||||
domain: window.location.hostname,
|
||||
method: 'GET', // Assuming the request method is GET; adjust as necessary
|
||||
path: window.location.pathname,
|
||||
};
|
||||
|
||||
console.log('Recording request:', analyticsData);
|
||||
|
||||
const ANALYTICS_URL = 'https://analytics.jonasjones.dev/requests/record/ipunknown';
|
||||
const ANALYTICS_API_KEY = import.meta.env.VITE_ANALYTICS_API_KEY;
|
||||
|
||||
try {
|
||||
const response = await fetch(ANALYTICS_URL, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': ANALYTICS_API_KEY,
|
||||
},
|
||||
body: JSON.stringify(analyticsData),
|
||||
});
|
||||
|
||||
if (response.ok) {
|
||||
console.log('Request recorded successfully');
|
||||
} else {
|
||||
console.error('Failed to record request:', response.status, await response.text());
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error recording request:', error);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue