mirror of
https://github.com/Hackdex-App/hackdex-website.git
synced 2026-06-14 03:10:44 -05:00
Attempt deviceId workaround
This commit is contained in:
parent
e71f138933
commit
fe4ecf5e09
|
|
@ -71,7 +71,11 @@ export async function getSignedPatchUrl(slug: string): Promise<{ ok: true; url:
|
|||
}
|
||||
}
|
||||
|
||||
export async function updatePatchDownloadCount(patchId: number, deviceId: string): Promise<{ ok: true; didIncrease: boolean } | { ok: false; error: string }> {
|
||||
export async function updatePatchDownloadCount(patchId: number, deviceIdObscured: string[]): Promise<{ ok: true; didIncrease: boolean } | { ok: false; error: string }> {
|
||||
if (deviceIdObscured.length !== 5) {
|
||||
return { ok: false, error: "Invalid device ID" };
|
||||
}
|
||||
const deviceId = deviceIdObscured.join("-");
|
||||
const supabase = await createClient();
|
||||
const { error: updateError } = await supabase
|
||||
.from("patch_downloads")
|
||||
|
|
|
|||
|
|
@ -221,7 +221,8 @@ const HackActions: React.FC<HackActionsProps> = ({
|
|||
deviceId = crypto.randomUUID();
|
||||
localStorage.setItem(key, deviceId);
|
||||
}
|
||||
const result = await updatePatchDownloadCount(patchId, deviceId);
|
||||
const deviceIdObscured = deviceId.split("-");
|
||||
const result = await updatePatchDownloadCount(patchId, deviceIdObscured);
|
||||
if (!result.ok) {
|
||||
console.error(result.error);
|
||||
} else if (result.didIncrease) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user