mirror of
https://github.com/JonasunderscoreJones/K-Comebacks.git
synced 2025-10-23 09:59:20 +02:00
Compare commits
3 commits
441e3d5dec
...
610937910c
Author | SHA1 | Date | |
---|---|---|---|
610937910c | |||
4e94fa0566 | |||
af799015a7 |
3 changed files with 612 additions and 413 deletions
985
package-lock.json
generated
985
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,6 @@
|
||||||
<script>
|
<script>
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
|
import { recordRequest } from "./analytics";
|
||||||
|
|
||||||
let releases = [];
|
let releases = [];
|
||||||
let searchArtist = "";
|
let searchArtist = "";
|
||||||
|
@ -43,8 +44,8 @@
|
||||||
: release.types) === selectedRelease ||
|
: release.types) === selectedRelease ||
|
||||||
release.types.includes(selectedRelease);
|
release.types.includes(selectedRelease);
|
||||||
const dateMatch =
|
const dateMatch =
|
||||||
(!startDate || new Date(release.date) >= startDate) &&
|
(!startDate || new Date(release.date) >= new Date(startDate)) &&
|
||||||
(!endDate || new Date(release.date) <= endDate);
|
(!endDate || new Date(release.date) <= new Date(endDate));
|
||||||
return artistMatch && titleMatch && releaseTypeMatch && dateMatch;
|
return artistMatch && titleMatch && releaseTypeMatch && dateMatch;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -71,6 +72,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(async () => {
|
onMount(async () => {
|
||||||
|
recordRequest();
|
||||||
try {
|
try {
|
||||||
const response = await fetch('https://cdn.jonasjones.dev/api/kcomebacks/rkpop_data.json');
|
const response = await fetch('https://cdn.jonasjones.dev/api/kcomebacks/rkpop_data.json');
|
||||||
//const response = await fetch('/rkpop_data.json')
|
//const response = await fetch('/rkpop_data.json')
|
||||||
|
|
34
src/routes/analytics.js
Normal file
34
src/routes/analytics.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
// 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