svelte-claps
Advanced tools
Comparing version 0.0.1 to 0.0.2
import { Redis } from '@upstash/redis'; | ||
import { generateHash, generateKey, getData, getIP } from './utils'; | ||
import { generateHash, getData, getIP } from './utils'; | ||
import variables from './variables'; | ||
const prepareRequest = async (event) => { | ||
const body = event.request.body ? await event.request.json() : {}; | ||
const { score, key } = body; | ||
const { score } = body; | ||
const key = event.url.searchParams.get('key'); | ||
const RAW_IP = getIP(event.request); | ||
const KEY = generateKey(event.url, key); | ||
const KEY = `CLAP:${key}`; | ||
const HASH_IP = await generateHash(RAW_IP); | ||
@@ -10,0 +11,0 @@ return { KEY, HASH_IP, score }; |
{ | ||
"name": "svelte-claps", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"devDependencies": { | ||
@@ -5,0 +5,0 @@ "@sveltejs/adapter-auto": "next", |
import type { ClapsResponse } from './types'; | ||
export declare function generateHash(ip: string): Promise<string>; | ||
export declare function generateKey(url: URL, key: string): string; | ||
export declare function getIP(req: Request): any; | ||
export declare function getData(key: string, ip: string): Promise<ClapsResponse>; |
@@ -11,8 +11,2 @@ import { Redis } from '@upstash/redis'; | ||
} | ||
export function generateKey(url, key) { | ||
if (key) { | ||
return `CLAP:${key}`; | ||
} | ||
return `CLAP:${url.origin + url.pathname}`; | ||
} | ||
export function getIP(req) { | ||
@@ -19,0 +13,0 @@ const xff = req.headers.get('x-forwarded-for'); |
Sorry, the diff of this file is not supported yet
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
0
21329
19
212